diff options
author | Till Brychcy | 2018-11-24 11:59:26 +0000 |
---|---|---|
committer | Jay Arthanareeswaran | 2019-05-17 09:18:50 +0000 |
commit | 3bfcbfdb646353b49a162b1ce4b2d12369297cbd (patch) | |
tree | 3545b67bfb4d75a6501f664dfd07e2d26e4cc542 | |
parent | a068825c7323c0bdfce75ff65ce829eb7b4bf2e4 (diff) | |
download | eclipse.jdt.core-I20190518-1800.tar.gz eclipse.jdt.core-I20190518-1800.tar.xz eclipse.jdt.core-I20190518-1800.zip |
Bug 541466 - Eclipse APT implementation fails when annotation referencesI20190518-1800I20190517-1800
a class not on the class path
Change-Id: Ic80814c9a2cf99dc02cc18ac51225c763d6ae6b8
-rw-r--r-- | org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedAnnotationBinding.java | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedAnnotationBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedAnnotationBinding.java index 51ed3bf578..db529aa3c4 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedAnnotationBinding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedAnnotationBinding.java @@ -57,19 +57,25 @@ public ElementValuePair[] getElementValuePairs() { pair.setMethodBinding(methods[0]); } // else silently leave a null there Object value = pair.getValue(); - if (value instanceof UnresolvedReferenceBinding) { - pair.setValue(((UnresolvedReferenceBinding) value). - resolve(this.env, false)); - // no parameterized types in annotation values - } else if (value instanceof Object[]) { - Object[] values = (Object[]) value; - for (int j = 0; j < values.length; j++) { - if (values[j] instanceof UnresolvedReferenceBinding) { - values[j] = ((UnresolvedReferenceBinding) values[j]).resolve(this.env, false); + boolean wasToleratingMissingTypeProcessingAnnotations = this.env.mayTolerateMissingType; + this.env.mayTolerateMissingType = true; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=360164 + try { + if (value instanceof UnresolvedReferenceBinding) { + pair.setValue(((UnresolvedReferenceBinding) value). + resolve(this.env, false)); + // no parameterized types in annotation values + } else if (value instanceof Object[]) { + Object[] values = (Object[]) value; + for (int j = 0; j < values.length; j++) { + if (values[j] instanceof UnresolvedReferenceBinding) { + values[j] = ((UnresolvedReferenceBinding) values[j]).resolve(this.env, false); + } } - } - } // do nothing for UnresolvedAnnotationBinding-s, since their - // content is only accessed through get* methods + } // do nothing for UnresolvedAnnotationBinding-s, since their + // content is only accessed through get* methods + } finally { + this.env.mayTolerateMissingType = wasToleratingMissingTypeProcessingAnnotations; + } } this.env = null; } |