src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java

changeset 1187
ac36176b7de0
parent 1127
ca49d50318dc
child 1210
62e611704863
     1.1 --- a/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Tue Jan 24 17:52:02 2012 +0000
     1.2 +++ b/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Tue Jan 24 15:51:44 2012 -0800
     1.3 @@ -70,6 +70,7 @@
     1.4      private JavaCompiler compiler;
     1.5      private Locale locale;
     1.6      private String[] args;
     1.7 +    private String[] classNames;
     1.8      private Context context;
     1.9      private List<JavaFileObject> fileObjects;
    1.10      private Map<JavaFileObject, JCCompilationUnit> notYetEntered;
    1.11 @@ -82,11 +83,13 @@
    1.12  
    1.13      JavacTaskImpl(Main compilerMain,
    1.14                  String[] args,
    1.15 +                String[] classNames,
    1.16                  Context context,
    1.17                  List<JavaFileObject> fileObjects) {
    1.18          this.ccw = ClientCodeWrapper.instance(context);
    1.19          this.compilerMain = compilerMain;
    1.20          this.args = args;
    1.21 +        this.classNames = classNames;
    1.22          this.context = context;
    1.23          this.fileObjects = fileObjects;
    1.24          setLocale(Locale.getDefault());
    1.25 @@ -101,17 +104,14 @@
    1.26                  Context context,
    1.27                  Iterable<String> classes,
    1.28                  Iterable<? extends JavaFileObject> fileObjects) {
    1.29 -        this(compilerMain, toArray(flags, classes), context, toList(fileObjects));
    1.30 +        this(compilerMain, toArray(flags), toArray(classes), context, toList(fileObjects));
    1.31      }
    1.32  
    1.33 -    static private String[] toArray(Iterable<String> flags, Iterable<String> classes) {
    1.34 +    static private String[] toArray(Iterable<String> iter) {
    1.35          ListBuffer<String> result = new ListBuffer<String>();
    1.36 -        if (flags != null)
    1.37 -            for (String flag : flags)
    1.38 -                result.append(flag);
    1.39 -        if (classes != null)
    1.40 -            for (String cls : classes)
    1.41 -                result.append(cls);
    1.42 +        if (iter != null)
    1.43 +            for (String s : iter)
    1.44 +                result.append(s);
    1.45          return result.toArray(new String[result.length()]);
    1.46      }
    1.47  
    1.48 @@ -129,7 +129,7 @@
    1.49              initContext();
    1.50              notYetEntered = new HashMap<JavaFileObject, JCCompilationUnit>();
    1.51              compilerMain.setAPIMode(true);
    1.52 -            result = compilerMain.compile(args, context, fileObjects, processors);
    1.53 +            result = compilerMain.compile(args, classNames, context, fileObjects, processors);
    1.54              cleanup();
    1.55              return result.isOK();
    1.56          } else {
    1.57 @@ -159,7 +159,7 @@
    1.58              initContext();
    1.59              compilerMain.setOptions(Options.instance(context));
    1.60              compilerMain.filenames = new LinkedHashSet<File>();
    1.61 -            Collection<File> filenames = compilerMain.processArgs(CommandLine.parse(args));
    1.62 +            Collection<File> filenames = compilerMain.processArgs(CommandLine.parse(args), classNames);
    1.63              if (!filenames.isEmpty())
    1.64                  throw new IllegalArgumentException("Malformed arguments " + toString(filenames, " "));
    1.65              compiler = JavaCompiler.instance(context);
    1.66 @@ -174,6 +174,7 @@
    1.67              // endContext will be called when all classes have been generated
    1.68              // TODO: should handle the case after each phase if errors have occurred
    1.69              args = null;
    1.70 +            classNames = null;
    1.71          }
    1.72      }
    1.73  
    1.74 @@ -204,6 +205,7 @@
    1.75          compiler = null;
    1.76          compilerMain = null;
    1.77          args = null;
    1.78 +        classNames = null;
    1.79          context = null;
    1.80          fileObjects = null;
    1.81          notYetEntered = null;

mercurial