@@ -24,10 +24,10 @@ public static void main(String... args) throws IOException {
2424
2525 List <String > files = new ArrayList <>();
2626 List <String > options = new ArrayList <>();
27-
27+
2828 for (int i = 0 ; i < args .length ; ++i ) {
2929 String arg = args [i ];
30-
30+
3131 if (arg .startsWith ("-" )) {
3232 int paramCount = compiler .isSupportedOption (arg );
3333 if (paramCount < 0 ) {
@@ -46,7 +46,7 @@ public static void main(String... args) throws IOException {
4646 files .add (arg );
4747 }
4848 }
49-
49+
5050 if (!files .isEmpty ()) {
5151 Iterable <? extends JavaFileObject > compilationUnits = fileManager .getJavaFileObjectsFromStrings (files );
5252 JavaCompiler .CompilationTask task =
@@ -68,12 +68,12 @@ public static void main(String... args) throws IOException {
6868 case OTHER :
6969 continue ;
7070 }
71-
71+
7272 if (diagnostic .getLineNumber () >= 0 && diagnostic .getColumnNumber () >= 0 ) {
7373 LineNumberReader reader = new LineNumberReader (new StringReader (diagnostic .getSource ().getCharContent (true ).toString ()));
7474 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" ,
7777 diagnostic .getSource ().getName (),
7878 diagnostic .getLineNumber (),
7979 diagnostic .getKind ().name ().toLowerCase (),
@@ -82,13 +82,13 @@ public static void main(String... args) throws IOException {
8282 "^"
8383 ));
8484 } else {
85- System .err .println (String .format ("%s: %s: %s" ,
85+ System .err .println (String .format ("%s: %s: %s" ,
8686 diagnostic .getSource ().getName (),
8787 diagnostic .getKind ().name ().toLowerCase (),
8888 diagnostic .getMessage (null )
8989 ));
9090 }
91-
91+
9292 if (files .contains (diagnostic .getSource ().getName ())) {
9393 System .out .println (String .format ("CG> annotate --type \" %s\" --file \" %s\" --position \" %s\" --message \" %s\" " ,
9494 type ,
@@ -99,10 +99,8 @@ public static void main(String... args) throws IOException {
9999 }
100100 }
101101 resultCode = success ? 0 : 1 ;
102- }
103- else {
104- System .err .println ("no source file" );
105- resultCode = 2 ;
102+ } else {
103+ resultCode = 0 ;
106104 }
107105 }
108106
0 commit comments