src/share/classes/com/sun/tools/javac/main/Main.java

Print this page




 367 
 368     /** Programmatic interface for main function.
 369      * @param args    The command line parameters.
 370      */
 371     public Result compile(String[] args,
 372                        Context context,
 373                        List<JavaFileObject> fileObjects,
 374                        Iterable<? extends Processor> processors)
 375     {
 376         return compile(args,  null, context, fileObjects, processors);
 377     }
 378 
 379     public Result compile(String[] args,
 380                        String[] classNames,
 381                        Context context,
 382                        List<JavaFileObject> fileObjects,
 383                        Iterable<? extends Processor> processors)
 384     {
 385         context.put(Log.outKey, out);
 386         log = Log.instance(context);



 387 








 388         if (options == null)
 389             options = Options.instance(context); // creates a new one
 390 
 391         filenames = new LinkedHashSet<File>();
 392         classnames = new ListBuffer<String>();
 393         JavaCompiler comp = null;
 394         /*
 395          * TODO: Logic below about what is an acceptable command line
 396          * should be updated to take annotation processing semantics
 397          * into account.
 398          */
 399         try {
 400             if (args.length == 0
 401                     && (classNames == null || classNames.length == 0)
 402                     && fileObjects.isEmpty()) {
 403                 Option.HELP.process(optionHelper, "-help");
 404                 return Result.CMDERR;
 405             }
 406 
 407             Collection<File> files;




 367 
 368     /** Programmatic interface for main function.
 369      * @param args    The command line parameters.
 370      */
 371     public Result compile(String[] args,
 372                        Context context,
 373                        List<JavaFileObject> fileObjects,
 374                        Iterable<? extends Processor> processors)
 375     {
 376         return compile(args,  null, context, fileObjects, processors);
 377     }
 378 
 379     public Result compile(String[] args,
 380                           String[] classNames,
 381                           Context context,
 382                           List<JavaFileObject> fileObjects,
 383                           Iterable<? extends Processor> processors)
 384     {
 385         context.put(Log.outKey, out);
 386         log = Log.instance(context);
 387         return compile(args,  classNames, context,
 388                        fileObjects, processors, log);
 389     }
 390 
 391     // Added to allow tests to install their own log subclasses
 392     public Result compile(String[] args,
 393                           String[] classNames,
 394                           Context context,
 395                           List<JavaFileObject> fileObjects,
 396                           Iterable<? extends Processor> processors,
 397                           Log log)
 398     {
 399         if (options == null)
 400             options = Options.instance(context); // creates a new one
 401 
 402         filenames = new LinkedHashSet<File>();
 403         classnames = new ListBuffer<String>();
 404         JavaCompiler comp = null;
 405         /*
 406          * TODO: Logic below about what is an acceptable command line
 407          * should be updated to take annotation processing semantics
 408          * into account.
 409          */
 410         try {
 411             if (args.length == 0
 412                     && (classNames == null || classNames.length == 0)
 413                     && fileObjects.isEmpty()) {
 414                 Option.HELP.process(optionHelper, "-help");
 415                 return Result.CMDERR;
 416             }
 417 
 418             Collection<File> files;