diff -r 51fb17abfc32 -r ac36176b7de0 src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java --- a/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java Tue Jan 24 17:52:02 2012 +0000 +++ b/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java Tue Jan 24 15:51:44 2012 -0800 @@ -70,6 +70,7 @@ private JavaCompiler compiler; private Locale locale; private String[] args; + private String[] classNames; private Context context; private List fileObjects; private Map notYetEntered; @@ -82,11 +83,13 @@ JavacTaskImpl(Main compilerMain, String[] args, + String[] classNames, Context context, List fileObjects) { this.ccw = ClientCodeWrapper.instance(context); this.compilerMain = compilerMain; this.args = args; + this.classNames = classNames; this.context = context; this.fileObjects = fileObjects; setLocale(Locale.getDefault()); @@ -101,17 +104,14 @@ Context context, Iterable classes, Iterable fileObjects) { - this(compilerMain, toArray(flags, classes), context, toList(fileObjects)); + this(compilerMain, toArray(flags), toArray(classes), context, toList(fileObjects)); } - static private String[] toArray(Iterable flags, Iterable classes) { + static private String[] toArray(Iterable iter) { ListBuffer result = new ListBuffer(); - if (flags != null) - for (String flag : flags) - result.append(flag); - if (classes != null) - for (String cls : classes) - result.append(cls); + if (iter != null) + for (String s : iter) + result.append(s); return result.toArray(new String[result.length()]); } @@ -129,7 +129,7 @@ initContext(); notYetEntered = new HashMap(); compilerMain.setAPIMode(true); - result = compilerMain.compile(args, context, fileObjects, processors); + result = compilerMain.compile(args, classNames, context, fileObjects, processors); cleanup(); return result.isOK(); } else { @@ -159,7 +159,7 @@ initContext(); compilerMain.setOptions(Options.instance(context)); compilerMain.filenames = new LinkedHashSet(); - Collection filenames = compilerMain.processArgs(CommandLine.parse(args)); + Collection filenames = compilerMain.processArgs(CommandLine.parse(args), classNames); if (!filenames.isEmpty()) throw new IllegalArgumentException("Malformed arguments " + toString(filenames, " ")); compiler = JavaCompiler.instance(context); @@ -174,6 +174,7 @@ // endContext will be called when all classes have been generated // TODO: should handle the case after each phase if errors have occurred args = null; + classNames = null; } } @@ -204,6 +205,7 @@ compiler = null; compilerMain = null; args = null; + classNames = null; context = null; fileObjects = null; notYetEntered = null;