Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTill Brychcy2018-10-03 06:21:39 -0400
committerTill Brychcy2018-10-05 17:25:12 -0400
commite29e536a8af05578c6efc9b982cb39d5e09b4e03 (patch)
tree71c4474d09c24db5f401b454c2321e4d3772e8f8 /org.eclipse.jdt.compiler.apt
parenta627e47891a7ae0c2b0fc8860ecc0529255b7673 (diff)
downloadeclipse.jdt.core-e29e536a8af05578c6efc9b982cb39d5e09b4e03.tar.gz
eclipse.jdt.core-e29e536a8af05578c6efc9b982cb39d5e09b4e03.tar.xz
eclipse.jdt.core-e29e536a8af05578c6efc9b982cb39d5e09b4e03.zip
Bug 539774 - Spurious compilation failures caused by java model usageI20181006-0600I20181005-1800
during annotation processing. Change-Id: If2e649786f4e6d1117636cb52556d8a3f791ec87
Diffstat (limited to 'org.eclipse.jdt.compiler.apt')
-rw-r--r--org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseAnnotationProcessorManager.java13
-rw-r--r--org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseProcessingEnvImpl.java2
2 files changed, 14 insertions, 1 deletions
diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseAnnotationProcessorManager.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseAnnotationProcessorManager.java
index efba8488d9..67fc9a8726 100644
--- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseAnnotationProcessorManager.java
+++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseAnnotationProcessorManager.java
@@ -23,6 +23,7 @@ import org.eclipse.jdt.internal.compiler.AbstractAnnotationProcessorManager;
import org.eclipse.jdt.internal.compiler.Compiler;
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
+import org.eclipse.jdt.internal.compiler.lookup.ModuleBinding;
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
/**
@@ -148,6 +149,17 @@ public abstract class BaseAnnotationProcessorManager extends AbstractAnnotationP
*/
@Override
public void processAnnotations(CompilationUnitDeclaration[] units, ReferenceBinding[] referenceBindings, boolean isLastRound) {
+ if (units != null) {
+ for (CompilationUnitDeclaration declaration : units) {
+ if (declaration != null && declaration.scope != null) {
+ ModuleBinding m = declaration.scope.module();
+ if (m != null) {
+ _processingEnv._current_module = m;
+ break;
+ }
+ }
+ }
+ }
RoundEnvImpl roundEnv = new RoundEnvImpl(units, referenceBindings, isLastRound, _processingEnv);
if (_isFirstRound) {
_isFirstRound = false;
@@ -161,5 +173,4 @@ public abstract class BaseAnnotationProcessorManager extends AbstractAnnotationP
this, roundEnv, roundEnv.getRootAnnotations(), traceProcessorInfo, traceRounds);
dispatcher.round();
}
-
}
diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseProcessingEnvImpl.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseProcessingEnvImpl.java
index 071236c8f6..f288a44543 100644
--- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseProcessingEnvImpl.java
+++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseProcessingEnvImpl.java
@@ -33,6 +33,7 @@ import org.eclipse.jdt.internal.compiler.apt.model.TypesImpl;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment;
+import org.eclipse.jdt.internal.compiler.lookup.ModuleBinding;
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
/**
@@ -54,6 +55,7 @@ public abstract class BaseProcessingEnvImpl implements ProcessingEnvironment {
private List<ICompilationUnit> _deletedUnits;
private boolean _errorRaised;
private Factory _factory;
+ public ModuleBinding _current_module;
public BaseProcessingEnvImpl() {
_addedUnits = new ArrayList<>();

Back to the top