langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
equal
deleted
inserted
replaced
223 // If processorpath is not explicitly set, use the classpath. |
223 // If processorpath is not explicitly set, use the classpath. |
224 processorClassLoader = fileManager.hasLocation(ANNOTATION_PROCESSOR_PATH) |
224 processorClassLoader = fileManager.hasLocation(ANNOTATION_PROCESSOR_PATH) |
225 ? fileManager.getClassLoader(ANNOTATION_PROCESSOR_PATH) |
225 ? fileManager.getClassLoader(ANNOTATION_PROCESSOR_PATH) |
226 : fileManager.getClassLoader(CLASS_PATH); |
226 : fileManager.getClassLoader(CLASS_PATH); |
227 |
227 |
|
228 if (processorClassLoader != null && processorClassLoader instanceof Closeable) { |
|
229 JavaCompiler compiler = JavaCompiler.instance(context); |
|
230 compiler.closeables = compiler.closeables.prepend((Closeable) processorClassLoader); |
|
231 } |
|
232 |
228 /* |
233 /* |
229 * If the "-processor" option is used, search the appropriate |
234 * If the "-processor" option is used, search the appropriate |
230 * path for the named class. Otherwise, use a service |
235 * path for the named class. Otherwise, use a service |
231 * provider mechanism to create the processor iterator. |
236 * provider mechanism to create the processor iterator. |
232 */ |
237 */ |
1209 public void close() { |
1214 public void close() { |
1210 filer.close(); |
1215 filer.close(); |
1211 if (discoveredProcs != null) // Make calling close idempotent |
1216 if (discoveredProcs != null) // Make calling close idempotent |
1212 discoveredProcs.close(); |
1217 discoveredProcs.close(); |
1213 discoveredProcs = null; |
1218 discoveredProcs = null; |
1214 if (processorClassLoader != null && processorClassLoader instanceof Closeable) { |
|
1215 try { |
|
1216 ((Closeable) processorClassLoader).close(); |
|
1217 } catch (IOException e) { |
|
1218 JCDiagnostic msg = diags.fragment("fatal.err.cant.close.loader"); |
|
1219 throw new FatalError(msg, e); |
|
1220 } |
|
1221 } |
|
1222 } |
1219 } |
1223 |
1220 |
1224 private List<ClassSymbol> getTopLevelClasses(List<? extends JCCompilationUnit> units) { |
1221 private List<ClassSymbol> getTopLevelClasses(List<? extends JCCompilationUnit> units) { |
1225 List<ClassSymbol> classes = List.nil(); |
1222 List<ClassSymbol> classes = List.nil(); |
1226 for (JCCompilationUnit unit : units) { |
1223 for (JCCompilationUnit unit : units) { |