langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java
equal
deleted
inserted
replaced
95 } |
95 } |
96 |
96 |
97 /* Internal version of call exposing Main.Result. */ |
97 /* Internal version of call exposing Main.Result. */ |
98 public Main.Result doCall() { |
98 public Main.Result doCall() { |
99 try { |
99 try { |
100 return handleExceptions(new Callable<Main.Result>() { |
100 return handleExceptions(() -> { |
101 @Override |
101 prepareCompiler(false); |
102 public Main.Result call() throws Exception { |
102 if (compiler.errorCount() > 0) |
103 prepareCompiler(false); |
103 return Main.Result.ERROR; |
104 if (compiler.errorCount() > 0) |
104 compiler.compile(args.getFileObjects(), args.getClassNames(), processors); |
105 return Main.Result.ERROR; |
105 return (compiler.errorCount() > 0) ? Main.Result.ERROR : Main.Result.OK; // FIXME? |
106 compiler.compile(args.getFileObjects(), args.getClassNames(), processors); |
|
107 return (compiler.errorCount() > 0) ? Main.Result.ERROR : Main.Result.OK; // FIXME? |
|
108 } |
|
109 }, Main.Result.SYSERR, Main.Result.ABNORMAL); |
106 }, Main.Result.SYSERR, Main.Result.ABNORMAL); |
110 } finally { |
107 } finally { |
111 try { |
108 try { |
112 cleanup(); |
109 cleanup(); |
113 } catch (ClientCodeException e) { |
110 } catch (ClientCodeException e) { |
226 notYetEntered = null; |
223 notYetEntered = null; |
227 } |
224 } |
228 |
225 |
229 @Override @DefinedBy(Api.COMPILER_TREE) |
226 @Override @DefinedBy(Api.COMPILER_TREE) |
230 public Iterable<? extends CompilationUnitTree> parse() { |
227 public Iterable<? extends CompilationUnitTree> parse() { |
231 return handleExceptions(new Callable<Iterable<? extends CompilationUnitTree>>() { |
228 return handleExceptions(this::parseInternal, List.<CompilationUnitTree>nil(), List.<CompilationUnitTree>nil()); |
232 @Override |
|
233 public Iterable<? extends CompilationUnitTree> call() { |
|
234 return parseInternal(); |
|
235 } |
|
236 }, List.<CompilationUnitTree>nil(), List.<CompilationUnitTree>nil()); |
|
237 } |
229 } |
238 |
230 |
239 private Iterable<? extends CompilationUnitTree> parseInternal() { |
231 private Iterable<? extends CompilationUnitTree> parseInternal() { |
240 try { |
232 try { |
241 prepareCompiler(true); |
233 prepareCompiler(true); |
358 } |
350 } |
359 } |
351 } |
360 |
352 |
361 @Override @DefinedBy(Api.COMPILER_TREE) |
353 @Override @DefinedBy(Api.COMPILER_TREE) |
362 public Iterable<? extends Element> analyze() { |
354 public Iterable<? extends Element> analyze() { |
363 return handleExceptions(new Callable<Iterable<? extends Element>>() { |
355 return handleExceptions(() -> analyze(null), List.<Element>nil(), List.<Element>nil()); |
364 @Override |
|
365 public Iterable<? extends Element> call() { |
|
366 return analyze(null); |
|
367 } |
|
368 }, List.<Element>nil(), List.<Element>nil()); |
|
369 } |
356 } |
370 |
357 |
371 /** |
358 /** |
372 * Complete all analysis on the given classes. |
359 * Complete all analysis on the given classes. |
373 * This can be used to ensure that all compile time errors are reported. |
360 * This can be used to ensure that all compile time errors are reported. |
425 genList.addAll(queue); |
412 genList.addAll(queue); |
426 } |
413 } |
427 |
414 |
428 @Override @DefinedBy(Api.COMPILER_TREE) |
415 @Override @DefinedBy(Api.COMPILER_TREE) |
429 public Iterable<? extends JavaFileObject> generate() { |
416 public Iterable<? extends JavaFileObject> generate() { |
430 return handleExceptions(new Callable<Iterable<? extends JavaFileObject>>() { |
417 return handleExceptions(() -> generate(null), List.<JavaFileObject>nil(), List.<JavaFileObject>nil()); |
431 @Override |
|
432 public Iterable<? extends JavaFileObject> call() { |
|
433 return generate(null); |
|
434 } |
|
435 }, List.<JavaFileObject>nil(), List.<JavaFileObject>nil()); |
|
436 } |
418 } |
437 |
419 |
438 /** |
420 /** |
439 * Generate code corresponding to the given classes. |
421 * Generate code corresponding to the given classes. |
440 * The classes must have previously been returned from {@link #enter}. |
422 * The classes must have previously been returned from {@link #enter}. |