langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java
changeset 26266 2d24bda701dc
parent 26264 a09fedde76be
child 27379 5ae894733e09
equal deleted inserted replaced
26265:46aacfffd3b5 26266:2d24bda701dc
    46 import com.sun.tools.javac.processing.AnnotationProcessingError;
    46 import com.sun.tools.javac.processing.AnnotationProcessingError;
    47 import com.sun.tools.javac.tree.*;
    47 import com.sun.tools.javac.tree.*;
    48 import com.sun.tools.javac.tree.JCTree.JCClassDecl;
    48 import com.sun.tools.javac.tree.JCTree.JCClassDecl;
    49 import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
    49 import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
    50 import com.sun.tools.javac.util.*;
    50 import com.sun.tools.javac.util.*;
       
    51 import com.sun.tools.javac.util.DefinedBy.Api;
    51 import com.sun.tools.javac.util.List;
    52 import com.sun.tools.javac.util.List;
    52 import com.sun.tools.javac.util.Log.PrefixKind;
    53 import com.sun.tools.javac.util.Log.PrefixKind;
    53 import com.sun.tools.javac.util.Log.WriterKind;
    54 import com.sun.tools.javac.util.Log.WriterKind;
    54 
    55 
    55 /**
    56 /**
    75     JavacTaskImpl(Context context) {
    76     JavacTaskImpl(Context context) {
    76         super(context, true);
    77         super(context, true);
    77         args = Arguments.instance(context);
    78         args = Arguments.instance(context);
    78     }
    79     }
    79 
    80 
    80     @Override // @DefinedBy(COMPILER_API)
    81     @Override @DefinedBy(Api.COMPILER)
    81     public Boolean call() {
    82     public Boolean call() {
    82         return doCall().isOK();
    83         return doCall().isOK();
    83     }
    84     }
    84 
    85 
    85     /* Internal version of call exposing Main.Result. */
    86     /* Internal version of call exposing Main.Result. */
   100                 throw new RuntimeException(e.getCause());
   101                 throw new RuntimeException(e.getCause());
   101             }
   102             }
   102         }
   103         }
   103     }
   104     }
   104 
   105 
   105     @Override // @DefinedBy(COMPILER_API)
   106     @Override @DefinedBy(Api.COMPILER)
   106     public void setProcessors(Iterable<? extends Processor> processors) {
   107     public void setProcessors(Iterable<? extends Processor> processors) {
   107         processors.getClass(); // null check
   108         processors.getClass(); // null check
   108         // not mt-safe
   109         // not mt-safe
   109         if (used.get())
   110         if (used.get())
   110             throw new IllegalStateException();
   111             throw new IllegalStateException();
   111         this.processors = processors;
   112         this.processors = processors;
   112     }
   113     }
   113 
   114 
   114     @Override // @DefinedBy(COMPILER_API)
   115     @Override @DefinedBy(Api.COMPILER)
   115     public void setLocale(Locale locale) {
   116     public void setLocale(Locale locale) {
   116         if (used.get())
   117         if (used.get())
   117             throw new IllegalStateException();
   118             throw new IllegalStateException();
   118         this.locale = locale;
   119         this.locale = locale;
   119     }
   120     }
   204         compiler = null;
   205         compiler = null;
   205         context = null;
   206         context = null;
   206         notYetEntered = null;
   207         notYetEntered = null;
   207     }
   208     }
   208 
   209 
   209     @Override // @DefinedBy(TREE_API)
   210     @Override @DefinedBy(Api.COMPILER_TREE)
   210     public Iterable<? extends CompilationUnitTree> parse() {
   211     public Iterable<? extends CompilationUnitTree> parse() {
   211         return handleExceptions(new Callable<Iterable<? extends CompilationUnitTree>>() {
   212         return handleExceptions(new Callable<Iterable<? extends CompilationUnitTree>>() {
   212             @Override
   213             @Override
   213             public Iterable<? extends CompilationUnitTree> call() {
   214             public Iterable<? extends CompilationUnitTree> call() {
   214                 return parseInternal();
   215                 return parseInternal();
   318         finally {
   319         finally {
   319             compiler.log.flush();
   320             compiler.log.flush();
   320         }
   321         }
   321     }
   322     }
   322 
   323 
   323     @Override // @DefinedBy(TREE_API)
   324     @Override @DefinedBy(Api.COMPILER_TREE)
   324     public Iterable<? extends Element> analyze() {
   325     public Iterable<? extends Element> analyze() {
   325         return handleExceptions(new Callable<Iterable<? extends Element>>() {
   326         return handleExceptions(new Callable<Iterable<? extends Element>>() {
   326             @Override
   327             @Override
   327             public Iterable<? extends Element> call() {
   328             public Iterable<? extends Element> call() {
   328                 return analyze(null);
   329                 return analyze(null);
   380                 }
   381                 }
   381             }
   382             }
   382             genList.addAll(queue);
   383             genList.addAll(queue);
   383         }
   384         }
   384 
   385 
   385     @Override // @DefinedBy(TREE_API)
   386     @Override @DefinedBy(Api.COMPILER_TREE)
   386     public Iterable<? extends JavaFileObject> generate() {
   387     public Iterable<? extends JavaFileObject> generate() {
   387         return handleExceptions(new Callable<Iterable<? extends JavaFileObject>>() {
   388         return handleExceptions(new Callable<Iterable<? extends JavaFileObject>>() {
   388             @Override
   389             @Override
   389             public Iterable<? extends JavaFileObject> call() {
   390             public Iterable<? extends JavaFileObject> call() {
   390                 return generate(null);
   391                 return generate(null);