diff options
author | Thomas Wolf | 2019-09-11 08:39:53 +0000 |
---|---|---|
committer | Stephan Herrmann | 2019-09-12 14:03:46 +0000 |
commit | 328421a0239051bed525c280adc9937c7a561a78 (patch) | |
tree | 73a36165801de046a1b5c7184a7a1f4a9078987b | |
parent | f5086fcd983dd469b270acfb7d2e6e3230cb578f (diff) | |
download | eclipse.jdt.core-328421a0239051bed525c280adc9937c7a561a78.tar.gz eclipse.jdt.core-328421a0239051bed525c280adc9937c7a561a78.tar.xz eclipse.jdt.core-328421a0239051bed525c280adc9937c7a561a78.zip |
Bug 532029 - APT: don't close class loader between rounds
Port of a fix done in the AspectJ AJDT project; see [1].
[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=532029#c9
Change-Id: Ic023bd1cc8b03f9a5af7a414a81839c9bb15c810
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Also-by: Stephan Herrmann <stephan.herrmann@berlin.de>
5 files changed, 20 insertions, 4 deletions
diff --git a/org.eclipse.jdt.compiler.apt/META-INF/MANIFEST.MF b/org.eclipse.jdt.compiler.apt/META-INF/MANIFEST.MF index 78e9d32706..ebdfb85ca7 100644 --- a/org.eclipse.jdt.compiler.apt/META-INF/MANIFEST.MF +++ b/org.eclipse.jdt.compiler.apt/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %fragmentName Bundle-SymbolicName: org.eclipse.jdt.compiler.apt;singleton:=true -Bundle-Version: 1.3.700.qualifier +Bundle-Version: 1.3.800.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Vendor: %providerName Fragment-Host: org.eclipse.jdt.core;bundle-version="[3.5.0,4.0.0)" diff --git a/org.eclipse.jdt.compiler.apt/pom.xml b/org.eclipse.jdt.compiler.apt/pom.xml index 961406d819..0000e2e2f5 100644 --- a/org.eclipse.jdt.compiler.apt/pom.xml +++ b/org.eclipse.jdt.compiler.apt/pom.xml @@ -18,7 +18,7 @@ </parent> <groupId>org.eclipse.jdt</groupId> <artifactId>org.eclipse.jdt.compiler.apt</artifactId> - <version>1.3.700-SNAPSHOT</version> + <version>1.3.800-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> <build> diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BatchAnnotationProcessorManager.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BatchAnnotationProcessorManager.java index 46106a636a..669cf47538 100644 --- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BatchAnnotationProcessorManager.java +++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BatchAnnotationProcessorManager.java @@ -255,9 +255,10 @@ public class BatchAnnotationProcessorManager extends BaseAnnotationProcessorMana _commandLineProcessors = null; _commandLineProcessorIter = null; } + @Override - public void reset() { - super.reset(); + protected void cleanUp() { + // the classloader needs to be kept open between rounds, close it at the end: if (this._procLoader instanceof URLClassLoader) { try { ((URLClassLoader) this._procLoader).close(); diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/AbstractAnnotationProcessorManager.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/AbstractAnnotationProcessorManager.java index fdb1e3b285..022b20ae91 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/AbstractAnnotationProcessorManager.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/AbstractAnnotationProcessorManager.java @@ -82,6 +82,13 @@ public abstract class AbstractAnnotationProcessorManager { public abstract void reset(); /** + * Final cleanup after all rounds have completed. + */ + protected void cleanUp() { + // default: do nothing, because reset() already did the common work + } + + /** * Run a new annotation processing round on the given values. * * @param units the given source type diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java index 363f9c5051..7584092b3a 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java @@ -912,6 +912,14 @@ public class Compiler implements ITypeRequestor, ProblemSeverities { } protected void processAnnotations() { + try { + processAnnotationsInternal(); + } finally { + this.annotationProcessorManager.cleanUp(); + } + } + + private void processAnnotationsInternal() { int newUnitSize = 0; int newClassFilesSize = 0; int bottom = this.annotationProcessorStartIndex; |