Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2019-04-14 12:45:35 +0000
committerStephan Herrmann2019-04-14 12:45:35 +0000
commit197de69dcb4d333fd486636329f19e697aee4541 (patch)
treebf5a83f57ca7e602735c57e3e5467b50b47dd782
parentfd5bb609f244a4b470f78f7693693f1904202502 (diff)
downloadeclipse.jdt.core-197de69dcb4d333fd486636329f19e697aee4541.tar.gz
eclipse.jdt.core-197de69dcb4d333fd486636329f19e697aee4541.tar.xz
eclipse.jdt.core-197de69dcb4d333fd486636329f19e697aee4541.zip
Bug 421821 - Two errors reported for unresolved type accessI20190414-1800
Change-Id: I9cbf25d6b5931bcfce05ea490cadddcb8253da93 Signed-off-by: Stephan Herrmann <stephan.herrmann@berlin.de>
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java26
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java4
2 files changed, 10 insertions, 20 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java
index 44d19d7af9..2b409dbbec 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java
@@ -4230,55 +4230,45 @@ public class NegativeTypeAnnotationTest extends AbstractRegressionTest {
"----------\n" +
"1. ERROR in X.java (at line 3)\n" +
" Y y1 = (@Marker Z) null;\n" +
- " ^^^^^^^^^^^^^^^^\n" +
- "Z cannot be resolved to a type\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 3)\n" +
- " Y y1 = (@Marker Z) null;\n" +
" ^\n" +
"Z cannot be resolved to a type\n" +
"----------\n" +
- "3. ERROR in X.java (at line 4)\n" +
+ "2. ERROR in X.java (at line 4)\n" +
" Y y2 = new @Marker Z();\n" +
" ^\n" +
"Z cannot be resolved to a type\n" +
"----------\n" +
- "4. ERROR in X.java (at line 5)\n" +
- " Y[] y3 = (@Marker Z[]) null;\n" +
- " ^^^^^^^^^^^^^^^^^^\n" +
- "Z cannot be resolved to a type\n" +
- "----------\n" +
- "5. ERROR in X.java (at line 5)\n" +
+ "3. ERROR in X.java (at line 5)\n" +
" Y[] y3 = (@Marker Z[]) null;\n" +
" ^\n" +
"Z cannot be resolved to a type\n" +
"----------\n" +
- "6. ERROR in X.java (at line 6)\n" +
+ "4. ERROR in X.java (at line 6)\n" +
" Y[] y4 = new @Marker Z[0];\n" +
" ^\n" +
"Z cannot be resolved to a type\n" +
"----------\n" +
- "7. ERROR in X.java (at line 7)\n" +
+ "5. ERROR in X.java (at line 7)\n" +
" Y[] y5 = (@Marker Y.Z) null;\n" +
" ^^^\n" +
"Y.Z cannot be resolved to a type\n" +
"----------\n" +
- "8. ERROR in X.java (at line 8)\n" +
+ "6. ERROR in X.java (at line 8)\n" +
" Y[] y6 = new @Marker Y. Z();\n" +
" ^^^^^\n" +
"Y.Z cannot be resolved to a type\n" +
"----------\n" +
- "9. ERROR in X.java (at line 9)\n" +
+ "7. ERROR in X.java (at line 9)\n" +
" Y[] y7 = (@Marker Y.Z[]) null;\n" +
" ^^^\n" +
"Y.Z cannot be resolved to a type\n" +
"----------\n" +
- "10. ERROR in X.java (at line 10)\n" +
+ "8. ERROR in X.java (at line 10)\n" +
" Y[] y8 = new @Marker Y[0]. Z;\n" +
" ^\n" +
"Z cannot be resolved or is not a field\n" +
"----------\n" +
- "11. ERROR in X.java (at line 11)\n" +
+ "9. ERROR in X.java (at line 11)\n" +
" Y[] y9 = new @Marker Y. Z[0];\n" +
" ^^^^^\n" +
"Y.Z cannot be resolved to a type\n" +
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java
index bb737d61bb..902ae099ce 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java
@@ -290,8 +290,8 @@ public void resolve(MethodScope initializationScope) {
CastExpression.checkNeedForAssignedCast(initializationScope, fieldType, (CastExpression) this.initialization);
}
} else {
- if ((fieldType.tagBits & TagBits.HasMissingType) == 0) {
- // if problem already got signaled on type, do not report secondary problem
+ if (((fieldType.tagBits | initializationType.tagBits) & TagBits.HasMissingType) == 0) {
+ // if problem already got signaled on either type, do not report secondary problem
initializationScope.problemReporter().typeMismatchError(initializationType, fieldType, this.initialization, null);
}
}

Back to the top