Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java3
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/QualifiedBaseReference.java12
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/ExternalizedRoles.java39
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/RegularRoleInheritance.java55
4 files changed, 81 insertions, 28 deletions
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 6673003fb..44f2ff89b 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
@@ -2239,6 +2239,9 @@ public MethodBinding resolveTypesFor(MethodBinding method, boolean fromSynthetic
this.scope.problemReporter().invalidType(arg.type, problemBinding);
}
}
+ // fix for NPE of https://bugs.eclipse.org/403396
+ if (parameterType != null && !parameterType.isValidBinding() && !(parameterType instanceof MissingTypeBinding))
+ foundArgProblem = true;
// SH}
if (parameterType == null) {
foundArgProblem = true;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/QualifiedBaseReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/QualifiedBaseReference.java
index 9e5dc8fa9..f6e93c733 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/QualifiedBaseReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/QualifiedBaseReference.java
@@ -49,15 +49,17 @@ public class QualifiedBaseReference extends QualifiedThisReference {
TypeBinding superResult = super.resolveType(scope);
if (superResult == null || !superResult.isValidBinding())
return null;
- if (this.currentCompatibleType != null && this.currentCompatibleType.isValidBinding()) {
- this.baseField = this.currentCompatibleType.getField(IOTConstants._OT_BASE, true);
+ ReferenceBinding currentType = this.currentCompatibleType;
+ while (currentType != null && currentType.isValidBinding() && currentType.isRole()) {
+ this.baseField = currentType.getField(IOTConstants._OT_BASE, true);
if (this.baseField != null) {
if (this.baseField.isValidBinding())
return this.resolvedType = this.baseField.type;
- } else {
- this.baseField = new ProblemFieldBinding((ReferenceBinding)this.resolvedType, IOTConstants.BASE, ProblemReasons.NotFound);
}
- }
+ currentType = currentType.superclass(); // base field may be inherited
+ }
+ if (this.baseField == null)
+ this.baseField = new ProblemFieldBinding((ReferenceBinding)this.resolvedType, IOTConstants.BASE, ProblemReasons.NotFound);
scope.problemReporter().unboundQualifiedBase((ReferenceBinding)this.qualification.resolvedType, this);
return null;
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/ExternalizedRoles.java b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/ExternalizedRoles.java
index ff81cee12..64bc8e442 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/ExternalizedRoles.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/ExternalizedRoles.java
@@ -1518,92 +1518,87 @@ public class ExternalizedRoles extends AbstractOTJLDTest {
" \n"
},
"----------\n" +
- "1. ERROR in Team167ratb5f_2.java (at line 3)\n" +
- " public class R playedBy Team167ratb5f_1 {\n" +
- " ^\n" +
- "The type R must be an abstract class to define abstract methods\n" +
- "----------\n" +
- "2. ERROR in Team167ratb5f_2.java (at line 8)\n" +
+ "1. ERROR in Team167ratb5f_2.java (at line 8)\n" +
" R<@base> r = getR2(getR1());\n" +
" ^\n" +
"Illegal use of value parameter: type Team167ratb5f_2.R does not declare a value parameter at position 1 (OTJLD 9.2.1).\n" +
"----------\n" +
- "3. ERROR in Team167ratb5f_2.java (at line 8)\n" +
+ "2. ERROR in Team167ratb5f_2.java (at line 8)\n" +
" R<@base> r = getR2(getR1());\n" +
" ^^^^^\n" +
"The method getR2(R<@tthis[Team167ratb5f_2]>) in the type Team167ratb5f_2.R is not applicable for the arguments (R)\n" +
"----------\n" +
- "4. ERROR in Team167ratb5f_2.java (at line 9)\n" +
+ "3. ERROR in Team167ratb5f_2.java (at line 9)\n" +
" r.test();\n" +
" ^\n" +
"The type R is not visible\n" +
"----------\n" +
- "5. ERROR in Team167ratb5f_2.java (at line 11)\n" +
+ "4. ERROR in Team167ratb5f_2.java (at line 11)\n" +
" abstract R<@base> getR1();\n" +
" ^\n" +
"Illegal use of value parameter: type Team167ratb5f_2.R does not declare a value parameter at position 1 (OTJLD 9.2.1).\n" +
"----------\n" +
- "6. ERROR in Team167ratb5f_2.java (at line 11)\n" +
+ "5. ERROR in Team167ratb5f_2.java (at line 11)\n" +
" abstract R<@base> getR1();\n" +
" ^^^^^^^^\n" +
"The return type is incompatible with Team167ratb5f_2.R.getR1()\n" +
"----------\n" +
- "7. ERROR in Team167ratb5f_2.java (at line 12)\n" +
+ "6. ERROR in Team167ratb5f_2.java (at line 12)\n" +
" R<@base> getR1() -> R<@base> getR1();\n" +
" ^\n" +
"Illegal use of value parameter: type Team167ratb5f_2.R does not declare a value parameter at position 1 (OTJLD 9.2.1).\n" +
"----------\n" +
- "8. ERROR in Team167ratb5f_2.java (at line 12)\n" +
+ "7. ERROR in Team167ratb5f_2.java (at line 12)\n" +
" R<@base> getR1() -> R<@base> getR1();\n" +
" ^\n" +
"Method designator binds to a method returning R whereas return type R is specified (OTJLD 3.1(c)).\n" +
"----------\n" +
- "9. ERROR in Team167ratb5f_2.java (at line 12)\n" +
+ "8. ERROR in Team167ratb5f_2.java (at line 12)\n" +
" R<@base> getR1() -> R<@base> getR1();\n" +
" ^\n" +
"Illegal use of value parameter: type Team167ratb5f_2.R does not declare a value parameter at position 1 (OTJLD 9.2.1).\n" +
"----------\n" +
- "10. ERROR in Team167ratb5f_2.java (at line 12)\n" +
+ "9. ERROR in Team167ratb5f_2.java (at line 12)\n" +
" R<@base> getR1() -> R<@base> getR1();\n" +
" ^\n" +
"Method designator binds to a method returning R1<@tthis[Team167ratb5f_1]> whereas return type R is specified (OTJLD 3.1(c)).\n" +
"----------\n" +
- "11. ERROR in Team167ratb5f_2.java (at line 13)\n" +
+ "10. ERROR in Team167ratb5f_2.java (at line 13)\n" +
" abstract R<@base> getR2(R<@base> in);\n" +
" ^\n" +
"Illegal use of value parameter: type Team167ratb5f_2.R does not declare a value parameter at position 1 (OTJLD 9.2.1).\n" +
"----------\n" +
- "12. ERROR in Team167ratb5f_2.java (at line 13)\n" +
+ "11. ERROR in Team167ratb5f_2.java (at line 13)\n" +
" abstract R<@base> getR2(R<@base> in);\n" +
" ^^^^^^^^^^^^^^^^^^\n" +
"The abstract method getR2 in type R can only be defined by an abstract class\n" +
"----------\n" +
- "13. ERROR in Team167ratb5f_2.java (at line 13)\n" +
+ "12. ERROR in Team167ratb5f_2.java (at line 13)\n" +
" abstract R<@base> getR2(R<@base> in);\n" +
" ^\n" +
"Illegal use of value parameter: type Team167ratb5f_2.R does not declare a value parameter at position 1 (OTJLD 9.2.1).\n" +
"----------\n" +
- "14. ERROR in Team167ratb5f_2.java (at line 14)\n" +
+ "13. ERROR in Team167ratb5f_2.java (at line 14)\n" +
" R<@base> getR2(R<@base> in) -> R<@base> getR2(R<@base>1 in); // here\n" +
" ^\n" +
"Illegal use of value parameter: type Team167ratb5f_2.R does not declare a value parameter at position 1 (OTJLD 9.2.1).\n" +
"----------\n" +
- "15. ERROR in Team167ratb5f_2.java (at line 14)\n" +
+ "14. ERROR in Team167ratb5f_2.java (at line 14)\n" +
" R<@base> getR2(R<@base> in) -> R<@base> getR2(R<@base>1 in); // here\n" +
" ^\n" +
"Illegal use of value parameter: type Team167ratb5f_2.R does not declare a value parameter at position 1 (OTJLD 9.2.1).\n" +
"----------\n" +
- "16. ERROR in Team167ratb5f_2.java (at line 14)\n" +
+ "15. ERROR in Team167ratb5f_2.java (at line 14)\n" +
" R<@base> getR2(R<@base> in) -> R<@base> getR2(R<@base>1 in); // here\n" +
" ^\n" +
"Illegal use of value parameter: type Team167ratb5f_2.R does not declare a value parameter at position 1 (OTJLD 9.2.1).\n" +
"----------\n" +
- "17. ERROR in Team167ratb5f_2.java (at line 14)\n" +
+ "16. ERROR in Team167ratb5f_2.java (at line 14)\n" +
" R<@base> getR2(R<@base> in) -> R<@base> getR2(R<@base>1 in); // here\n" +
" ^^^^^^^^^^^^^^^\n" +
"No method getR2() found in type Team167ratb5f_1 to resolve method designator (OTJLD 3.1(c)).\n" +
"----------\n" +
- "18. ERROR in Team167ratb5f_2.java (at line 14)\n" +
+ "17. ERROR in Team167ratb5f_2.java (at line 14)\n" +
" R<@base> getR2(R<@base> in) -> R<@base> getR2(R<@base>1 in); // here\n" +
" ^\n" +
"Syntax error on token \"1\", delete this token\n" +
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/RegularRoleInheritance.java b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/RegularRoleInheritance.java
index 4c4974731..c3da60812 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/RegularRoleInheritance.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/RegularRoleInheritance.java
@@ -34,7 +34,7 @@ public class RegularRoleInheritance extends AbstractOTJLDTest {
// Static initializer to specify tests subset using TESTS_* static variables
// All specified tests which does not belong to the class are skipped...
static {
-// TESTS_NAMES = new String[] { "test148_extendingRoleFromUnrelatedTeam2" };
+// TESTS_NAMES = new String[] { "testBug403396_2" };
// TESTS_NUMBERS = new int[] { 1459 };
// TESTS_RANGE = new int[] { 1097, -1 };
}
@@ -1489,4 +1489,57 @@ public class RegularRoleInheritance extends AbstractOTJLDTest {
},
"cannot be resolved");
}
+
+ public void testBug403396_1() {
+ runConformTest(
+ new String[] {
+ "base/BGraph.java",
+ "package base;\n" +
+ "\n" +
+ "public team class BGraph {\n" +
+ " public class BNode { }\n" +
+ " public class BEdge {}\n" +
+ "}\n",
+ "features/Features.java",
+ "package features;\n" +
+ "import base base.BGraph;\n" +
+ "public team class Features {\n" +
+ " public team class BasicGraph playedBy BGraph {\n" +
+ " public BasicGraph() { base(); }\n" +
+ " public class Edge playedBy BEdge<@base> {\n" +
+ " public Edge() { base(); }\n" +
+ " }\n" +
+ " }\n" +
+ " public team class WeightedGraph extends BasicGraph {\n" +
+ " }\n" +
+ "}\n"
+ });
+ }
+
+ public void testBug403396_2() {
+ runConformTest(
+ new String[] {
+ "base/BGraph.java",
+ "package base;\n" +
+ "\n" +
+ "public team class BGraph {\n" +
+ " public class BNode { }\n" +
+ " public class BEdge {}\n" +
+ "}\n",
+ "features/Features.java",
+ "package features;\n" +
+ "import base base.BGraph;\n" +
+ "public team class Features {\n" +
+ " public team class BasicGraph playedBy BGraph {\n" +
+ " public BasicGraph() { base(); }\n" +
+ " public class Edge playedBy BEdge<@base> {\n" +
+ " public Edge() { base(); }\n" +
+ " }\n" +
+ " }\n" +
+ " public team class WeightedGraph extends BasicGraph {\n" +
+ " @Override public class Edge {}\n" +
+ " }\n" +
+ "}\n"
+ });
+ }
}

Back to the top