Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/CalloutMappingDeclaration.java5
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CalloutImplementor.java1
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutToField.java33
3 files changed, 38 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/CalloutMappingDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/CalloutMappingDeclaration.java
index b9e9de2c9..9c8c0e976 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/CalloutMappingDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/CalloutMappingDeclaration.java
@@ -236,6 +236,11 @@ public class CalloutMappingDeclaration extends AbstractMethodMappingDeclaration
this.roleMethodSpec.returnType.resolvedType = requiredType; // keep going..
return; // warned
}
+ if (this.roleMethodSpec.returnType.resolvedType == null) {
+ // https://bugs.eclipse.org/387236
+ // if returnType was added late (above) and if type mismatch exists, we still need a resolved type here:
+ this.roleMethodSpec.returnType.resolve(this.scope);
+ }
}
} else { // 'set'
if (this.roleMethodSpec.resolvedMethod.returnType != TypeBinding.VOID) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CalloutImplementor.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CalloutImplementor.java
index fd703674f..2b8717697 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CalloutImplementor.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CalloutImplementor.java
@@ -418,7 +418,6 @@ public class CalloutImplementor extends MethodMappingImplementor
// if this one is given, it might be instantiated:
returnType = calloutBindingDeclaration.roleMethodSpec.returnType.resolvedType;
else
- // CLOVER: never reached in jacks suite
// this one should exist in any case:
returnType = calloutBindingDeclaration.roleMethodSpec.resolvedMethod.returnType;
MethodDeclaration newMethod = gen.method(
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutToField.java b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutToField.java
index 6fb98469f..42b446d24 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutToField.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutToField.java
@@ -3670,4 +3670,37 @@ public class CalloutToField extends AbstractOTJLDTest {
},
"OK0");
}
+
+ // Bug 387236 - [compiler] type mismatch in signature-less c-t-f with array type causes NPE
+ public void testBug387236() {
+ runNegativeTest(new String[] {
+ "b/Base.java",
+ "package b;\n" +
+ "\n" +
+ "public class Base {\n" +
+ " Object[] values;\n" +
+ "}",
+ "t/Team.java",
+ "package t;\n" +
+ "\n" +
+ "import base b.Base;\n" +
+ "\n" +
+ "public team class Team {\n" +
+ " protected abstract class AR {\n" +
+ " protected abstract String[] getValues();\n" +
+ " }\n" +
+ " protected class CR extends AR playedBy Base {\n" +
+ " @SuppressWarnings(\"decapsulation\") getValues -> get values;\n" +
+ " \n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in t\\Team.java (at line 10)\n" +
+ " @SuppressWarnings(\"decapsulation\") getValues -> get values;\n" +
+ " ^^^^^^^^^\n" +
+ "When binding field values via callout to role method getValues():\n" +
+ "Incompatible types: can\'t convert java.lang.Object[] to java.lang.String[] (OTJLD 3.5(b)).\n" +
+ "----------\n");
+ }
}

Back to the top