@@ -24,10 +24,10 @@ public static void main(String... args) throws IOException {
24
24
25
25
List <String > files = new ArrayList <>();
26
26
List <String > options = new ArrayList <>();
27
-
27
+
28
28
for (int i = 0 ; i < args .length ; ++i ) {
29
29
String arg = args [i ];
30
-
30
+
31
31
if (arg .startsWith ("-" )) {
32
32
int paramCount = compiler .isSupportedOption (arg );
33
33
if (paramCount < 0 ) {
@@ -46,7 +46,7 @@ public static void main(String... args) throws IOException {
46
46
files .add (arg );
47
47
}
48
48
}
49
-
49
+
50
50
if (!files .isEmpty ()) {
51
51
Iterable <? extends JavaFileObject > compilationUnits = fileManager .getJavaFileObjectsFromStrings (files );
52
52
JavaCompiler .CompilationTask task =
@@ -68,12 +68,12 @@ public static void main(String... args) throws IOException {
68
68
case OTHER :
69
69
continue ;
70
70
}
71
-
71
+
72
72
if (diagnostic .getLineNumber () >= 0 && diagnostic .getColumnNumber () >= 0 ) {
73
73
LineNumberReader reader = new LineNumberReader (new StringReader (diagnostic .getSource ().getCharContent (true ).toString ()));
74
74
String line = reader .lines ().skip (diagnostic .getLineNumber () - 1 ).limit (1 ).findAny ().get ();
75
-
76
- System .err .println (String .format ("%s:%d: %s: %s\n %s\n %" +diagnostic .getColumnNumber ()+"s" ,
75
+
76
+ System .err .println (String .format ("%s:%d: %s: %s\n %s\n %" +diagnostic .getColumnNumber ()+"s" ,
77
77
diagnostic .getSource ().getName (),
78
78
diagnostic .getLineNumber (),
79
79
diagnostic .getKind ().name ().toLowerCase (),
@@ -82,13 +82,13 @@ public static void main(String... args) throws IOException {
82
82
"^"
83
83
));
84
84
} else {
85
- System .err .println (String .format ("%s: %s: %s" ,
85
+ System .err .println (String .format ("%s: %s: %s" ,
86
86
diagnostic .getSource ().getName (),
87
87
diagnostic .getKind ().name ().toLowerCase (),
88
88
diagnostic .getMessage (null )
89
89
));
90
90
}
91
-
91
+
92
92
if (files .contains (diagnostic .getSource ().getName ())) {
93
93
System .out .println (String .format ("CG> annotate --type \" %s\" --file \" %s\" --position \" %s\" --message \" %s\" " ,
94
94
type ,
@@ -99,10 +99,8 @@ public static void main(String... args) throws IOException {
99
99
}
100
100
}
101
101
resultCode = success ? 0 : 1 ;
102
- }
103
- else {
104
- System .err .println ("no source file" );
105
- resultCode = 2 ;
102
+ } else {
103
+ resultCode = 0 ;
106
104
}
107
105
}
108
106
0 commit comments