Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2013-02-08 19:42:32 +0000
committerStephan Herrmann2013-02-08 19:42:32 +0000
commit755b267f743e6a97a216740cd998a4c2104fb32d (patch)
tree80213c284889fe7b07e7d543781cb9fed1d69cb4
parente017f6d7f003fbba1d0291e889e4b9e989b0ec9c (diff)
downloadorg.eclipse.objectteams-755b267f743e6a97a216740cd998a4c2104fb32d.tar.gz
org.eclipse.objectteams-755b267f743e6a97a216740cd998a4c2104fb32d.tar.xz
org.eclipse.objectteams-755b267f743e6a97a216740cd998a4c2104fb32d.zip
Bug 400362 - [compiler] role field with anchored role type breaks
implicit inheritance
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/copyinheritance/CopyInheritance.java1
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/ImplicitInheritance.java26
2 files changed, 27 insertions, 0 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/copyinheritance/CopyInheritance.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/copyinheritance/CopyInheritance.java
index 9b4a64095..996a98237 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/copyinheritance/CopyInheritance.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/copyinheritance/CopyInheritance.java
@@ -1378,6 +1378,7 @@ public class CopyInheritance implements IOTConstants, ClassFileConstants, ExtraC
}
}
AstGenerator gen = new AstGenerator(roleDeclaration.sourceStart, roleDeclaration.sourceEnd);
+ gen.replaceableEnclosingClass = roleDeclaration.binding.enclosingType();
FieldDeclaration fieldDeclaration =
AstConverter.createField(field, roleDeclaration, gen);
AstEdit.addField(roleDeclaration,fieldDeclaration, true, false/*typeProblem*/, false);
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/ImplicitInheritance.java b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/ImplicitInheritance.java
index 863910ca2..17ce0bb94 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/ImplicitInheritance.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/ImplicitInheritance.java
@@ -1369,4 +1369,30 @@ public class ImplicitInheritance extends AbstractOTJLDTest {
"----------\n");
}
+ // Bug 400362 - [compiler] role field with anchored role type breaks implicit inheritance
+ public void test0c16_implicitInheritanceRegression2() {
+ runConformTest(
+ new String[]{
+ "p2/SubTeam.java",
+ "package p2;\n" +
+ "import p1.SuperTeam;\n" +
+ "public team class SubTeam extends SuperTeam {\n" +
+ " public abstract class R {}\n" +
+ "}\n",
+ "p1/SuperTeam.java",
+ "package p1;\n" +
+ "public team class SuperTeam {\n" +
+ " final OtherTeam other=new OtherTeam();\n" +
+ " public abstract class R {\n" +
+ " OR<@other> otherRole;\n" +
+ " }\n" +
+ "}\n",
+ "p1/OtherTeam.java",
+ "package p1;\n" +
+ "public team class OtherTeam {\n" +
+ " public abstract class OR {}\n" +
+ "}\n"
+ },
+ "");
+ }
}

Back to the top