1 /* |
1 /* |
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
120 if (needHelp) |
120 if (needHelp) |
121 showHelp(out); |
121 showHelp(out); |
122 |
122 |
123 if (javacFiles.isEmpty()) { |
123 if (javacFiles.isEmpty()) { |
124 if (!needHelp) |
124 if (!needHelp) |
125 System.out.println("no files given"); |
125 out.println("no files given"); |
126 } |
126 } |
127 |
127 |
128 JavacTool tool = JavacTool.create(); |
128 JavacTool tool = JavacTool.create(); |
129 |
129 |
130 JavacFileManager fm = new JavacFileManager(new Context(), false, null); |
130 JavacFileManager fm = new JavacFileManager(new Context(), false, null); |
177 } else { |
177 } else { |
178 throw new BadArgs("dc.bad.value.for.option", arg, args[i]); |
178 throw new BadArgs("dc.bad.value.for.option", arg, args[i]); |
179 } |
179 } |
180 } else if (arg.equals(STATS)) { |
180 } else if (arg.equals(STATS)) { |
181 env.messages.setStatsEnabled(true); |
181 env.messages.setStatsEnabled(true); |
182 } else if (arg.matches("-bootclasspath") && i + 1 < args.length) { |
182 } else if (arg.equals("-bootclasspath") && i + 1 < args.length) { |
183 javacBootClassPath = splitPath(args[++i]); |
183 javacBootClassPath = splitPath(args[++i]); |
184 } else if (arg.matches("-classpath") && i + 1 < args.length) { |
184 } else if (arg.equals("-classpath") && i + 1 < args.length) { |
185 javacClassPath = splitPath(args[++i]); |
185 javacClassPath = splitPath(args[++i]); |
186 } else if (arg.matches("-sourcepath") && i + 1 < args.length) { |
186 } else if (arg.equals("-sourcepath") && i + 1 < args.length) { |
187 javacSourcePath = splitPath(args[++i]); |
187 javacSourcePath = splitPath(args[++i]); |
188 } else if (arg.equals(XMSGS_OPTION)) { |
188 } else if (arg.equals(XMSGS_OPTION)) { |
189 env.messages.setOptions(null); |
189 env.messages.setOptions(null); |
190 } else if (arg.startsWith(XMSGS_CUSTOM_PREFIX)) { |
190 } else if (arg.startsWith(XMSGS_CUSTOM_PREFIX)) { |
191 env.messages.setOptions(arg.substring(arg.indexOf(":") + 1)); |
191 env.messages.setOptions(arg.substring(arg.indexOf(":") + 1)); |
232 out.println(" in the doc comments of private methods."); |
232 out.println(" in the doc comments of private methods."); |
233 out.println(" If no -Xmsgs options are provided, the default is"); |
233 out.println(" If no -Xmsgs options are provided, the default is"); |
234 out.println(" equivalent to -Xmsgs:all/protected, meaning that"); |
234 out.println(" equivalent to -Xmsgs:all/protected, meaning that"); |
235 out.println(" all messages are reported for protected and public"); |
235 out.println(" all messages are reported for protected and public"); |
236 out.println(" declarations only. "); |
236 out.println(" declarations only. "); |
|
237 out.println(" -stats"); |
|
238 out.println(" Report statistics on the reported issues."); |
237 out.println(" -h -help --help -usage -?"); |
239 out.println(" -h -help --help -usage -?"); |
238 out.println(" Show this message."); |
240 out.println(" Show this message."); |
239 out.println(""); |
241 out.println(""); |
240 out.println("The following javac options are also supported"); |
242 out.println("The following javac options are also supported"); |
241 out.println(" -bootclasspath, -classpath, -sourcepath, -Xmaxerrs, -Xmaxwarns"); |
243 out.println(" -bootclasspath, -classpath, -sourcepath, -Xmaxerrs, -Xmaxwarns"); |
245 out.println("to be checked on the command line."); |
247 out.println("to be checked on the command line."); |
246 } |
248 } |
247 |
249 |
248 List<File> splitPath(String path) { |
250 List<File> splitPath(String path) { |
249 List<File> files = new ArrayList<File>(); |
251 List<File> files = new ArrayList<File>(); |
250 for (String f: path.split(File.separator)) { |
252 for (String f: path.split(File.pathSeparator)) { |
251 if (f.length() > 0) |
253 if (f.length() > 0) |
252 files.add(new File(f)); |
254 files.add(new File(f)); |
253 } |
255 } |
254 return files; |
256 return files; |
255 } |
257 } |