langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java
changeset 24897 655b72d7b96e
parent 23810 b92eb80925f0
child 25291 0fd42e6dfdf6
equal deleted inserted replaced
24896:986d876a9121 24897:655b72d7b96e
   159         } else {
   159         } else {
   160             initContext();
   160             initContext();
   161             compilerMain.log = Log.instance(context);
   161             compilerMain.log = Log.instance(context);
   162             compilerMain.setOptions(Options.instance(context));
   162             compilerMain.setOptions(Options.instance(context));
   163             compilerMain.filenames = new LinkedHashSet<>();
   163             compilerMain.filenames = new LinkedHashSet<>();
       
   164             compilerMain.deferredFileManagerOptions = new LinkedHashMap<>();
       
   165             // The following line is conceptually wrong. It should not refer to args
       
   166             // which may include inappropriate file manager options.
       
   167             // (Ideally, args should not even be passed into JavacTaskImpl at all.)
       
   168             // The "no filenames in args" check should have been handled by the use of
       
   169             // the GrumpyHelper in JavacTool.getTask, but processArgs also has some
       
   170             // additional checking, which should be factored out and called separately.
       
   171             // If we fix this, then filenames and deferredFileManagerOptions in Main
       
   172             // can revert to being protected or private, not public.
   164             Collection<File> filenames = compilerMain.processArgs(CommandLine.parse(args), classNames);
   173             Collection<File> filenames = compilerMain.processArgs(CommandLine.parse(args), classNames);
   165             if (filenames != null && !filenames.isEmpty())
   174             if (filenames != null && !filenames.isEmpty())
   166                 throw new IllegalArgumentException("Malformed arguments " + toString(filenames, " "));
   175                 throw new IllegalArgumentException("Malformed arguments " + toString(filenames, " "));
   167             compiler = JavaCompiler.instance(context);
   176             compiler = JavaCompiler.instance(context);
   168             compiler.keepComments = true;
   177             compiler.keepComments = true;