Fix for Bug 425601 [dom ast] References to parameterized
nested types don't have IBinding#isDeprecated() set
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java
index eab4468..0fe5b03 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java
@@ -4860,7 +4860,12 @@
" ^^^^\n" +
"Null type mismatch: required \'@NonNull T\' but the provided value is null\n" +
"----------\n" +
- "2. ERROR in X.java (at line 11)\n" +
+ "2. ERROR in X.java (at line 10)\n" +
+ " void test(Inner<Number> inum) {\n" +
+ " ^^^^^^\n" +
+ "Null constraint mismatch: The type \'Number\' is not a valid substitute for the type parameter \'@NonNull T\'\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 11)\n" +
" @NonNull Number nnn = inum.process(null); // ERR on argument\n" +
" ^^^^\n" +
"Null type mismatch: required \'@NonNull Number\' but the provided value is null\n" +
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter18Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter18Test.java
index 9411235..dc14743 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter18Test.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter18Test.java
@@ -4938,7 +4938,7 @@
*
* @throws JavaModelException
*/
-public void _testBug425601_001() throws JavaModelException {
+public void testBug425601_001() throws JavaModelException {
this.workingCopy = getWorkingCopy("/Converter18/src/testBug425601_001/Outer.java",
true/* resolve */);
String contents = "package testBug425601_001;\n" +
@@ -4983,7 +4983,7 @@
*
* @throws JavaModelException
*/
-public void _testBug425601_002() throws JavaModelException {
+public void testBug425601_002() throws JavaModelException {
this.workingCopy = getWorkingCopy("/Converter18/src/testBug425601_002/Outer.java",
true/* resolve */);
String contents = "package testBug425601_002;\n" +
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
index 0ea209a..a41df4b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
@@ -846,18 +846,29 @@
return uniqueKey;
}
-void faultInTypesForFieldsAndMethods() {
- if (!isPrototype()) throw new IllegalStateException();
+private void checkAnnotationsInType() {
// check @Deprecated annotation
getAnnotationTagBits(); // marks as deprecated by side effect
ReferenceBinding enclosingType = enclosingType();
if (enclosingType != null && enclosingType.isViewedAsDeprecated() && !isDeprecated())
this.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
+
+ for (int i = 0, length = this.memberTypes.length; i < length; i++)
+ ((SourceTypeBinding) this.memberTypes[i]).checkAnnotationsInType();
+}
+
+void faultInTypesForFieldsAndMethods() {
+ if (!isPrototype()) throw new IllegalStateException();
+ checkAnnotationsInType();
+ internalFaultInTypeForFieldsAndMethods();
+}
+
+private void internalFaultInTypeForFieldsAndMethods() {
fields();
methods();
for (int i = 0, length = this.memberTypes.length; i < length; i++)
- ((SourceTypeBinding) this.memberTypes[i]).faultInTypesForFieldsAndMethods();
+ ((SourceTypeBinding) this.memberTypes[i]).internalFaultInTypeForFieldsAndMethods();
}
// NOTE: the type of each field of a source type is resolved when needed
public FieldBinding[] fields() {