--- a/langtools/src/share/classes/com/sun/tools/javac/main/Main.java Tue Jan 24 17:52:02 2012 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/Main.java Tue Jan 24 15:51:44 2012 -0800
@@ -31,6 +31,7 @@
import java.net.URL;
import java.security.DigestInputStream;
import java.security.MessageDigest;
+import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;
@@ -208,6 +209,10 @@
* @param flags The array of command line arguments.
*/
public Collection<File> processArgs(String[] flags) { // XXX sb protected
+ return processArgs(flags, null);
+ }
+
+ public Collection<File> processArgs(String[] flags, String[] classNames) { // XXX sb protected
int ac = 0;
while (ac < flags.length) {
String flag = flags[ac];
@@ -248,6 +253,10 @@
}
}
+ if (this.classnames != null && classNames != null) {
+ this.classnames.addAll(Arrays.asList(classNames));
+ }
+
if (!checkDirectory(D))
return null;
if (!checkDirectory(S))
@@ -346,6 +355,15 @@
List<JavaFileObject> fileObjects,
Iterable<? extends Processor> processors)
{
+ return compile(args, null, context, fileObjects, processors);
+ }
+
+ public Result compile(String[] args,
+ String[] classNames,
+ Context context,
+ List<JavaFileObject> fileObjects,
+ Iterable<? extends Processor> processors)
+ {
context.put(Log.outKey, out);
log = Log.instance(context);
@@ -361,14 +379,16 @@
* into account.
*/
try {
- if (args.length == 0 && fileObjects.isEmpty()) {
+ if (args.length == 0
+ && (classNames == null || classNames.length == 0)
+ && fileObjects.isEmpty()) {
Option.HELP.process(optionHelper, "-help");
return Result.CMDERR;
}
Collection<File> files;
try {
- files = processArgs(CommandLine.parse(args));
+ files = processArgs(CommandLine.parse(args), classNames);
if (files == null) {
// null signals an error in options, abort
return Result.CMDERR;