Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2013-02-09 19:49:38 +0000
committerStephan Herrmann2013-02-09 19:49:38 +0000
commitc781c767a0c6759204546599f1a23ee389585276 (patch)
tree1101e37b8d4129e7501f7a656a897eb01e6e821d /testplugins
parent755b267f743e6a97a216740cd998a4c2104fb32d (diff)
downloadorg.eclipse.objectteams-c781c767a0c6759204546599f1a23ee389585276.tar.gz
org.eclipse.objectteams-c781c767a0c6759204546599f1a23ee389585276.tar.xz
org.eclipse.objectteams-c781c767a0c6759204546599f1a23ee389585276.zip
Bug 400360 - [reconciler] fails to resolve callout-to-field with
path-anchored type Solution: include necessary STATE_ROLES_LINKED into mngmt by lookupEnv
Diffstat (limited to 'testplugins')
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.tests/model/org/eclipse/objectteams/otdt/tests/otmodel/OTReconcilerTests.java65
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/OTSubHierarchyContentProviderTests.java14
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TreeNode.java17
3 files changed, 86 insertions, 10 deletions
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/model/org/eclipse/objectteams/otdt/tests/otmodel/OTReconcilerTests.java b/testplugins/org.eclipse.objectteams.otdt.tests/model/org/eclipse/objectteams/otdt/tests/otmodel/OTReconcilerTests.java
index 6d2993c44..a17f5ec59 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/model/org/eclipse/objectteams/otdt/tests/otmodel/OTReconcilerTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/model/org/eclipse/objectteams/otdt/tests/otmodel/OTReconcilerTests.java
@@ -1631,4 +1631,69 @@ public class OTReconcilerTests extends ReconcilerTests {
deleteProject("P");
}
}
+
+ // Bug 400360 - [reconciler] fails to resolve callout-to-field with path-anchored type
+ public void testBug400360() throws CoreException, InterruptedException {
+ try {
+ // Resources creation
+ IJavaProject p = createOTJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "bin");
+ IProject project = p.getProject();
+ IProjectDescription prjDesc = project.getDescription();
+ prjDesc.setBuildSpec(OTDTPlugin.createProjectBuildCommands(prjDesc));
+ project.setDescription(prjDesc, null);
+ p.setOption(JavaCore.COMPILER_PB_UNUSED_LOCAL, JavaCore.IGNORE);
+
+ OTREContainer.initializeOTJProject(project);
+
+ String allShapesSourceString =
+ "public team class AllShapes {\n" +
+ "\n" +
+ " public abstract class Connector { }\n" +
+ " public abstract class RectangularConnector extends Connector { }\n" +
+ "}\n";
+ this.createFile(
+ "/P/AllShapes.java",
+ allShapesSourceString);
+
+ String chdSourceString =
+ "public team class CompanyHierarchyDisplay {\n" +
+ " \n" +
+ " public final AllShapes _shapes = new AllShapes();\n" +
+ " \n" +
+ " public class Connection {\n" +
+ " Connector<@_shapes> connShape;\n" +
+ " }\n" +
+ "}\n";
+ this.createFile(
+ "/P/CompanyHierarchyDisplay.java",
+ chdSourceString);
+
+ String versionASourceString =
+ "public team class VersionA {\n" +
+ " private final CompanyHierarchyDisplay _chd;\n" +
+ " \n" +
+ " public VersionA(CompanyHierarchyDisplay chd) {\n" +
+ " _chd = chd;\n" +
+ " }\n" +
+ " \n" +
+ " public class RectangularConnections playedBy Connection<@_chd> {\n" +
+ " final AllShapes _shapesX = _chd._shapes;\n" +
+ " @SuppressWarnings(\"decapsulation\")\n" +
+ " void setShape(RectangularConnector<@_shapesX> shape) -> set Connector<@_chd._shapes> connShape;\n" +
+ " }\n" +
+ "}\n";
+ this.createFile(
+ "/P/VersionA.java",
+ versionASourceString);
+
+ char[] versionASourceChars = versionASourceString.toCharArray();
+ this.problemRequestor.initialize(versionASourceChars);
+
+ ICompilationUnit unit = getCompilationUnit("/P/VersionA.java").getWorkingCopy(this.wcOwner, null);
+
+ assertNoProblem(versionASourceChars, unit);
+ } finally {
+ deleteProject("P");
+ }
+ }
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/OTSubHierarchyContentProviderTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/OTSubHierarchyContentProviderTests.java
index 04feb41fd..cee09fc55 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/OTSubHierarchyContentProviderTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/OTSubHierarchyContentProviderTests.java
@@ -61,7 +61,7 @@ public class OTSubHierarchyContentProviderTests extends FileBasedUITest
private IType _T8;
private IType _T1_R1;
- private IType _T1_R2;
+ // private IType _T1_R2; not within the cone of types reachable from _T1_R1
private IType _T2_R1;
private IType _T2_R2;
@@ -175,14 +175,7 @@ public class OTSubHierarchyContentProviderTests extends FileBasedUITest
pkg,
"T1",
"R1").getCorrespondingJavaElement();
-
- _T1_R2 = (IType)
- getRole(getTestProjectDir(),
- SRC_FOLDER,
- pkg,
- "T1",
- "R2").getCorrespondingJavaElement();
-
+
_T2_R1 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
@@ -272,7 +265,7 @@ public class OTSubHierarchyContentProviderTests extends FileBasedUITest
_allTypesInProject = new IType[]
{
_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8,
- _T1_R1, _T1_R2,
+ _T1_R1, //_T1_R2,
_T2_R1, _T2_R2,
_T3_R1, _T3_R2,
_T4_R2,
@@ -310,6 +303,7 @@ public class OTSubHierarchyContentProviderTests extends FileBasedUITest
for (int idx = 0; idx < _allTypesInProject.length; idx++)
{
IType cur = _allTypesInProject[idx];
+ if (cur == _T2_R2) continue; // skip, cur's parent is outside the visible cone
actual = _testObject.getParent(cur);
assertEquals("Unexpected parent for " + cur.getFullyQualifiedName() + " ", parents.get(cur), actual);
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TreeNode.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TreeNode.java
index 5104585e5..68d2a431c 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TreeNode.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TreeNode.java
@@ -21,7 +21,9 @@
package org.eclipse.objectteams.otdt.ui.tests.hierarchy.contentprovider;
import java.util.HashMap;
+import java.util.Map.Entry;
+import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IType;
import org.eclipse.objectteams.otdt.tests.FileBasedTest;
@@ -141,4 +143,19 @@ public class TreeNode
this._children.put(node.getElement(), node);
}
+
+ // facilitate debugging:
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ toString(buf, 0);
+ return buf.toString();
+ }
+
+ private void toString(StringBuffer buf, int indent) {
+ for (int i=0; i<indent; i++) buf.append(' ');
+ IJavaElement element = (IJavaElement)this._element;
+ buf.append(element.getParent().getElementName()).append('.').append(element.getElementName()).append('\n');
+ for (Entry<Object,TreeNode> e : this._children.entrySet())
+ e.getValue().toString(buf, 4);
+ }
} \ No newline at end of file

Back to the top