langtools/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java
changeset 37939 3eb8c2a89b77
parent 37644 33cf53901cac
child 38526 6f5838874afc
equal deleted inserted replaced
37938:42baa89d2156 37939:3eb8c2a89b77
   213      */
   213      */
   214     class AnalyzeTask extends BaseTask {
   214     class AnalyzeTask extends BaseTask {
   215 
   215 
   216         private final Iterable<? extends CompilationUnitTree> cuts;
   216         private final Iterable<? extends CompilationUnitTree> cuts;
   217 
   217 
   218         AnalyzeTask(final OuterWrap wrap) {
   218         AnalyzeTask(final OuterWrap wrap, String... extraArgs) {
   219             this(Collections.singletonList(wrap));
   219             this(Collections.singletonList(wrap), extraArgs);
   220         }
   220         }
   221 
   221 
   222         AnalyzeTask(final Collection<OuterWrap> wraps) {
   222         AnalyzeTask(final Collection<OuterWrap> wraps, String... extraArgs) {
   223             this(wraps.stream(),
   223             this(wraps.stream(),
   224                     new WrapSourceHandler(),
   224                     new WrapSourceHandler(),
   225                     "-XDshouldStopPolicy=FLOW", "-Xlint:unchecked", "-XaddExports:jdk.jshell/jdk.internal.jshell.remote=ALL-UNNAMED", "-proc:none");
   225                     Util.join(new String[] {
   226         }
   226                         "-XDshouldStopPolicy=FLOW", "-Xlint:unchecked",
   227 
   227                         "-XaddExports:jdk.jshell/jdk.internal.jshell.remote=ALL-UNNAMED",
   228         <T>AnalyzeTask(final Stream<T> stream, SourceHandler<T> sourceHandler,
   228                         "-proc:none"
       
   229                     }, extraArgs));
       
   230         }
       
   231 
       
   232         private <T>AnalyzeTask(final Stream<T> stream, SourceHandler<T> sourceHandler,
   229                 String... extraOptions) {
   233                 String... extraOptions) {
   230             super(stream, sourceHandler, extraOptions);
   234             super(stream, sourceHandler, extraOptions);
   231             cuts = analyze();
   235             cuts = analyze();
   232         }
   236         }
   233 
   237 
   262 
   266 
   263         private final Map<OuterWrap, List<OutputMemoryJavaFileObject>> classObjs = new HashMap<>();
   267         private final Map<OuterWrap, List<OutputMemoryJavaFileObject>> classObjs = new HashMap<>();
   264 
   268 
   265         CompileTask(final Collection<OuterWrap> wraps) {
   269         CompileTask(final Collection<OuterWrap> wraps) {
   266             super(wraps.stream(), new WrapSourceHandler(),
   270             super(wraps.stream(), new WrapSourceHandler(),
   267                     "-Xlint:unchecked", "-XaddExports:jdk.jshell/jdk.internal.jshell.remote=ALL-UNNAMED", "-proc:none");
   271                     "-Xlint:unchecked", "-XaddExports:jdk.jshell/jdk.internal.jshell.remote=ALL-UNNAMED", "-proc:none", "-parameters");
   268         }
   272         }
   269 
   273 
   270         boolean compile() {
   274         boolean compile() {
   271             fileManager.registerClassFileCreationListener(this::listenForNewClassFile);
   275             fileManager.registerClassFileCreationListener(this::listenForNewClassFile);
   272             boolean result = task.call();
   276             boolean result = task.call();