Bug 475634: InternalCompilerError in TypeAnchorReference.getTypeBinding
(121)
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java
index c641fcc..04c7bf4 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java
@@ -29,6 +29,7 @@
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.impl.Constant;
import org.eclipse.jdt.internal.compiler.lookup.*;
+import org.eclipse.objectteams.otdt.internal.core.compiler.ast.TypeAnchorReference;
/**
* OTDT changes: support base class decapsulation through type arguments
@@ -307,6 +308,13 @@
ReferenceBinding currentOriginal = (ReferenceBinding)currentType.original();
for (int j = 0; j < argLength; j++) {
TypeReference arg = args[j];
+//{ObjectTeams:
+ if (arg instanceof TypeAnchorReference) {
+ scope.problemReporter().valueParamWrongPosition((TypeAnchorReference) arg);
+ argHasError = true;
+ continue;
+ }
+// SH}
TypeBinding argType = isClassScope
? arg.resolveTypeArgument((ClassScope) scope, currentOriginal, j)
: arg.resolveTypeArgument((BlockScope) scope, currentOriginal, j);
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/syntax/Syntax.java b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/syntax/Syntax.java
index 582118a..e7ab742 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/syntax/Syntax.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/syntax/Syntax.java
@@ -1504,4 +1504,35 @@
},
"");
}
+
+ public void testBug475634a() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public team class X {\n" +
+ " protected class R playedBy java.util.List<@Ann> {}\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " protected class R playedBy java.util.List<@Ann> {}\n" +
+ " ^^^^\n" +
+ "Illegal position for value parameter @Ann: must be a parameter of a single name type reference(OTJLD A.9(a)).\n" +
+ "----------\n");
+ }
+
+ public void testBug475634b() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public team class X extends java.util.List<@Ann> {\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " public team class X extends java.util.List<@Ann> {\n" +
+ " ^^^^\n" +
+ "Illegal position for value parameter @Ann: must be a parameter of a single name type reference(OTJLD A.9(a)).\n" +
+ "----------\n");
+ }
}