initial commit in accordance with CQ 3784
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/.classpath
new file mode 100644
index 0000000..3889ea2
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/.classpath
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="OTRE"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/OTRE"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/.project
new file mode 100644
index 0000000..ac8a149
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/.project
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.objectteams.otdt.test.builder</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.objectteams.otdt.OTJavaNature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..f8a917f
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Builder Plug-in
+Bundle-SymbolicName: org.eclipse.objectteams.otdt.test.builder;singleton:=true
+Bundle-Version: 1.3.0
+Bundle-ClassPath: otdt-buildertests.jar
+Bundle-Activator: org.eclipse.objectteams.otdt.test.builder.BuilderTestPlugin
+Bundle-Vendor: objectteams.org
+Export-Package: org.eclipse.objectteams.otdt.test.builder
+Require-Bundle: org.junit,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.jdt.core.tests.builder,
+ org.eclipse.objectteams.otdt,
+ org.eclipse.objectteams.otdt.compiler.adaptor,
+ org.eclipse.jdt.core.tests.compiler,
+ org.eclipse.jdt.core,
+ org.eclipse.test.performance,
+ org.eclipse.objectteams.otdt.tests
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/build.properties
new file mode 100644
index 0000000..244c7b9
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/build.properties
@@ -0,0 +1,8 @@
+source.otdt-buildertests.jar = src/
+output.otdt-buildertests.jar = bin/
+bin.includes = plugin.xml,\
+ otdt-buildertests.jar,\
+ test.xml,\
+ JCL/,\
+ workspace/,\
+ META-INF/
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/plugin.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/plugin.xml
new file mode 100644
index 0000000..dbc928d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/plugin.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+
+
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/AllTests.java
new file mode 100644
index 0000000..d1a6577
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/AllTests.java
@@ -0,0 +1,39 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id$
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.test.builder;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(
+ "Test for org.eclipse.objectteams.otdt.test.builder"); //$NON-NLS-1$
+ //$JUnit-BEGIN$
+ suite.addTest(IncrementalTests.suite());
+ suite.addTest(CompilationOrderTests.suite());
+ suite.addTest(OTEquinoxBuilderTests.suite());
+ //$JUnit-END$
+ return suite;
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/BuilderTestPlugin.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/BuilderTestPlugin.java
new file mode 100644
index 0000000..4421945
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/BuilderTestPlugin.java
@@ -0,0 +1,70 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id$
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.test.builder;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class BuilderTestPlugin extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.objectteams.otdt.test.builder"; //$NON-NLS-1$
+
+ // The shared instance
+ private static BuilderTestPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public BuilderTestPlugin() {
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static BuilderTestPlugin getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/CompilationOrderTests.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/CompilationOrderTests.java
new file mode 100644
index 0000000..ab4d1e5
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/CompilationOrderTests.java
@@ -0,0 +1,112 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id$
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.test.builder;
+
+import junit.framework.Test;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.compiler.CategorizedProblem;
+import org.eclipse.jdt.core.tests.builder.Problem;
+import org.eclipse.jdt.core.tests.util.Util;
+
+
+public class CompilationOrderTests extends OTBuilderTests {
+
+ public static Test suite() {
+ return buildTestSuite(CompilationOrderTests.class);
+ }
+
+ public CompilationOrderTests(String name) {
+ super(name);
+ }
+
+ /* In batch-mode this causes a problem,
+ * compilation order is different in workbench mode, though
+ * (depends on class names?!).
+ * Original jacks test is removed.
+ */
+ @SuppressWarnings("nls")
+ public void test177otjd5f() throws JavaModelException {
+ System.out.println("***** test177otjd5f() *****");
+ IPath projectPath = env.addProject("Project", "1.5");
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+ env.addExternalJar(projectPath, OTRE_JAR_PATH);
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ env.addClass(root, "p", "ATeam",
+ "package p; \n"+
+ "public team class ATeam { protected class R implements IConfined {} public IConfined getR() { return new R(); } }");
+
+ env.addClass(root, "p", "M",
+ "package p; \n"+
+ "public class M {\n"+
+ " @SuppressWarnings(\"unused\")\n"+
+ " void foo() {\n"+
+ " final ATeam t = new ATeam();\n"+
+ " IConfined<@t> ic = t.getR();\n"+
+ " }\n"+
+ "}");
+
+ fullBuild(projectPath);
+ expectingNoProblems();
+ }
+
+ /* (TODO(SH): test doesn't really fit into this class).
+ * Witness for an NPE in ExplicitConstructorCall.resolve():
+ * If o.o.Team cannot be found, receiverType could be null!
+ */
+ public void testMissingOTRE() throws JavaModelException {
+ System.out.println("***** testMissingOTRE() *****");
+ IPath projectPath = env.addProject("Project", "1.5");
+ // don't abort when detecting the build path error
+ // (otherwise other errors would be expunged).
+ env.getJavaProject(projectPath).setOption(JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH, JavaCore.ERROR);
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+ // don't: env.addExternalJar(projectPath, OTRE_JAR_PATH);
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ IPath ateam = env.addClass(root, "p", "ATeam",
+ "package p; \n"+
+ "public team class ATeam { ATeam() { super(); } }");
+
+ fullBuild(projectPath);
+
+ expectingProblemsFor(ateam);
+ expectingOnlySpecificProblemsFor(ateam,
+ new Problem[] {
+ new Problem("", "The type org.objectteams.Team cannot be resolved. It is indirectly referenced from required .class files", ateam, 30, 35, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR),
+ new Problem("", "The constructor Team() is undefined", ateam, 48,56, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)
+ });
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/IncrementalTests.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/IncrementalTests.java
new file mode 100644
index 0000000..db547ae
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/IncrementalTests.java
@@ -0,0 +1,872 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id$
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.test.builder;
+
+import junit.framework.Test;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.compiler.CategorizedProblem;
+import org.eclipse.jdt.core.tests.builder.Problem;
+import org.eclipse.jdt.core.tests.util.Util;
+
+/**
+ * This test class tests incremental compilation of teams and roles.
+ */
+@SuppressWarnings("nls")
+public class IncrementalTests extends OTBuilderTests {
+
+
+ public IncrementalTests(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ return buildTestSuite(IncrementalTests.class);
+ }
+
+ /*
+ */
+ public void testRemoveTeamType() throws JavaModelException {
+ System.out.println("***** testRemoveTeamType() *****");
+ IPath projectPath = env.addProject("Project");
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+ env.addExternalJar(projectPath, OTRE_JAR_PATH);
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA { }");
+
+
+ IPath pathToAB = env.addClass(root, "p.AA", "R",
+ "team package p.AA; \n"+
+ " protected class R {}");
+
+
+ fullBuild(projectPath);
+ expectingNoProblems();
+
+ /* Remove team AA */
+ env.removeClass(env.getPackagePath(root, "p"), "AA");
+
+ /* build must detect, that R - although unchanged - becomes invalid. */
+ incrementalBuild(projectPath);
+ expectingProblemsFor(pathToAB);
+ expectingSpecificProblemFor(pathToAB, new Problem("", "Enclosing team p.AA not found for role file R (OTJLD 1.2.5(c)).", pathToAB, 13, 17, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR));
+
+ /* Restore team AA */
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA {}");
+
+ incrementalBuild(projectPath);
+ expectingNoProblems();
+ }
+ /*
+ */
+ public void testRemoveRoleType() throws JavaModelException {
+ System.out.println("***** testRemoveRoleType() *****");
+ IPath projectPath = env.addProject("Project");
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+ env.addExternalJar(projectPath, OTRE_JAR_PATH);
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA { \n"+
+ " protected class RA {}}");
+
+ IPath pathToAB = env.addClass(root, "p", "AB",
+ "package p; \n"+
+ "public team class AB extends AA {"+
+ " protected class RB extends RA {} }");
+
+
+ fullBuild(projectPath);
+ expectingNoProblems();
+
+ /* Remove role AA.RA */
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA {}");
+
+ /* build must detect, that AB - although unchanged - becomes invalid. */
+ incrementalBuild(projectPath);
+ expectingProblemsFor(pathToAB);
+ expectingSpecificProblemFor(pathToAB, new Problem("", "RA cannot be resolved to a type", pathToAB, 75, 77, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR));
+
+ /* Restore role AA.RA */
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA { \n"+
+ " public class RA {}}");
+
+ incrementalBuild(projectPath);
+ expectingNoProblems();
+ }
+ public void testRemoveRoleFile() throws JavaModelException {
+ System.out.println("***** testRemoveRoleFile() *****");
+ IPath projectPath = env.addProject("Project");
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+ env.addExternalJar(projectPath, OTRE_JAR_PATH);
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ env.addClass(root, "p", "Outer",
+ "package p; \n"+
+ "public team class Outer {}");
+ IPath pathToNested= env.addClass(root, "p/Outer", "Nested",
+ "team package p.Outer;\n"+
+ "protected team class Nested {}");
+
+ IPath pathToOuterSub = env.addClass(root, "p", "OuterSub",
+ "package p; \n"+
+ "public team class OuterSub extends Outer {\n"+
+ " Nested aRole;\n"+
+ "}");
+
+ fullBuild(projectPath);
+ expectingNoProblems();
+
+ /* Remove role Outer.Nested */
+ env.removeFile(pathToNested);
+
+ /* build must detect, that AB - although unchanged - becomes invalid -- but no further errors/exceptions */
+ incrementalBuild(projectPath);
+ expectingProblemsFor(pathToOuterSub);
+ expectingSpecificProblemFor(pathToOuterSub, new Problem("", "Nested cannot be resolved to a type", pathToOuterSub, 58, 64, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR));
+
+ }
+ /*
+ */
+ public void testRemoveRoleMethod() throws JavaModelException {
+ System.out.println("***** testRemoveRoleMethod() *****");
+ IPath projectPath = env.addProject("Project");
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+ env.addExternalJar(projectPath, OTRE_JAR_PATH);
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA { \n"+
+ " public class RA { \n"+
+ " public void foo() {}\n"+
+ "}}");
+
+ env.addClass(root, "p", "AB",
+ "package p; \n"+
+ "public team class AB extends AA {"+
+ " protected class RB extends RA {} }");
+
+
+ fullBuild(projectPath);
+ expectingNoProblems();
+
+ /* Remove role method AA.RA.foo */
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA { \n"+
+ " public class RA {}}");
+
+ /* add a class referencing AB.RA */
+ IPath pathToM = env.addClass(root, "p", "M",
+ "package p; \n"+
+ "public class M { \n"+
+ " void test() {\n"+
+ " new AB().new RA().foo();\n"+
+ "}}");
+
+ /* build must detect, that the use of AB - although AB is unchanged - becomes invalid. */
+ incrementalBuild(projectPath);
+ expectingProblemsFor(pathToM);
+ expectingSpecificProblemFor(pathToM, new Problem("", "The method foo() is undefined for the type RA<@tthis[AB]>", pathToM, 68, 71, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR));
+
+ /* Restore method AA.RA.foo */
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA { \n"+
+ " public class RA { \n"+
+ " public void foo() {}\n"+
+ "}}");
+
+ incrementalBuild(projectPath);
+ expectingNoProblems();
+ }
+
+ /*
+ */
+ public void testModifyTSuperRole1() throws JavaModelException {
+ System.out.println("***** testModifyTSuperRole1() *****");
+ IPath projectPath = env.addProject("Project");
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+ env.addExternalJar(projectPath, OTRE_JAR_PATH);
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA { \n"+
+ " protected class R {\n" +
+ " void bar() { }\n"+
+ "}}");
+
+ IPath pathToAB = env.addClass(root, "p", "AB",
+ "package p; \n"+
+ "public team class AB extends AA {\n"+
+ " protected class R {\n"+
+ " void foo() { this.bar(); }\n"+
+ "} }");
+
+
+ fullBuild(projectPath);
+ expectingNoProblems();
+
+ /* Remove method AA.R.bar() */
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA {\n" +
+ " protected class R {}\n" +
+ "}");
+
+ /* build must detect, that AB - although unchanged - becomes invalid through a self-call. */
+ incrementalBuild(projectPath);
+ expectingProblemsFor(pathToAB);
+ expectingSpecificProblemFor(pathToAB, new Problem("", "The method bar() is undefined for the type AB.R", pathToAB, 94, 97, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR));
+
+ /* Restore method AA.R.bar */
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA { \n"+
+ " protected class R {\n" +
+ " void bar() { }\n"+
+ "}}");
+
+ incrementalBuild(projectPath);
+ expectingNoProblems();
+ }
+
+ /*
+ * The body of a tsuper role is modified.
+ */
+ public void testModifyTSuperRole2() throws Exception {
+ System.out.println("***** testModifyTSuperRole2() *****");
+ IPath projectPath = env.addProject("Project");
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+ env.addExternalJar(projectPath, OTRE_JAR_PATH);
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA { \n"+
+ " protected class R {\n" +
+ " String bar() { return \"NOK\"; }\n"+
+ "}}");
+
+ env.addClass(root, "p", "AB",
+ "package p; \n"+
+ "public team class AB extends AA {\n"+
+ " protected class R {\n"+
+ " protected String foo() { return this.bar(); }\n"+
+ " }\n"+
+ " public static String test() {\n"+
+ " return new AB().new R().foo();\n"+
+ " }\n"+
+ "}");
+
+
+ fullBuild(projectPath);
+ expectingNoProblems();
+
+ /* Change method R.bar() */
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA {\n" +
+ " protected class R {\n" +
+ " String bar() { return \"OK\"; }\n"+
+ "}}");
+
+ /* build must achieve that AB - although unchanged - behaves differently. */
+ incrementalBuild(projectPath);
+ expectingNoProblems();
+
+ IJavaProject project = JavaCore.create(env.getProject("Project"));
+ OTLaunchEnvironment launcher = new OTLaunchEnvironment(
+ env.getWorkspaceRootPath(),
+ project.getOutputLocation());
+ Object result = launcher.launch("p.AB", "test");
+ assertEquals("OK", result);
+ // cleanup:
+ launcher = null;
+ result = null;
+ System.gc();
+ }
+
+ /*
+ * The body of a tsuper role is modified -- three levels.
+ */
+ public void testModifyTSuperRole3() throws Exception {
+ System.out.println("***** testModifyTSuperRole3() *****");
+ IPath projectPath = env.addProject("Project");
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+ env.addExternalJar(projectPath, OTRE_JAR_PATH);
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA { \n"+
+ " protected class R {\n" +
+ " String bar() { \n" +
+ " return \"NOK\";\n"+
+ " }\n"+
+ "}}");
+
+ env.addClass(root, "p", "AB",
+ "package p; \n"+
+ "public team class AB extends AA {}");
+
+ env.addClass(root, "p", "AC",
+ "package p; \n"+
+ "public team class AC extends AB {\n"+
+ " protected class R {\n"+
+ " protected String foo() { return this.bar(); }\n"+
+ " }\n"+
+ " public static String test() {\n"+
+ " return new AC().new R().foo();\n"+
+ " }\n"+
+ "}");
+
+
+ fullBuild(projectPath);
+ expectingNoProblems();
+
+ /* Change method R.bar() */
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA {\n" +
+ " protected class R {\n" +
+ " String bar() { return \"OK\"; }\n"+
+ "}}");
+
+ /* build must achieve that AB - although unchanged - behaves differently. */
+ incrementalBuild(projectPath);
+ expectingNoProblems();
+
+ IJavaProject project = JavaCore.create(env.getProject("Project"));
+ OTLaunchEnvironment launcher = new OTLaunchEnvironment(
+ env.getWorkspaceRootPath(),
+ project.getOutputLocation());
+ Object result = launcher.launch("p.AC", "test");
+ assertEquals("OK", result);
+// cleanup:
+ launcher = null;
+ result = null;
+ System.gc();
+ }
+
+ /** A playedBy declaration is added to a super role file.
+ * Witness for NPE in RoleModel.getBaseclassAttributename.
+ */
+ public void testModifySuperRole1() throws JavaModelException {
+ System.out.println("***** testModifySuperRole1() *****");
+ IPath projectPath = env.addProject("Project");
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+ env.addExternalJar(projectPath, OTRE_JAR_PATH);
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA { \n"+
+ "}");
+
+ env.addClass(root, "p/AA", "R1",
+ "team package p.AA;\n"+
+ "protected class R1 {\n"+
+ " void foo() { }\n"+
+ "}");
+
+ env.addClass(root, "p/AA", "R2",
+ "team package p.AA;\n"+
+ "protected class R2 extends R1 {\n"+
+ " void bar() { this.foo(); }\n"+
+ "}");
+
+ env.addClass(root, "p", "B",
+ "package p;\n"+
+ "public class B {\n"+
+ " void snafu() {}\n"+
+ "}");
+
+
+ fullBuild(projectPath);
+ expectingNoProblems();
+
+ /* add a playedBy declaration */
+ env.addClass(root, "p/AA", "R1",
+ "team package p.AA;\n"+
+ "protected class R1 playedBy B {\n"+
+ " void foo() { }\n"+
+ "}");
+
+ incrementalBuild(projectPath);
+ expectingNoProblems();
+ }
+
+ /**
+ * A sibling role is modified causing a binary role to fail generating callins.
+ */
+ public void testModifySiblingRole1() throws JavaModelException {
+ System.out.println("***** testModifySiblingRole1() *****");
+ IPath projectPath = env.addProject("Project");
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+ env.addExternalJar(projectPath, OTRE_JAR_PATH);
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ env.addClass(root, "p", "B",
+ "package p;\n"+
+ "public class B {\n"+
+ " void snafu() {}\n"+
+ "}");
+
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA { \n"+
+ "}");
+
+ env.addClass(root, "p/AA", "R1",
+ "team package p.AA;\n"+
+ "protected class R1 playedBy B {\n"+
+ " protected void foo() { }\n"+
+ " foo <- after snafu;\n"+
+ "}");
+
+ env.addClass(root, "p/AA", "R2",
+ "team package p.AA;\n"+
+ "protected class R2 {\n"+
+ " void bar() { new R1(new B()).foo(); }\n"+
+ "}");
+
+
+
+ fullBuild(projectPath);
+ expectingNoProblems();
+
+ /* change the method */
+ env.addClass(root, "p/AA", "R2",
+ "team package p.AA;\n"+
+ "protected class R2 {\n"+
+ " void bar() { }\n"+
+ "}");
+
+ incrementalBuild(projectPath);
+ expectingNoProblems();
+ }
+
+ /*
+ * The team with a role file is modified
+ */
+ public void testModifyTeam1() throws Exception {
+ System.out.println("***** testModifyTeam1() *****");
+ IPath projectPath = env.addProject("Project", "1.5");
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+ env.addExternalJar(projectPath, OTRE_JAR_PATH);
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ env.addClass(root, "p", "B",
+ "package p; \n"+
+ "public class B { \n"+
+ " String bar() { return \"NOK\"; }\n"+
+ "}");
+
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA { \n"+
+ " public static String test() {\n"+
+ " new AA();\n"+
+ " return new B().bar();\n"+
+ " }\n"+
+ "}");
+
+ env.addClass(root, "p.AA", "R",
+ "team package p.AA; \n"+
+ "protected class R playedBy B {\n"+
+ " @SuppressWarnings(\"basecall\")\n"+
+ " callin String foo() { return \"OK\"; }\n"+
+ " foo <- replace bar;\n"+
+ "}");
+
+
+ fullBuild(projectPath);
+ expectingNoProblems();
+
+ /* add constructor */
+
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA { \n"+
+ " public AA() { this.activate(); }\n"+
+ " public static String test() {\n"+
+ " new AA();\n"+
+ " return new B().bar();\n"+
+ " }\n"+
+ "}");
+
+ /* build must achieve that R - although unchanged - is compiled into AA. */
+ incrementalBuild(projectPath);
+ expectingNoProblems();
+
+ IJavaProject project = JavaCore.create(env.getProject("Project"));
+ OTLaunchEnvironment launcher = new OTLaunchEnvironment(
+ env.getWorkspaceRootPath(),
+ project.getOutputLocation(),
+ true /* useTransformer */);
+ Object result = launcher.launch("p.AA", "test");
+ assertEquals("OK", result);
+ // cleanup:
+ launcher = null;
+ result = null;
+ System.gc();
+ }
+
+ public void testAddRoFiToCompiledTeam()
+ throws JavaModelException
+ {
+ System.out.println("***** testAddRoFiToCompiledTeam() *****");
+ IPath projectPath = env.addProject("Project");
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+ env.addExternalJar(projectPath, OTRE_JAR_PATH);
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA { \n"+
+ " protected class R {\n" +
+ " String bar() { \n" +
+ " return \"NOK\";\n"+
+ " }\n"+
+ "}}");
+
+ fullBuild(projectPath);
+ expectingNoProblems();
+
+ env.addClass(root, "p/AA", "ExtRole",
+ "team package p.AA; \n"+
+ "public class ExtRole { \n"+
+ " public String ok() { \n" +
+ " return \"NOK\";\n"+
+ " }\n"+
+ "}");
+
+ /* build must achieve that AA - although unchanged - is recompiled. */
+ incrementalBuild(projectPath);
+ expectingNoProblems();
+
+ // same as above, just modify the contents:
+ IPath packagePath = root.append("p/AA");
+ env.addClass(packagePath, "ExtRole",
+ "team package p.AA; \n"+
+ "public class ExtRole { \n"+
+ " public String ok() { \n" +
+ " return \"OK\";\n"+
+ " }\n"+
+ "}");
+
+ /* build must(?) achieve that AA - although unchanged - is recompiled. */
+ incrementalBuild(projectPath);
+ expectingNoProblems();
+ }
+
+ public void testAddRoFiToBrokenTeam()
+ throws JavaModelException
+ {
+ System.out.println("***** testAddRoFiToBrokenTeam() *****");
+ IPath projectPath = env.addProject("Project");
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+ env.addExternalJar(projectPath, OTRE_JAR_PATH);
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ // a broken team:
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA { \n"+
+ " int abstract foo;// syntax error\n"+
+ "}");
+
+ fullBuild(projectPath);
+ expectingProblemsFor(root);
+
+ // add a role file:
+ env.addClass(root, "p/AA", "ExtRole",
+ "team package p.AA; \n"+
+ "public class ExtRole { \n"+
+ " public String ok() { \n" +
+ " return \"NOK\";\n"+
+ " }\n"+
+ "}");
+
+ /* build must achieve that errors in AA are detected again. */
+ incrementalBuild(projectPath);
+ expectingProblemsFor(root);
+
+ /* also break role file: */
+ IPath rofi = env.addClass(root, "p/AA", "ExtRole",
+ "team package p.AA; \n"+
+ "public class ExtRole { \n"+
+ " public String ok { // error \n" +
+ " return \"NOK\";\n"+
+ " }\n"+
+ "}");
+
+ /* now everything is broken. */
+ incrementalBuild(projectPath);
+ expectingProblemsFor(root);
+
+ // correct the syntax error:
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA { \n"+
+ " int foo() { return 0; }\n"+
+ "}");
+
+ /* build must detect that ExtRole still has an error. */
+ incrementalBuild(projectPath);
+ expectingProblemsFor(rofi);
+ }
+
+ public void testBreakTeamWithRoFi()
+ throws JavaModelException
+ {
+ System.out.println("***** testBreakTeamWithRoFi() *****");
+ IPath projectPath = env.addProject("Project");
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+ env.addExternalJar(projectPath, OTRE_JAR_PATH);
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ // team and role w/o errors:
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA { \n"+
+ " public void nop() { } \n" +
+ "}");
+
+ env.addClass(root, "p/AA", "ExtRole",
+ "team package p.AA; \n"+
+ "public class ExtRole { \n"+
+ " public String ok() { \n" +
+ " return \"OK\";\n"+
+ " }\n"+
+ "}");
+
+ fullBuild(projectPath);
+ expectingNoProblems();
+
+ // introduce an error to the team:
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA { \n"+
+ " int abstract nop();\n"+
+ "}");
+
+ /* build must achieve that AA - although unchanged - is recompiled. */
+ incrementalBuild(projectPath);
+ expectingProblemsFor(root);
+
+ }
+
+ public void testRoFiExtendsInline()
+ throws JavaModelException
+ {
+ System.out.println("***** testRoFiExtendsInline() *****");
+ IPath projectPath = env.addProject("Project");
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+ env.addExternalJar(projectPath, OTRE_JAR_PATH);
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA { \n"+
+ " protected team class R {\n" +
+ " String bar() { \n" +
+ " return \"NOK\";\n"+
+ " }\n"+
+ "}}");
+ // Note: declaring R as a nested team requires to process the predifined roles,
+ // which caused a StackOverflowError previously.
+
+ fullBuild(projectPath);
+ expectingNoProblems();
+
+ env.addClass(root, "p/AA", "ExtRole",
+ "team package p.AA; \n"+
+ "public team class ExtRole extends R {\n"+
+ " public String ok() { \n" +
+ " return bar();\n"+
+ " }\n"+
+ "}");
+
+ // still OK.
+ incrementalBuild(projectPath);
+ expectingNoProblems();
+
+ // same as above, just modify the contents:
+ env.addClass(root, "p", "AA",
+ "package p; \n"+
+ "public team class AA { \n"+
+ " protected team class R {\n" +
+ " String bar() { \n" +
+ " return \"OK\";\n"+
+ " }\n"+
+ "}}");
+
+ // no reason why this should find problems.
+ incrementalBuild(projectPath);
+ expectingNoProblems();
+ }
+ // see http://trac.objectteams.org/ot/ticket/89
+ public void testRemoveBoundBaseMethod()
+ throws JavaModelException
+ {
+ System.out.println("***** testRemoveBoundBaseMethod() *****");
+ IPath projectPath = env.addProject("Project", "1.5");
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+ env.addExternalJar(projectPath, OTRE_JAR_PATH);
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ env.addClass(root, "p0", "Base",
+ "package p0; \n"+
+ "public class Base { \n"+
+ " public void foo() {}\n"+
+ "}");
+ IPath pathToT1= env.addClass(root, "p", "T1",
+ "package p; \n"+
+ "import base p0.Base;\n"+
+ "public team class T1 { \n"+
+ " protected class R playedBy Base {\n" +
+ " void bar() { } \n" +
+ " bar <- after foo;\n"+
+ " }\n"+
+ "}");
+
+ fullBuild(projectPath);
+ expectingNoProblems();
+
+ // remove foo():
+ env.addClass(root, "p0", "Base",
+ "package p0; \n"+
+ "public class Base { \n"+
+ "}");
+
+ env.addClass(root, "p", "T2",
+ "package p; \n"+
+ "public team class T2 extends T1 {}");
+
+ // must detect, that callin binding in T1 is now invalid
+ incrementalBuild(projectPath);
+ expectingProblemsFor(pathToT1);
+ expectingSpecificProblemFor(pathToT1, new Problem("", "No method foo found in type p0.Base to resolve method designator (OTJLD 4.1(c)).", pathToT1, 137, 140, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR));
+
+ // restore:
+ env.addClass(root, "p0", "Base",
+ "package p0; \n"+
+ "public class Base { \n"+
+ " public void foo() {}\n"+
+ "}");
+ fullBuild(projectPath);
+ expectingNoProblems();
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTBuilderTests.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTBuilderTests.java
new file mode 100644
index 0000000..f1bb882
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTBuilderTests.java
@@ -0,0 +1,74 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id$
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.test.builder;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.tests.builder.BuilderTests;
+import org.eclipse.jdt.core.tests.builder.Problem;
+import org.eclipse.objectteams.otdt.internal.compiler.adaptor.BuildManager;
+import org.eclipse.objectteams.otdt.core.ext.OTDTPlugin;
+
+public class OTBuilderTests extends BuilderTests {
+
+ public static final String OT_RUNTIME_PATH;
+ public static final String OTRE_JAR_PATH;
+ static {
+ OT_RUNTIME_PATH = JavaCore.getClasspathVariable(OTDTPlugin.OTDT_INSTALLDIR).toOSString();
+ OTRE_JAR_PATH = OT_RUNTIME_PATH
+ + File.separator
+ + "lib" //$NON-NLS-1$
+ + File.separator
+ + "otre.jar"; //$NON-NLS-1$
+ }
+
+ public OTBuilderTests(String name) {
+ super(name);
+ }
+
+ /** Sets up this test.
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ env = new OTTestingEnvironment();
+ env.openEmptyWorkspace();
+ env.resetWorkspace();
+
+ BuildManager.DEBUG = 2;
+ }
+
+ /** Verifies that the given element has problems.
+ * Old implementation from BuilderTests
+ */
+ protected void expectingProblemsFor(IPath expected) {
+ if (DEBUG)
+ printProblemsFor(expected);
+
+ /* get the leaf problems for this type */
+ Problem[] problems = env.getProblemsFor(expected);
+ assertTrue("missing expected problem with " + expected.toString(), problems.length > 0); //$NON-NLS-1$
+ }
+
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTEquinoxBuilderTests.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTEquinoxBuilderTests.java
new file mode 100644
index 0000000..6d8f3b9
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTEquinoxBuilderTests.java
@@ -0,0 +1,380 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id$
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.test.builder;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import junit.framework.Test;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.compiler.CategorizedProblem;
+import org.eclipse.jdt.core.tests.builder.Problem;
+import org.eclipse.jdt.internal.core.JavaCorePreferenceInitializer;
+import org.eclipse.jdt.internal.core.JavaModelManager;
+import org.eclipse.objectteams.otdt.tests.FileBasedTest;
+
+@SuppressWarnings({ "nls", "restriction" })
+public class OTEquinoxBuilderTests extends OTBuilderTests {
+
+ MyFileBasedTest fileManager= new MyFileBasedTest("delegate");
+ class MyFileBasedTest extends FileBasedTest {
+ public MyFileBasedTest(String name) {
+ super(name);
+ }
+ @Override
+ protected String getPluginID() {
+ return "org.eclipse.objectteams.otdt.test.builder";
+ }
+ @Override // make available locally:
+ protected IJavaProject setUpJavaProject(String projectName) throws CoreException, IOException
+ {
+ return super.setUpJavaProject(projectName);
+ }
+ protected void replaceWorkspaceFile(String src, IJavaProject project, String dest)
+ throws IOException, CoreException
+ {
+ File srcFile = new File(getPluginDirectoryPath()+File.separator+"workspace"+File.separator+src);
+ IFile destFile= project.getProject().getFile(dest);
+ destFile.setContents(new FileInputStream(srcFile), true, false, null);
+ }
+ };
+
+// static {
+// TESTS_NAMES = new String[] { "testBaseImportTrac304"};
+// }
+ public OTEquinoxBuilderTests(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ if (true) {
+ return buildTestSuite(OTEquinoxBuilderTests.class);
+ }
+ return new OTEquinoxBuilderTests("testBaseImportTwoAspectBindings");
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ env.setAutoBuilding(false);
+
+ DEBUG = true;
+
+ }
+
+ IProject reopenProject(String projectName) throws CoreException {
+ final IProject project = fileManager.getWorkspaceRoot().getProject(projectName);
+ IWorkspaceRunnable populate = new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ //project.create(null);
+ project.open(null);
+ }
+ };
+ fileManager.getWorkspace().run(populate, null);
+ env.addProject(project);
+ return project;
+ }
+
+ public void testForcedExports() throws CoreException, IOException {
+ IJavaProject trac18b= fileManager.setUpJavaProject("Trac18b");
+ env.addProject(trac18b.getProject());
+ IJavaProject trac18a= fileManager.setUpJavaProject("Trac18a");
+ env.addProject(trac18a.getProject());
+ fullBuild();
+ expectingNoProblemsFor(trac18b.getPath());
+ expectingOnlySpecificProblemsFor(trac18a.getPath(), new Problem[] {
+ getDecapsulationProblem(trac18a, "trac18b.actions.SampleAction", "trac18a/Team18.java", 42, 70), // import
+ getDecapsulationProblem(trac18a, "trac18b.actions.SampleAction", "trac18a/Team18.java", 199, 211), // playedBy
+ });
+ // after success now break it:
+ fileManager.replaceWorkspaceFile("Trac18a2/plugin.xml", trac18a, "plugin.xml");
+ incrementalBuild();
+ expectingNoProblemsFor(trac18b.getPath());
+ expectAccessRestriction(trac18a, "src/trac18a/Team18.java", 42, 70);
+ }
+
+ public void testForcedExportsMissing() throws CoreException, IOException {
+ IJavaProject trac18b= fileManager.setUpJavaProject("Trac18b");
+ env.addProject(trac18b.getProject());
+ IJavaProject trac18a= fileManager.setUpJavaProject("Trac18a2");
+ env.addProject(trac18a.getProject());
+ fullBuild();
+ expectingNoProblemsFor(trac18b.getPath());
+ expectAccessRestriction(trac18a, "src/trac18a/Team18.java", 42, 70);
+ // fix the error
+ fileManager.replaceWorkspaceFile("Trac18a/plugin.xml", trac18a, "plugin.xml");
+ incrementalBuild();
+ expectingNoProblemsFor(trac18b.getPath());
+ expectingOnlySpecificProblemsFor(trac18a.getPath(), new Problem[] {
+ getDecapsulationProblem(trac18a, "trac18b.actions.SampleAction", "trac18a/Team18.java", 42, 70),
+ getDecapsulationProblem(trac18a, "trac18b.actions.SampleAction", "trac18a/Team18.java", 163, 175),
+ });
+ }
+
+ /* project Trac18a3 contains a base-ctor call and a callout binding,
+ * both referring to the force-exported base class.*/
+ public void testForcedExportsGeneratedMethodRefs() throws CoreException, IOException {
+ IJavaProject trac18b= fileManager.setUpJavaProject("Trac18b");
+ env.addProject(trac18b.getProject());
+ IJavaProject trac18a= fileManager.setUpJavaProject("Trac18a3");
+ env.addProject(trac18a.getProject());
+ fullBuild();
+ expectingNoProblemsFor(trac18b.getPath());
+ expectingOnlySpecificProblemsFor(trac18a.getPath(), new Problem[] {
+ getDecapsulationProblem(trac18a, "trac18b.actions.SampleAction", "trac18a/Team18.java", 42, 70),
+ getDecapsulationProblem(trac18a, "trac18b.actions.SampleAction", "trac18a/Team18.java", 163, 175),
+ getDecapsulationProblem(trac18a, "trac18b.actions.SampleAction", "trac18a/Team18.java", 201, 205) // location of the base-ctor call.
+ });
+ }
+ /* trying to produce a broken and bogus error message a la Trac #154 (no success yet). */
+ public void testForcedExportTrac154() throws CoreException, IOException {
+ IJavaProject trac154b1= fileManager.setUpJavaProject("Trac154b1");
+ env.addProject(trac154b1.getProject());
+ IJavaProject trac154b2= fileManager.setUpJavaProject("Trac154b2");
+ env.addProject(trac154b2.getProject());
+ IJavaProject trac154a= fileManager.setUpJavaProject("Trac154a");
+ env.addProject(trac154a.getProject());
+ fullBuild();
+ expectingNoProblemsFor(trac154b1.getPath());
+ expectingNoProblemsFor(trac154b2.getPath());
+ expectingOnlySpecificProblemsFor(trac154a.getPath(), new Problem[] {
+ getDecapsulationProblem(trac154a, "trac154b1.actions.SampleAction", "aspect/MyTeam.java", 29, 59),
+ getDecapsulationProblem(trac154a, "trac154b1.actions.SampleAction", "aspect/MyTeam.java", 118, 130)
+ });
+ }
+
+ public void testBaseImportNoAspectBinding () throws CoreException, IOException {
+ IJavaProject trac18b= fileManager.setUpJavaProject("Trac18b");
+ env.addProject(trac18b.getProject());
+ IJavaProject aspectPlugin= fileManager.setUpJavaProject("MissingAspectBinding");
+ aspectPlugin.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error");
+ env.addProject(aspectPlugin.getProject());
+ fullBuild();
+ expectingNoProblemsFor(trac18b.getPath());
+ expectingOnlySpecificProblemsFor(aspectPlugin.getPath(), new Problem[] {
+ new Problem("", "Illegal base import: no aspect binding declared for team MissingAspectBindingTeam (OT/Equinox).",
+ aspectPlugin.getPath().append(new Path("src/MissingAspectBindingTeam.java")),
+ 12, 34,
+ CategorizedProblem.CAT_CODE_STYLE, IMarker.SEVERITY_ERROR)
+ });
+ // now fix it:
+ fileManager.replaceWorkspaceFile("MissingAspectBinding/plugin-corrected.xml", aspectPlugin, "plugin.xml");
+ incrementalBuild();
+ expectingNoProblemsFor(trac18b.getPath());
+ expectingNoProblemsFor(aspectPlugin.getPath());
+ }
+
+ /* Two aspect bindings refer to the same team, which has base imports referring to two different base bundles. */
+ public void testBaseImportTwoAspectBindings () throws CoreException, IOException {
+ IJavaProject trac213b1= fileManager.setUpJavaProject("Trac213b1");
+ env.addProject(trac213b1.getProject());
+ IJavaProject trac213b2= fileManager.setUpJavaProject("Trac213b2");
+ env.addProject(trac213b2.getProject());
+ fullBuild();
+
+ // initially only an empty team
+ IJavaProject aspectPlugin= fileManager.setUpJavaProject("Trac213a");
+ aspectPlugin.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error");
+ env.addProject(aspectPlugin.getProject());
+ fullBuild();
+
+ // now add content to the team, binding to Trac213b1:
+ fileManager.replaceWorkspaceFile("Trac213a/aux/TheTeam_step1.java", aspectPlugin, "src/trac213a/TheTeam.java");
+
+ incrementalBuild();
+ expectingNoProblemsFor(trac213b1.getPath());
+ expectingNoProblemsFor(trac213b2.getPath());
+ expectingNoProblemsFor(aspectPlugin.getPath());
+
+ // now add content to the team, binding to Trac213b2:
+ fileManager.replaceWorkspaceFile("Trac213a/aux/plugin_step2.xml", aspectPlugin, "plugin.xml");
+ fileManager.replaceWorkspaceFile("Trac213a/aux/TheTeam_step2.java", aspectPlugin, "src/trac213a/TheTeam.java");
+
+ incrementalBuild();
+ expectingNoProblemsFor(trac213b1.getPath());
+ expectingNoProblemsFor(trac213b2.getPath());
+ expectingNoProblemsFor(aspectPlugin.getPath());
+ }
+
+ public void testWrongBaseImport1() throws CoreException, IOException {
+ IJavaProject trac18b= fileManager.setUpJavaProject("Trac18b");
+ env.addProject(trac18b.getProject());
+ IJavaProject aspectPlugin= fileManager.setUpJavaProject("WrongBaseImport1");
+ aspectPlugin.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error");
+ env.addProject(aspectPlugin.getProject());
+ fullBuild();
+ expectingNoProblemsFor(trac18b.getPath());
+ expectingOnlySpecificProblemsFor(aspectPlugin.getPath(), new Problem[] {
+ new Problem("", "Illegal base import: this package is not provided by the declared base plug-in(s) Trac18b (OT/Equinox).",
+ aspectPlugin.getPath().append(new Path("src/WrongBaseImportTeam1.java")),
+ 12, 55,
+ CategorizedProblem.CAT_CODE_STYLE, IMarker.SEVERITY_ERROR)
+ });
+ }
+
+ public void testWrongBaseImport2() throws CoreException, IOException {
+ IJavaProject trac18b= fileManager.setUpJavaProject("Trac18b");
+ env.addProject(trac18b.getProject());
+ IJavaProject aspectPlugin= fileManager.setUpJavaProject("WrongBaseImport2");
+ aspectPlugin.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error");
+ env.addProject(aspectPlugin.getProject());
+ fullBuild();
+ expectingNoProblemsFor(trac18b.getPath());
+ expectingOnlySpecificProblemsFor(aspectPlugin.getPath(), new Problem[] {
+ new Problem("", "Illegal base import: this package is not provided by the declared base plug-in org.eclipse.objectteams.otequinox but by plug-in Trac18b (OT/Equinox).",
+ aspectPlugin.getPath().append(new Path("src/WrongBaseImportTeam2.java")),
+ 12, 34,
+ CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)
+ });
+ }
+
+ public void testBaseImportTrac132 () throws CoreException, IOException {
+ IJavaProject trac132b= fileManager.setUpJavaProject("Trac132b");
+ env.addProject(trac132b.getProject());
+ IJavaProject aspectPlugin1= fileManager.setUpJavaProject("Trac132a1");
+ aspectPlugin1.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error");
+ env.addProject(aspectPlugin1.getProject());
+ IJavaProject aspectPlugin2= fileManager.setUpJavaProject("Trac132a2");
+ aspectPlugin2.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error");
+ env.addProject(aspectPlugin2.getProject());
+ fullBuild();
+ expectingNoProblemsFor(trac132b.getPath());
+ expectingNoProblemsFor(aspectPlugin1.getPath());
+ expectingNoProblemsFor(aspectPlugin2.getPath());
+ }
+
+ public void testBaseImportTrac304 () throws CoreException, IOException {
+ IJavaProject trac304b= fileManager.setUpJavaProject("Trac304b");
+ env.addProject(trac304b.getProject());
+ // the fragment:
+ IJavaProject trac304f= fileManager.setUpJavaProject("Trac304f");
+ env.addProject(trac304f.getProject());
+ IJavaProject trac304ot= fileManager.setUpJavaProject("Trac304ot");
+ trac304ot.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error");
+ env.addProject(trac304ot.getProject());
+ fullBuild();
+ expectingNoProblemsFor(trac304b.getPath());
+ expectingNoProblemsFor(trac304ot.getPath());
+ }
+
+ public void testIllegalUseOfForcedExport() throws CoreException, IOException {
+ IJavaProject trac18b= fileManager.setUpJavaProject("Trac18b");
+ env.addProject(trac18b.getProject());
+ IJavaProject aspectPlugin= fileManager.setUpJavaProject("IllegalUseOfForcedExport");
+ aspectPlugin.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error");
+ env.addProject(aspectPlugin.getProject());
+ fullBuild();
+ expectingNoProblemsFor(trac18b.getPath());
+ expectingOnlySpecificProblemsFor(aspectPlugin.getPath(),
+ new Problem[] {
+ getIllegalUseOfForcedExportProblem(aspectPlugin, "trac18b.actions.SampleAction", 88, 100),
+ getIllegalUseOfForcedExportProblem(aspectPlugin, "trac18b.actions.SampleAction", 7, 35)});
+ }
+
+ public void testAccumulatedBases1() throws CoreException, IOException {
+ IJavaProject project= fileManager.setUpJavaProject("AccumulatedBases");
+ project.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error");
+ env.addProject(project.getProject());
+ fullBuild();
+ expectingNoProblemsFor(project.getPath());
+ fileManager.replaceWorkspaceFile("AccumulatedBases/versions/Team1.java.1", project, "src/accumulatedbases/Team1.java");
+ incrementalBuild();
+ expectingNoProblemsFor(project.getPath());
+ }
+
+ // NOTE: run this as the last test here, because I haven't figured out how to
+ // clean up after the simulated workbench restart.
+ public void testBaseImportTrac132_2 () throws CoreException, IOException {
+ IJavaProject trac132b= fileManager.setUpJavaProject("Trac132b");
+ env.addProject(trac132b.getProject());
+ IJavaProject aspectPlugin1= fileManager.setUpJavaProject("Trac132a1");
+ aspectPlugin1.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error");
+ env.addProject(aspectPlugin1.getProject());
+ IJavaProject aspectPlugin2= fileManager.setUpJavaProject("Trac132a2");
+ aspectPlugin2.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error");
+ env.addProject(aspectPlugin2.getProject());
+ fullBuild();
+ expectingNoProblemsFor(trac132b.getPath());
+ expectingNoProblemsFor(aspectPlugin1.getPath());
+ expectingNoProblemsFor(aspectPlugin2.getPath());
+
+ // not needed.
+// JavaModelManager.getJavaModelManager().removePerProjectInfo((JavaProject) trac132b);
+// JavaModelManager.getJavaModelManager().removePerProjectInfo((JavaProject) aspectPlugin1);
+// JavaModelManager.getJavaModelManager().removePerProjectInfo((JavaProject) aspectPlugin2);
+
+ // doesn't work see :
+ //ResourcesPlugin.getPlugin().getBundle().stop();
+ //ResourcesPlugin.getPlugin().getBundle().start();
+
+ // simulate shutdown (from AbstractJavaModelTests.simulateExitRestart:
+ env.getWorkspace().save(true, null);
+ JavaModelManager.getJavaModelManager().shutdown();
+ JavaModelManager.doNotUse(); // reset the MANAGER singleton
+ JavaModelManager.getJavaModelManager().startup();
+ new JavaCorePreferenceInitializer().initializeDefaultPreferences();
+
+
+ env.openEmptyWorkspace();
+ env.setAutoBuilding(true);
+
+ trac132b= JavaCore.create(reopenProject("Trac132b"));
+ aspectPlugin1= JavaCore.create(reopenProject("Trac132a1"));
+ aspectPlugin2= JavaCore.create(reopenProject("Trac132a2"));
+ env.addClass(new Path("/Trac132a2/src"), "Dummy", "public class Dummy {}"); // trigger minimal build
+ incrementalBuild();
+ expectingNoProblemsFor(trac132b.getPath());
+ expectingNoProblemsFor(aspectPlugin1.getPath());
+ expectingNoProblemsFor(aspectPlugin2.getPath());
+ }
+
+ // ---------------- HELPERS: ---------------------------
+ private Problem getDecapsulationProblem(IJavaProject project, String baseclassName, String teamPath, int start, int end) {
+ return new Problem("", "Decapsulating base class "+baseclassName+" by means of a forced export. Note, that additionally a corresponing declaration is needed in config.ini (OTJLD 2.1.2(c) + OT/Equinox).",
+ project.getPath().append(new Path("src/"+teamPath)),
+ start, end,
+ CategorizedProblem.CAT_RESTRICTION, IMarker.SEVERITY_WARNING);
+ }
+ private Problem getIllegalUseOfForcedExportProblem(IJavaProject project, String className, int start, int end) {
+ return new Problem("", "The forced-exported type "+className+" cannot be accessed other than as a role's base class (OT/Equinox).",
+ project.getPath().append(new Path("src/IllegalUseOfForcedExportTeam.java")),
+ start, end,
+ CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR);
+ }
+ private void expectAccessRestriction(IJavaProject project, String fileName, int start, int end) {
+ expectingSpecificProblemFor(project.getPath(),
+ new Problem("", "Access restriction: The type SampleAction is not accessible due to restriction on required project Trac18b",
+ project.getPath().append(new Path(fileName)),
+ start, end,
+ CategorizedProblem.CAT_RESTRICTION, IMarker.SEVERITY_ERROR)
+ );
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTLaunchEnvironment.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTLaunchEnvironment.java
new file mode 100644
index 0000000..ad2861a
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTLaunchEnvironment.java
@@ -0,0 +1,118 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id$
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.test.builder;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.objectteams.otdt.core.ext.OTREContainer;
+import org.eclipse.objectteams.otre.jplis.ObjectTeamsTransformer;
+
+/**
+ * Utility class for launching a program in a controlled environment.
+ * Disposing the application's object and the OTLaunchEnvironment
+ * should enable the JVM to also dispose all classes loaded in the process.
+ *
+ * @author stephan
+ * @version $Id: OTLaunchEnvironment.java 14220 2006-09-04 22:13:40Z stephan $
+ */
+public class OTLaunchEnvironment extends URLClassLoader
+{
+ ObjectTeamsTransformer transformer = null;
+ /** Where to look for class files. */
+ IPath bindir;
+ /**
+ * Setup a launch environment for the given paths.
+ * @param workspaceRoot path to the workspace root
+ * @param bindir absolute workspace path to the output location holding class files.
+ * @throws MalformedURLException if the OTRE_JAR_PATH is not a valid path.
+ */
+ OTLaunchEnvironment(IPath workspaceRoot, IPath bindir) throws MalformedURLException {
+ super(new URL[]{getOTREURL()});
+ this.bindir = workspaceRoot.append(bindir);
+ }
+ /**
+ * Same as above but supports the use of OTRE transformers, if `useTransformer == true'
+ */
+ OTLaunchEnvironment(IPath workspaceRoot, IPath bindir, boolean useTransformer)
+ throws MalformedURLException
+ {
+ this(workspaceRoot, bindir);
+ if (useTransformer)
+ this.transformer = new ObjectTeamsTransformer();
+ }
+
+ static URL getOTREURL() throws MalformedURLException {
+ IClasspathEntry[] entries = new OTREContainer().getClasspathEntries();
+ return new URL("file:"+entries[0].getPath()); //$NON-NLS-1$
+ }
+ @Override
+ protected Class<?> findClass(String name) throws ClassNotFoundException {
+ String fileName = name.replace('.', File.separatorChar)+".class"; //$NON-NLS-1$
+ File file = new File(bindir.append(fileName).toOSString());
+ if (file.exists()) {
+ try {
+ return defineClassFromFile(name, file);
+ } catch (Exception e) {
+ // we have a file but it was invalid, don't continue
+ throw new ClassNotFoundException(name);
+ }
+ }
+ // this will use the URL pointing to the OTRE:
+ return super.findClass(name);
+ }
+
+ /* We found an existing file, load its bytes and define the class. */
+ private Class<?> defineClassFromFile(String name, File file)
+ throws Exception
+ {
+ FileInputStream fis = new FileInputStream(file);
+ byte[] bytes = new byte[(int) file.length()];
+ fis.read(bytes);
+ if (transformer != null)
+ bytes = transformer.transform(this, name, null, null, bytes);
+ return defineClass(name, bytes, 0, bytes.length);
+ }
+
+ /**
+ * Load class `className' and invoke its method `methodName'.
+ * The method must be static and without arguments.
+ *
+ * @param className
+ * @param methodName
+ * @return the methods return (possibly boxed).
+ *
+ * @throws Exception too many to list explicitly ;-)
+ */
+ public Object launch(String className, String methodName)
+ throws Exception
+ {
+ Class clazz = this.loadClass(className);
+ Method method = clazz.getMethod(methodName, new Class[0]);
+ return method.invoke(null, new Object[0]);
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTTestingEnvironment.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTTestingEnvironment.java
new file mode 100644
index 0000000..fdb86e4
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTTestingEnvironment.java
@@ -0,0 +1,42 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id$
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.test.builder;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.tests.builder.TestingEnvironment;
+
+public class OTTestingEnvironment extends TestingEnvironment {
+
+ @Override // in order to set OT nature: // FIXME: request jdt.method to become protected or use a role for overriding
+ protected void addBuilderSpecs(String projectName) {
+ try {
+ IProject project = getProject(projectName);
+ IProjectDescription description = project.getDescription();
+ description.setNatureIds(new String[] { JavaCore.NATURE_ID, JavaCore.OTJ_NATURE_ID });
+ project.setDescription(description, null);
+ } catch (CoreException e) {
+ handleCoreException(e);
+ }
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/test.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/test.xml
new file mode 100644
index 0000000..ce5ba19
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/test.xml
@@ -0,0 +1,65 @@
+<project name="testsuite" default="run" basedir=".">
+
+ <property name="otdt-tests-workspace" value="${test.eclipseDir}/otdt-tests-workspace"/>
+
+ <!-- library.xml need these properties-->
+ <property name="eclipse-home" value="${test.eclipseDir}"/>
+ <property name="test.target" value="performance"/>
+
+ <!-- sets the properties eclipseTest-home, and library-file -->
+ <property name="plugin-name" value="org.eclipse.objectteams.otdt.test.builder"/>
+
+ <property name="library-file" value="${test.eclipseDir}/plugins/${org.eclipse.test}/library.xml"/>
+
+ <!-- This target holds all initialization code that needs to be done for -->
+ <!-- all tests that are to be run. Initialization for individual tests -->
+ <!-- should be done within the body of the suite target. -->
+ <target name="init">
+ <tstamp/>
+ <delete>
+ <fileset dir="${test.eclipseDir}" includes="org.eclipse.objectteams.otdt.test.builder.AllTests.xml,${plugin-name}.${file-id}.xml"/>
+ </delete>
+
+ </target>
+
+ <!-- This target defines the tests that need to be run. -->
+ <target name="suite">
+
+ <!-- OTDT Non UI tests -->
+ <property name="otdt-builder-folder"
+ value="${otdt-tests-workspace}/otdt-builder-folder"/>
+ <delete dir="${otdt-nonUI-folder}" quiet="true"/>
+
+ <ant target="core-test" antfile="${library-file}" dir="${test.eclipseDir}">
+ <property name="data-dir" value="${otdt-builder-folder}"/>
+ <property name="plugin-name" value="${plugin-name}"/>
+ <property name="classname" value="org.eclipse.objectteams.otdt.test.builder.AllTests"/>
+ </ant>
+
+ </target>
+
+ <target name="checkOS">
+ <condition property="os.isWindows">
+ <os family="windows"/>
+ </condition>
+ </target>
+
+ <!-- This target holds code to cleanup the testing environment after -->
+ <!-- after all of the tests have been run. You can use this target to -->
+ <!-- delete temporary files that have been created. -->
+ <target name="cleanup">
+
+ </target>
+
+ <!-- This target runs the test suite. Any actions that need to happen -->
+ <!-- after all the tests have been run should go here. -->
+ <target name="run" depends="init,suite,cleanup">
+<!--
+ <ant target="collect" antfile="${library-file}" dir="${test.eclipseDir}">
+ <property name="includes" value="org.eclipse.objectteams.otdt.test.builder.AllTests.xml"/>
+ <property name="output-file" value="${plugin-name}.${file-id}.xml"/>
+ </ant>
+-->
+ </target>
+
+</project>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/.classpath
new file mode 100644
index 0000000..cee6929
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="OTRE"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/.project
new file mode 100644
index 0000000..1df9d7c
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/.project
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>AccumulatedBases</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.objectteams.otdt.builder.OTJBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.objectteams.otdt.OTJavaNature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/.settings/org.eclipse.jdt.core.prefs b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..9e5f077
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Sun Aug 03 18:01:18 CEST 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.objectteams.otdt.compiler.problem.binding_conventions=error
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..a45de4d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: AccumulatedBases Plug-in
+Bundle-SymbolicName: AccumulatedBases;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.debug.ui,
+ org.eclipse.objectteams.otequinox,
+ org.eclipse.jdt.debug.ui,
+ org.eclipse.jdt.junit
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/build.properties
new file mode 100644
index 0000000..e9863e2
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/plugin.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/plugin.xml
new file mode 100644
index 0000000..8edcf89
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/plugin.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.objectteams.otequinox.aspectBindings">
+ <aspectBinding
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+ <basePlugin
+ icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+ id="org.eclipse.debug.ui">
+ </basePlugin>
+ <team
+ class="accumulatedbases.Team1"
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+ </team>
+ </aspectBinding>
+ <aspectBinding
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+ <basePlugin
+ icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+ id="org.eclipse.jdt.debug.ui">
+ </basePlugin>
+ <team
+ class="accumulatedbases.Team2"
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif"
+ superclass="accumulatedbases.Team1">
+ </team>
+ </aspectBinding>
+ <aspectBinding
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+ <basePlugin
+ icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+ id="org.eclipse.jdt.junit">
+ </basePlugin>
+ <team
+ activation="ALL_THREADS"
+ class="accumulatedbases.Team3"
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif"
+ superclass="accumulatedbases.Team2">
+ </team>
+ </aspectBinding>
+ </extension>
+
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/src/accumulatedbases/Team1.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/src/accumulatedbases/Team1.java
new file mode 100644
index 0000000..e657aaa
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/src/accumulatedbases/Team1.java
@@ -0,0 +1,10 @@
+package accumulatedbases;
+
+import base org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+
+public team class Team1 {
+ protected class R1 playedBy AbstractLaunchConfigurationTabGroup {
+
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/src/accumulatedbases/Team2.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/src/accumulatedbases/Team2.java
new file mode 100644
index 0000000..f50ef08
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/src/accumulatedbases/Team2.java
@@ -0,0 +1,8 @@
+package accumulatedbases;
+
+import base org.eclipse.jdt.internal.debug.ui.launcher.LocalJavaApplicationTabGroup;
+
+@SuppressWarnings("restriction")
+public team class Team2 extends Team1 {
+ protected class R2 extends R1 playedBy LocalJavaApplicationTabGroup {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/src/accumulatedbases/Team3.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/src/accumulatedbases/Team3.java
new file mode 100644
index 0000000..fb98912
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/src/accumulatedbases/Team3.java
@@ -0,0 +1,9 @@
+package accumulatedbases;
+
+import base org.eclipse.jdt.internal.junit.launcher.JUnitTabGroup;
+
+
+@SuppressWarnings("restriction")
+public team class Team3 extends Team2 {
+ protected class R3 extends R1 playedBy JUnitTabGroup {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/versions/Team1.java.1 b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/versions/Team1.java.1
new file mode 100644
index 0000000..e1c4851
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AccumulatedBases/versions/Team1.java.1
@@ -0,0 +1,11 @@
+package accumulatedbases;
+
+import base org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+
+public team class Team1
+{
+ protected class R1 playedBy AbstractLaunchConfigurationTabGroup {
+
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/IllegalUseOfForcedExport/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/IllegalUseOfForcedExport/.classpath
new file mode 100644
index 0000000..b70b156
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/IllegalUseOfForcedExport/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="OTRE"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/IllegalUseOfForcedExport/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/IllegalUseOfForcedExport/.project
new file mode 100644
index 0000000..27f1f6a
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/IllegalUseOfForcedExport/.project
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>IllegalUseOfForcedExport</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.objectteams.otdt.builder.OTJBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.objectteams.otdt.OTJavaNature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/IllegalUseOfForcedExport/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/IllegalUseOfForcedExport/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..ae01de6
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/IllegalUseOfForcedExport/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Test Illegal Use Of ForcedExport Plug-in
+Bundle-SymbolicName: IllegalUseOfForcedExport; singleton:=true
+Bundle-Version: 1.0.0
+Require-Bundle: org.eclipse.objectteams.otequinox,
+ Trac18b
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/IllegalUseOfForcedExport/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/IllegalUseOfForcedExport/build.properties
new file mode 100644
index 0000000..2b0d95b
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/IllegalUseOfForcedExport/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/IllegalUseOfForcedExport/plugin.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/IllegalUseOfForcedExport/plugin.xml
new file mode 100644
index 0000000..641f08d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/IllegalUseOfForcedExport/plugin.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.objectteams.otequinox.aspectBindings">
+ <aspectBinding
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+ <basePlugin
+ icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+ id="Trac18b">
+ <forcedExports>
+ trac18b.actions
+ </forcedExports>
+ </basePlugin>
+ <team
+ activation="ALL_THREADS"
+ class="IllegalUseOfForcedExportTeam"
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+ </team>
+ </aspectBinding>
+ </extension>
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/IllegalUseOfForcedExport/src/IllegalUseOfForcedExportTeam.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/IllegalUseOfForcedExport/src/IllegalUseOfForcedExportTeam.java
new file mode 100644
index 0000000..8955968
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/IllegalUseOfForcedExport/src/IllegalUseOfForcedExportTeam.java
@@ -0,0 +1,5 @@
+import trac18b.actions.SampleAction;
+
+public team class IllegalUseOfForcedExportTeam {
+ SampleAction action;
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/MissingAspectBinding/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/MissingAspectBinding/.classpath
new file mode 100644
index 0000000..b70b156
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/MissingAspectBinding/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="OTRE"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/MissingAspectBinding/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/MissingAspectBinding/.project
new file mode 100644
index 0000000..ea12513
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/MissingAspectBinding/.project
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>MissingAspectBinding</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.objectteams.otdt.builder.OTJBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.objectteams.otdt.OTJavaNature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/MissingAspectBinding/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/MissingAspectBinding/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..7d974ed
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/MissingAspectBinding/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: TestNoAspectBinding Plug-in
+Bundle-SymbolicName: MissingAspectBinding; singleton:=true
+Bundle-Version: 1.0.0
+Require-Bundle: org.eclipse.objectteams.otequinox,
+ Trac18b
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/MissingAspectBinding/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/MissingAspectBinding/build.properties
new file mode 100644
index 0000000..2b0d95b
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/MissingAspectBinding/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/MissingAspectBinding/plugin-corrected.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/MissingAspectBinding/plugin-corrected.xml
new file mode 100644
index 0000000..04dafdf
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/MissingAspectBinding/plugin-corrected.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.objectteams.otequinox.aspectBindings">
+ <aspectBinding
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+ <basePlugin
+ icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+ id="Trac18b">
+ </basePlugin>
+ <team
+ activation="ALL_THREADS"
+ class="MissingAspectBindingTeam"
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+ </team>
+ </aspectBinding>
+ </extension>
+
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/MissingAspectBinding/plugin.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/MissingAspectBinding/plugin.xml
new file mode 100644
index 0000000..40a3556
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/MissingAspectBinding/plugin.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/MissingAspectBinding/src/MissingAspectBindingTeam.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/MissingAspectBinding/src/MissingAspectBindingTeam.java
new file mode 100644
index 0000000..81224ad
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/MissingAspectBinding/src/MissingAspectBindingTeam.java
@@ -0,0 +1,5 @@
+import base trac18b.api.PublicBase;
+
+public team class MissingAspectBindingTeam {
+ protected class R playedBy PublicBase {}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a1/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a1/.classpath
new file mode 100644
index 0000000..b70b156
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a1/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="OTRE"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a1/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a1/.project
new file mode 100644
index 0000000..377bf83
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a1/.project
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Trac132a1</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.objectteams.otdt.builder.OTJBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.objectteams.otdt.OTJavaNature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a1/.settings/org.eclipse.jdt.core.prefs b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a1/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..509e627
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a1/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,3 @@
+#Sat Nov 10 00:41:15 CET 2007
+eclipse.preferences.version=1
+org.eclipse.objectteams.otdt.compiler.problem.binding_conventions=error
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a1/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a1/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..9f1180c
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a1/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Trac132 Aspect 1 Plug-in
+Bundle-SymbolicName: Trac132a1; singleton:=true
+Bundle-Version: 1.0.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.objectteams.otequinox,
+ Trac132b
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a1/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a1/build.properties
new file mode 100644
index 0000000..0d3d3a7
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a1/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a1/plugin.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a1/plugin.xml
new file mode 100644
index 0000000..76e750f
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a1/plugin.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.objectteams.otequinox.aspectBindings">
+ <aspectBinding
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+ <basePlugin
+ icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+ id="Trac132b">
+ </basePlugin>
+ <team
+ activation="ALL_THREADS"
+ class="trac132a1.Team132_1"
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+ </team>
+ </aspectBinding>
+ </extension>
+
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a1/src/trac132a1/Team132_1.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a1/src/trac132a1/Team132_1.java
new file mode 100644
index 0000000..f71ad09
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a1/src/trac132a1/Team132_1.java
@@ -0,0 +1,14 @@
+package trac132a1;
+
+import base trac132b.actions.SampleAction;
+import base trac132b.api.PublicBase;
+
+@SuppressWarnings("restriction")
+public team class Team132_1 {
+ protected class Action playedBy SampleAction {
+
+ }
+ protected class RoleOfPublic playedBy PublicBase {
+
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a2/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a2/.classpath
new file mode 100644
index 0000000..b70b156
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a2/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="OTRE"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a2/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a2/.project
new file mode 100644
index 0000000..8ba3fce
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a2/.project
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Trac132a2</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.objectteams.otdt.builder.OTJBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.objectteams.otdt.OTJavaNature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a2/.settings/org.eclipse.jdt.core.prefs b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a2/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..509e627
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a2/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,3 @@
+#Sat Nov 10 00:41:15 CET 2007
+eclipse.preferences.version=1
+org.eclipse.objectteams.otdt.compiler.problem.binding_conventions=error
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a2/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a2/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..1bc8e3a
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a2/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Trac132 Aspect 2 Plug-in
+Bundle-SymbolicName: Trac132a2; singleton:=true
+Bundle-Version: 1.0.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.objectteams.otequinox,
+ Trac132b
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a2/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a2/build.properties
new file mode 100644
index 0000000..0d3d3a7
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a2/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a2/plugin.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a2/plugin.xml
new file mode 100644
index 0000000..51021b1
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a2/plugin.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.objectteams.otequinox.aspectBindings">
+ <aspectBinding
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+ <basePlugin
+ icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+ id="Trac132b">
+ </basePlugin>
+ <team
+ activation="ALL_THREADS"
+ class="trac132a2.Team132_2"
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+ </team>
+ </aspectBinding>
+ </extension>
+
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a2/src/trac132a2/Team132_2.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a2/src/trac132a2/Team132_2.java
new file mode 100644
index 0000000..611735d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132a2/src/trac132a2/Team132_2.java
@@ -0,0 +1,14 @@
+package trac132a2;
+
+import base trac132b.actions.SampleAction;
+import base trac132b.api.PublicBase;
+
+@SuppressWarnings("restriction")
+public team class Team132_2 {
+ protected class Action playedBy SampleAction {
+
+ }
+ protected class RoleOfPublic playedBy PublicBase {
+
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132b/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132b/.classpath
new file mode 100644
index 0000000..751c8f2
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132b/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132b/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132b/.project
new file mode 100644
index 0000000..ea3db2a
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132b/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Trac132b</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132b/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132b/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..ac53ef5
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132b/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Trac132 Base Plug-in
+Bundle-SymbolicName: Trac132b; singleton:=true
+Bundle-Version: 1.0.0
+Require-Bundle: org.eclipse.ui
+Export-Package: trac132b.api,
+ trac132b.actions;x-internal:=true
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132b/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132b/build.properties
new file mode 100644
index 0000000..0d3d3a7
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132b/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132b/plugin.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132b/plugin.xml
new file mode 100644
index 0000000..5910717
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132b/plugin.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.actionSets">
+ <actionSet
+ label="Sample Action Set"
+ visible="true"
+ id="Trac132b.actionSet">
+ <menu
+ label="Sample &Menu"
+ id="sampleMenu">
+ <separator
+ name="sampleGroup">
+ </separator>
+ </menu>
+ <action
+ label="&Sample Action"
+ icon="icons/sample.gif"
+ class="trac132b.actions.SampleAction"
+ tooltip="Hello, Eclipse world"
+ menubarPath="sampleMenu/sampleGroup"
+ toolbarPath="sampleGroup"
+ id="trac132b.actions.SampleAction">
+ </action>
+ </actionSet>
+ </extension>
+
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132b/src/trac132b/actions/SampleAction.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132b/src/trac132b/actions/SampleAction.java
new file mode 100644
index 0000000..0c1a7ca
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132b/src/trac132b/actions/SampleAction.java
@@ -0,0 +1,64 @@
+package trac132b.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.jface.dialogs.MessageDialog;
+
+/**
+ * Our sample action implements workbench action delegate.
+ * The action proxy will be created by the workbench and
+ * shown in the UI. When the user tries to use the action,
+ * this delegate will be created and execution will be
+ * delegated to it.
+ * @see IWorkbenchWindowActionDelegate
+ */
+public class SampleAction implements IWorkbenchWindowActionDelegate {
+ private IWorkbenchWindow window;
+ /**
+ * The constructor.
+ */
+ public SampleAction() {
+ }
+
+ /**
+ * The action has been activated. The argument of the
+ * method represents the 'real' action sitting
+ * in the workbench UI.
+ * @see IWorkbenchWindowActionDelegate#run
+ */
+ public void run(IAction action) {
+ MessageDialog.openInformation(
+ window.getShell(),
+ "Trac132b Plug-in",
+ "Hello, Eclipse world");
+ }
+
+ /**
+ * Selection in the workbench has been changed. We
+ * can change the state of the 'real' action here
+ * if we want, but this can only happen after
+ * the delegate has been created.
+ * @see IWorkbenchWindowActionDelegate#selectionChanged
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ /**
+ * We can use this method to dispose of any system
+ * resources we previously allocated.
+ * @see IWorkbenchWindowActionDelegate#dispose
+ */
+ public void dispose() {
+ }
+
+ /**
+ * We will cache window object in order to
+ * be able to provide parent shell for the message dialog.
+ * @see IWorkbenchWindowActionDelegate#init
+ */
+ public void init(IWorkbenchWindow window) {
+ this.window = window;
+ }
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132b/src/trac132b/api/PublicBase.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132b/src/trac132b/api/PublicBase.java
new file mode 100644
index 0000000..b193459
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac132b/src/trac132b/api/PublicBase.java
@@ -0,0 +1,5 @@
+package trac132b.api;
+
+public class PublicBase {
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154a/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154a/.classpath
new file mode 100644
index 0000000..c24f8de
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154a/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="OTRE"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154a/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154a/.project
new file mode 100644
index 0000000..3d731b8
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154a/.project
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Trac154a</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.objectteams.otdt.builder.OTJBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.objectteams.otdt.OTJavaNature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154a/.settings/org.eclipse.jdt.core.prefs b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154a/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..d742631
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154a/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon Oct 27 18:58:23 CET 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.objectteams.otdt.compiler.problem.binding_conventions=error
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154a/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154a/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..bf7729a
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154a/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Trac154 aspect Plug-in
+Bundle-SymbolicName: Trac154a;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: Trac154b1;bundle-version="1.0.0",
+ org.eclipse.objectteams.otequinox,
+ org.eclipse.ui
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154a/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154a/build.properties
new file mode 100644
index 0000000..e9863e2
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154a/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154a/plugin.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154a/plugin.xml
new file mode 100644
index 0000000..d73e081
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154a/plugin.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.objectteams.otequinox.aspectBindings">
+ <aspectBinding
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+ <basePlugin
+ icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+ id="Trac154b1">
+ <forcedExports>
+ trac154b1.actions
+ </forcedExports>
+ </basePlugin>
+ <team
+ class="aspect.MyTeam"
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+ </team>
+ </aspectBinding>
+ </extension>
+
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154a/src/aspect/MyTeam.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154a/src/aspect/MyTeam.java
new file mode 100644
index 0000000..7bf9efe
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154a/src/aspect/MyTeam.java
@@ -0,0 +1,9 @@
+package aspect;
+
+import base trac154b1.actions.SampleAction;
+
+public team class MyTeam {
+
+ protected class R playedBy SampleAction {}
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/.classpath
new file mode 100644
index 0000000..ad32c83
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/.project
new file mode 100644
index 0000000..a59d0d8
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Trac154b1</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/.settings/org.eclipse.jdt.core.prefs b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..98b75e0
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Mon Oct 27 18:55:23 CET 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..1296dad
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Trac154 base Plug-in 1
+Bundle-SymbolicName: Trac154b1; singleton:=true
+Bundle-Version: 1.0.0
+Require-Bundle: org.eclipse.ui
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Export-Package: trac154b1.actions
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/build.properties
new file mode 100644
index 0000000..0d3d3a7
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/icons/sample.gif b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/icons/sample.gif
new file mode 100644
index 0000000..34fb3c9
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/icons/sample.gif
Binary files differ
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/plugin.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/plugin.xml
new file mode 100644
index 0000000..b45bc2d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/plugin.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.actionSets">
+ <actionSet
+ label="Sample Action Set"
+ visible="true"
+ id="Trac154b1.actionSet">
+ <menu
+ label="Sample &Menu"
+ id="sampleMenu">
+ <separator
+ name="sampleGroup">
+ </separator>
+ </menu>
+ <action
+ label="&Sample Action"
+ icon="icons/sample.gif"
+ class="trac154b1.actions.SampleAction"
+ tooltip="Hello, Eclipse world"
+ menubarPath="sampleMenu/sampleGroup"
+ toolbarPath="sampleGroup"
+ id="trac154b1.actions.SampleAction">
+ </action>
+ </actionSet>
+ </extension>
+
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/src/trac154b1/actions/SampleAction.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/src/trac154b1/actions/SampleAction.java
new file mode 100644
index 0000000..fd6ec4f
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b1/src/trac154b1/actions/SampleAction.java
@@ -0,0 +1,64 @@
+package trac154b1.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.jface.dialogs.MessageDialog;
+
+/**
+ * Our sample action implements workbench action delegate.
+ * The action proxy will be created by the workbench and
+ * shown in the UI. When the user tries to use the action,
+ * this delegate will be created and execution will be
+ * delegated to it.
+ * @see IWorkbenchWindowActionDelegate
+ */
+public class SampleAction implements IWorkbenchWindowActionDelegate {
+ private IWorkbenchWindow window;
+ /**
+ * The constructor.
+ */
+ public SampleAction() {
+ }
+
+ /**
+ * The action has been activated. The argument of the
+ * method represents the 'real' action sitting
+ * in the workbench UI.
+ * @see IWorkbenchWindowActionDelegate#run
+ */
+ public void run(IAction action) {
+ MessageDialog.openInformation(
+ window.getShell(),
+ "Trac154 base Plug-in 1",
+ "Hello, Eclipse world");
+ }
+
+ /**
+ * Selection in the workbench has been changed. We
+ * can change the state of the 'real' action here
+ * if we want, but this can only happen after
+ * the delegate has been created.
+ * @see IWorkbenchWindowActionDelegate#selectionChanged
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ /**
+ * We can use this method to dispose of any system
+ * resources we previously allocated.
+ * @see IWorkbenchWindowActionDelegate#dispose
+ */
+ public void dispose() {
+ }
+
+ /**
+ * We will cache window object in order to
+ * be able to provide parent shell for the message dialog.
+ * @see IWorkbenchWindowActionDelegate#init
+ */
+ public void init(IWorkbenchWindow window) {
+ this.window = window;
+ }
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b2/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b2/.classpath
new file mode 100644
index 0000000..ad32c83
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b2/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b2/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b2/.project
new file mode 100644
index 0000000..b02f3cf
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b2/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Trac154b2</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b2/.settings/org.eclipse.jdt.core.prefs b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b2/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..b727278
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b2/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Mon Oct 27 18:56:07 CET 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b2/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b2/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..bf7740a
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b2/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Trac154 base Plug-in 2
+Bundle-SymbolicName: Trac154b2
+Bundle-Version: 1.0.0
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: Trac154b1;bundle-version="1.0.0",
+ org.eclipse.ui
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b2/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b2/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b2/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b2/src/internal/SubClass.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b2/src/internal/SubClass.java
new file mode 100644
index 0000000..a3c4597
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac154b2/src/internal/SubClass.java
@@ -0,0 +1,7 @@
+package internal;
+
+import trac154b1.actions.SampleAction;
+
+public class SubClass extends SampleAction {
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/.classpath
new file mode 100644
index 0000000..b70b156
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="OTRE"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/.project
new file mode 100644
index 0000000..722dc22
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/.project
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Trac18a</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.objectteams.otdt.builder.OTJBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.objectteams.otdt.OTJavaNature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/.settings/org.eclipse.jdt.core.prefs b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..509e627
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,3 @@
+#Sat Nov 10 00:41:15 CET 2007
+eclipse.preferences.version=1
+org.eclipse.objectteams.otdt.compiler.problem.binding_conventions=error
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..5d5f795
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Trac18a Plug-in
+Bundle-SymbolicName: Trac18a; singleton:=true
+Bundle-Version: 1.0.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.objectteams.otequinox,
+ Trac18b
+Bundle-ActivationPolicy: lazy
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/build.properties
new file mode 100644
index 0000000..0d3d3a7
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/plugin.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/plugin.xml
new file mode 100644
index 0000000..3329dbe
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/plugin.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.actionSets">
+ <actionSet
+ label="Sample Action Set"
+ visible="true"
+ id="Trac18a.actionSet">
+ <menu
+ label="Sample &Menu"
+ id="sampleMenu">
+ <separator
+ name="sampleGroup">
+ </separator>
+ </menu>
+ <action
+ label="&Sample Action"
+ icon="icons/sample.gif"
+ class="trac18a.actions.SampleAction"
+ tooltip="Hello, Eclipse world"
+ menubarPath="sampleMenu/sampleGroup"
+ toolbarPath="sampleGroup"
+ id="trac18a.actions.SampleAction">
+ </action>
+ </actionSet>
+ </extension>
+ <extension
+ point="org.eclipse.objectteams.otequinox.aspectBindings">
+ <aspectBinding
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+ <basePlugin
+ icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+ id="Trac18b">
+ <forcedExports>
+ trac18b.actions,
+trac18b.otherclasses
+ </forcedExports>
+ </basePlugin>
+ <team
+ activation="ALL_THREADS"
+ class="trac18a.Team18"
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+ </team>
+ </aspectBinding>
+ </extension>
+
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/src/trac18a/Team18.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/src/trac18a/Team18.java
new file mode 100644
index 0000000..d428053
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/src/trac18a/Team18.java
@@ -0,0 +1,20 @@
+/**
+ *
+ */
+package trac18a;
+
+import base trac18b.actions.SampleAction;
+import base trac18b.api.PublicBase;
+
+/**
+ * @author stephan
+ *
+ */
+public team class Team18 {
+ protected class Action playedBy SampleAction {
+
+ }
+ protected class RoleOfPublic playedBy PublicBase {
+
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/src/trac18a/actions/SampleAction.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/src/trac18a/actions/SampleAction.java
new file mode 100644
index 0000000..e60be67
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a/src/trac18a/actions/SampleAction.java
@@ -0,0 +1,64 @@
+package trac18a.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.jface.dialogs.MessageDialog;
+
+/**
+ * Our sample action implements workbench action delegate.
+ * The action proxy will be created by the workbench and
+ * shown in the UI. When the user tries to use the action,
+ * this delegate will be created and execution will be
+ * delegated to it.
+ * @see IWorkbenchWindowActionDelegate
+ */
+public class SampleAction implements IWorkbenchWindowActionDelegate {
+ private IWorkbenchWindow window;
+ /**
+ * The constructor.
+ */
+ public SampleAction() {
+ }
+
+ /**
+ * The action has been activated. The argument of the
+ * method represents the 'real' action sitting
+ * in the workbench UI.
+ * @see IWorkbenchWindowActionDelegate#run
+ */
+ public void run(IAction action) {
+ MessageDialog.openInformation(
+ window.getShell(),
+ "Trac18a Plug-in",
+ "Hello, Aspect world");
+ }
+
+ /**
+ * Selection in the workbench has been changed. We
+ * can change the state of the 'real' action here
+ * if we want, but this can only happen after
+ * the delegate has been created.
+ * @see IWorkbenchWindowActionDelegate#selectionChanged
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ /**
+ * We can use this method to dispose of any system
+ * resources we previously allocated.
+ * @see IWorkbenchWindowActionDelegate#dispose
+ */
+ public void dispose() {
+ }
+
+ /**
+ * We will cache window object in order to
+ * be able to provide parent shell for the message dialog.
+ * @see IWorkbenchWindowActionDelegate#init
+ */
+ public void init(IWorkbenchWindow window) {
+ this.window = window;
+ }
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/.classpath
new file mode 100644
index 0000000..b70b156
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="OTRE"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/.project
new file mode 100644
index 0000000..722dc22
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/.project
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Trac18a</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.objectteams.otdt.builder.OTJBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.objectteams.otdt.OTJavaNature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/.settings/org.eclipse.jdt.core.prefs b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..509e627
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,3 @@
+#Sat Nov 10 00:41:15 CET 2007
+eclipse.preferences.version=1
+org.eclipse.objectteams.otdt.compiler.problem.binding_conventions=error
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..537183c
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Trac18a Plug-in
+Bundle-SymbolicName: Trac18a; singleton:=true
+Bundle-Version: 1.0.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.objectteams.otequinox,
+ Trac18b
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/build.properties
new file mode 100644
index 0000000..0d3d3a7
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/plugin.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/plugin.xml
new file mode 100644
index 0000000..06c2c53
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/plugin.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.actionSets">
+ <actionSet
+ label="Sample Action Set"
+ visible="true"
+ id="Trac18a.actionSet">
+ <menu
+ label="Sample &Menu"
+ id="sampleMenu">
+ <separator
+ name="sampleGroup">
+ </separator>
+ </menu>
+ <action
+ label="&Sample Action"
+ icon="icons/sample.gif"
+ class="trac18a.actions.SampleAction"
+ tooltip="Hello, Eclipse world"
+ menubarPath="sampleMenu/sampleGroup"
+ toolbarPath="sampleGroup"
+ id="trac18a.actions.SampleAction">
+ </action>
+ </actionSet>
+ </extension>
+ <extension
+ point="org.eclipse.objectteams.otequinox.aspectBindings">
+ <aspectBinding
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+ <basePlugin
+ icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+ id="Trac18b">
+ </basePlugin>
+ <team
+ activation="ALL_THREADS"
+ class="trac18a.Team18"
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+ </team>
+ </aspectBinding>
+ </extension>
+
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/src/trac18a/Team18.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/src/trac18a/Team18.java
new file mode 100644
index 0000000..c0c4dd9
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/src/trac18a/Team18.java
@@ -0,0 +1,16 @@
+/**
+ *
+ */
+package trac18a;
+
+import base trac18b.actions.SampleAction;
+
+/**
+ * @author stephan
+ *
+ */
+public team class Team18 {
+ protected class Action playedBy SampleAction {
+
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/src/trac18a/actions/SampleAction.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/src/trac18a/actions/SampleAction.java
new file mode 100644
index 0000000..e60be67
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a2/src/trac18a/actions/SampleAction.java
@@ -0,0 +1,64 @@
+package trac18a.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.jface.dialogs.MessageDialog;
+
+/**
+ * Our sample action implements workbench action delegate.
+ * The action proxy will be created by the workbench and
+ * shown in the UI. When the user tries to use the action,
+ * this delegate will be created and execution will be
+ * delegated to it.
+ * @see IWorkbenchWindowActionDelegate
+ */
+public class SampleAction implements IWorkbenchWindowActionDelegate {
+ private IWorkbenchWindow window;
+ /**
+ * The constructor.
+ */
+ public SampleAction() {
+ }
+
+ /**
+ * The action has been activated. The argument of the
+ * method represents the 'real' action sitting
+ * in the workbench UI.
+ * @see IWorkbenchWindowActionDelegate#run
+ */
+ public void run(IAction action) {
+ MessageDialog.openInformation(
+ window.getShell(),
+ "Trac18a Plug-in",
+ "Hello, Aspect world");
+ }
+
+ /**
+ * Selection in the workbench has been changed. We
+ * can change the state of the 'real' action here
+ * if we want, but this can only happen after
+ * the delegate has been created.
+ * @see IWorkbenchWindowActionDelegate#selectionChanged
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ /**
+ * We can use this method to dispose of any system
+ * resources we previously allocated.
+ * @see IWorkbenchWindowActionDelegate#dispose
+ */
+ public void dispose() {
+ }
+
+ /**
+ * We will cache window object in order to
+ * be able to provide parent shell for the message dialog.
+ * @see IWorkbenchWindowActionDelegate#init
+ */
+ public void init(IWorkbenchWindow window) {
+ this.window = window;
+ }
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/.classpath
new file mode 100644
index 0000000..b70b156
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="OTRE"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/.project
new file mode 100644
index 0000000..722dc22
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/.project
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Trac18a</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.objectteams.otdt.builder.OTJBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.objectteams.otdt.OTJavaNature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/.settings/org.eclipse.jdt.core.prefs b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..509e627
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,3 @@
+#Sat Nov 10 00:41:15 CET 2007
+eclipse.preferences.version=1
+org.eclipse.objectteams.otdt.compiler.problem.binding_conventions=error
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..537183c
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Trac18a Plug-in
+Bundle-SymbolicName: Trac18a; singleton:=true
+Bundle-Version: 1.0.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.objectteams.otequinox,
+ Trac18b
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/build.properties
new file mode 100644
index 0000000..0d3d3a7
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/plugin.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/plugin.xml
new file mode 100644
index 0000000..d3d801c
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/plugin.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.actionSets">
+ <actionSet
+ label="Sample Action Set"
+ visible="true"
+ id="Trac18a.actionSet">
+ <menu
+ label="Sample &Menu"
+ id="sampleMenu">
+ <separator
+ name="sampleGroup">
+ </separator>
+ </menu>
+ <action
+ label="&Sample Action"
+ icon="icons/sample.gif"
+ class="trac18a.actions.SampleAction"
+ tooltip="Hello, Eclipse world"
+ menubarPath="sampleMenu/sampleGroup"
+ toolbarPath="sampleGroup"
+ id="trac18a.actions.SampleAction">
+ </action>
+ </actionSet>
+ </extension>
+ <extension
+ point="org.eclipse.objectteams.otequinox.aspectBindings">
+ <aspectBinding
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+ <basePlugin
+ icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+ id="Trac18b">
+ <forcedExports>
+ trac18b.actions
+ </forcedExports>
+ </basePlugin>
+ <team
+ activation="ALL_THREADS"
+ class="trac18a.Team18"
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+ </team>
+ </aspectBinding>
+ </extension>
+
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/src/trac18a/Team18.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/src/trac18a/Team18.java
new file mode 100644
index 0000000..9372d10
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/src/trac18a/Team18.java
@@ -0,0 +1,19 @@
+/**
+ *
+ */
+package trac18a;
+
+import base trac18b.actions.SampleAction;
+
+/**
+ * @author stephan
+ *
+ */
+public team class Team18 {
+ protected class Action playedBy SampleAction {
+ public Action() {
+ base();
+ }
+ void dispose() -> void dispose();
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/src/trac18a/actions/SampleAction.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/src/trac18a/actions/SampleAction.java
new file mode 100644
index 0000000..e60be67
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18a3/src/trac18a/actions/SampleAction.java
@@ -0,0 +1,64 @@
+package trac18a.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.jface.dialogs.MessageDialog;
+
+/**
+ * Our sample action implements workbench action delegate.
+ * The action proxy will be created by the workbench and
+ * shown in the UI. When the user tries to use the action,
+ * this delegate will be created and execution will be
+ * delegated to it.
+ * @see IWorkbenchWindowActionDelegate
+ */
+public class SampleAction implements IWorkbenchWindowActionDelegate {
+ private IWorkbenchWindow window;
+ /**
+ * The constructor.
+ */
+ public SampleAction() {
+ }
+
+ /**
+ * The action has been activated. The argument of the
+ * method represents the 'real' action sitting
+ * in the workbench UI.
+ * @see IWorkbenchWindowActionDelegate#run
+ */
+ public void run(IAction action) {
+ MessageDialog.openInformation(
+ window.getShell(),
+ "Trac18a Plug-in",
+ "Hello, Aspect world");
+ }
+
+ /**
+ * Selection in the workbench has been changed. We
+ * can change the state of the 'real' action here
+ * if we want, but this can only happen after
+ * the delegate has been created.
+ * @see IWorkbenchWindowActionDelegate#selectionChanged
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ /**
+ * We can use this method to dispose of any system
+ * resources we previously allocated.
+ * @see IWorkbenchWindowActionDelegate#dispose
+ */
+ public void dispose() {
+ }
+
+ /**
+ * We will cache window object in order to
+ * be able to provide parent shell for the message dialog.
+ * @see IWorkbenchWindowActionDelegate#init
+ */
+ public void init(IWorkbenchWindow window) {
+ this.window = window;
+ }
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/.classpath
new file mode 100644
index 0000000..751c8f2
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/.project
new file mode 100644
index 0000000..172a67f
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Trac18b</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..09fa9e0
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Trac18b Plug-in
+Bundle-SymbolicName: Trac18b; singleton:=true
+Bundle-Version: 1.0.0
+Require-Bundle: org.eclipse.ui
+Export-Package: trac18b.api
+Bundle-ActivationPolicy: lazy
+
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/build.properties
new file mode 100644
index 0000000..0d3d3a7
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/plugin.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/plugin.xml
new file mode 100644
index 0000000..e42d5e0
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/plugin.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.actionSets">
+ <actionSet
+ label="Sample Action Set"
+ visible="true"
+ id="Trac18b.actionSet">
+ <menu
+ label="Sample &Menu"
+ id="sampleMenu">
+ <separator
+ name="sampleGroup">
+ </separator>
+ </menu>
+ <action
+ label="&Sample Action"
+ icon="icons/sample.gif"
+ class="trac18b.actions.SampleAction"
+ tooltip="Hello, Eclipse world"
+ menubarPath="sampleMenu/sampleGroup"
+ toolbarPath="sampleGroup"
+ id="trac18b.actions.SampleAction">
+ </action>
+ </actionSet>
+ </extension>
+
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/src/trac18b/actions/SampleAction.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/src/trac18b/actions/SampleAction.java
new file mode 100644
index 0000000..0ef856e
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/src/trac18b/actions/SampleAction.java
@@ -0,0 +1,64 @@
+package trac18b.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.jface.dialogs.MessageDialog;
+
+/**
+ * Our sample action implements workbench action delegate.
+ * The action proxy will be created by the workbench and
+ * shown in the UI. When the user tries to use the action,
+ * this delegate will be created and execution will be
+ * delegated to it.
+ * @see IWorkbenchWindowActionDelegate
+ */
+public class SampleAction implements IWorkbenchWindowActionDelegate {
+ private IWorkbenchWindow window;
+ /**
+ * The constructor.
+ */
+ public SampleAction() {
+ }
+
+ /**
+ * The action has been activated. The argument of the
+ * method represents the 'real' action sitting
+ * in the workbench UI.
+ * @see IWorkbenchWindowActionDelegate#run
+ */
+ public void run(IAction action) {
+ MessageDialog.openInformation(
+ window.getShell(),
+ "Trac18b Plug-in",
+ "Hello, Eclipse world");
+ }
+
+ /**
+ * Selection in the workbench has been changed. We
+ * can change the state of the 'real' action here
+ * if we want, but this can only happen after
+ * the delegate has been created.
+ * @see IWorkbenchWindowActionDelegate#selectionChanged
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ /**
+ * We can use this method to dispose of any system
+ * resources we previously allocated.
+ * @see IWorkbenchWindowActionDelegate#dispose
+ */
+ public void dispose() {
+ }
+
+ /**
+ * We will cache window object in order to
+ * be able to provide parent shell for the message dialog.
+ * @see IWorkbenchWindowActionDelegate#init
+ */
+ public void init(IWorkbenchWindow window) {
+ this.window = window;
+ }
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/src/trac18b/api/PublicBase.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/src/trac18b/api/PublicBase.java
new file mode 100644
index 0000000..4a93991
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/src/trac18b/api/PublicBase.java
@@ -0,0 +1,5 @@
+package trac18b.api;
+
+public class PublicBase {
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/src/trac18b/otherclasses/OtherClass.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/src/trac18b/otherclasses/OtherClass.java
new file mode 100644
index 0000000..d62824c
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac18b/src/trac18b/otherclasses/OtherClass.java
@@ -0,0 +1,5 @@
+package trac18b.otherclasses;
+
+public class OtherClass {
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/.classpath
new file mode 100644
index 0000000..c24f8de
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="OTRE"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/.project
new file mode 100644
index 0000000..3943bd2
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/.project
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Trac213a</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.objectteams.otdt.builder.OTJBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.objectteams.otdt.OTJavaNature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/.settings/org.eclipse.jdt.core.prefs b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..a205a2b
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Sat Mar 14 19:00:03 CET 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.objectteams.otdt.compiler.problem.binding_conventions=error
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..58fb008
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/META-INF/MANIFEST.MF
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Trac213a Plug-in
+Bundle-SymbolicName: Trac213a;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: trac213a.Activator
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.objectteams.otequinox,
+ Trac213b1;bundle-version="1.0.0",
+ Trac213b2;bundle-version="1.0.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/aux/TheTeam_step1.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/aux/TheTeam_step1.java
new file mode 100644
index 0000000..2a6ba99
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/aux/TheTeam_step1.java
@@ -0,0 +1,11 @@
+package trac213a;
+
+import base trac213b1.Activator1;
+
+public team class TheTeam {
+
+ protected class R1 playedBy Activator1 {
+
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/aux/TheTeam_step2.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/aux/TheTeam_step2.java
new file mode 100644
index 0000000..56de0bd
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/aux/TheTeam_step2.java
@@ -0,0 +1,15 @@
+package trac213a;
+
+import base trac213b1.Activator1;
+import base trac213b2.Activator2;
+
+public team class TheTeam {
+
+ protected class R1 playedBy Activator1 {
+
+ }
+ protected class R2 playedBy Activator2 {
+
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/aux/plugin_step2.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/aux/plugin_step2.xml
new file mode 100644
index 0000000..d25bc85
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/aux/plugin_step2.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.objectteams.otequinox.aspectBindings">
+ <aspectBinding
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+ <basePlugin
+ icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+ id="Trac213b1">
+ </basePlugin>
+ <team
+ activation="ALL_THREADS"
+ class="trac213a.TheTeam"
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+ </team>
+ </aspectBinding>
+ <aspectBinding
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+ <basePlugin
+ icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+ id="Trac213b2">
+ </basePlugin>
+ <team
+ activation="ALL_THREADS"
+ class="trac213a.TheTeam"
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+ </team>
+ </aspectBinding>
+ </extension>
+
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/build.properties
new file mode 100644
index 0000000..e9863e2
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/plugin.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/plugin.xml
new file mode 100644
index 0000000..d54d890
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/plugin.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.objectteams.otequinox.aspectBindings">
+ <aspectBinding
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+ <basePlugin
+ icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+ id="Trac213b1">
+ </basePlugin>
+ <team
+ activation="ALL_THREADS"
+ class="trac213a.TheTeam"
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+ </team>
+ </aspectBinding>
+ </extension>
+
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/src/trac213a/Activator.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/src/trac213a/Activator.java
new file mode 100644
index 0000000..fb3d3d5
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/src/trac213a/Activator.java
@@ -0,0 +1,50 @@
+package trac213a;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "Trac213a";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/src/trac213a/TheTeam.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/src/trac213a/TheTeam.java
new file mode 100644
index 0000000..371cb03
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/src/trac213a/TheTeam.java
@@ -0,0 +1,6 @@
+package trac213a;
+
+public team class TheTeam {
+
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b1/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b1/.classpath
new file mode 100644
index 0000000..ad32c83
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b1/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b1/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b1/.project
new file mode 100644
index 0000000..67d9e39
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b1/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Trac213b1</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b1/.settings/org.eclipse.jdt.core.prefs b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b1/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..b74a520
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b1/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Sat Mar 14 18:51:55 CET 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b1/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b1/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..56fb5a2
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b1/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Trac213b1 Plug-in
+Bundle-SymbolicName: Trac213b1
+Bundle-Version: 1.0.0
+Bundle-Activator: trac213b1.Activator1
+Require-Bundle: org.eclipse.core.runtime
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Export-Package: trac213b1
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b1/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b1/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b1/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b1/src/trac213b1/Activator1.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b1/src/trac213b1/Activator1.java
new file mode 100644
index 0000000..6f3d21e
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b1/src/trac213b1/Activator1.java
@@ -0,0 +1,50 @@
+package trac213b1;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator1 extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "Trac213b1";
+
+ // The shared instance
+ private static Activator1 plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator1() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator1 getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b2/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b2/.classpath
new file mode 100644
index 0000000..ad32c83
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b2/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b2/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b2/.project
new file mode 100644
index 0000000..5e4bac1
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b2/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Trac213b2</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b2/.settings/org.eclipse.jdt.core.prefs b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b2/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..dfe2608
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b2/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Sat Mar 14 18:52:23 CET 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b2/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b2/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..44661c9
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b2/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Trac213b2 Plug-in
+Bundle-SymbolicName: Trac213b2
+Bundle-Version: 1.0.0
+Bundle-Activator: trac213b2.Activator2
+Require-Bundle: org.eclipse.core.runtime
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Export-Package: trac213b2
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b2/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b2/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b2/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b2/src/trac213b2/Activator2.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b2/src/trac213b2/Activator2.java
new file mode 100644
index 0000000..bd58e81
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213b2/src/trac213b2/Activator2.java
@@ -0,0 +1,50 @@
+package trac213b2;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator2 extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "Trac213b2";
+
+ // The shared instance
+ private static Activator2 plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator2() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator2 getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304b/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304b/.classpath
new file mode 100644
index 0000000..ad32c83
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304b/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304b/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304b/.project
new file mode 100644
index 0000000..e9fa5c0
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304b/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Trac304b</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304b/.settings/org.eclipse.jdt.core.prefs b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304b/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..d6adcef
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304b/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,9 @@
+#Sun Sep 06 00:10:18 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.objectteams.otdt.compiler.option.pure_java=enabled
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304b/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304b/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..24047b3
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304b/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Trac304b
+Bundle-SymbolicName: Trac304b
+Bundle-Version: 1.0.0
+Bundle-Activator: trac304b.Activator
+Require-Bundle: org.eclipse.core.runtime
+Bundle-ActivationPolicy: lazy
+Eclipse-ExtensibleAPI: true
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Export-Package: trac304b
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304b/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304b/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304b/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304b/src/trac304b/Activator.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304b/src/trac304b/Activator.java
new file mode 100644
index 0000000..66cc2b1
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304b/src/trac304b/Activator.java
@@ -0,0 +1,50 @@
+package trac304b;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "Trac304b";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304f/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304f/.classpath
new file mode 100644
index 0000000..ad32c83
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304f/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304f/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304f/.project
new file mode 100644
index 0000000..115fe03
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304f/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Trac304f</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304f/.settings/org.eclipse.jdt.core.prefs b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304f/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..6bc01aa
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304f/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,9 @@
+#Sun Sep 06 00:11:24 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.objectteams.otdt.compiler.option.pure_java=enabled
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304f/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304f/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..e18fd32
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304f/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Trac304f
+Bundle-SymbolicName: Trac304f
+Bundle-Version: 1.0.0
+Fragment-Host: Trac304b
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Export-Package: fragment304
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304f/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304f/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304f/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304f/src/fragment304/FragClass.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304f/src/fragment304/FragClass.java
new file mode 100644
index 0000000..8319a3f
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304f/src/fragment304/FragClass.java
@@ -0,0 +1,5 @@
+package fragment304;
+
+public class FragClass {
+ void fragMethod() {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/.classpath
new file mode 100644
index 0000000..c24f8de
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="OTRE"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/.project
new file mode 100644
index 0000000..e3f5dee
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/.project
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Trac304ot</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.objectteams.otdt.builder.OTJBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.objectteams.otdt.OTJavaNature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/.settings/org.eclipse.jdt.core.prefs b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..781d9a4
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,10 @@
+#Sun Sep 06 00:13:00 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.objectteams.otdt.compiler.option.pure_java=enabled
+org.eclipse.objectteams.otdt.compiler.problem.binding_conventions=error
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..4fd6b95
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/META-INF/MANIFEST.MF
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Trac304ot
+Bundle-SymbolicName: Trac304ot;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: trac304ot.Activator
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.objectteams.otequinox,
+ Trac304b;bundle-version="1.0.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: trac304b
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/build.properties
new file mode 100644
index 0000000..e9863e2
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/plugin.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/plugin.xml
new file mode 100644
index 0000000..cb28f5e
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/plugin.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.objectteams.otequinox.aspectBindings">
+ <aspectBinding
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+ <basePlugin
+ icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+ id="Trac304b">
+ <requiredFragment
+ id="Trac304f">
+ </requiredFragment>
+ </basePlugin>
+ <team
+ class="trac304ot.Team304ot"
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+ </team>
+ </aspectBinding>
+ </extension>
+
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/src/trac304ot/Activator.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/src/trac304ot/Activator.java
new file mode 100644
index 0000000..c1856e6
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/src/trac304ot/Activator.java
@@ -0,0 +1,50 @@
+package trac304ot;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "Trac304ot";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/src/trac304ot/Team304ot.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/src/trac304ot/Team304ot.java
new file mode 100644
index 0000000..18e6c97
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/src/trac304ot/Team304ot.java
@@ -0,0 +1,16 @@
+/**
+ *
+ */
+package trac304ot;
+
+import base fragment304.FragClass;
+
+/**
+ * @author stephan
+ *
+ */
+public team class Team304ot {
+ protected class Role playedBy FragClass {
+
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport1/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport1/.classpath
new file mode 100644
index 0000000..b70b156
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport1/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="OTRE"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport1/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport1/.project
new file mode 100644
index 0000000..266b92c
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport1/.project
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>WrongBaseImport1</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.objectteams.otdt.builder.OTJBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.objectteams.otdt.OTJavaNature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport1/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport1/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..c5d233c
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport1/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Test wrong base import Plug-in
+Bundle-SymbolicName: WrongBaseImport1; singleton:=true
+Bundle-Version: 1.0.0
+Require-Bundle: org.eclipse.objectteams.otequinox,
+ Trac18b,
+ org.eclipse.core.runtime
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport1/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport1/build.properties
new file mode 100644
index 0000000..0d3d3a7
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport1/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport1/plugin.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport1/plugin.xml
new file mode 100644
index 0000000..13fbd6b
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport1/plugin.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.objectteams.otequinox.aspectBindings">
+ <aspectBinding
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+ <basePlugin
+ icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+ id="Trac18b">
+ </basePlugin>
+ <team
+ activation="ALL_THREADS"
+ class="WrongBaseImportTeam1"
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+ </team>
+ </aspectBinding>
+ </extension>
+
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport1/src/WrongBaseImportTeam1.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport1/src/WrongBaseImportTeam1.java
new file mode 100644
index 0000000..6ce2441
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport1/src/WrongBaseImportTeam1.java
@@ -0,0 +1,5 @@
+import base org.eclipse.objectteams.otequinox.TransformerPlugin;
+
+public team class WrongBaseImportTeam1 {
+ public class WrongRole playedBy TransformerPlugin {}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport2/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport2/.classpath
new file mode 100644
index 0000000..b70b156
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport2/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="OTRE"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport2/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport2/.project
new file mode 100644
index 0000000..11fe442
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport2/.project
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>WrongBaseImport2</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.objectteams.otdt.builder.OTJBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.objectteams.otdt.OTJavaNature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport2/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport2/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..6b8c992
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport2/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Test wrong base import Plug-in
+Bundle-SymbolicName: WrongBaseImport2; singleton:=true
+Bundle-Version: 1.0.0
+Require-Bundle: org.eclipse.objectteams.otequinox,
+ Trac18b
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport2/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport2/build.properties
new file mode 100644
index 0000000..0d3d3a7
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport2/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport2/plugin.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport2/plugin.xml
new file mode 100644
index 0000000..ed5ab4e
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport2/plugin.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.objectteams.otequinox.aspectBindings">
+ <aspectBinding
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+ <basePlugin
+ icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+ id="org.eclipse.objectteams.otequinox">
+ </basePlugin>
+ <team
+ activation="ALL_THREADS"
+ class="WrongBaseImportTeam2"
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+ </team>
+ </aspectBinding>
+ </extension>
+
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport2/src/WrongBaseImportTeam2.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport2/src/WrongBaseImportTeam2.java
new file mode 100644
index 0000000..3953407
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/WrongBaseImport2/src/WrongBaseImportTeam2.java
@@ -0,0 +1,5 @@
+import base trac18b.api.PublicBase;
+
+public team class WrongBaseImportTeam2 {
+ protected class WrongRole playedBy PublicBase {}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/.classpath b/testplugins/org.eclipse.objectteams.otdt.tests/.classpath
new file mode 100644
index 0000000..c991626
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/.classpath
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="model"/>
+ <classpathentry kind="src" path="search"/>
+ <classpathentry kind="src" path="hierarchy"/>
+ <classpathentry kind="src" path="compiler"/>
+ <classpathentry kind="src" path="parser"/>
+ <classpathentry kind="src" path="formatter"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="selection"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/.cvsignore b/testplugins/org.eclipse.objectteams.otdt.tests/.cvsignore
new file mode 100644
index 0000000..ba077a4
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/.project b/testplugins/org.eclipse.objectteams.otdt.tests/.project
new file mode 100644
index 0000000..fbd0226
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.objectteams.otdt.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/.settings/org.eclipse.jdt.core.prefs b/testplugins/org.eclipse.objectteams.otdt.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..05e2501
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,52 @@
+#Thu Mar 08 22:55:51 CET 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..bd8c1ba
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,45 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OTDTTest Plug-in
+Bundle-SymbolicName: org.eclipse.objectteams.otdt.tests;singleton:=true
+Bundle-Version: 1.3.0
+Bundle-ClassPath: otdt-tests.jar
+Bundle-ActivationPolicy: lazy
+Require-Bundle: org.junit,
+ org.eclipse.jdt.core;bundle-version="[3.5.0.v_OTDT_r130,4.0.0)",
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.jdt.core.tests.compiler,
+ org.eclipse.test.performance,
+ org.eclipse.objectteams.otdt,
+ org.eclipse.jdt.core.tests.builder,
+ org.eclipse.objectteams.otdt.debug,
+ org.eclipse.text,
+ org.eclipse.jdt.core.tests.model
+Bundle-Vendor: The TOPPrax consortium
+Export-Package: org.eclipse.objectteams.otdt.tests,
+ org.eclipse.objectteams.otdt.tests.compiler,
+ org.eclipse.objectteams.otdt.tests.compiler.ast,
+ org.eclipse.objectteams.otdt.tests.compiler.errorreporting,
+ org.eclipse.objectteams.otdt.tests.compiler.smap,
+ org.eclipse.objectteams.otdt.tests.hierarchy,
+ org.eclipse.objectteams.otdt.tests.model,
+ org.eclipse.objectteams.otdt.tests.otmodel,
+ org.eclipse.objectteams.otdt.tests.otmodel.anonymousinnerclass.rolelevel.internal,
+ org.eclipse.objectteams.otdt.tests.otmodel.anonymousinnerclass.teamlevel,
+ org.eclipse.objectteams.otdt.tests.otmodel.equals,
+ org.eclipse.objectteams.otdt.tests.otmodel.externalrole,
+ org.eclipse.objectteams.otdt.tests.otmodel.internal,
+ org.eclipse.objectteams.otdt.tests.otmodel.internalrole,
+ org.eclipse.objectteams.otdt.tests.otmodel.role.bound.toordinary,
+ org.eclipse.objectteams.otdt.tests.otmodel.role.bound.toteam,
+ org.eclipse.objectteams.otdt.tests.otmodel.role.unbound,
+ org.eclipse.objectteams.otdt.tests.otmodel.sample,
+ org.eclipse.objectteams.otdt.tests.otmodel.teams,
+ org.eclipse.objectteams.otdt.tests.parser,
+ org.eclipse.objectteams.otdt.tests.search,
+ org.eclipse.objectteams.otdt.tests.selection,
+ org.eclipse.objectteams.otdt.tests.selection.codeselect,
+ org.eclipse.objectteams.otdt.tests.subhierarchy,
+ org.eclipse.objectteams.otdt.tests.superhierarchy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/build.properties b/testplugins/org.eclipse.objectteams.otdt.tests/build.properties
new file mode 100644
index 0000000..c2021fe
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/build.properties
@@ -0,0 +1,19 @@
+source.otdt-tests.jar = src/,\
+ compiler/,\
+ hierarchy/,\
+ model/,\
+ parser/,\
+ search/,\
+ selection/,\
+ analysis/,\
+ formatter/
+output.otdt-tests.jar = bin/
+bin.includes = plugin.xml,\
+ otdt-tests.jar,\
+ workspace/,\
+ META-INF/,\
+ test.xml,\
+ JCL/
+src.includes = .classpath,\
+ .project,\
+ build.properties
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/CustomizedCompiler.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/CustomizedCompiler.java
new file mode 100644
index 0000000..56aeb61
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/CustomizedCompiler.java
@@ -0,0 +1,69 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: CustomizedCompiler.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler;
+
+import java.util.Vector;
+
+import org.eclipse.jdt.internal.compiler.Compiler;
+import org.eclipse.jdt.internal.compiler.ICompilerRequestor;
+import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy;
+import org.eclipse.jdt.internal.compiler.IProblemFactory;
+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
+import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+
+/**
+ * @author ike
+ *
+ */
+public class CustomizedCompiler extends Compiler
+{
+ private Vector<ICallbackClient> _callBacks;
+
+ /**
+ * @param environment
+ * @param policy
+ * @param settings
+ * @param requestor
+ * @param problemFactory
+ */
+ public CustomizedCompiler(INameEnvironment environment, IErrorHandlingPolicy policy, CompilerOptions settings, ICompilerRequestor requestor, IProblemFactory problemFactory)
+ {
+ super(environment, policy, settings, requestor, problemFactory);
+ }
+
+ public void addCallBack(ICallbackClient c)
+ {
+ if (_callBacks == null)
+ _callBacks = new Vector<ICallbackClient>();
+
+ _callBacks.add(c);
+ }
+
+ @Override
+ public void process(CompilationUnitDeclaration unit, int i) {
+ super.process(unit, i);
+//{ObjectTeams: callback all waiting tests
+ for (ICallbackClient cbc : this._callBacks)
+ cbc.callback(unit);
+//ike}
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/ICallbackClient.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/ICallbackClient.java
new file mode 100644
index 0000000..735314e
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/ICallbackClient.java
@@ -0,0 +1,32 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: ICallbackClient.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler;
+
+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
+
+/**
+ * @author ike
+ *
+ */
+public interface ICallbackClient
+{
+ public void callback(CompilationUnitDeclaration cuDecl);
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/SourceElementRequestorTest.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/SourceElementRequestorTest.java
new file mode 100644
index 0000000..df6a4b6
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/SourceElementRequestorTest.java
@@ -0,0 +1,220 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: SourceElementRequestorTest.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler;
+import java.util.Locale;
+
+import junit.framework.Test;
+
+import org.eclipse.jdt.core.compiler.CategorizedProblem;
+import org.eclipse.jdt.core.compiler.IProblem;
+import org.eclipse.jdt.internal.compiler.ISourceElementRequestor;
+import org.eclipse.jdt.internal.compiler.SourceElementParser;
+import org.eclipse.jdt.internal.compiler.ast.Expression;
+import org.eclipse.jdt.internal.compiler.ast.ImportReference;
+import org.eclipse.jdt.internal.compiler.batch.CompilationUnit;
+import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
+import org.eclipse.objectteams.otdt.tests.otmodel.FileBasedModelTest;
+
+/**
+ * @author haebor/mkr
+ * @version $Id: SourceElementRequestorTest.java 23494 2010-02-05 23:06:44Z stephan $
+ */
+public class SourceElementRequestorTest extends FileBasedModelTest implements ISourceElementRequestor
+{
+ private char[] source;
+ protected String PROJECT_DIR;
+
+ public SourceElementRequestorTest(String testName)
+ {
+ super(testName);
+ }
+
+ public static Test suite()
+ {
+ if (true)
+ {
+ return new Suite(SourceElementRequestorTest.class);
+ }
+ junit.framework.TestSuite suite = new Suite(SourceElementRequestorTest.class
+ .getName());
+ return suite;
+ }
+
+ public void setUpSuite() throws Exception
+ {
+ setTestProjectDir(PROJECT_DIR);
+ super.setUpSuite();
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ public void fullParse(String src, String fileName)
+ {
+ this.source = src.toCharArray();
+
+ // km: ctor with new parameter "reportLocalDeclarations", "optimizeStringLiterals" assuming both to be true
+ SourceElementParser parser =
+ new SourceElementParser(this, new DefaultProblemFactory(Locale.getDefault()), new CompilerOptions(), true, true);
+
+ ICompilationUnit sourceUnit = new CompilationUnit(source, fileName, null);
+
+ parser.parseCompilationUnit(sourceUnit, true, null);
+ }
+
+ public void acceptConstructorReference(char[] typeName, int argCount, int sourcePosition)
+ {
+ }
+
+ public void acceptFieldReference(char[] fieldName, int sourcePosition)
+ {
+ }
+
+ public void acceptLineSeparatorPositions(int[] positions)
+ {
+ }
+
+ public void acceptMethodReference(char[] methodName, int argCount, int sourcePosition)
+ {
+ }
+
+ public void acceptTypeReference(char[][] typeName, int sourceStart, int sourceEnd)
+ {
+ }
+
+ public void acceptTypeReference(char[] typeName, int sourcePosition)
+ {
+ }
+
+ public void acceptUnknownReference(char[][] name, int sourceStart, int sourceEnd)
+ {
+ }
+
+ public void acceptUnknownReference(char[] name, int sourcePosition)
+ {
+ }
+
+ public void enterCompilationUnit()
+ {
+ }
+
+ public void enterInitializer(int declarationStart, int modifiers)
+ {
+ }
+
+ public void exitCompilationUnit(int declarationEnd)
+ {
+ }
+
+ public void exitConstructor(int declarationEnd)
+ {
+ }
+
+ public void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd)
+ {
+ }
+
+ public void exitInitializer(int declarationEnd)
+ {
+ }
+
+ public void enterCalloutMapping(CalloutInfo calloutInfo)
+ {
+ }
+
+ public void enterCalloutToFieldMapping(CalloutToFieldInfo calloutInfo)
+ {
+ }
+
+ public void enterCallinMapping(CallinInfo callinInfo)
+ {
+ }
+
+ public void exitCallinMapping(int sourceEnd, int declarationSourceEnd)
+ {
+ }
+
+ public void exitCalloutMapping(int sourceEnd, int declarationSourceEnd)
+ {
+ }
+
+ public void exitCalloutToFieldMapping(int sourceEnd, int declarationSourceEnd)
+ {
+ }
+
+ public void acceptBaseReference(char[][] typeName, int sourceStart, int sourceEnd){}
+
+ public void enterConstructor(MethodInfo methodInfo) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void enterField(FieldInfo fieldInfo) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void enterMethod(MethodInfo methodInfo) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void enterType(TypeInfo typeInfo) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void exitType(int declarationEnd) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void acceptProblem(CategorizedProblem problem) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void acceptImport(int declarationStart, int declarationEnd, char[][] tokens, boolean onDemand, int modifiers) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void acceptAnnotationTypeReference(char[][] annotation, int sourceStart, int sourceEnd) {
+ // TODO Auto-generated method stub
+ }
+
+ public void acceptAnnotationTypeReference(char[] annotation, int sourcePosition) {
+ // TODO Auto-generated method stub
+ }
+
+ public void acceptPackage(ImportReference importReference) {
+ // TODO Auto-generated method stub
+ }
+
+ public void exitMethod(int declarationEnd, Expression defaultValue) {
+ // TODO Auto-generated method stub
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/TestBase.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/TestBase.java
new file mode 100644
index 0000000..9622d50
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/TestBase.java
@@ -0,0 +1,698 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: TestBase.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.compiler.IProblem;
+import org.eclipse.jdt.internal.compiler.batch.Main;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+import org.eclipse.objectteams.otdt.core.ext.OTDTPlugin;
+
+/**
+ * This class represents a base for testing the compiler with several files.
+ *
+ * @author Jan Wloka
+ * @version $Id: TestBase.java 23494 2010-02-05 23:06:44Z stephan $
+ */
+public class TestBase extends TestCase
+{
+
+ public static final String NL = "\r\n";
+
+ public static final String CLASS_FILE_EXTENSION = ".class";
+ public static final String JAVA_FILE_EXTENSION = ".java";
+ public static final String LOG_FILE_EXTENSION = ".log";
+
+ public static final String WORKSPACE_NAME = "testing-workspace";
+ public static final String PROJECT_NAME = "TestProject";
+
+ public static final String JAVA_HOME = System.getProperty("java.home");
+ public static final String USER_HOME = System.getProperty("user.home");
+
+ public static final String JRE_JAR_PATH = JAVA_HOME
+ + File.separator
+ + "lib"
+ + File.separator
+ + "rt.jar";
+
+ public static final String OT_RUNTIME_PATH;
+ static {
+ OT_RUNTIME_PATH = JavaCore.getClasspathVariable(OTDTPlugin.OTDT_INSTALLDIR).toOSString();
+ }
+
+
+ public static final String OTRE_JAR_PATH = OT_RUNTIME_PATH
+ + File.separator
+ + "lib"
+ + File.separator
+ + "otre.jar";
+
+ public static final String OT_SCRIPT_PATH = OT_RUNTIME_PATH
+ + File.separator
+ + "otj"
+ + File.separator
+ + "bin"
+ + File.separator
+ + "ot";
+
+ public static final String PROJECT_PATH = USER_HOME
+ + File.separator
+ + WORKSPACE_NAME
+ + File.separator
+ + PROJECT_NAME;
+
+
+ private Main _compiler;
+ private String _logFileName;
+ private File _workingDir;
+
+ public TestBase(String testName)
+ {
+ super(testName);
+ }
+
+ private void cleanWorkingDirectory()
+ {
+ if (!_workingDir.isDirectory())
+ {
+ return;
+ }
+ cleanRecursively(_workingDir);
+// File[] containedFiles = _workingDir.listFiles();
+//
+// for (int idx = 0; idx < containedFiles.length; idx++)
+// {
+// containedFiles[idx].delete();
+// }
+//
+// _workingDir.delete();
+ }
+ private void cleanRecursively(File file) {
+ if (file.isDirectory()) {
+ for (File child : file.listFiles()) {
+ cleanRecursively(child);
+ }
+ }
+ file.delete();
+ }
+
+ /**
+ * Executes the main() method of a given classfile.
+ * @param fname e.g. MyMainClass
+ * @param expectedResult e.g. OK
+ * @return e.g. OK
+ */
+ public boolean executeFile(String fname, String expectedResult)
+ {
+ System.out.println(" ***** executed ***** ");
+ String result = executeCommand(OT_SCRIPT_PATH + " -classpath " + PROJECT_PATH +" "+ fname);
+ if(result.compareTo(expectedResult) != 0)
+ {
+ System.out.println(" Expected result: " + expectedResult);
+ System.out.println(" Actual result: " + result);
+
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * execute unix shell command
+ * @param commandToExecute
+ * @return the result from output stream
+ */
+ private static String executeCommand(String commandToExecute)
+ {
+ ArrayList<Exception> exceptions = new ArrayList<Exception>();
+
+ Process commandExecutionProcess;
+
+ StringWriter output = new StringWriter();
+ StringWriter errors = new StringWriter();
+
+ try
+ {
+ commandExecutionProcess = Runtime.getRuntime().exec(commandToExecute);
+
+ StreamRedirectThread outRedirect =
+ new StreamRedirectThread(
+ "output_reader",
+ commandExecutionProcess.getInputStream(),
+ output);
+ StreamRedirectThread errRedirect = new StreamRedirectThread("error_reader",
+ commandExecutionProcess.getErrorStream(), errors);
+
+ outRedirect.start();
+ errRedirect.start();
+
+ commandExecutionProcess.waitFor();
+
+ outRedirect.join(); // wait until output (std out) of commandline tool is fully read
+ errRedirect.join(); // wait until standard error of commandline tool is fully read
+ if (outRedirect.getException() != null)
+ {
+ exceptions.add(outRedirect.getException());
+ }
+ if (errRedirect.getException() != null)
+ {
+ exceptions.add(errRedirect.getException());
+ }
+ }
+ catch (Exception ex)
+ {
+ exceptions.add(ex);
+ }
+ finally
+ {
+ output.flush();
+ try
+ {
+ output.close();
+ }
+ catch (Exception ex)
+ {
+ exceptions.add(ex);
+ }
+ errors.flush();
+ try
+ {
+ errors.close();
+ }
+ catch (Exception ex)
+ {
+ exceptions.add(ex);
+ }
+ }
+
+ return errors.toString() + output.toString();
+
+ }
+ // -- use default options: --
+ public void compileFile(String fname)
+ {
+ compileFile(fname, null);
+ }
+ public void compileFile(String fname, String[] classpath)
+ {
+ Map<String,String> options= new HashMap<String,String>();
+ options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
+ options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
+ options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
+ options.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED);
+ options.put(CompilerOptions.OPTION_ReportInvalidJavadoc, CompilerOptions.ERROR);
+ options.put(CompilerOptions.OPTION_ReportInvalidJavadocTags, CompilerOptions.ERROR);
+ compileFile(fname, classpath, options);
+ }
+ // -- use custom options: --
+ public void compileFile(String fname, String[] classpath, Map options)
+ {
+ System.out.println("*************************** "
+ + this.getClass().getName()
+ +" "
+ + this.getName()
+ + " ***************************");
+ _logFileName = fname;
+
+ try
+ {
+ if (!validClasspathEntries())
+ {
+ throw new FileNotFoundException("Whether OTRE_JAR_PATH (otre.jar) or JRE_JAR_PATH (rt.jar) is unvalid.");
+ }
+
+ String[] args = (classpath == null)
+ ? createClassPath(fname)
+ : classpath;
+
+ File javaFile = new File(_workingDir.getAbsolutePath()
+ + File.separator
+ + fname
+ + JAVA_FILE_EXTENSION);
+
+ if(!javaFile.exists())
+ {
+ throw new FileNotFoundException("File to compile was not found!: " + _logFileName);
+ }
+
+ _compiler =
+ new Main(
+ new PrintWriter(
+ new FileOutputStream(PROJECT_PATH
+ + File.separator
+ + _logFileName
+ + LOG_FILE_EXTENSION)),
+ new PrintWriter(
+ new FileOutputStream(PROJECT_PATH
+ + File.separator
+ + _logFileName
+ + LOG_FILE_EXTENSION)),
+ false,
+ options,
+ null);
+
+ _compiler.compile(args);
+ }
+ catch (FileNotFoundException ex)
+ {
+ handleException(ex);
+ }
+ }
+
+ private boolean validClasspathEntries()
+ {
+ File otreJar = new File(OTRE_JAR_PATH);
+ File jreJar = new File(JRE_JAR_PATH);
+
+ return (otreJar.exists() && jreJar.exists());
+ }
+
+ public void createFile(String fname, String content)
+ {
+ try
+ {
+ File pkgDir = createPackageDirectory(content);
+ File file = new File(pkgDir.getAbsolutePath()
+ + File.separator
+ + fname
+ + JAVA_FILE_EXTENSION);
+ file.deleteOnExit();
+
+ FileWriter writer = new FileWriter(file);
+ writer.write(content);
+ writer.close();
+ }
+ catch (IOException ex)
+ {
+ handleException(ex);
+ }
+ }
+
+ /**
+ * Creates a file at given relative position and all necessary directories
+ * The content of package is not evaluatet for saving location
+ * @param fname the name of the new file to create
+ * @param relPath the relative path where to store the file
+ * @param content the content
+ */
+ public void createFileAt(String fname, String relPath, String content)
+ {
+ try
+ {
+ String curPath = _workingDir.getAbsolutePath();
+
+ if(relPath.trim().length() > 0)
+ {
+ curPath+= File.separator + relPath;
+ }
+
+ File pkgDir = new File(curPath);
+ pkgDir.mkdirs();
+
+ File file = new File(pkgDir.getAbsolutePath()
+ + File.separator
+ + fname
+ + JAVA_FILE_EXTENSION);
+ file.deleteOnExit();
+
+ FileWriter writer = new FileWriter(file);
+ writer.write(content);
+ writer.close();
+ }
+ catch (IOException ex)
+ {
+ handleException(ex);
+ }
+ }
+
+ private File createPackageDirectory(String fileContent) throws IOException
+ {
+ String qualPkgName = getQualifiedPackageName(fileContent);
+ String dirPath = getDirectoryPath(qualPkgName);
+
+ String curPath = _workingDir.getAbsolutePath() + File.separator + dirPath;
+ File result = new File(curPath);
+ result.mkdirs();
+
+ return result;
+ }
+
+ private String getDirectoryPath(String qualPkgName)
+ {
+ if ((qualPkgName == null) || (qualPkgName.trim().length() == 0))
+ {
+ return "";
+ }
+
+ if (qualPkgName.indexOf('.') == -1)
+ {
+ return qualPkgName;
+ }
+ else
+ {
+ return qualPkgName.replaceAll("[.]", File.separator);
+ }
+ }
+
+ private String getQualifiedPackageName(String fileContent)
+ {
+ String packageKeyword = "package ";
+
+ int pos1 = fileContent.indexOf(packageKeyword);
+ if (pos1 == -1)
+ {
+ return "";
+ }
+
+ int pos2 = fileContent.indexOf(';', pos1);
+ if (pos2 == -1)
+ {
+ return "";
+ }
+
+
+ return fileContent.substring(pos1 + packageKeyword.length(), pos2);
+ }
+
+ private void handleException(Exception ex)
+ {
+ System.out.println("UNCAUGHT EXCEPTION: " + ex);
+ ex.printStackTrace(System.out);
+ }
+
+
+ /**
+ * checks whether the compiler has proceeded without errors or warnings
+ */
+ public boolean isCompilationSuccessful()
+ {
+ if (_compiler.globalErrorsCount != 0)
+ {
+ printAllProblems();
+ return false;
+ }
+ else
+ {
+ File file = new File(_workingDir.getAbsolutePath()
+ + File.separator
+ + _logFileName
+ + LOG_FILE_EXTENSION);
+ file.delete();
+ return true;
+ }
+ }
+
+ /**
+ * checks whether the compiler has generated the expected errors and warnings,
+ * if it created more problems than specified this is OK for this method.
+ * @param problemIDs IDs of the expected errors and warnings as specified in
+ * org.eclipse.jdt.core.compiler.IProblem
+ */
+ public boolean hasAtLeastExpectedProblems(int[] problemIDs)
+ {
+ expected: for (int i = 0; i < problemIDs.length; i++) {
+ for (int j = 0; j < _compiler.logger._globalProblems.size(); j++) {
+ if (problemIDs[i] == ((IProblem)_compiler.logger._globalProblems.get(j)).getID())
+ continue expected;
+ }
+ printAllProblems();
+ return false;
+ }
+ File file = new File(_workingDir.getAbsolutePath()
+ + File.separator
+ + _logFileName
+ + LOG_FILE_EXTENSION);
+ file.delete();
+ return true;
+ }
+
+ /**
+ * checks whether the compiler has generated the expected errors and warnings
+ * @param problemIDs IDs of the expected errors and warnings as specified in
+ * org.eclipse.jdt.core.compiler.IProblem
+ */
+ public boolean hasExpectedProblems(int[] problemIDs)
+ {
+ if ( areProblemsEqual(_compiler.logger._globalProblems, problemIDs) )
+ {
+ File file = new File(_workingDir.getAbsolutePath()
+ + File.separator
+ + _logFileName
+ + LOG_FILE_EXTENSION);
+ file.delete();
+
+ return true;
+ }
+ else
+ {
+ printAllProblems();
+ return false;
+ }
+ }
+
+ private void printAllProblems()
+ {
+ for (Iterator iter = _compiler.logger._globalProblems.iterator(); iter.hasNext();)
+ {
+ IProblem prob = (IProblem)iter.next();
+ System.err.println(prob.toString());
+ if (prob.getID() == IProblem.Unclassified) // it was an exception.
+ throw new InternalError(prob.toString());
+ }
+ }
+
+ /**
+ * checks whether the compiler has generated the expected errors and warnings
+ * @param errorIDs IDs of the expected errors as specified in
+ * org.eclipse.jdt.core.compiler.IProblem
+ * @param warningIDs analogous
+ */
+ public boolean hasExpectedProblems(int[] errorIDs, int[] warningIDs)
+ {
+ if ( areProblemsEqual(_compiler.logger._globalErrors, errorIDs)
+ && areProblemsEqual(_compiler.logger._globalWarnings, warningIDs) )
+ {
+
+ File file = new File(_workingDir.getAbsolutePath()
+ + File.separator
+ + _logFileName
+ + LOG_FILE_EXTENSION);
+ file.delete();
+
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+
+ /**
+ * @param problems Vector elements of type IProblem
+ */
+ private boolean areProblemsEqual(List problems, int[] problemIDs)
+ {
+ if ( problemIDs == null)
+ {
+ return problems.isEmpty();
+ }
+
+ boolean result = true;
+
+ if (problems.size() != problemIDs.length)
+ {
+ result = false;
+ }
+ for (Iterator iter = problems.iterator(); result && iter.hasNext();)
+ {
+ IProblem curProblem = (IProblem) iter.next();
+ int curProblemID = curProblem.getID();
+
+ boolean found = false;
+ int idx = 0;
+
+ while (!found && (idx < problemIDs.length))
+ {
+ if (curProblemID == problemIDs[idx])
+ {
+ found = true;
+ }
+ idx++;
+ }
+ if (!found)
+ {
+ result = false;
+ }
+ }
+ return result;
+ }
+
+// public boolean isCompilationSuccessful(int errors, int warnings)
+// {
+// if (_compiler.globalErrorsCount != errors
+// || _compiler.globalProblemsCount > (errors + warnings)
+// || _compiler.globalWarningsCount != warnings)
+// {
+// return false;
+// }
+// else
+// {
+// // TODO (SH): check whether we have the expected problems.
+// File file = new File(_workingDir.getAbsolutePath()
+// + File.separator
+// + _logFileName
+// + LOG_FILE_EXTENSION);
+// file.delete();
+//
+// return true;
+// }
+// }
+
+
+ private String[] createClassPath(String fname)
+ {
+ File javaFile = new File(_workingDir.getAbsolutePath()
+ + File.separator
+ + fname
+ + JAVA_FILE_EXTENSION);
+
+ String[] args =
+ {
+ "-classpath",
+ new Path(OTRE_JAR_PATH).toString()
+ + File.pathSeparator
+ + new Path(JRE_JAR_PATH).toString()
+ + File.pathSeparator
+ + new Path(_workingDir.getAbsolutePath()
+ + File.separator).toString(),
+ javaFile.getAbsolutePath()
+ };
+
+ return args;
+ }
+
+ protected String[] createClassPathNoOTRE(String fname)
+ {
+ File javaFile = new File(_workingDir.getAbsolutePath()
+ + File.separator
+ + fname
+ + JAVA_FILE_EXTENSION);
+
+ String[] args =
+ {
+ "-classpath",
+ new Path(JRE_JAR_PATH).toString()
+ + File.pathSeparator
+ + new Path(_workingDir.getAbsolutePath()
+ + File.separator).toString(),
+ javaFile.getAbsolutePath()
+ };
+
+ return args;
+ }
+
+
+ protected void setUp() throws Exception
+ {
+ _workingDir = new File(PROJECT_PATH);
+ cleanWorkingDirectory();
+ _workingDir.mkdirs();
+ }
+
+ protected void tearDown() throws Exception
+ {
+
+ }
+
+ /**
+ * This method was added for convenient testing of single testmethods in testclasses.
+ * The first commandline argument is expected to be the class where the
+ * testmethod can be found. The following arguments are the testmethodnames
+ * that should run.
+ * example:
+ * java Testbase org.eclipse.objectteams.otdt.tests.compiler.errorreporting.compiler.CalloutBindingTest testMultipleCalloutBinding1
+ * @param args
+ * @throws ClassNotFoundException
+ * @throws SecurityException
+ * @throws NoSuchMethodException
+ * @throws IllegalArgumentException
+ * @throws InstantiationException
+ * @throws IllegalAccessException
+ * @throws InvocationTargetException
+ */
+
+ public static void main(String[] args) throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException
+ {
+ TestSuite selected = null;
+ Constructor clsConst =null;
+
+ switch (args.length)
+ {
+ case 0:
+ {
+ System.err.println("You must specify the class containing the testcases as argument.");
+ System.exit(1);
+ break; // duh
+ }
+
+ case 1: // take all methods
+ {
+ Class testClass = Class.forName(args[0]);
+ selected = new TestSuite(testClass);
+ break;
+ }
+
+ default: // single methods to execute given
+ {
+ Class<?> testClass = Class.forName(args[0]);
+ clsConst = testClass.getConstructor( new Class<?>[] { String.class } );
+ selected = new TestSuite();
+
+ for (int idx = 1; idx < args.length; idx++)
+ {
+ selected.addTest((Test)clsConst.newInstance( new Object[] { args[idx] } ));
+ }
+ }
+ }
+
+ TestRunner.run(selected);
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/ast/TypeDeclarationTest.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/ast/TypeDeclarationTest.java
new file mode 100644
index 0000000..cfc5b52
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/ast/TypeDeclarationTest.java
@@ -0,0 +1,104 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: TypeDeclarationTest.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.ast;
+
+import junit.framework.Test;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.objectteams.otdt.tests.compiler.SourceElementRequestorTest;
+
+/**
+ * @author haebor
+ * @version $Id: TypeDeclarationTest.java 23494 2010-02-05 23:06:44Z stephan $
+ */
+public class TypeDeclarationTest extends SourceElementRequestorTest
+{
+
+ private boolean _testFlag;
+
+ public TypeDeclarationTest(String testName)
+ {
+ super(testName);
+ }
+
+ public static Test suite()
+ {
+ if (true)
+ {
+ return new Suite(TypeDeclarationTest.class);
+ }
+ junit.framework.TestSuite suite = new Suite(TypeDeclarationTest.class
+ .getName());
+ return suite;
+ }
+
+ public void setUpSuite() throws Exception
+ {
+ this.PROJECT_DIR = "ExternalDefinedRole";
+ super.setUpSuite();
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ public void enterType(TypeInfo typeInfo) {
+ _testFlag = typeInfo.isRoleFile;
+ }
+
+ public void testRoleInterface_RolefileFlag() throws JavaModelException
+ {
+ org.eclipse.jdt.core.ICompilationUnit unit = getCompilationUnit(
+ "ExternalDefinedRole",
+ "unbound",
+ "unbound.teampkg.Team_5a",
+ "SampleRole.java");
+
+ String src = unit.getSource();
+
+ String fileName = unit.getCorrespondingResource().toString();
+
+ fullParse(src, fileName);
+
+ assertTrue(_testFlag);
+ }
+
+ public void testRoleClass_RolefileFlag() throws JavaModelException
+ {
+ org.eclipse.jdt.core.ICompilationUnit unit = getCompilationUnit(
+ "ExternalDefinedRole",
+ "unbound",
+ "unbound.teampkg.Team_5b",
+ "SampleRole.java");
+
+ String src = unit.getSource();
+ IResource res = unit.getCorrespondingResource();
+
+ String fileName = res.toString();
+ fullParse(src, fileName);
+
+ assertTrue(_testFlag);
+ }
+
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/CallinBindingTest.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/CallinBindingTest.java
new file mode 100644
index 0000000..44bc0ab
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/CallinBindingTest.java
@@ -0,0 +1,243 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: CallinBindingTest.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.errorreporting;
+
+import org.eclipse.jdt.core.compiler.IProblem;
+import org.eclipse.objectteams.otdt.tests.compiler.TestBase;
+
+
+/**
+ * This class contains tests concerning callin bindings.
+ *
+ * @author kaschja
+ * @version $Id: CallinBindingTest.java 23494 2010-02-05 23:06:44Z stephan $
+ */
+public class CallinBindingTest extends TestBase
+{
+ public CallinBindingTest(String testName)
+ {
+ super(testName);
+ }
+
+ /**
+ * A "replace-callin binding" is used with a base call.
+ * Bound role method is declared as callin method.
+ */
+ public void testCallinInMethodDeclaration()
+ {
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public int baseMethod(int i) {return 1;}" +
+ NL + "} ");
+
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " callin int roleMethod(int i)" +
+ NL + " {" +
+ NL + " return base.roleMethod(i); " +
+ NL + " }" +
+ NL + " roleMethod <- replace baseMethod; " +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * A base-call must have arguments matching the role-method's signature.
+ */
+ public void testBrokenBaseCall()
+ {
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public void baseMethod(int i) {}" +
+ NL + "} ");
+
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " callin void roleMethod(int i)" +
+ NL + " {" +
+ NL + " base.roleMethod(); " +
+ NL + " }" +
+ NL + " roleMethod <- replace baseMethod; " +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(hasExpectedProblems(new int[] { IProblem.BaseCallDoesntMatchRoleMethodSignature }));
+ }
+
+ /**
+ * A base call in a role method.
+ * Bound role method must be declared as callin method.
+ */
+ public void testMissingCallinModifierInMethodDeclaration1()
+ {
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public void baseMethod() {}" +
+ NL + "} ");
+
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " public void roleMethod()" +
+ NL + " {" +
+ NL + " base.roleMethod(); " +
+ NL + " }" +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(hasExpectedProblems(new int[] {IProblem.BasecallInRegularMethod }));
+ }
+
+ /**
+ * A callin binding declaration must include a modifier
+ * (before/replace/after).
+ */
+ public void testCallinBindingDeclarationWithoutModifier1()
+ {
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public void baseMethod() {}" +
+ NL + "} ");
+
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " public void roleMethod() {}" +
+ NL + " roleMethod <- baseMethod;" +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(hasExpectedProblems(new int[] { IProblem.CallinReplaceKeyWordNotOptional }));
+ }
+
+ /**
+ * A method in a regular class must not be declared as callin method.
+ */
+ public void testCallinModifierDeclaredInMethodOfRegularClass1()
+ {
+ createFile("MyClass","public class MyClass" +
+ NL + "{" +
+ NL + " callin void classMethod() {}" +
+ NL + "}");
+
+ compileFile("MyClass");
+
+ assertTrue(hasExpectedProblems(new int[] {IProblem.OTKeywordInRegularClass}));
+ }
+
+ /**
+ * A callin method must not be called by the role itself
+ */
+ public void testCallinMethodCalledInOtherMethodOfSameRole1()
+ {
+ createFile("MyBase","public class MyBase {}");
+
+ createFile("MyTeam","public team class MyTeam" +
+ NL + "{" +
+ NL + " protected class MyRole playedBy MyBase" +
+ NL + " {" +
+ NL + " callin void callinMethod() {}" +
+ NL + " void roleMethod()" +
+ NL + " {" +
+ NL + " callinMethod();" +
+ NL + " }" +
+ NL + " }" +
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(hasExpectedProblems(new int[] {IProblem.CallToCallin, IProblem.DefinitelyMissingBaseCall}));
+ }
+
+ /**
+ * It is an allowed alternative to declare a callin-binding
+ * with full method signature
+ */
+ public void testMethodsWithSignaturesInCallinBindings1()
+ {
+ createFile("MyBase","public class MyBase" +
+ NL + "{" +
+ NL + " public void baseMethodA() {}" +
+ NL + " public void baseMethodB() {}" +
+ NL + " public void baseMethodC() {}" +
+ NL + "}");
+
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{" +
+ NL + " protected class MyRole playedBy MyBase" +
+ NL + " {" +
+ NL + " void callinMethodA() {}" +
+ NL + " callin void callinMethodB() {}" +
+ NL + " void callinMethodA() <- after void baseMethodA();" +
+ NL + " void callinMethodB() <- replace void baseMethodB(), void baseMethodC();" +
+ NL + " }" +
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * It is an allowed alternative to declare a callin-binding
+ * without method signature
+ */
+ public void testMethodsWithoutSignaturesInCallinBindings1()
+ {
+ createFile("MyBase","public class MyBase" +
+ NL + "{" +
+ NL + " public void baseMethodA() {}" +
+ NL + " public void baseMethodB() {}" +
+ NL + " public void baseMethodC() {}" +
+ NL + "}");
+
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{" +
+ NL + " protected class MyRole playedBy MyBase" +
+ NL + " {" +
+ NL + " void callinMethodA() {}" +
+ NL + " callin void callinMethodB() {}" +
+ NL + " callinMethodA <- before baseMethodA;" +
+ NL + " callinMethodB <- replace baseMethodB, baseMethodC;" +
+ NL + " }" +
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/CalloutBindingTest.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/CalloutBindingTest.java
new file mode 100644
index 0000000..1f6f328
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/CalloutBindingTest.java
@@ -0,0 +1,1279 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: CalloutBindingTest.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.errorreporting;
+
+import org.eclipse.jdt.core.compiler.IProblem;
+import org.eclipse.objectteams.otdt.tests.compiler.TestBase;
+
+/**
+ * This class contains tests concerning callout bindings.
+ *
+ * @author kaschja
+ * @version $Id: CalloutBindingTest.java 23494 2010-02-05 23:06:44Z stephan $
+ */
+public class CalloutBindingTest extends TestBase
+{
+ public CalloutBindingTest(String testName)
+ {
+ super(testName);
+ }
+
+// There are no ambiguous base-method matches (there's always a best match
+// (one to one))
+//
+// /**
+// * A callout binding with ambiguous Base-Method Signature
+// */
+// public void testCalloutBindingAmbiguousBaseMethod1()
+// {
+//
+// createFile("MyBase","public class MyBase " +
+// NL + "{ " +
+// NL + " protected void baseMethod(short arg){}" +
+// NL + " public void baseMethod(int arg){}" +
+// NL + "} ");
+//
+// createFile("MySuperTeam","public team class MySuperTeam " +
+// NL + "{ " +
+// NL + " public class MyRole playedBy MyBase " +
+// NL + " { " +
+// NL + " public void roleMethod(long arg){};" +
+// NL + " } " +
+// NL + "}");
+//
+// createFile("MyTeam","public team class MyTeam extends MySuperTeam" +
+// NL + "{ " +
+// NL + " public class MyRole" +
+// NL + " { " +
+// NL + " roleMethod => baseMethod; " +
+// NL + " } " +
+// NL + "}");
+//
+// compileFile("MyTeam");
+//
+// //should throw warning about ambiguous base-method
+// assertTrue(hasExpectedProblems(new int[] { IProblem.CalloutBindingTooManyBaseMatches }));
+// }
+//
+// /**
+// * A callout binding with ambiguous Base-Method Signature
+// */
+// public void testCalloutBindingAmbiguousBaseMethod2()
+// {
+//
+// createFile("MyBase","public class MyBase " +
+// NL + "{ " +
+// NL + " public void baseMethod(long arg){}" +
+// NL + " public void baseMethod(int arg){}" +
+// NL + "} ");
+//
+// createFile("MySuperTeam","public team class MySuperTeam " +
+// NL + "{ " +
+// NL + " public class MyRole playedBy MyBase " +
+// NL + " { " +
+// NL + " public void roleMethod(short arg){};" +
+// NL + " } " +
+// NL + "}");
+//
+// createFile("MyTeam","public team class MyTeam extends MySuperTeam" +
+// NL + "{ " +
+// NL + " public class MyRole" +
+// NL + " { " +
+// NL + " roleMethod => baseMethod; " +
+// NL + " } " +
+// NL + "}");
+//
+// compileFile("MyTeam");
+//
+// //should throw warning about ambiguous base-method
+// assertTrue(hasExpectedProblems(new int[] { IProblem.CalloutBindingTooManyBaseMatches }));
+// }
+//
+// /**
+// * A callout binding with ambiguous Base-Method Signature
+// */
+// public void testCalloutBindingAmbiguousBaseMethod3()
+// {
+//
+// createFile("MyBase","public class MyBase " +
+// NL + "{ " +
+// NL + " public void baseMethod(String arg){}" +
+// NL + " public void baseMethod(Integer arg){}" +
+// NL + "} ");
+//
+// createFile("MySuperTeam","public team class MySuperTeam " +
+// NL + "{ " +
+// NL + " public class MyRole playedBy MyBase " +
+// NL + " { " +
+// NL + " public void roleMethod(String arg){};" +
+// NL + " public void roleMethod(Integer arg){};" +
+// NL + " } " +
+// NL + "}");
+//
+// createFile("MyTeam","public team class MyTeam extends MySuperTeam" +
+// NL + "{ " +
+// NL + " public class MyRole" +
+// NL + " { " +
+// NL + " roleMethod => baseMethod; " +
+// NL + " } " +
+// NL + "}");
+//
+// compileFile("MyTeam");
+//
+// //should throw warning about ambiguous base-method
+// assertTrue(hasExpectedProblems(new int[] { IProblem.CalloutBindingTooManyBaseMatches }));
+// }
+
+ /**
+ * A callout binding declaration must not include a modifier
+ * (before/replace/after).
+ */
+ public void testCalloutBindingDeclarationWithModifier1()
+ {
+
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public void baseMethod(){}" +
+ NL + "} ");
+
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " public abstract void roleMethod();" +
+ NL + " roleMethod -> after baseMethod; " +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(hasExpectedProblems(new int[] { IProblem.UnresolvedCalloutMethodSpec, IProblem.ParsingErrorDeleteToken}));
+ }
+
+ /**
+ * A callout binding declaration must not include a modifier
+ * (before/replace/after).
+ */
+ public void testCalloutBindingMethodArgumentWithModifier1()
+ {
+
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public void baseMethod(final String str){}" +
+ NL + "} ");
+
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " public abstract void roleMethod(final String str);" +
+ NL + " roleMethod -> after baseMethod; " +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(hasExpectedProblems(new int[] { IProblem.UnresolvedCalloutMethodSpec, IProblem.ParsingErrorDeleteToken}));
+ }
+
+ /**
+ * A role method must not be bound to a non-existing base method.
+ */
+ public void testBindingOfNonExistingMethod1()
+ {
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + "} ");
+
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " public abstract void roleMethod();" +
+ NL + " roleMethod -> baseMethod; " +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ //TODO(SH): this is what I expect in 3.2, but other non-resolve error msg would be acceptable, too
+ assertTrue(hasAtLeastExpectedProblems(new int[]{ IProblem.UnresolvedCalloutMethodSpec}));
+ }
+
+ /**
+ * A non-existing role method must not be bound to a base method.
+ */
+ public void testBindingOfNonExistingMethod2()
+ {
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public void baseMethod(){} " +
+ NL + "} ");
+
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " roleMethod -> baseMethod; " +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ //TODO(SH): this is what I expect in 3.2, but other non-resolve error msg would be acceptable, too
+ assertTrue(hasExpectedProblems(new int[]{ IProblem.UnresolvedCalloutMethodSpec}, null ));
+ }
+
+ /**
+ * An abstract role method must not be bound with the "=>"-operator.
+ */
+ public void testBindingWithWrongOperator1()
+ {
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public void baseMethod(){} " +
+ NL + "} ");
+
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " public abstract void roleMethod();" +
+ NL + " roleMethod => baseMethod; " +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(hasExpectedProblems(new int[]{ IProblem.AbstractMethodBoundAsOverride }, null ));
+ }
+
+ /**
+ * A non-abstract role method must not be bound with the "->"-operator.
+ */
+ public void testBindingWithWrongOperator2()
+ {
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public void baseMethod(){} " +
+ NL + "} ");
+
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " public void roleMethod(){}" +
+ NL + " roleMethod -> baseMethod; " +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertFalse(isCompilationSuccessful());
+ assertTrue(hasExpectedProblems(new int[]{ IProblem.RegularCalloutOverrides, IProblem.CalloutOverridesLocal } ));
+ }
+
+ /**
+ * A role method must not be bound to the same base method multiple times.
+ */
+ public void testMultipleCalloutBinding1()
+ {
+ createFile("MyBase","public class MyBase"
+ + NL + "{"
+ + NL + " public void baseMethodA(){}"
+ + NL + " public void baseMethodB(){}"
+ + NL + "}");
+
+ createFile("MyTeam",
+ "public team class MyTeam"
+ + NL + "{ "
+ + NL + " protected class MyRole playedBy MyBase"
+ + NL + " { "
+ + NL + " public abstract void roleMethod();"
+ + NL + " void roleMethod() -> void baseMethodA();"
+ + NL + " void roleMethod() -> void baseMethodB();"
+ + NL + " } "
+ + NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue( hasExpectedProblems(new int[] { IProblem.DuplicateCalloutBinding, IProblem.DuplicateCalloutBinding} ));
+ }
+
+ /**
+ * A role method must not be bound to various base methods by callout.
+ */
+ public void testMultipleCalloutBinding2()
+ {
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public void baseMethodA(){} " +
+ NL + " public void baseMethodB(){} " +
+ NL + "} ");
+
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " public abstract void roleMethod();" +
+ NL + " roleMethod -> baseMethodA; " +
+ NL + " roleMethod -> baseMethodB; " +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue( hasExpectedProblems(new int[] { IProblem.DuplicateCalloutBinding, IProblem.DuplicateCalloutBinding} ));
+ }
+
+ /**
+ * A role method must not be bound to various base methods by callout,
+ * no matter where the binding is implemented.
+ */
+ public void testMultipleCalloutBinding3()
+ {
+ createFile("MyBase",
+ "public class MyBase "
+ + NL + "{"
+ + NL + " public void baseMethodA(){}"
+ + NL + " public void baseMethodB(){}"
+ + NL + "}");
+
+ createFile("MySuperTeam",
+ "public team class MySuperTeam "
+ + NL + "{ "
+ + NL + " protected class MyRole playedBy MyBase "
+ + NL + " {"
+ + NL + " public abstract void roleMethod();"
+ + NL + " roleMethod -> baseMethodA;"
+ + NL + " }"
+ + NL + "}");
+
+ createFile("MyTeam",
+ "public team class MyTeam extends MySuperTeam"
+ + NL + "{ "
+ + NL + " protected class MyRole playedBy MyBase"
+ + NL + " {"
+// + NL + " public abstract void roleMethod();"
+ + NL + " roleMethod -> baseMethodB;"
+ + NL + " }"
+ + NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue( hasExpectedProblems(new int[] { IProblem.RegularCalloutOverridesCallout} ));
+ }
+
+ /**
+ * A role method must not be bound to the same base method multiple times.
+ */
+ public void testMultipleCalloutBinding4()
+ {
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public void baseMethod(){} " +
+ NL + "} ");
+
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " public abstract void roleMethod();" +
+ NL + " roleMethod -> baseMethod; " +
+ NL + " roleMethod -> baseMethod; " +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue( hasExpectedProblems( new int[] { IProblem.DuplicateCalloutBinding, IProblem.DuplicateCalloutBinding } ));
+ }
+
+ public void testBindingMatchingRoleBaseMethod()
+ {
+ createFile("MyException", "public class MyException extends Exception{}");
+
+ createFile("AClass",
+ "public class AClass {}"
+ + NL);
+
+ createFile("BClass",
+ "public class BClass extends AClass{}"
+ + NL);
+
+ createFile("MyBase",
+ "public class MyBase "
+ + NL + "{ "
+ + NL + " public void baseMethodAClass(AClass o){}"
+ + NL + "}"
+ + NL);
+
+ createFile("MyTeam",
+ "public team class MyTeam "
+ + NL + "{ "
+ + NL + " protected class MyRole playedBy MyBase "
+ + NL + " { "
+ + NL + " public abstract void roleMethodBClass(BClass o);"
+ + NL + " roleMethodBClass -> baseMethodAClass;"
+ + NL + " } "
+ + NL + "}"
+ + NL);
+
+
+ compileFile("MyTeam");
+
+ assertTrue( isCompilationSuccessful() );
+ }
+
+ public void testBindingMatchingRoleBaseMethod2()
+ {
+ createFile("MyException", "public class MyException extends Exception{}");
+
+ createFile("AClass",
+ "public class AClass {}"
+ + NL);
+
+ createFile("BClass",
+ "public class BClass extends AClass{}"
+ + NL);
+
+ createFile("MyBase",
+ "public class MyBase "
+ + NL + "{ "
+ + NL + " public BClass baseMethodBClassReturn(){ return null; }"
+ + NL + "}"
+ + NL);
+
+ createFile("MyTeam",
+ "public team class MyTeam "
+ + NL + "{ "
+ + NL + " protected class MyRole playedBy MyBase "
+ + NL + " { "
+ + NL + " public abstract AClass roleMethodAClassReturn2();"
+ + NL + " roleMethodAClassReturn2 -> baseMethodBClassReturn;"
+ + NL + " } "
+ + NL + "}"
+ + NL);
+
+
+ compileFile("MyTeam");
+
+ assertTrue( isCompilationSuccessful());
+ }
+
+ /**
+ * The signatures of role method and bound base method
+ * must have compatible declarations
+ */
+ public void testBindingMismatchingRoleBaseMethod1()
+ {
+ createFile("MyBase",
+ "public class MyBase "
+ + NL + "{ "
+ + NL + " public void baseMethod(int i){}"
+ + NL + "}"
+ + NL);
+
+ createFile("MyTeam",
+ "public team class MyTeam "
+ + NL + "{ "
+ + NL + " protected class MyRole playedBy MyBase "
+ + NL + " { "
+ + NL + " public abstract void roleMethod();"
+ + NL + " roleMethod -> baseMethod; "
+ + NL + " } "
+ + NL + "}"
+ + NL);
+
+
+ compileFile("MyTeam");
+
+ assertTrue( hasExpectedProblems(new int[] { IProblem.TooFewArgumentsInCallout } ));
+ }
+
+ /**
+ * The signatures of role method and bound base method
+ * must have compatible declarations. This is the not-so-easy example!
+ */
+ public void testBindingMismatchingRoleBaseMethod2()
+ {
+ createFile("MyException", "public class MyException extends Exception{static final long serialVersionUID=1234;}");
+
+ createFile("AClass",
+ "public class AClass {}"
+ + NL);
+
+ createFile("BClass",
+ "public class BClass extends AClass{}"
+ + NL);
+
+ createFile("MyBase",
+ "public class MyBase "
+ + NL + "{ "
+ + NL + " public void baseMethodBClass(BClass o) throws MyException{}"
+ + NL + "}"
+ + NL);
+
+ createFile("MyTeam",
+ "public team class MyTeam "
+ + NL + "{ "
+ + NL + " protected class MyRole playedBy MyBase "
+ + NL + " { "
+ + NL + " public abstract void roleMethodAClass(AClass o);"
+ + NL + " roleMethodAClass -> baseMethodBClass;"
+ + NL + " } "
+ + NL + "}"
+ + NL);
+
+
+ compileFile("MyTeam");
+ assertTrue( hasExpectedProblems(new int[] { IProblem.IncompatibleMappedCalloutArgument, IProblem.CalloutUndeclaredException} ));
+ }
+
+
+ public void testBindingMismatchingRoleBaseMethod3()
+ {
+ createFile("MyException", "public class MyException extends Exception{static final long serialVersionUID=1234;}");
+
+ createFile("AClass",
+ "public class AClass {}"
+ + NL);
+
+ createFile("BClass",
+ "public class BClass extends AClass{}"
+ + NL);
+
+ createFile("MyBase",
+ "public class MyBase "
+ + NL + "{ "
+ + NL + " public void baseMethodAClass(AClass o){}"
+ + NL + "}"
+ + NL);
+
+ createFile("MyTeam",
+ "public team class MyTeam "
+ + NL + "{ "
+ + NL + " protected class MyRole playedBy MyBase "
+ + NL + " { "
+ + NL + " public abstract AClass roleMethodAClassReturn1();"
+ + NL + " roleMethodAClassReturn1 -> baseMethodAClass;"
+ + NL + " } "
+ + NL + "}"
+ + NL);
+
+
+ compileFile("MyTeam");
+
+ assertFalse( isCompilationSuccessful() );
+ }
+
+ /**
+ * The signatures of role method and bound base method
+ * must have conform exception declarations (throw-clauses)
+ *
+ * The role method must not declare throwing an exception
+ * while the base method does not
+ *
+ * Actually, why shouldn't you be able to add a throws-clause in the role-method?
+ * IMHO, this shouldn't be an error. (carp)
+ */
+ public void testBindingWithDifferentExceptionDeclarations1()
+ {
+ createFile("MyException", "public class MyException extends Exception{static final long serialVersionUID=1234;}");
+
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public void baseMethod(){}" +
+ NL + "} ");
+
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " public abstract void roleMethod() throws MyException;" +
+ NL + " roleMethod -> baseMethod; " +
+ NL + " } "+
+ NL + "}");
+
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * The signatures of role method and bound base method
+ * must have conform exception declarations (throw-clauses)
+ *
+ * The role method must declare throwing an exception
+ * if the base method does
+ */
+ public void testBindingWithDifferentExceptionDeclarations2()
+ {
+ createFile("MyException", "public class MyException extends Exception{static final long serialVersionUID=1234;}");
+
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public void baseMethod() throws MyException " +
+ NL + " {" +
+ NL + " throw new MyException();" +
+ NL + " }" +
+ NL + "} ");
+
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " public abstract void roleMethod();" +
+ NL + " roleMethod -> baseMethod; " +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(hasExpectedProblems(new int[] {IProblem.CalloutUndeclaredException}));
+ }
+
+ /**
+ * The signatures of role method and bound base method
+ * must have conform exception declarations (throw-clauses)
+ *
+ * The declared exceptions must not be of different types.
+ */
+ public void testBindingWithDifferentExceptionDeclarations3()
+ {
+ createFile("MyException", "public class MyException extends Exception{static final long serialVersionUID=1234;}");
+ createFile("YourException", "public class YourException extends Exception{static final long serialVersionUID=1234;}");
+
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public void baseMethod() throws MyException " +
+ NL + " {" +
+ NL + " throw new MyException();" +
+ NL + " }" +
+ NL + "}");
+
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " public abstract void roleMethod() throws YourException;" +
+ NL + " roleMethod -> baseMethod; " +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(hasExpectedProblems(new int[] {IProblem.CalloutUndeclaredException}));
+ }
+
+ public void testBrokenBindingDeclaration1()
+ {
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public void baseMethod()" +
+ NL + " {" +
+ NL + " }" +
+ NL + "}");
+
+ createFile("MyTeam",
+ "public team class MyTeam" +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " public void roleMethod1() {}" +
+ NL + " public void roleMethod2() {}" +
+ NL + " public void roleMethod3() {}" +
+ NL + " public void roleMethod4() {}" +
+ NL + " public void roleMethod5() {}" +
+ NL + " public void roleMethod6() {}" +
+ NL + "" +
+ NL + " public void roleMethod11() {}" +
+ NL + " public void roleMethod12() {}" +
+ NL + " public void roleMethod13() {}" +
+ NL + " public void roleMethod14() {}" +
+ NL + " public void roleMethod15() {}" +
+ NL + " public void roleMethod16() {}" +
+ NL + "" +
+ NL + " void roleMethod1() -> baseMethod();" +
+ NL + " roleMethod2() -> void baseMethod();" +
+ NL + " roleMethod3() -> baseMethod();" +
+ NL + " roleMethod4() -> baseMethod;" +
+ NL + " roleMethod5 -> baseMethod();" +
+ NL + " roleMethod6() -> baseMethod();" +
+ NL + "" +
+ NL + " void roleMethod11 -> baseMethod;" +
+ NL + " roleMethod12 -> void baseMethod;" +
+ NL + " roleMethod13 -> baseMethod;" +
+ NL + " void roleMethod14 -> void baseMethod;" +
+ NL + " void roleMethod15() -> baseMethod;" +
+ NL + " roleMethod16 -> void baseMethod();" +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ //TODO: km: SH, please check
+ // assertTrue( hasExpectedProblems(new int[] { IProblem.SyntaxErrorInCallout} ));
+ }
+
+ public void testRemainingAbstractMethod1()
+ {
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public void baseMethod()" +
+ NL + " {" +
+ NL + " }" +
+ NL + "}");
+
+ createFile("MyTeam",
+ "public team class MyTeam" +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " public abstract void abstractRoleMethod();" +
+ NL + "" +
+ NL + " public abstract void roleMethod();" +
+ NL + "" +
+ NL + " void roleMethod() -> void baseMethod();" +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue( hasExpectedProblems(new int[] { IProblem.AbstractMethodsInConcreteClass, IProblem.AbstractMethodInAbstractClass } ));
+ }
+
+ public void testArrayParameters1()
+ {
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public void baseMethod(int[] baseArray)" +
+ NL + " {" +
+ NL + " }" +
+ NL + "}");
+
+ createFile("MyTeam",
+ "public team class MyTeam" +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " public abstract void abstractRoleMethod(int[] roleArray);" +
+ NL + "" +
+ NL + " void abstractRoleMethod(int[] r) -> void baseMethod(int[] b);" +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+
+ }
+
+ public void testArrayParameters2()
+ {
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public void baseMethod(Object[] baseArray)" +
+ NL + " {" +
+ NL + " }" +
+ NL + "}");
+
+ createFile("MyTeam",
+ "public team class MyTeam" +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " public abstract void abstractRoleMethod(Object[] roleArray);" +
+ NL + "" +
+ NL + " void abstractRoleMethod(Object[] r) -> void baseMethod(Object[] b);" +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+
+ }
+
+
+ public void testArrayLowering1()
+ {
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public void baseMethod(MyBase[] baseArray)" +
+ NL + " {" +
+ NL + " }" +
+ NL + "}");
+
+ createFile("MyTeam",
+ "public team class MyTeam" +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " public abstract void abstractRoleMethod(MyRole[] roleArray);" +
+ NL + "" +
+ NL + " void abstractRoleMethod(MyRole[] r) -> void baseMethod(MyBase[] b);" +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+
+ }
+
+ /**
+ * Simple test that should work.
+ *
+ */
+ public void testSimpleWorkingExample()
+ {
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public void baseMethod(Object obj)" +
+ NL + " {" +
+ NL + " }" +
+ NL + "}");
+
+ createFile("MyTeam",
+ "public team class MyTeam" +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " public abstract void abstractRoleMethod(Object obj);" +
+ NL + "" +
+ NL + " void abstractRoleMethod(Object obj) -> void baseMethod(Object obj);" +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+
+ }
+
+ /**
+ * Simple test with static base method.
+ */
+ public void testStaticBaseMethod()
+ {
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public static void baseMethod(Object obj)" +
+ NL + " {" +
+ NL + " }" +
+ NL + "}");
+
+ createFile("MyTeam",
+ "public team class MyTeam" +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " public abstract void abstractRoleMethod(Object obj);" +
+ NL + "" +
+ NL + " void abstractRoleMethod(Object obj) -> void baseMethod(Object obj);" +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+
+ }
+
+ /**
+ * A common callout binding scenario consisting of a base class, a team
+ * with a default constructor, an abstract role class, a role class with
+ * multiple callout bindings and a main method for team instantiation.
+ */
+ public void testCalloutBinding1()
+ {
+ createFile("MyBase",
+ "public class MyBase"
+ + NL + "{"
+ + NL + " public void myBaseMethod(int a)"
+ + NL + " {"
+ + NL + " System.out.println(\"laber\");"
+ + NL + " }"
+ + NL + " public void myVoidBaseMethod()"
+ + NL + " {"
+ + NL + " System.out.println(\"blubber\");"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ createFile("MyTeam",
+ "public team class MyTeam"
+ + NL + "{"
+ + NL + " public MyTeam()"
+ + NL + " {"
+ + NL + " super();"
+ + NL + " Role r = new Role(new MyBase());"
+ + NL + " r.myCallout(3);"
+ + NL + " r.myAbstractCallout(4);"
+ + NL + " r.myAbstractInheritedVoidCallout();"
+ + NL + " }"
+ + NL + ""
+ + NL + " public abstract class SuperRole"
+ + NL + " {"
+ + NL + ""
+ + NL + " void myCallout(int a)"
+ + NL + " {"
+ + NL + " System.out.println(\"Hallo\");"
+ + NL + " }"
+ + NL + ""
+ + NL + " abstract void myAbstractInheritedVoidCallout();"
+ + NL + " }"
+ + NL + ""
+ + NL + " public class Role extends SuperRole playedBy MyBase"
+ + NL + " {"
+ + NL + " protected abstract void myAbstractCallout(int a);"
+ + NL + ""
+ + NL + " public void method()"
+ + NL + " {"
+ + NL + " System.out.println(\"normal method\"); "
+ + NL + " }"
+ + NL + ""
+ + NL + " protected void myCallout(int a) => void myBaseMethod(int a);"
+ + NL + " void myAbstractCallout(int a) -> void myBaseMethod(int a);"
+ + NL + " protected void myAbstractInheritedVoidCallout() -> void myVoidBaseMethod();"
+ + NL + " }"
+ + NL + " public static void main(String[] args){"
+ + NL + " new MyTeam();"
+ + NL + " };"
+ + NL + "}"
+ + NL);
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ public void testResultLifting1()
+ {
+
+ createFile("MyBase",
+ "public class MyBase"
+ + NL + "{"
+ + NL + " public MyBase foo()"
+ + NL + " {"
+ + NL + " return this;"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ createFile("MyTeam",
+ "public team class MyTeam"
+ + NL + "{"
+ + NL + " protected class MyRole playedBy MyBase"
+ + NL + " {"
+ + NL + " public void print() {System.out.println(\"OK\");}"
+ + NL + " protected abstract MyRole bar();"
+ + NL + " bar -> foo;"
+ + NL + " }"
+ + NL + ""
+ + NL + " MyTeam()"
+ + NL + " {"
+ + NL + " MyRole r1 = new MyRole(new MyBase());"
+ + NL + " MyRole r2 = r1.bar();"
+ + NL + " r2.print();"
+ + NL + " }"
+ + NL + ""
+ + NL + " public static void main(String[] args)"
+ + NL + " {"
+ + NL + " new MyTeam();"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ public void testResultLifting2()
+ {
+
+ createFile("MyBase",
+ "public class MyBase"
+ + NL + "{"
+ + NL + " public MyBase foo()"
+ + NL + " {"
+ + NL + " return this;"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ createFile("MyTeamInterface",
+ "public team class MyTeamInterface"
+ + NL + "{"
+ + NL + " public interface MyInterface playedBy MyBase"
+ + NL + " {"
+ + NL + " MyInterface bar();"
+ + NL + " void print();"
+ + NL + " }"
+ + NL + ""
+ + NL + " protected class MyRole implements MyInterface"
+ + NL + " {"
+ + NL + " public void print() {System.out.println(\"OK\");}"
+ + NL + " bar -> foo;"
+ + NL + " }"
+ + NL + ""
+ + NL + " MyTeamInterface()"
+ + NL + " {"
+ + NL + " MyRole r = new MyRole(new MyBase());"
+ + NL + " MyInterface rI = r.bar();"
+ + NL + " rI.print();"
+ + NL + " }"
+ + NL + ""
+ + NL + " public static void main(String[] args)"
+ + NL + " {"
+ + NL + " new MyTeamInterface();"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ compileFile("MyTeamInterface");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ public void testResultLifting3()
+ {
+
+ createFile("MyBase",
+ "public class MyBase"
+ + NL + "{"
+ + NL + " public MyBase foo()"
+ + NL + " {"
+ + NL + " return this;"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ createFile("MyBase2",
+ "public class MyBase2"
+ + NL + "{"
+ + NL + " public MyBase2 foo()"
+ + NL + " {"
+ + NL + " return this;"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ createFile("MyTeam",
+ "public team class MyTeam"
+ + NL + "{"
+ + NL + " abstract protected class MyInnerClass"// playedBy MyBase2"
+ + NL + " {"
+ + NL + " protected abstract MyRole bar();"
+ + NL + " public abstract void print();"
+ + NL + " }"
+ + NL + ""
+ + NL + " protected class MyRole extends MyInnerClass playedBy MyBase"
+ + NL + " {"
+ + NL + " public void print() {System.out.println(\"OK\");}"
+ + NL + " bar -> foo;"
+ + NL + " }"
+ + NL + ""
+ + NL + " MyTeam()"
+ + NL + " {"
+ + NL + " MyRole r = new MyRole(new MyBase());"
+ + NL + " MyInnerClass rI = r.bar();"
+ + NL + " rI.print();"
+ + NL + " }"
+ + NL + ""
+ + NL + " public static void main(String[] args)"
+ + NL + " {"
+ + NL + " new MyTeam();"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ public void testSimpleSample()
+ {
+
+ createFile("MyBase",
+ "public class MyBase"
+ + NL + "{"
+ + NL + " public String getValue(int i)"
+ + NL + " {"
+ + NL + " return \"Hallo\";"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ createFile("MyTeam",
+ "public team class MyTeam"
+ + NL + "{"
+ + NL + " protected class MyRole playedBy MyBase"
+ + NL + " {"
+ + NL + " public abstract String getValue(int i);"
+ + NL + " getValue -> getValue;"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ createFile("Main",
+ "public class Main"
+ + NL + "{"
+ + NL + " public static void main(String[] args)"
+ + NL + " {"
+ + NL + " MyTeam teem = new MyTeam();"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ compileFile("Main");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+
+ public void testIncompatibleReturnTypes()
+ {
+
+ createFile("MyBase",
+ "public class MyBase"
+ + NL + "{"
+ + NL + " public long getValue()"
+ + NL + " {"
+ + NL + " return 1L;"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ createFile("MyTeam",
+ "public team class MyTeam"
+ + NL + "{"
+ + NL + " protected class MyRole playedBy MyBase"
+ + NL + " {"
+ + NL + " public abstract int getValue();"
+ + NL + " getValue -> getValue;"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ createFile("Main",
+ "public class Main"
+ + NL + "{"
+ + NL + " public static void main(String[] args)"
+ + NL + " {"
+ + NL + " MyTeam teem = new MyTeam();"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ compileFile("Main");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+
+ public void testCalloutOverrideWithCallout()
+ {
+
+ createFile("MyBase",
+ "public class MyBase"
+ + NL + "{"
+ + NL + " public int getValue()"
+ + NL + " {"
+ + NL + " return 1;"
+ + NL + " }"
+ + NL + " public int getValueBad()"
+ + NL + " {"
+ + NL + " return 666;"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ createFile("MyTeam",
+ "public team class MyTeam"
+ + NL + "{"
+ + NL + " public class MyRole playedBy MyBase"
+ + NL + " {"
+ + NL + " protected abstract int getValue();"
+ + NL + " int getValue() -> int getValueBad();"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ createFile("MySubTeam",
+ "public team class MySubTeam extends MyTeam "
+ + NL + "{"
+ + NL + " public class MyRole"
+ + NL + " {"
+ + NL + " int getValue() => int getValue();"
+ + NL + " }"
+ + NL + " public int getValue(MyBase as MyRole role) { return role.getValue(); }"
+ + NL + "}"
+ + NL);
+
+ createFile("Main",
+ "public class Main"
+ + NL + "{"
+ + NL + " public static void main(String[] args)"
+ + NL + " {"
+ + NL + " MySubTeam teem = new MySubTeam();"
+ + NL + " System.out.println(teem.getValue(new MyBase()));"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ compileFile("Main");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * An overloaded base-method cannot be bound without specifying the full signature.
+ */
+ public void testAmbiguousBinding1()
+ {
+ createFile("MyBase","public class MyBase " +
+ NL + "{ " +
+ NL + " public void baseMethod(){} " +
+ NL + " protected void baseMethod(String arg){} " +
+ NL + "} ");
+
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase " +
+ NL + " { " +
+ NL + " public abstract void roleMethod();" +
+ NL + " roleMethod -> baseMethod; " +
+ NL + " } "+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/CompilationUnitContainmentTest.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/CompilationUnitContainmentTest.java
new file mode 100644
index 0000000..06a4a31
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/CompilationUnitContainmentTest.java
@@ -0,0 +1,53 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: CompilationUnitContainmentTest.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.errorreporting;
+
+import org.eclipse.objectteams.otdt.tests.compiler.TestBase;
+
+
+/**
+ * This class contains tests concerning compilation units.
+ *
+ * @author brcan
+ * @version $Id: CompilationUnitContainmentTest.java 23494 2010-02-05 23:06:44Z stephan $
+ */
+public class CompilationUnitContainmentTest extends TestBase
+{
+ public CompilationUnitContainmentTest(String testName)
+ {
+ super(testName);
+ }
+
+ /**
+ * The compilation unit's name doesn't match with the type declaration's name.
+ * Comment:
+ * Just like classes in Java, the name of the team has to be identical to
+ * the file name.
+ */
+ public void testInvalidCompilationUnitName1()
+ {
+ createFile("MyTeam","public team class MyTeamWrongName {}");
+
+ compileFile("MyTeam");
+
+ assertFalse(isCompilationSuccessful());
+ }
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/CopyInheritanceTest.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/CopyInheritanceTest.java
new file mode 100644
index 0000000..02f0bee
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/CopyInheritanceTest.java
@@ -0,0 +1,216 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: CopyInheritanceTest.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.errorreporting;
+
+import org.eclipse.objectteams.otdt.tests.compiler.TestBase;
+
+/**
+ * @author macwitte/haebor
+ */
+public class CopyInheritanceTest extends TestBase {
+
+ /**
+ * Testcases for Copy-Inheritance
+ */
+ public CopyInheritanceTest(String testName) {
+ super(testName);
+ }
+
+ /**
+ * Test copy inheritance for string-array-references
+ */
+ public void testCopyStringArrayReferences()
+ {
+
+
+ createFile("MySuperTeam","public team class MySuperTeam " +
+ NL + "{ " +
+ NL + " public class MyRole" +
+ NL + " { " +
+ NL + " String[] strArray;" +
+ NL + " public void roleMethod()" +
+ NL + " {" +
+ NL + " strArray = new String[1];" +
+ NL + " strArray[0] = \"adsf\";" +
+ NL + " }" +
+ NL + " } " +
+ NL + "}");
+
+ createFile("MyTeam","public team class MyTeam extends MySuperTeam" +
+ NL + "{ " +
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * Test copy inheritance for role-array-references
+ */
+ public void testCopyRoleArrayReferences()
+ {
+
+
+ createFile("MySuperTeam","public team class MySuperTeam " +
+ NL + "{ " +
+ NL + " public class MyRole" +
+ NL + " { " +
+ NL + " MyRole[] roleArray;" +
+ NL + " public void roleMethod()" +
+ NL + " {" +
+ NL + " roleArray = new MyRole[1];" +
+ NL + " roleArray[0] = new MyRole();" +
+ NL + " }" +
+ NL + " } " +
+ NL + "}");
+
+ createFile("MyTeam","public team class MyTeam extends MySuperTeam" +
+ NL + "{ " +
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * Test copy inheritance for int-array-references
+ */
+ public void testCopyIntArrayReferences()
+ {
+
+
+ createFile("MySuperTeam","public team class MySuperTeam " +
+ NL + "{ " +
+ NL + " public class MyRole" +
+ NL + " { " +
+ NL + " int[] intArray;" +
+ NL + " public void roleMethod()" +
+ NL + " {" +
+ NL + " intArray = new int[1];" +
+ NL + " intArray[0] = 42;" +
+ NL + " }" +
+ NL + " } " +
+ NL + "}");
+
+ createFile("MyTeam","public team class MyTeam extends MySuperTeam" +
+ NL + "{ " +
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * Test copy inheritance for array-length-field access
+ */
+ public void testCopyIntArrayLengthFieldAccess()
+ {
+
+ createFile("MySuperTeam","public team class MySuperTeam " +
+ NL + "{ " +
+ NL + " public class MyRole" +
+ NL + " { " +
+ NL + " int[] intArray;" +
+ NL + " public void roleMethod()" +
+ NL + " {" +
+ NL + " intArray = new int[42];" +
+ NL + " intArray[0] = intArray.length;" +
+ NL + " }" +
+ NL + " } " +
+ NL + "}");
+
+ createFile("MyTeam","public team class MyTeam extends MySuperTeam" +
+ NL + "{ " +
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+
+ /**
+ * Test copy inheritance with missing import in subclass
+ */
+ public void testMissingImport1()
+ {
+ createFile("MySuperTeam","" +
+ NL + "public team class MySuperTeam " +
+ NL + "{ " +
+ NL + " public class MyRole {}" +
+ NL + "}");
+
+ createFile("MyTeam","" +
+ NL + "public team class MyTeam extends MySuperTeam" +
+ NL + "{ " +
+ NL + " public class MyRole" +
+ NL + " { " +
+ NL + " BigDecimal roleMethod()" +
+ NL + " {" +
+ NL + " return null;" +
+ NL + " }" +
+ NL + " } " +
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+ /**
+ * Test copy inheritance with missing import in subclass
+ */
+ public void testMissingImport2()
+ {
+ createFile("MySuperTeam","" +
+ NL + "public team class MySuperTeam " +
+ NL + "{ " +
+ NL + " public class MyRole {" +
+ //NL + " public void method(){}" +
+ NL + " }" +
+ NL + "}");
+
+ createFile("MyTeam","" +
+ NL + "public team class MyTeam extends MySuperTeam" +
+ NL + "{ " +
+ NL + " public class MyRole" +
+ NL + " { " +
+ NL + " BigDecimal roleMethod()" +
+ NL + " {" +
+ NL + " return null;" +
+ NL + " }" +
+ NL + " void roleMethod1()" +
+ NL + " {" +
+ NL + " return null;" +
+ NL + " }" +
+
+ NL + " } " +
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/ExternalRoleTest.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/ExternalRoleTest.java
new file mode 100644
index 0000000..794249f
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/ExternalRoleTest.java
@@ -0,0 +1,152 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: ExternalRoleTest.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.errorreporting;
+
+import java.io.File;
+
+import org.eclipse.objectteams.otdt.core.compiler.IOTConstants;
+import org.eclipse.objectteams.otdt.tests.compiler.TestBase;
+
+/**
+ * @author macwitte
+ */
+public class ExternalRoleTest extends TestBase implements IOTConstants{
+
+ public ExternalRoleTest(String testName)
+ {
+ super(testName);
+ }
+
+ /**
+ * Test for external defined role with special team-package declaration
+ */
+ public void testExternalRoleWithCompiledTeam()
+ {
+ createFile("MyRole","team package MyTeam;" +
+ NL + "public class MyRole {" +
+ NL + "}");
+
+ createFile("MyTeam","public team class MyTeam { " +
+ NL + " private MyRole r = null;" +
+ NL + "}");
+
+ compileFile("MyTeam");
+ assertTrue(isCompilationSuccessful());
+
+ compileFile("MyTeam"+File.separator+"MyRole");
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * Test for external defined role with special team-package declaration
+ */
+ public void testExternalRoleWithUncompiledTeam()
+ {
+ createFile("MyRole","team package MyTeam;" +
+ NL + "public class MyRole {" +
+ NL + " void foo() { System.out.println(MyTeam.this); }" +
+ NL + "}");
+
+ createFile("MyTeam","public team class MyTeam { " +
+ NL + " private MyRole r = null;" +
+ NL + "}");
+
+ compileFile("MyTeam"+File.separator+"MyRole");
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * Test for external defined role with special team-package declaration
+ */
+ public void testExternalRoleWithQualifiedPackageName()
+ {
+ createFile("MyRole","team package org.eclipse.objectteams.MyTeam;" +
+ NL + "public class MyRole {" +
+ NL + "}");
+
+ createFile("MyTeam","package org.eclipse.objectteams;" +
+ NL + "public team class MyTeam { " +
+ NL + " private MyRole r = null;" +
+ NL + "}");
+
+ compileFile("org"+File.separator+"objectteams"+File.separator+"MyTeam"+File.separator+"MyRole");
+ assertTrue(isCompilationSuccessful());
+
+ compileFile("org"+File.separator+"objectteams"+File.separator+"MyTeam");
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * Test for external defined role with special team-package declaration
+ * Expected Team has missing team Modifier
+ */
+ public void testExternalRoleWithMissingTeamModifier()
+ {
+ createFile("MyRole","team package MyTeam;" +
+ NL + "public class MyRole {" +
+ NL + "}");
+
+ createFile("MyTeam","public class MyTeam { " +
+ NL + " private MyRole r = null;" +
+ NL + "}");
+
+ compileFile("MyTeam"+File.separator+"MyRole");
+ assertFalse(isCompilationSuccessful());
+ }
+
+ /**
+ * Test for external defined role with special team-package declaration
+ * Expected Team does not exist
+ */
+ public void testExternalRoleWithMissingTeam()
+ {
+ createFile("MyRole","team package MyTeam;" +
+ NL + "public class MyRole {" +
+ NL + "}");
+
+ compileFile("MyTeam"+File.separator+"MyRole");
+ assertFalse(isCompilationSuccessful());
+ }
+
+ //http://nevermind.cs.tu-berlin.de/~gis/ot/2.4.2-otjld-inaccessible-base-class-9.html
+ public void inaccessiblebaseclass()
+ {
+ createFile("MyClass","package p1;"+
+ NL + "public class MyClass {"+
+ NL + " class InnerClass {}"+
+ NL + "}");
+
+ createFile("MyTeam","package p2;"+
+ NL + "public team class MyTeam {"+
+ NL + "public class MyRole extends p1.MyClass playedBy InnerClass {}"+
+ NL + "}");
+
+ compileFile("p1"+File.separator+"MyClass");
+ assertTrue(isCompilationSuccessful());
+
+ compileFile("p2"+File.separator+"MyTeam");
+ assertFalse(isCompilationSuccessful());
+
+ }
+
+
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/LiftingTest.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/LiftingTest.java
new file mode 100644
index 0000000..4039e8f
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/LiftingTest.java
@@ -0,0 +1,96 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: LiftingTest.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.errorreporting;
+
+import org.eclipse.objectteams.otdt.core.compiler.IOTConstants;
+import org.eclipse.objectteams.otdt.tests.compiler.TestBase;
+
+/**
+ * This class contains tests concerning the Lifting mechanism in ObjectTeams.
+ *
+ * @author brcan
+ * @version $Id: LiftingTest.java 23494 2010-02-05 23:06:44Z stephan $
+ */
+public class LiftingTest extends TestBase implements IOTConstants
+{
+ public LiftingTest(String testName)
+ {
+ super(testName);
+ }
+
+ /**
+ * A test for declared lifting.
+ */
+ public void testDeclaredLifting1()
+ {
+ createFile("MyBase","public class MyBase {}");
+
+ createFile("MyTeam","public team class MyTeam { " +
+ NL + " protected class MyRole playedBy MyBase {" +
+ NL + " }" +
+ NL + " public void method(MyBase as MyRole obj){" +
+ NL + " System.out.println(\"method(\"+obj+\")\");" +
+ NL + " }" +
+ NL + " public static void main (String[] args) {" +
+ NL + " (new MyTeam()).method(new MyBase());" +
+ NL + " }"+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * A test for smart lifting.
+ */
+ public void testSmartLifting1()
+ {
+ createFile("Base2", "public class Base2 {}");
+
+ createFile("Base3", "public class Base3 extends Base2{}");
+
+ createFile("MyTeam","public team class MyTeam extends org.objectteams.Team {" +
+ NL + " public static void main(String[] args){" +
+ NL + " System.out.println(\"MyTeam\");" +
+ NL + " new MyTeam();" +
+ NL + " }" +
+ NL + " public MyTeam() {" +
+ NL + " super();" +
+ NL + " System.out.println(\"MyTeam.MyTeam()\");" +
+ NL + " System.out.println("+new String(_OT_LIFT_TO)+OT_DELIM+"Role2(this, new Base2(), 0));" +
+ NL + " }" +
+ NL + " public class Role1 {}" +
+ NL + " public class Role2 extends Role1 playedBy Base2{}" +
+ NL + " public class Role3 extends Role2 playedBy Base3{}" +
+ NL + " public class Role4 extends Role3 playedBy Base3{}" +
+ NL + " public class Role6 extends Role4 playedBy Base3{}" +
+ NL + " public class Role5 extends Role4 playedBy Base3{}" +
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ // TODO (SH): what problem expected? definite ambiguity 7.3(b)?
+ // need to replace explicit lift-invocation with some legal syntax.
+ assertFalse(isCompilationSuccessful());
+ }
+}
+
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/LoweringTest.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/LoweringTest.java
new file mode 100644
index 0000000..33c0690
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/LoweringTest.java
@@ -0,0 +1,153 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: LoweringTest.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.errorreporting;
+
+import org.eclipse.objectteams.otdt.tests.compiler.TestBase;
+
+/**
+ * This class contains tests concerning the Lowering mechanism in ObjectTeams.
+ *
+ * @author brcan
+ * @version $Id: LoweringTest.java 23494 2010-02-05 23:06:44Z stephan $
+ */
+public class LoweringTest extends TestBase
+{
+ public LoweringTest(String testName)
+ {
+ super(testName);
+ }
+
+ /**
+ * Testing arraylowering; simple structure of classes,
+ * complex lowering.
+ */
+ public void testArrayLowering1()
+ {
+ createFile("MyBase","public class MyBase"
+ + NL + "{"
+ + NL + ""
+ + NL + " public void myBaseLowerMethod(MyBase[][] b1, MyBase[][] b2)"
+ + NL + " {"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ createFile("MyTeam",
+ "public team class MyTeam"
+ + NL + "{"
+ + NL + ""
+ + NL + " public class Role playedBy MyBase"
+ + NL + " {"
+ + NL + ""
+ + NL + " abstract void myLoweringCallout(Role[][] r1, Role[][] r2);"
+ + NL + ""
+ + NL + " void myLoweringCallout(Role[][] r1, Role[][] r2) -> void myBaseLowerMethod(MyBase[][] r1, MyBase[][] r2);"
+ + NL + " }"
+ + NL + ""
+ + NL + " public static void main(String[] args){"
+ + NL + " new MyTeam();"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * A test for lowering.
+ */
+ public void testLowering1()
+ {
+ createFile("MyBase","public class MyBase"
+ + NL + "{"
+ + NL + " public void myBaseMethod(int a)"
+ + NL + " {"
+ + NL + " System.out.println(\"normal\");"
+ + NL + " }"
+ + NL + ""
+ + NL + " public int myBaseLowerMethod(MyBase b)"
+ + NL + " {"
+ + NL + " System.out.println(\"lowered\");"
+ + NL + " return 5;"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ createFile("MyBase2","public class MyBase2 extends MyBase"
+ + NL + "{"
+ + NL + " public void myBaseMethod(int a)"
+ + NL + " {"
+ + NL + " System.out.println(\"normal\");"
+ + NL + " }"
+ + NL + ""
+ + NL + " public int myBaseLowerMethod(MyBase b)"
+ + NL + " {"
+ + NL + " System.out.println(\"lowered\");"
+ + NL + " return 5;"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ createFile("MyTeam",
+ "public team class MyTeam extends org.objectteams.Team"
+ + NL + "{"
+ + NL + " public MyTeam()"
+ + NL + " {"
+ + NL + " Role r = new Role(new MyBase());"
+ + NL + " r.myCallout(4);"
+ + NL + " }"
+ + NL + ""
+ + NL + " public class Role0"
+ + NL + " {"
+ + NL + ""
+ + NL + " void myCallout(int a)"
+ + NL + " {"
+ + NL + " System.out.println(\"Hallo\");"
+ + NL + " }"
+ + NL + " }"
+ + NL + ""
+ + NL + " public class Role extends Role0 playedBy MyBase"
+ + NL + " {"
+ + NL + ""
+ + NL + " abstract int myLoweringCallout(Role r);"
+ + NL + ""
+ + NL + " void myCallout(int a) => void myBaseMethod(int a);"
+ + NL + " int myLoweringCallout(Role r) -> int myBaseLowerMethod(MyBase r);"
+ + NL + " }"
+ + NL + ""
+ + NL + " public class Role2 playedBy MyBase2"
+ + NL + " {"
+ + NL + " }"
+ + NL + ""
+ + NL + " public static void main(String[] args){"
+ + NL + " new MyTeam();"
+ + NL + " }"
+ + NL + "}"
+ + NL);
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/ParameterMappingsTest.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/ParameterMappingsTest.java
new file mode 100644
index 0000000..34e11a6
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/ParameterMappingsTest.java
@@ -0,0 +1,215 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: ParameterMappingsTest.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.errorreporting;
+
+import org.eclipse.objectteams.otdt.tests.compiler.TestBase;
+
+/**
+ * This class contains tests concerning the parameter mappings in callin and
+ * callout bindings.
+ *
+ * @author brcan
+ * @version $Id: ParameterMappingsTest.java 23494 2010-02-05 23:06:44Z stephan $
+ */
+public class ParameterMappingsTest extends TestBase
+{
+ public ParameterMappingsTest(String testName)
+ {
+ super(testName);
+ }
+
+ /**
+ * A base method with a parameter is used in a callout binding.
+ */
+ public void testCalloutParameterMappingResult1()
+ {
+ createFile("MyBase",
+ "public class MyBase { \r\n"+
+ " public int baseMethod() { return 2; } \r\n"+
+ "} \r\n"
+ );
+
+ createFile("SuperRoleClass",
+ "public class SuperRoleClass { \r\n"+
+ " public int roleMethod() { return 1000; } \r\n"+
+ "} \r\n"
+ );
+
+ createFile("MyTeam",
+ "public team class MyTeam { \r\n"+
+ " protected class MyRole extends SuperRoleClass playedBy MyBase { \r\n"+
+ " int roleMethod() => int baseMethod() with { \r\n"+
+ " result <- result * 5 \r\n"+
+ " } \r\n"+
+ " } \r\n"+
+ "} \r\n"
+ );
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * A base method with a parameter is used in a callout binding.
+ */
+ public void testCalloutParameterMappings1()
+ {
+ createFile("MyBase",
+ "public class MyBase { \r\n"+
+ " public void baseMethod(boolean valueB) {} \r\n"+
+ "} \r\n"
+ );
+
+ createFile("MyTeam",
+ "public team class MyTeam { \r\n"+
+ " protected class MyRole playedBy MyBase { \r\n"+
+ " public abstract void roleMethod(int valueA); \r\n"+
+ " void roleMethod(int valueA) -> void baseMethod(boolean valueB) with { \r\n"+
+ " valueA == 1 -> valueB \r\n"+
+ " } \r\n"+
+ " } \r\n"+
+ "} \r\n"
+ );
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * A base method with a parameter is used in a callin binding.
+ */
+ public void testCallinParameterMappings1()
+ {
+ createFile("MyBase",
+ "public class MyBase { \r\n"+
+ " public void baseMethod(float valueB) {} \r\n"+
+ "} \r\n"
+ );
+
+ createFile("MyTeam",
+ "public team class MyTeam { \r\n"+
+ " protected class MyRole playedBy MyBase { \r\n"+
+ " public void roleMethod(float valueA) { \r\n"+
+ " } \r\n"+
+ " void roleMethod(float valueA) <- before void baseMethod(float valueB) with { \r\n"+
+ " valueA <- valueB * 3.14f \r\n"+
+ " } \r\n"+
+ " } \r\n"+
+ "} \r\n"
+ );
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * A base method with a parameter list is used in a callout binding.
+ */
+ public void testCalloutParameterMappingList1()
+ {
+ createFile("MyBase",
+ "public class MyBase { \r\n"+
+ " public void baseMethod(float valueB, float valueC) { \r\n"+
+ " } \r\n"+
+ "} \r\n"
+ );
+
+ createFile("MyTeam",
+ "public team class MyTeam{ \r\n"+
+ " protected class MyRole playedBy MyBase { \r\n"+
+ " public abstract void roleMethod(float valueA); \r\n"+
+ " void roleMethod(float valueA) -> void baseMethod(float valueB, float valueC) with { \r\n"+
+ " valueA * 3.14f -> valueB , \r\n"+
+ " valueA * 3.14f -> valueC \r\n"+
+ " } \r\n"+
+ " } \r\n"+
+ "} \r\n"
+ );
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * A base method with a parameter list is used in a callin binding.
+ */
+ public void testCallinParameterMappingList1()
+ {
+ createFile("MyBase",
+ "public class MyBase { \r\n"+
+ " public void baseMethod(float valueB, float valueC) { \r\n"+
+ " } \r\n"+
+ "} \r\n"
+ );
+
+ createFile("MyTeam",
+ "public team class MyTeam{ \r\n"+
+ " protected class MyRole playedBy MyBase { \r\n"+
+ " public void roleMethod(float valueA) { \r\n"+
+ " } \r\n"+
+ " void roleMethod(float valueA) <- after void baseMethod(float valueB, float valueC) with { \r\n"+
+ " valueA <- valueC * 3.14f \r\n"+
+ " } \r\n"+
+ " } \r\n"+
+ "} \r\n"
+ );
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+
+ /**
+ * Broken callin-binding:
+ * the base-method's argument list is different from the one in the binding declaration.
+ */
+ public void testCallinParameterMappingList2()
+ {
+ createFile("MyBase",
+ "public class MyBase { \r\n"+
+ " public void baseMethod(float valueB) { \r\n"+
+ " } \r\n"+
+ "} \r\n"
+ );
+
+ createFile("MyTeam",
+ "public team class MyTeam{ \r\n"+
+ " protected class MyRole playedBy MyBase { \r\n"+
+ " public void roleMethod(float valueA) { \r\n"+
+ " } \r\n"+
+ " void roleMethod(float valueA) <- replace void baseMethod(float valueB, float valueC) with { \r\n"+
+ " valueA <- valueB * 3.14, \r\n"+
+ " valueA <- valueC * 3.14 \r\n"+
+ " } \r\n"+
+ " } \r\n"+
+ "} \r\n"
+ );
+
+ compileFile("MyTeam");
+
+ assertFalse(isCompilationSuccessful());
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/ParserTest.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/ParserTest.java
new file mode 100644
index 0000000..ec186d1
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/ParserTest.java
@@ -0,0 +1,125 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: ParserTest.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.errorreporting;
+
+import org.eclipse.objectteams.otdt.tests.compiler.TestBase;
+
+/**
+ * This class contains tests concerning the parser.
+ *
+ * @author brcan
+ * @version $Id: ParserTest.java 23494 2010-02-05 23:06:44Z stephan $
+ */
+public class ParserTest extends TestBase
+{
+ public ParserTest(String testName)
+ {
+ super(testName);
+ }
+
+ /**
+ * A test consisting of a main class, a base class, a team with two
+ * methods (team-level methods) and a role which has a callin method
+ * and a callin + callout binding.
+ */
+// TODO(jwl): What is the gist we are actually testing here?
+ public void testParser()
+ {
+ createFile("Main",
+ "public class Main"
+ + NL + "{"
+ + NL + " public static void main(String[] args)"
+ + NL + " {"
+ + NL + " MyClass baseObj = new MyClass();"
+ + NL + " MyTeam teamInstance = new MyTeam();"
+ + NL + " within(teamInstance)"
+ + NL + " {"
+ + NL + " System.out.println();"
+ + NL + " System.out.println(\" Main.main --> MyTeam.whisper Hello \");"
+ + NL + " teamInstance.whisper(baseObj, \"Hello\");"
+ + NL + " }"
+ + NL + " }"
+ + NL + "}");
+
+ createFile("MyClass",
+ "public class MyClass "
+ + NL + "{"
+ + NL + " public void say(String msg)"
+ + NL + " {"
+ + NL + " System.out.println(\" MyBase says : \" + msg);"
+ + NL + " }"
+ + NL + " public void whisper(String msg)"
+ + NL + " {"
+ + NL + " System.out.println(\" MyBase whispers : \" + msg);"
+ + NL + " }"
+ + NL + "}");
+
+ createFile("MyTeam",
+ "public team class MyTeam"
+ + NL + "{"
+ + NL + " public class MyRole playedBy MyClass"
+ + NL + " {"
+ + NL + " callin void say(String msg)"
+ + NL + " {"
+ + NL + " System.out.println(\" MyRole says : \" + msg);"
+ + NL + " base.say(msg);"
+ + NL + " }"
+ + NL + " say <- replace whisper;"
+ + NL + " public abstract void whisper(String msg);"
+ + NL + " whisper -> whisper;"
+ + NL + " }"
+ + NL + " public void say(String msg)"
+ + NL + " {"
+ + NL + " System.out.println(\" MyTeam says : \" + msg);"
+ + NL + " }"
+ + NL + " public void whisper(MyClass as MyRole role, String msg)"
+ + NL + " {"
+ + NL + " System.out.println(\" MyTeam whispers : \" + msg );"
+ + NL + " role.whisper(msg);"
+ + NL + " }"
+ + NL + "}");
+
+ compileFile("Main");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ public void testScopedKeywordJavadoc()
+ {
+ createFile("Main",
+ "public class Main"
+ + NL + "{"
+ + NL + " /**"
+ + NL + " * @param base an input"
+ + NL + " */"
+ + NL + " public void foo(String base)"
+ + NL + " {"
+ + NL + " System.out.println(base);"
+ + NL + " }"
+ + NL + "}");
+
+
+
+ compileFile("Main");
+
+ assertTrue(isCompilationSuccessful());
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/RoleBaseInheritanceTest.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/RoleBaseInheritanceTest.java
new file mode 100644
index 0000000..c1eba20
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/RoleBaseInheritanceTest.java
@@ -0,0 +1,255 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: RoleBaseInheritanceTest.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.errorreporting;
+
+import org.eclipse.objectteams.otdt.tests.compiler.TestBase;
+
+
+/**
+ * Tests the relationship between role and base classes.
+ *
+ * @author kaschja
+ * @version $Id: RoleBaseInheritanceTest.java 23494 2010-02-05 23:06:44Z stephan $
+ */
+public class RoleBaseInheritanceTest extends TestBase
+{
+ public RoleBaseInheritanceTest(String testName)
+ {
+ super(testName);
+ }
+
+ /**
+ * A role class must not be bound to a non-existing base class.
+ */
+ public void testBindingOfNonExistingBaseClass1()
+ {
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " class MyRole playedBy NonExistingBase " +
+ NL + " { " +
+ NL + " } " +
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+ /**
+ * A regular class (non-team) must not be bound to a base class.
+ */
+ public void testBindingRegularClassWithBaseClass1()
+ {
+ createFile("MyBase","public class MyBase {}");
+
+ createFile("MyClass","public class MyClass " +
+ NL + "{" +
+ NL + " class MyRole playedBy MyBase {}" +
+ NL + "}");
+
+ compileFile("MyClass");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+ /**
+ * A role class must not be bound to a primitive type.
+ * In this testing sample the primitive type is int.
+ */
+ public void testBindingOfPrimitiveType1()
+ {
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " class MyRole playedBy int " +
+ NL + " { " +
+ NL + " } " +
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+ /**
+ * A role class must not be bound to an array.
+ * In this testing sample the array element type is the primitive type int.
+ */
+ public void testBindingOfArrayType1()
+ {
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " class MyRole playedBy int[] " +
+ NL + " { " +
+ NL + " } " +
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+ /**
+ * A role class must not be bound to an array.
+ * In this testing sample the array element type is a class type.
+ */
+ public void testBindingOfArrayType2()
+ {
+ createFile("MyBase", "public class MyBase{}");
+
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " class MyRole playedBy MyBase[] " +
+ NL + " { " +
+ NL + " } " +
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+
+ /**
+ * A role class must not be bound to a base class
+ * if both classes have identical names
+ * In this testing sample the classes reside in the same package
+ */
+ public void testBindingWithNamingClash1()
+ {
+ createFile("Role", "public class Role{}");
+
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " class Role playedBy Role " +
+ NL + " { " +
+ NL + " } " +
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+
+//TODO fix problem with creating packages with method TestBase.createFile
+ /**
+ * A role class must not be bound to a base class
+ * if both classes have identical names
+ * In this testing sample the classes reside in different packages
+ */
+// public void testBindingWithNamingClash2()
+// {
+// createFile("basepackage/Role", "package basepackage;\npublic class Role{}");
+//
+// createFile("teampackage/MyTeam",
+// "package teampackage;" +
+// NL + "public team class MyTeam " +
+// NL + "{ " +
+// NL + " class Role playedBy Role " +
+// NL + " { " +
+// NL + " } " +
+// NL + "}");
+//
+// compileFile("MyTeam");
+//
+// assertFalse(isCompilationSuccessful());
+// }
+
+ /**
+ * A role class must not be bound to a base class
+ * if there is another role in the same team
+ * which has the same name as the bound base class.
+ */
+ public void testBindingWithNamingClash3()
+ {
+ createFile("RoleB", "public class RoleB{}");
+
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " class RoleA playedBy RoleB" +
+ NL + " { " +
+ NL + " } " +
+ NL + " class RoleB" +
+ NL + " { " +
+ NL + " } " +
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+ /**
+ * A role class must not be bound to a base class
+ * if there is a role in a superteam
+ * which has the same name as the bound base class.
+ */
+ public void testBindingWithNamingClash4()
+ {
+ createFile("RoleB", "public class RoleB{}");
+
+ createFile("Superteam","public team class Superteam " +
+ NL + "{ " +
+ NL + " class RoleB" +
+ NL + " { " +
+ NL + " } " +
+ NL + "}");
+
+ createFile("Subteam","public team class Subteam extends Superteam" +
+ NL + "{ " +
+ NL + " class RoleA playedBy RoleB" +
+ NL + " { " +
+ NL + " } " +
+ NL + "}");
+
+ compileFile("Subteam");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+ /**
+ * A role class must not be bound to a base class
+ * if there is a role in a subteam
+ * which has the same name as the bound base class.
+ */
+ public void testBindingWithNamingClash5()
+ {
+ createFile("RoleB", "public class RoleB{}");
+
+ createFile("Superteam","public team class Superteam " +
+ NL + "{ " +
+ NL + " class RoleA playedBy RoleB" +
+ NL + " { " +
+ NL + " } " +
+ NL + "}");
+
+ createFile("Subteam","public team class Subteam extends Superteam" +
+ NL + "{ " +
+ NL + " class RoleB" +
+ NL + " { " +
+ NL + " } " +
+ NL + "}");
+
+ compileFile("Subteam");
+
+ assertFalse(isCompilationSuccessful());
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/RoleContainmentTest.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/RoleContainmentTest.java
new file mode 100644
index 0000000..4c1a890
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/RoleContainmentTest.java
@@ -0,0 +1,56 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: RoleContainmentTest.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.errorreporting;
+
+import org.eclipse.jdt.core.compiler.IProblem;
+import org.eclipse.objectteams.otdt.tests.compiler.TestBase;
+
+/**
+ * This class contains tests concerning roles.
+ *
+ * @author kaschja
+ * @version $Id: RoleContainmentTest.java 23494 2010-02-05 23:06:44Z stephan $
+ */
+public class RoleContainmentTest extends TestBase
+{
+ public RoleContainmentTest(String testName)
+ {
+ super(testName);
+ }
+
+ /**
+ * A role that is not declared as abstract contains an abstract method.
+ * Comment:
+ * A role has to be declared as abstract if it contains an abstract method.
+ */
+ public void testAbstractMethodInNonAbstractRole1()
+ {
+ createFile("MyTeam","public team class MyTeam { " +
+ NL + " protected class MyRole {" +
+ NL + " public abstract void roleMethod();" +
+ NL + " }"+
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(hasExpectedProblems(new int[] { IProblem.AbstractMethodsInConcreteClass, IProblem.AbstractMethodInAbstractClass } ));
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/RoleInheritanceTest.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/RoleInheritanceTest.java
new file mode 100644
index 0000000..330165b
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/RoleInheritanceTest.java
@@ -0,0 +1,357 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: RoleInheritanceTest.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.errorreporting;
+
+import org.eclipse.objectteams.otdt.tests.compiler.TestBase;
+
+/**
+ * This class contains tests concerning role inheritance.
+ *
+ * @author kaschja
+ * @version $Id: RoleInheritanceTest.java 23494 2010-02-05 23:06:44Z stephan $
+ */
+public class RoleInheritanceTest extends TestBase
+{
+ public RoleInheritanceTest(String testName)
+ {
+ super(testName);
+ }
+
+ /**
+ * A role extends explicitly a role of a foreign team (non-superteam).
+ * Both roles have the same name.
+ * Comment:
+ * A role can only extend explicitly another role of the same team.
+ */
+ public void testRoleExtendsRoleWithSameNameOfForeignTeam1()
+ {
+ createFile("TeamA","public team class TeamA " +
+ NL + "{ " +
+ NL + " protected class Role {} " +
+ NL + "}");
+
+ createFile("TeamB","public team class TeamB " +
+ NL + "{ " +
+ NL + " protected class Role extends TeamA.Role {} " +
+ NL + "}");
+
+ compileFile("TeamB");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+ /**
+ * A role extends explicitly a role of a foreign team (non-superteam).
+ * Comment:
+ * A role can only extend explicitly another role of the same team.
+ */
+ public void testRoleExtendsRoleOfForeignTeam1()
+ {
+ createFile("TeamA","public team class TeamA " +
+ NL + "{ " +
+ NL + " protected class RoleA {} " +
+ NL + "}");
+
+ createFile("TeamB","public team class TeamB " +
+ NL + "{ " +
+ NL + " protected class RoleB extends TeamA.RoleA {} " +
+ NL + "}");
+
+ compileFile("TeamB");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+ /**
+ * A role inherits implicitly and explicitly a role from the superteam.
+ * Comment:
+ * A role may not inherit a role explicitly if it is already inherited
+ * implicitly from the superteam (by name-matching).
+ */
+ public void testRoleInheritsRoleImplicitlyAndExplicitlyFromSuperTeam1()
+ {
+ createFile("TeamA","public team class TeamA " +
+ NL + "{ " +
+ NL + " protected class Role {} " +
+ NL + "}");
+
+ createFile("TeamB","public team class TeamB extends TeamA" +
+ NL + "{ " +
+ NL + " protected class Role extends TeamA.Role {} " +
+ NL + "}");
+
+ compileFile("TeamB");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+ /**
+ * A role inherits from an external class.
+ */
+ public void testRoleExtendsExternalClass1()
+ {
+ createFile("MyClass","public class MyClass " +
+ NL + "{ " +
+ NL + "}");
+
+ createFile("Team","public team class Team " +
+ NL + "{ " +
+ NL + " protected class Role extends MyClass {} " +
+ NL + "}");
+
+ compileFile("Team");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * A role inherits explicitly from an abstract role.
+ * It does not implement the abstract methods.
+ * Comment:
+ * A role has to implement the abstract methods if it extends
+ * an abstract role.
+ */
+ public void testRoleInheritsExplicitlyFromAbstractRole1()
+ {
+ createFile("MyTeam","public team class MyTeam { " +
+ NL + " abstract class Role1 {" +
+ NL + " public abstract void role1Method();" +
+ NL + " }" +
+ NL + " class Role2 extends Role1 {} " +
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+ /**
+ * A role inherits implicitly from an abstract role.
+ * It does not implement the abstract methods.
+ * Comment:
+ * A role has to implement the abstract methods of the implicitly
+ * inherited abstract role.
+ */
+ public void testRoleInheritsImplicitlyFromAbstractRole1()
+ {
+ createFile("TeamA","public team class TeamA { " +
+ NL + " abstract class RoleA {" +
+ NL + " public abstract void roleMethod();" +
+ NL + " }" +
+ NL + "}");
+
+ createFile("TeamB","public team class TeamB extends TeamA " +
+ NL + "{ " +
+ NL + " protected class RoleA {} " +
+ NL + "}");
+
+ compileFile("TeamB");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+ /**
+ * An implicitly inherited role inherits explicitly from an external class.
+ * The super-role does not extend any class.
+ */
+ public void testImplicitInheritedRoleExtendsExternalClass1()
+ {
+ createFile("ExternalClass","public class ExternalClass " +
+ NL + "{ " +
+ NL + "}");
+
+ createFile("TeamA","public team class TeamA " +
+ NL + "{ " +
+ NL + " protected class Role {} " +
+ NL + "}");
+
+ createFile("TeamB","public team class TeamB extends TeamA" +
+ NL + "{ " +
+ NL + " protected class Role extends ExternalClass {} " +
+ NL + "}");
+
+ compileFile("TeamB");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * An implicitly inherited role inherits explicitly from an external class.
+ * The super-role extends a different class than the sub-role.
+ * Comment:
+ * An implicitly inherited role has to extend the same external class
+ * as the super-role.
+ */
+ public void testImplicitInheritedRoleExtendsExternalClass2()
+ {
+ createFile("ExternalClass","public class ExternalClass " +
+ NL + "{ " +
+ NL + "}");
+
+ createFile("DifferentClass","public class DifferentClass " +
+ NL + "{ " +
+ NL + "}");
+
+ createFile("TeamA","public team class TeamA " +
+ NL + "{ " +
+ NL + " protected class Role extends DifferentClass {} " +
+ NL + "}");
+
+ createFile("TeamB","public team class TeamB extends TeamA" +
+ NL + "{ " +
+ NL + " protected class Role extends ExternalClass {} " +
+ NL + "}");
+
+ compileFile("TeamB");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+ /**
+ * A sub-role has a restricted visibility compared to the super-role.
+ * Comment:
+ * A role may not restrain the visibility of the implicitly inherited role.
+ * (does the private modifier actually makes sense in a role context?)
+ */
+ public void testRestrictedVisibilityOfSubRole1()
+ {
+ createFile("TeamA","public team class TeamA " +
+ NL + "{ " +
+ NL + " public class Role {} " +
+ NL + "}");
+
+ createFile("TeamB","public team class TeamB extends TeamA" +
+ NL + "{ " +
+ NL + " protected class Role {} " +
+ NL + "}");
+
+ compileFile("TeamB");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+ /**
+ * An overwriting method in a sub-role has a restricted visibility compared
+ * to the overwritten method in the super-role.
+ * Comment:
+ * A method in a role may not restrain the visibility of the
+ * implicitly inherited role-method.
+ */
+ public void testRestrictedVisibilityOfMethodInSubRole1()
+ {
+ createFile("TeamA","public team class TeamA " +
+ NL + "{ " +
+ NL + " protected class Role {" +
+ NL + " public void roleMethod() {};" +
+ NL + " }" +
+ NL + "}");
+
+ createFile("TeamB","public team class TeamB extends TeamA" +
+ NL + "{ " +
+ NL + " protected class Role {" +
+ NL + " private void roleMethod() {};" +
+ NL + " }" +
+ NL + "}");
+
+ compileFile("TeamB");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+ /**
+ * An implicitly inherited role does not implement all the interfaces
+ * of the super-role.
+ * Commment:
+ * An implicitly inherited role has to implement all the interfaces of the
+ * super-role.
+ */
+ public void testImplementationOfInterfacesBySubRole1()
+ {
+ createFile("IState","public interface IState" +
+ NL + "{" +
+ NL + " public IState getState();" +
+ NL + "}");
+
+ createFile("ITransfer","public interface ITransfer" +
+ NL + "{" +
+ NL + " public void doTransfer();" +
+ NL + "}");
+
+ createFile("TeamA","public team class TeamA " +
+ NL + "{ " +
+ NL + " protected class Role implements IState, ITransfer " +
+ NL + " {" +
+ NL + " public IState getState() {}" +
+ NL + " public void doTransfer() {}" +
+ NL + " }" +
+ NL + "}");
+
+ createFile("TeamB","public team class TeamB extends TeamA" +
+ NL + "{ " +
+ NL + " protected class Role implements IState " +
+ NL + " {" +
+ NL + " public IState getState() {}" +
+ NL + " }" +
+ NL + "}");
+
+ compileFile("TeamB");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+ /**
+ * An implicitly inherited role implements more interfaces than
+ * the super-role.
+ */
+ public void testImplementationOfInterfacesBySubRole2()
+ {
+ createFile("IState","public interface IState" +
+ NL + "{" +
+ NL + " public IState getState();" +
+ NL + "}");
+
+ createFile("ITransfer","public interface ITransfer" +
+ NL + "{" +
+ NL + " public void doTransfer();" +
+ NL + "}");
+
+ createFile("TeamA","public team class TeamA " +
+ NL + "{ " +
+ NL + " protected class Role implements IState" +
+ NL + " {" +
+ NL + " public IState getState() { return null; }" +
+ NL + " }" +
+ NL + "}");
+
+ createFile("TeamB","public team class TeamB extends TeamA" +
+ NL + "{ " +
+ NL + " protected class Role implements IState, ITransfer " +
+ NL + " {" +
+ NL + " public IState getState() { return tsuper.getState(); }" +
+ NL + " public void doTransfer() {}" +
+ NL + " }" +
+ NL + "}");
+
+ compileFile("TeamB");
+
+ assertTrue(isCompilationSuccessful());
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/SourceSnippetRecoveryTest.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/SourceSnippetRecoveryTest.java
new file mode 100644
index 0000000..cd31c03
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/SourceSnippetRecoveryTest.java
@@ -0,0 +1,55 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: SourceSnippetRecoveryTest.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.errorreporting;
+
+import org.eclipse.jdt.core.compiler.IProblem;
+import org.eclipse.objectteams.otdt.tests.compiler.TestBase;
+
+
+/**
+ * This class contains tests concerning source code snippets, or wrong code.
+ *
+ * @author Markus Witte
+ */
+public class SourceSnippetRecoveryTest extends TestBase {
+
+ public SourceSnippetRecoveryTest(String testName)
+ {
+ super(testName);
+ }
+
+ /**
+ * A "replace-callin binding" is used with a base call.
+ * Bound role method must be declared as callin method.
+ */
+ public void testIncompleteCallinBinding()
+ {
+ createFile("MyClass","public class MyClass " +
+ NL + "{ " +
+ NL + " baseMethod <- met1, met2;" +
+ NL + "} ");
+
+
+ compileFile("MyClass");
+
+ assertTrue(hasExpectedProblems(new int[] {IProblem.ParsingErrorMergeTokens})); // silly but factual
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/TeamActivationTest.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/TeamActivationTest.java
new file mode 100644
index 0000000..4894d12
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/TeamActivationTest.java
@@ -0,0 +1,84 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: TeamActivationTest.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.errorreporting;
+
+import org.eclipse.jdt.core.compiler.IProblem;
+import org.eclipse.objectteams.otdt.tests.compiler.TestBase;
+
+/**
+ * This class is for testing team activation.
+ * Note, test cases which tried to test sequences of activation statements are removed,
+ * because
+ * (a) this can only be tested when also executing the program, and
+ * (b) test goals stated in comments were wrong.
+ *
+ * @author kaschja
+ * @version $Id: TeamActivationTest.java 23494 2010-02-05 23:06:44Z stephan $
+ */
+public class TeamActivationTest extends TestBase
+{
+ public TeamActivationTest(String testName)
+ {
+ super(testName);
+ }
+
+ /**
+ * team activation with "within" must have team as argument
+ */
+ public void testWithinWithTeamAsArgument() {
+ createFile("MyTeam","public team class MyTeam {}");
+
+ createFile("MyClient","public class MyClient"+
+ NL + "{"+
+ NL + " public static void main(String[] argv) {"+
+ NL + " MyTeam myTeam = new MyTeam();"+
+ NL + " within(myTeam) {"+
+ NL + " System.out.println(\"MyClient.main.within\");"+
+ NL + " }"+
+ NL + " }"+
+ NL + "}");
+
+ compileFile("MyClient");
+
+ assertTrue(isCompilationSuccessful());
+ }
+ /**
+ * team activation with "within" dont have normal class as argument
+ */
+ public void testWithinWithRegularClassAsArgument() {
+ createFile("MyClass","public class MyClass {}");
+
+ createFile("MyClient","public class MyClient"+
+ NL + "{"+
+ NL + " public static void main(String[] argv) {"+
+ NL + " MyClass myClass = new MyClass();"+
+ NL + " within(myClass) {"+
+ NL + " System.out.println(\"MyClient.main.within\");"+
+ NL + " }"+
+ NL + " }"+
+ NL + "}");
+
+ compileFile("MyClient");
+
+ assertTrue(hasExpectedProblems(new int[] {IProblem.WithinStatementNeedsTeamInstance}));
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/TeamContainmentTest.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/TeamContainmentTest.java
new file mode 100644
index 0000000..108bd0c
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/TeamContainmentTest.java
@@ -0,0 +1,188 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: TeamContainmentTest.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.errorreporting;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jdt.core.compiler.IProblem;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+import org.eclipse.objectteams.otdt.tests.compiler.TestBase;
+
+
+/**
+ * This class contains tests concerning team inheritance.
+ *
+ * @author kaschja
+ * @version $Id: TeamContainmentTest.java 23494 2010-02-05 23:06:44Z stephan $
+ */
+public class TeamContainmentTest extends TestBase
+{
+ public TeamContainmentTest(String testName)
+ {
+ super(testName);
+ }
+
+ /* An empty team with no package statement should compile without
+ * problems.
+ */
+ public void testEmptyTeam1()
+ {
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /* An empty team with a specific package statement should compile without
+ * problems.
+ */
+ public void testEmptyTeam2()
+ {
+ createFile("MyTeam","package teams;" +
+ NL + "public team class MyTeam " +
+ NL + "{ " +
+ NL + "}");
+
+ compileFile("teams"+File.separator+"MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /* An empty team with a specific package statement should compile without
+ * problems.
+ */
+ public void testEmptyTeam3()
+ {
+ createFile("MyTeam","" + "package pkg1.pkg2.pkg3;" +
+ NL + "public team class MyTeam " +
+ NL + "{ " +
+ NL + "}");
+
+ compileFile("pkg1"+File.separator+"pkg2"+File.separator+"pkg3"+File.separator+"MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * A team that is not declared as abstract contains an abstract role.
+ * Comment:
+ * A team has to be declared as abstract if it contains an abstract relevant role.
+ * For the notion of "relevant roles" see OT lang.def. 7.1(c) (SH).
+ */
+ public void testAbstractRoleInNonAbstractTeam1()
+ {
+ // TODO (SH): differentiate relevant/irrelevant roles (s.above).
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " abstract protected class MyRole " +
+ NL + " {" +
+ NL + " abstract void roleMethod();" +
+ NL + " }" +
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * A team that is not declared as abstract contains an abstract
+ * team-level method.
+ * Comment:
+ * A team has to be declared as abstract if it contains an abstract
+ * team-level method.
+ */
+ public void testAbstractMethodInNonAbstractTeam1()
+ {
+ createFile("MyTeam","public team class MyTeam " +
+ NL + "{ " +
+ NL + " abstract void teamMethod();" +
+ NL + "}");
+
+ compileFile("MyTeam");
+
+ assertTrue(hasExpectedProblems(new int[]{ IProblem.AbstractMethodsInConcreteClass, IProblem.AbstractMethodInAbstractClass}));
+ }
+
+ public void testRoleLackingJavadoc1()
+ {
+ createFile("MyBase","/** Comment for MyBase. */" +
+ NL + "public class MyBase " +
+ NL + "{ " +
+ NL + "}");
+
+ createFile("MyTeam","/** Comment for MyTeam. */" +
+ NL + "public team class MyTeam " +
+ NL + "{ " +
+ NL + " public class MyRole playedBy MyBase" +
+ NL + " {" +
+ NL + " }" +
+ NL + "}");
+
+ Map<String,String> options= new HashMap<String,String>();
+ options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
+ options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
+ options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
+ options.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED);
+ options.put(CompilerOptions.OPTION_ReportInvalidJavadoc, CompilerOptions.ERROR);
+ options.put(CompilerOptions.OPTION_ReportInvalidJavadocTags, CompilerOptions.ERROR);
+ options.put(CompilerOptions.OPTION_ReportMissingJavadocComments, CompilerOptions.ERROR);
+
+ compileFile("MyTeam", null, options);
+
+ assertTrue(hasExpectedProblems(new int[]{ IProblem.JavadocMissing})); // reported only once!
+ }
+
+ public void testRoleLackingJavadoc2()
+ {
+ createFile("MyBase","/** Comment for MyBase. */" +
+ NL + "public class MyBase " +
+ NL + "{ " +
+ NL + "}");
+
+ createFile("MyTeam","/** Comment for MyTeam. */" +
+ NL + "public team class MyTeam " +
+ NL + "{ " +
+ NL + " protected class MyRole playedBy MyBase" +
+ NL + " {" +
+ NL + " }" +
+ NL + "}");
+
+ Map<String,String> options= new HashMap<String,String>();
+ options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
+ options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
+ options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
+ options.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED);
+ options.put(CompilerOptions.OPTION_ReportInvalidJavadoc, CompilerOptions.ERROR);
+ options.put(CompilerOptions.OPTION_ReportInvalidJavadocTags, CompilerOptions.ERROR);
+ options.put(CompilerOptions.OPTION_ReportMissingJavadocComments, CompilerOptions.ERROR);
+
+ compileFile("MyTeam", null, options);
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/TeamInheritanceTest.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/TeamInheritanceTest.java
new file mode 100644
index 0000000..c0e0489
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/TeamInheritanceTest.java
@@ -0,0 +1,146 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: TeamInheritanceTest.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.errorreporting;
+
+import org.eclipse.jdt.core.compiler.IProblem;
+import org.eclipse.objectteams.otdt.tests.compiler.TestBase;
+
+/**
+ * This class contains tests concerning team inheritance.
+ *
+ * @author kaschja
+ * @version $Id: TeamInheritanceTest.java 23494 2010-02-05 23:06:44Z stephan $
+ */
+public class TeamInheritanceTest extends TestBase
+{
+ public TeamInheritanceTest(String testName)
+ {
+ super(testName);
+ }
+
+ /**
+ * A team class inherits from a non-team class.
+ * Comment:
+ * This is legal since Trac #144.
+ */
+ public void testTeamInheritance1()
+ {
+ createFile("OrdinaryClass","public class OrdinaryClass {}");
+
+ createFile("MyTeam","public team class MyTeam extends OrdinaryClass {}");
+
+ compileFile("MyTeam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * A regular class (non-team class) inherits from a team class.
+ * Comment:
+ * A regular Java class can only extend another Java class,not a team class.
+ */
+ public void testInvalidTeamInheritance2()
+ {
+ createFile("MyTeam","public team class MyTeam {}");
+
+ createFile("MyClass","public class MyClass extends MyTeam {}");
+
+ compileFile("MyClass");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+ /**
+ * A team class inherits from an abstract team class.
+ * It does not implement the inherited abstract method.
+ * Comment:
+ * A team has to implement the inherited abstract methods of the superteam.
+ */
+ public void testNotImplementedAbstractMethod1()
+ {
+ createFile("Superteam","public abstract team class Superteam " +
+ NL + "{ " +
+ NL + " abstract void teamMethod(); " +
+ NL + "}");
+
+ createFile("Subteam","public team class Subteam extends Superteam" +
+ NL + "{ " +
+ NL + "}");
+
+ compileFile("Subteam");
+
+ assertFalse(isCompilationSuccessful());
+ }
+
+ /**
+ * A team class contains a role class.
+ * Another team class that inherits from this team, does not have to
+ * contain the inherited role explicitly.
+ */
+ public void testImplicitInheritance1()
+ {
+ createFile("Superteam","public team class Superteam " +
+ NL + "{ " +
+ NL + " protected class Role {}; " +
+ NL + "}");
+
+ createFile("Subteam","public team class Subteam extends Superteam" +
+ NL + "{ " +
+ NL + "}");
+
+ compileFile("Superteam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ /**
+ * @see testImplicitInheritance1
+ * additional instantiation of inherited role
+ */
+ public void testImplicitInheritance2()
+ {
+ createFile("Superteam","public team class Superteam " +
+ NL + "{ " +
+ NL + " protected class Role {}; " +
+ NL + "}");
+
+ createFile("Subteam","public team class Subteam extends Superteam" +
+ NL + "{ " +
+ NL + " Role _myRole = new Role(); " +
+ NL + "}");
+
+ compileFile("Superteam");
+
+ assertTrue(isCompilationSuccessful());
+ }
+
+ public void testMissingOTRE1() {
+ createFile("T",
+ "import static org.objectteams.Team.ALL_THREADS;\n" +
+ "class B {}\n" +
+ "public team class T {\n" +
+ " protected class R playedBy B {}\n" +
+ " Thread a = ALL_THREADS;\n" +
+ "}");
+ compileFile("T", createClassPathNoOTRE("T"));
+ assertTrue(hasAtLeastExpectedProblems(new int[] {IProblem.ImportNotFound, IProblem.IsClassPathCorrect, IProblem.HierarchyHasProblems}));
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/TestAll.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/TestAll.java
new file mode 100644
index 0000000..18965e0
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/errorreporting/TestAll.java
@@ -0,0 +1,72 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: TestAll.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.errorreporting;
+
+import junit.framework.TestSuite;
+
+/**
+ * This class collects all test cases in one test suite.
+ *
+ * @author brcan
+ * @version $Id: TestAll.java 23494 2010-02-05 23:06:44Z stephan $
+ */
+public class TestAll extends TestSuite
+{
+ public TestAll()
+ {
+ super();
+ }
+
+ public static TestSuite suite()
+ {
+ TestSuite suite = new TestSuite("All Compiler Tests");
+
+ // containment tests
+ suite.addTestSuite(CompilationUnitContainmentTest.class);
+ suite.addTestSuite(RoleContainmentTest.class);
+ suite.addTestSuite(TeamContainmentTest.class);
+ // inheritance tests
+ suite.addTestSuite(RoleBaseInheritanceTest.class);
+ suite.addTestSuite(RoleInheritanceTest.class);
+ suite.addTestSuite(TeamInheritanceTest.class);
+ // Copy Inheritance
+ suite.addTestSuite(CopyInheritanceTest.class);
+ // binding tests
+ suite.addTestSuite(CallinBindingTest.class);
+ suite.addTestSuite(CalloutBindingTest.class);
+ // lifting and lowering tests
+ suite.addTestSuite(LiftingTest.class);
+ suite.addTestSuite(LoweringTest.class);
+ // parameter mapping tests
+ suite.addTestSuite(ParameterMappingsTest.class);
+ // team activation tests
+ suite.addTestSuite(TeamActivationTest.class);
+ // parser tests
+ suite.addTestSuite(ParserTest.class);
+ //Code snippets and wrong code tests
+ suite.addTestSuite(SourceSnippetRecoveryTest.class);
+ //External Role tests
+ suite.addTestSuite(ExternalRoleTest.class);
+
+
+ return suite;
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/AbstractSourceMapGeneratorTest.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/AbstractSourceMapGeneratorTest.java
new file mode 100644
index 0000000..0442647
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/AbstractSourceMapGeneratorTest.java
@@ -0,0 +1,488 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: AbstractSourceMapGeneratorTest.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.smap;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import junit.framework.Test;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.compiler.CategorizedProblem;
+import org.eclipse.jdt.core.compiler.IProblem;
+import org.eclipse.jdt.core.tests.compiler.regression.InMemoryNameEnvironment;
+import org.eclipse.jdt.core.tests.util.Util;
+import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy;
+import org.eclipse.jdt.internal.compiler.IProblemFactory;
+import org.eclipse.jdt.internal.compiler.ISourceElementRequestor;
+import org.eclipse.jdt.internal.compiler.SourceElementParser;
+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.Expression;
+import org.eclipse.jdt.internal.compiler.ast.ImportReference;
+import org.eclipse.jdt.internal.compiler.batch.CompilationUnit;
+import org.eclipse.jdt.internal.compiler.batch.FileSystem;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
+import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
+import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
+import org.eclipse.objectteams.otdt.core.ext.OTDTPlugin;
+import org.eclipse.objectteams.otdt.debug.core.breakpoints.IOOTBreakPoints;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.SmapStratum;
+import org.eclipse.objectteams.otdt.tests.compiler.CustomizedCompiler;
+import org.eclipse.objectteams.otdt.tests.compiler.ICallbackClient;
+import org.eclipse.objectteams.otdt.tests.otmodel.FileBasedModelTest;
+
+/**
+ * @author ike
+ */
+public abstract class AbstractSourceMapGeneratorTest extends FileBasedModelTest implements ICallbackClient, ISourceElementRequestor
+{
+
+ protected String PROJECT_DIR;
+
+ public static final String COMPLIANCE_1_3 = "1.3";
+ public static final String COMPLIANCE_1_4 = "1.4";
+ public static final String COMPLIANCE_1_5 = "1.5";
+
+ private String complianceLevel = COMPLIANCE_1_5;
+ protected String[] classpaths;
+ protected Hashtable <String, List<SmapStratum>>expectedStrata;
+
+ protected String TYPENAME;
+
+ public static boolean optimizeStringLiterals = false;
+ public static long sourceLevel = ClassFileConstants.JDK1_5; //$NON-NLS-1$
+
+ public String OTRE_JAR_PATH = getOTRE_Path();
+
+ public static String OUTPUT_DIR = Util.getOutputDirectory() + File.separator + "smaptest";
+
+ // the source line within method Team.java:__OT__Confined._OT$getTeam().
+ public static int OT_CONFINED_GET_TEAM_LINE = IOOTBreakPoints.LINE_ConfinedGetTeam;
+
+ public AbstractSourceMapGeneratorTest(String testName)
+ {
+ super(testName);
+ }
+
+ private String getOTRE_Path()
+ {
+ URL url = FileLocator.find(OTDTPlugin.getDefault().getBundle(), new Path("lib/otre.jar"), null);
+ URL resolved_url = null;
+ try
+ {
+ resolved_url = FileLocator.resolve(url);
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+
+ if (resolved_url != null)
+ return resolved_url.getPath();
+ else
+ return url.getPath();
+
+ }
+
+ public static Test suite()
+ {
+ if (true)
+ {
+ return new Suite(AbstractSourceMapGeneratorTest.class);
+ }
+ junit.framework.TestSuite suite = new Suite(AbstractSourceMapGeneratorTest.class
+ .getName());
+ return suite;
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ expectedStrata = new Hashtable<String, List<SmapStratum>>();
+ }
+
+ protected INameEnvironment getNameEnvironment(final String[] testFiles,
+ String[] classPaths)
+ {
+ this.classpaths = classPaths == null ? getDefaultClassPaths() : classPaths;
+ return new InMemoryNameEnvironment(testFiles, getClassLibs());
+ }
+
+ protected INameEnvironment[] getClassLibs()
+ {
+ String encoding = (String)getCompilerOptions().getMap().get(CompilerOptions.OPTION_Encoding);
+ if ("".equals(encoding))
+ encoding = null;
+
+ INameEnvironment[] classLibs = new INameEnvironment[1];
+ classLibs[0] = new FileSystem(this.classpaths, new String[] {}, // ignore initial file names
+ encoding // default encoding
+ );
+ return classLibs;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected CompilerOptions getCompilerOptions()
+ {
+ CompilerOptions cOptions = new CompilerOptions();
+ Map<String, String> options = cOptions.getMap();
+ if (COMPLIANCE_1_3.equals(this.complianceLevel))
+ {
+ options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_3);
+ options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_3);
+ options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_3);
+ }
+ else if (COMPLIANCE_1_4.equals(this.complianceLevel))
+ {
+ options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4);
+ options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4);
+ options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4);
+ }
+ else if (COMPLIANCE_1_5.equals(this.complianceLevel))
+ {
+ options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
+ options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
+ options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
+ }
+
+ options.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE);
+ options.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.WARNING);
+ options.put(CompilerOptions.OPTION_ReportLocalVariableHiding, CompilerOptions.WARNING);
+ options.put(CompilerOptions.OPTION_ReportFieldHiding, CompilerOptions.WARNING);
+ options.put(CompilerOptions.OPTION_ReportPossibleAccidentalBooleanAssignment, CompilerOptions.WARNING);
+ options.put(CompilerOptions.OPTION_ReportSyntheticAccessEmulation, CompilerOptions.WARNING);
+ options.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.PRESERVE);
+ options.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.PRESERVE);
+ options.put(CompilerOptions.OPTION_ReportUnnecessaryElse, CompilerOptions.WARNING);
+
+ return new CompilerOptions(options);
+ }
+
+ protected String[] getDefaultClassPaths()
+ {
+ return Util.concatWithClassLibs(OTRE_JAR_PATH, false);
+ }
+
+ protected IErrorHandlingPolicy getErrorHandlingPolicy()
+ {
+ return new IErrorHandlingPolicy()
+ {
+ public boolean stopOnFirstError()
+ {
+ return false;
+ }
+
+ public boolean proceedOnErrors()
+ {
+ return true;
+ }
+ };
+ }
+
+ protected IProblemFactory getProblemFactory()
+ {
+ return new DefaultProblemFactory(Locale.getDefault());
+ }
+
+ /**
+ * @param team
+ * @param role
+ * @throws JavaModelException
+ */
+ public boolean parseAndCompile(org.eclipse.jdt.core.ICompilationUnit[] units ) throws JavaModelException
+ {
+ return parseAndCompile(units, null);
+ }
+ public boolean parseAndCompile(org.eclipse.jdt.core.ICompilationUnit[] units, HashMap<String, int[]> methodLineNumbers ) throws JavaModelException
+ {
+ return parseAndCompile(units, methodLineNumbers, null, null);
+ }
+ public boolean parseAndCompile(org.eclipse.jdt.core.ICompilationUnit[] units,
+ HashMap<String, int[]> methodLineNumbers,
+ String[] classPaths,
+ String outputPath)
+ throws JavaModelException
+ {
+ SourceElementParser parser = new SourceElementParser(this,
+ new DefaultProblemFactory(Locale.getDefault()),
+ new CompilerOptions(), false, false);
+ ICompilationUnit [] cUnits = new ICompilationUnit[units.length];
+
+ for (int idx = 0; idx < units.length; idx++)
+ {
+ org.eclipse.jdt.core.ICompilationUnit unit = units[idx];
+
+ String unit_src = unit.getSource();
+ IResource unit_res = unit.getCorrespondingResource();
+ String unit_fileName = unit_res.toString();
+ char[] unit_source = unit_src.toCharArray();
+ ICompilationUnit unit_sourceUnit = new CompilationUnit(unit_source,
+ unit_fileName, null);
+
+ CompilationUnitDeclaration cuDecl = parser.parseCompilationUnit(
+ unit_sourceUnit, true, null);
+
+ if (cuDecl.hasErrors())
+ return false;
+
+ cUnits[idx] = unit_sourceUnit;
+ }
+
+ Requestor requestor = new Requestor(
+ false,
+ null, /*no custom requestor */
+ false, /* show category */
+ false /* show warning token*/,
+ methodLineNumbers);
+ if (outputPath != null) {
+ requestor.outputPath = outputPath;
+ File outDir = new File(outputPath);
+ if (!outDir.exists())
+ outDir.mkdir();
+ }
+
+ CompilerOptions options = getCompilerOptions();
+
+ CustomizedCompiler batchCompiler = new CustomizedCompiler(
+ getNameEnvironment( new String[] {}, classPaths),
+ getErrorHandlingPolicy(),
+ options,
+ requestor,
+ getProblemFactory()
+ );
+
+ batchCompiler.addCallBack(this);
+
+ batchCompiler.compile(cUnits); // compile all files together
+
+ boolean hasErrors = requestor.hasErrors;
+
+ //errorlog contains errore and warnings, skip warnings
+ if (hasErrors)
+ {
+ String expectedErrorlog = "";
+ String actualErrorlog = requestor.problemLog;
+ assertEquals("COMPILATION FAILED. Errorlog should be empty.", expectedErrorlog, actualErrorlog);
+ }
+
+ if (methodLineNumbers != null)
+ requestor.checkAllLineNumbersSeen();
+
+ return !hasErrors;
+ }
+
+ public abstract void callback(CompilationUnitDeclaration cuDecl);
+
+ public void acceptConstructorReference(char[] typeName, int argCount, int sourcePosition)
+ {
+ }
+
+ public void acceptFieldReference(char[] fieldName, int sourcePosition)
+ {
+ }
+
+ public void acceptImport(int declarationStart, int declarationEnd, char[] name, boolean onDemand, int modifiers)
+ {
+ }
+
+ public void acceptLineSeparatorPositions(int[] positions)
+ {
+ }
+
+ public void acceptMethodReference(char[] methodName, int argCount, int sourcePosition)
+ {
+ }
+
+ public void acceptPackage(ImportReference importReference)
+ {
+ }
+
+ public void acceptProblem(IProblem problem)
+ {
+ }
+
+ public void acceptTypeReference(char[][] typeName, int sourceStart, int sourceEnd)
+ {
+ }
+
+ public void acceptTypeReference(char[] typeName, int sourcePosition)
+ {
+ }
+
+ public void acceptUnknownReference(char[][] name, int sourceStart, int sourceEnd)
+ {
+ }
+
+ public void acceptUnknownReference(char[] name, int sourcePosition)
+ {
+ }
+
+ public void enterClass(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[] superclass, char[][] superinterfaces)
+ {
+ }
+
+ public void enterCompilationUnit()
+ {
+ }
+
+ public void enterConstructor(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[][] parameterTypes, char[][] parameterNames, char[][] exceptionTypes)
+ {
+ }
+
+ public void enterField(int declarationStart, int modifiers, char[] type, char[] name, int nameSourceStart, int nameSourceEnd)
+ {
+ }
+
+ public void enterInitializer(int declarationStart, int modifiers)
+ {
+ }
+
+ public void enterInterface(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[][] superinterfaces)
+ {
+ }
+
+ public void enterMethod(int declarationStart, int modifiers, char[] returnType, char[] name, int nameSourceStart, int nameSourceEnd, char[][] parameterTypes, char[][] parameterNames, char[][] exceptionTypes)
+ {
+ }
+
+ public void exitClass(int declarationEnd)
+ {
+ }
+
+ public void exitCompilationUnit(int declarationEnd)
+ {
+ }
+
+ public void exitConstructor(int declarationEnd)
+ {
+ }
+
+ public void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd)
+ {
+ }
+
+ public void exitInitializer(int declarationEnd)
+ {
+ }
+
+ public void exitMethod(int declarationEnd, Expression defaultValue)
+ {
+ }
+
+ public void acceptBaseReference(char[][] typeName, int sourceStart, int sourceEnd)
+ {
+ }
+
+ public void enterInterface(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[][] superinterfaces, char[] baseclassName, boolean isRoleFile)
+ {
+ }
+
+ public void enterClass(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[] superclass, char[][] superinterfaces, char[] baseclassName, boolean isRoleFile)
+ {
+ }
+
+ public void enterCalloutMapping(CalloutInfo calloutInfo)
+ {
+ }
+
+ public void enterCalloutToFieldMapping(CalloutToFieldInfo calloutInfo)
+ {
+ }
+
+ public void enterCallinMapping(CallinInfo callinInfo)
+ {
+ }
+
+ public void exitCalloutMapping(int sourceEnd, int declarationSourceEnd)
+ {
+ }
+
+ public void exitCalloutToFieldMapping(int sourceEnd, int declarationSourceEnd)
+ {
+ }
+
+ public void exitCallinMapping(int sourceEnd, int declarationSourceEnd)
+ {
+ }
+
+ public void acceptProblem(CategorizedProblem problem) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void enterConstructor(MethodInfo methodInfo) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void enterField(FieldInfo fieldInfo) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void enterMethod(MethodInfo methodInfo) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void enterType(TypeInfo typeInfo) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void exitMethod(int declarationEnd, int defaultValueStart, int defaultValueEnd) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void exitType(int declarationEnd) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void acceptImport(int declarationStart, int declarationEnd, char[][] tokens, boolean onDemand, int modifiers) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void acceptAnnotationTypeReference(char[][] annotation,
+ int sourceStart, int sourceEnd) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void acceptAnnotationTypeReference(char[] annotation,
+ int sourcePosition) {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/AllTests.java
new file mode 100644
index 0000000..c5ff3cc
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/AllTests.java
@@ -0,0 +1,47 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: AllTests.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.smap;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author ike
+ *
+ */
+public class AllTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(
+ "All Tests for generation of SourceMaps");
+ //$JUnit-BEGIN$
+ suite.addTest(OTJStratumGenerationTest003.suite());
+ suite.addTest(OTJStratumGenerationTest005.suite());
+ suite.addTest(OTJStratumGenerationTest006.suite());
+ suite.addTest(OTJStratumGenerationTest007.suite());
+ suite.addTest(OTJStratumGenerationTest002.suite());
+ suite.addTestSuite(BaseClassSmapGenerationMethodTest.class);
+ suite.addTest(OTJStratumGenerationTest004.suite());
+ suite.addTest(OTJStratumGenerationTest001.suite());
+ //$JUnit-END$
+ return suite;
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/BaseClassSmapGenerationMethodTest.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/BaseClassSmapGenerationMethodTest.java
new file mode 100644
index 0000000..8df76a3
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/BaseClassSmapGenerationMethodTest.java
@@ -0,0 +1,610 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: BaseClassSmapGenerationMethodTest.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.smap;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.TreeMap;
+
+import junit.framework.TestCase;
+
+/** Tests the Method which generates the Smap for Baseclasse.
+ * @author ike
+ */
+public class BaseClassSmapGenerationMethodTest extends TestCase
+{
+
+ public void testMethod001()
+ {
+ String baseClassFileName = "SimpleClass$1" ;
+ String baseClassSourceUnit = "path/to/SimpleClass";
+ int endlineNumber = 3;
+ Hashtable<String, int[][]> mappings = new Hashtable<String, int[][]>();
+ int lineMappings[][] = new int[2][3];
+ lineMappings[0] = new int[]{2,2,7};
+ lineMappings[1] = new int[]{3,0,8};
+
+ mappings.put("path/to/TeamA.java", lineMappings);
+
+ int baseMapping [][] = null;
+
+ String expectedString =
+ "SMAP" + "\n" +
+ "SimpleClass$1.class" + "\n" +
+ "OTJ" + "\n" +
+ "*S OTJ" + "\n" +
+ "*F" + "\n" +
+ "+ 1 TeamA.java" + "\n" +
+ "path/to/TeamA.java" + "\n" +
+ "+ 2 SimpleClass.java" + "\n" +
+ "path/to/SimpleClass.java" + "\n" +
+ "*L" + "\n" +
+ "1#2:1" + "\n" +
+ "2#1,2:7" + "\n" +
+ "3#1:8" + "\n" +
+ "*E"
+ ;
+
+ byte actual[] = generateSMAP(baseClassFileName, baseClassSourceUnit, endlineNumber, mappings, baseMapping);
+
+ String actualString = new String(actual);
+
+ assertEquals("SMAP should be equal.", expectedString, actualString);
+ }
+
+ public void testMethod002()
+ {
+ String baseClassFileName = "SimpleClass$1" ;
+ String baseClassSourceUnit = "SimpleClass";
+ int endlineNumber = 3;
+ Hashtable<String, int[][]> mappings = new Hashtable<String, int[][]>();
+ int lineMappings[][] = new int[2][3];
+ lineMappings[0] = new int[]{2,2,7};
+ lineMappings[1] = new int[]{3,0,8};
+
+ mappings.put("TeamA.java", lineMappings);
+
+ int baseMapping [][] = null;
+
+ String expectedString =
+ "SMAP" + "\n" +
+ "SimpleClass$1.class" + "\n" +
+ "OTJ" + "\n" +
+ "*S OTJ" + "\n" +
+ "*F" + "\n" +
+ "1 TeamA.java" + "\n" +
+ "2 SimpleClass.java" + "\n" +
+ "*L" + "\n" +
+ "1#2:1" + "\n" +
+ "2#1,2:7" + "\n" +
+ "3#1:8" + "\n" +
+ "*E";
+
+ byte actual[] = generateSMAP(baseClassFileName, baseClassSourceUnit, endlineNumber, mappings, baseMapping);
+
+ String actualString = new String(actual);
+
+ assertEquals("SMAP should be equal.", expectedString, actualString);
+
+ }
+
+ public void testMethod003()
+ {
+ String baseClassFileName = "SimpleClass$1" ;
+ String baseClassSourceUnit = "SimpleClass";
+ int endlineNumber = 3;
+ Hashtable<String, int[][]> mappings = new Hashtable<String, int[][]>();
+
+ int baseMapping [][] = null;
+
+ String expectedString =
+ "SMAP" + "\n" +
+ "SimpleClass$1.class" + "\n" +
+ "OTJ" + "\n" +
+ "*S OTJ" + "\n" +
+ "*F" + "\n" +
+ "1 SimpleClass.java" + "\n" +
+ "*L" + "\n" +
+ "1#1,3:1" + "\n" +
+ "*E";
+
+ byte actual[] = generateSMAP(baseClassFileName, baseClassSourceUnit, endlineNumber, mappings, baseMapping);
+
+ String actualString = new String(actual);
+
+ assertEquals("SMAP should be equal.", expectedString, actualString);
+
+ }
+
+ public void testMethod004()
+ {
+ String baseClassFileName = "BaseClass" ;
+ String baseClassSourceUnit = "very/very/long/path/to/BaseClass";
+ int endlineNumber = 50;
+ Hashtable<String, int[][]> mappings = new Hashtable<String, int[][]>();
+ int lineMappings1[][] = new int[7][3];
+ lineMappings1[0] = new int[]{7,0,10};
+ lineMappings1[1] = new int[]{14,1,25};
+ lineMappings1[2] = new int[]{21,0,30};
+ lineMappings1[3] = new int[]{28,2,35};
+ lineMappings1[4] = new int[]{35,0,40};
+ lineMappings1[5] = new int[]{42,3,45};
+ lineMappings1[6] = new int[]{125,0,250};
+
+ mappings.put("path/to/TeamB.java", lineMappings1);
+
+ int lineMappings2[][] = new int[4][3];
+ lineMappings2[0] = new int[]{8,0,3};
+ lineMappings2[1] = new int[]{16,1,9};
+ lineMappings2[2] = new int[]{24,0,12};
+ lineMappings2[3] = new int[]{32,5,15};
+
+ mappings.put("very/long/path/to/TeamA.java", lineMappings1);
+
+ int baseMapping [][] = null;
+
+ String expectedString =
+ "SMAP" + "\n" +
+ "BaseClass.class" + "\n" +
+ "OTJ" + "\n" +
+ "*S OTJ" + "\n" +
+ "*F" + "\n" +
+ "+ 1 TeamA.java" + "\n" +
+ "very/long/path/to/TeamA.java" + "\n" +
+ "+ 2 TeamB.java" + "\n" +
+ "path/to/TeamB.java" + "\n" +
+ "+ 3 BaseClass.java" + "\n" +
+ "very/very/long/path/to/BaseClass.java" + "\n" +
+ "*L" + "\n" +
+ "1#3,6:1" + "\n" +
+ "7#2:10" + "\n" +
+ "8#3,6:8" + "\n" +
+ "14#2,1:25" + "\n" +
+ "15#3,6:15" + "\n" +
+ "21#2:30" + "\n" +
+ "22#3,6:22" + "\n" +
+ "28#2,2:35" + "\n" +
+ "29#3,6:29" + "\n" +
+ "35#2:40" + "\n" +
+ "36#3,6:36" + "\n" +
+ "42#2,3:45" + "\n" +
+ "43#3,8:43" + "\n" +
+ "125#2:250" + "\n" +
+ "*E";
+
+ byte actual[] = generateSMAP(baseClassFileName, baseClassSourceUnit, endlineNumber, mappings, baseMapping);
+
+ String actualString = new String(actual);
+
+ assertEquals("SMAP should be equal.", expectedString, actualString);
+
+ }
+
+ public void testSMAPIsNull001()
+ {
+ String baseClassFileName = "SimpleClass$1" ;
+ String baseClassSourceUnit = "path/to/SimpleClass";
+ int endlineNumber = 3;
+ Hashtable<String, int[][]> mappings = null;
+
+ int baseMapping [][] = null;
+
+ byte actual[] = generateSMAP(baseClassFileName, baseClassSourceUnit, endlineNumber, mappings, baseMapping);
+
+ assertNull("No SMAP should be generated.", actual);
+ }
+
+ public void testSMAPIsNull002()
+ {
+ String baseClassFileName = null;
+ String baseClassSourceUnit = "path/to/SimpleClass";
+ int endlineNumber = 3;
+ Hashtable<String, int[][]> mappings = new Hashtable<String, int[][]>();;
+ int lineMappings[][] = new int[2][3];
+ lineMappings[0] = new int[]{2,2,7};
+ lineMappings[1] = new int[]{3,0,8};
+ mappings.put("path/to/TeamA.java", lineMappings);
+
+ int baseMapping[][] = null;
+
+ byte actual[] = generateSMAP(baseClassFileName, baseClassSourceUnit, endlineNumber, mappings, baseMapping);
+
+ assertNull("No SMAP should be generated.", actual);
+ }
+
+ public void testSMAPIsNotNull001()
+ {
+ String baseClassFileName = "SimpleClass$1";
+ String baseClassSourceUnit = null;
+ int endlineNumber = 3;
+ Hashtable<String, int[][]> mappings = new Hashtable<String, int[][]>();;
+ int lineMappings[][] = new int[2][3];
+ lineMappings[0] = new int[]{2,2,7};
+ lineMappings[1] = new int[]{3,0,8};
+ mappings.put("path/to/TeamA.java", lineMappings);
+
+ int baseMapping[][] = null;
+
+ byte actual[] = generateSMAP(baseClassFileName, baseClassSourceUnit, endlineNumber, mappings, baseMapping);
+
+ String expectedString =
+ "SMAP" + "\n" +
+ "SimpleClass$1.class" + "\n" +
+ "OTJ" + "\n" +
+ "*S OTJ" + "\n" +
+ "*F" + "\n" +
+ "+ 1 TeamA.java" + "\n" +
+ "path/to/TeamA.java" + "\n" +
+ "2 SimpleClass$1.java" + "\n" +
+ "*L" + "\n" +
+ "1#2:1" + "\n" +
+ "2#1,2:7" + "\n" +
+ "3#1:8" + "\n" +
+ "*E";
+
+
+ String actualString = new String(actual);
+
+ assertEquals("SMAP should be equal.", expectedString, actualString);
+
+ }
+
+ public void testSMAPIsNotNull002()
+ {
+ String baseClassFileName = "pkg.subpkg.SimpleClass$1";
+ String baseClassSourceUnit = null;
+ int endlineNumber = 3;
+ Hashtable<String, int[][]> mappings = new Hashtable<String, int[][]>();;
+ int lineMappings[][] = new int[2][3];
+ lineMappings[0] = new int[]{2,2,7};
+ lineMappings[1] = new int[]{3,0,8};
+ mappings.put("path/to/TeamA.java", lineMappings);
+
+ int baseMapping [][] = null;
+
+ byte actual[] = generateSMAP(baseClassFileName, baseClassSourceUnit, endlineNumber, mappings, baseMapping);
+
+ String expectedString =
+ "SMAP" + "\n" +
+ "SimpleClass$1.class" + "\n" +
+ "OTJ" + "\n" +
+ "*S OTJ" + "\n" +
+ "*F" + "\n" +
+ "+ 1 TeamA.java" + "\n" +
+ "path/to/TeamA.java" + "\n" +
+ "+ 2 SimpleClass$1.java" + "\n" +
+ "pkg/subpkg/SimpleClass$1.java" + "\n" +
+ "*L" + "\n" +
+ "1#2:1" + "\n" +
+ "2#1,2:7" + "\n" +
+ "3#1:8" + "\n" +
+ "*E";
+
+
+ String actualString = new String(actual);
+
+ assertEquals("SMAP should be equal.", expectedString, actualString);
+
+ }
+
+
+ public void testSMAPBaseMappings()
+ {
+ String baseClassFileName = "path.to.SimpleClass";
+ String baseClassSourceUnit = "path/to/SimpleClass";
+ int endlineNumber = 15;
+ Hashtable<String, int[][]> mappings = new Hashtable<String, int[][]>();;
+ int lineMappings[][] = new int[2][3];
+ lineMappings[0] = new int[]{2,2,7};
+ lineMappings[1] = new int[]{3,0,8};
+ mappings.put("path/to/TeamA.java", lineMappings);
+
+ int baseMapping[][] = new int[2][2];
+ baseMapping[0] = new int[]{10,1};
+ baseMapping[1] = new int[]{12,6};
+
+ byte actual[] = generateSMAP(baseClassFileName, baseClassSourceUnit, endlineNumber, mappings, baseMapping);
+ String actualString = new String(actual);
+
+ String expectedString =
+ "SMAP" + "\n" +
+ "SimpleClass.class" + "\n" +
+ "OTJ" + "\n" +
+ "*S OTJ" + "\n" +
+ "*F" + "\n" +
+ "+ 1 TeamA.java" + "\n" +
+ "path/to/TeamA.java" + "\n" +
+ "+ 2 SimpleClass.java" + "\n" +
+ "path/to/SimpleClass.java" + "\n" +
+ "*L" + "\n" +
+ "1#2:1" + "\n" +
+ "2#1,2:7" + "\n" +
+ "3#1:8" + "\n" +
+ "4#2,6:4" + "\n" +
+ "10#2:1" + "\n" +
+ "11#2:11" + "\n" +
+ "12#2:6" + "\n" +
+ "13#2,3:13" + "\n" +
+ "*E";
+
+ assertEquals("SMAP should be equal.", expectedString, actualString);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////////////
+ //// THIS METHOD IS TESTED ////
+ ///////////////////////////////////////////////////////////////////////////////////////
+
+ /** This method generates a SMAP for Baseclasses. This SMAP maps generated code for
+ * callin bindings to theirs corresponding sourcecodepresentation.
+ *
+ * @param baseClassfileName - name of classfile this smap is generated for (e.g. pkg.subpkg.SimpleClass)
+ * @param baseSourceunitName - path of sourceunit of corresponding baseclasstype,
+ * (e.g path/to/SimpleClass);
+ * if baseSourceunitName is not available name and path are generated from
+ * baseClassfileName
+ *
+ * @param endlineNumber - this linenumber is the maximum linenumber of all entries in linenumbertables of all methods;
+ * it is not the endlinenumber of sourcefile.
+ * @param mappings -
+ * String -> int[][]<br>
+ * key: path of Team or RoleFile sourceunit which has callins"<br>
+ * value: int-array with:<br> int[0][0] - inputstartline of callin<br>
+ * int[0][1] - offset, if callin has more as one line(0 means one line, 1 means 2 lines, ...)<br>
+ * int[0][2] - written linenumber in baseclasscode (linenumber of _OT$MyRole$roleMethod$baseMethod() call in chainMethod)<br>
+ * e.g.<br>
+ * path/to/Teamname.java -> <br>[9][0][16]<br> [20][2][18]
+ *
+ * @param baseMappings - contains mappings to itself (int[][]):<br>
+ * int[0][0] - generated linenumber<br>
+ * int[0][1] - fixed linenumber (linenumber of e.g. signature of "_OT$xyz$orig(..)")
+ *
+ * @return smap - the string which should be stored in Classfileattribute SourceDebugExtension
+ *
+ * @author ike
+ */
+ public byte[] generateSMAP(String baseClassfileName, String baseSourceunitName, int endlineNumber, Hashtable<String, int[][]> mappings, int baseMappings [][])
+ {
+ if (baseClassfileName==null || mappings==null)
+ {
+ return null;
+ }
+
+ String OTJ_STRATUM_NAME = "OTJ";
+ String CLASS_ENDING = ".class";
+ String JAVA_ENDING = ".java";
+ String generatedFileName = new String();
+ String components[] = baseClassfileName.split("\\.");
+ String newBaseSourceunitName = null;
+ String absoluteBaseSourceunitName = null;
+ boolean baseSourceunitNameAvailable = (baseSourceunitName != null);
+
+ if (components.length > 1)
+ {
+ generatedFileName = components[components.length -1] + CLASS_ENDING;
+ newBaseSourceunitName = components[components.length -1] + JAVA_ENDING;
+ absoluteBaseSourceunitName = (baseClassfileName.replaceAll("\\.", "/") + JAVA_ENDING);
+ }
+ else
+ {
+ generatedFileName = baseClassfileName + CLASS_ENDING;
+ newBaseSourceunitName = baseClassfileName + JAVA_ENDING;
+ absoluteBaseSourceunitName = null;
+ }
+
+ if (baseSourceunitNameAvailable)
+ {
+ String tmp[] = baseSourceunitName.split("/");
+ int index = tmp.length;
+
+ newBaseSourceunitName = tmp[index-1] + JAVA_ENDING;
+
+ if (tmp.length > 1)
+ {
+ absoluteBaseSourceunitName = baseSourceunitName + JAVA_ENDING;
+ }
+ }
+
+ Hashtable<String, Integer> typeNameToFileId = new Hashtable<String, Integer>();
+ int fileSectionIdCounter = 1;
+
+ StringBuffer out = new StringBuffer();
+
+ // print Header
+ out.append("SMAP\n");
+ out.append(generatedFileName + "\n");
+
+ // print strata
+ out.append(OTJ_STRATUM_NAME+ "\n");
+
+ // begin StratumSection
+ out.append("*S " + OTJ_STRATUM_NAME + "\n");
+
+ // print FileSection
+ out.append("*F" + "\n");
+
+ for (Iterator<String> iter = mappings.keySet().iterator(); iter.hasNext();)
+ {
+ String fullqualifiedName = iter.next();
+ typeNameToFileId.put(fullqualifiedName, new Integer(fileSectionIdCounter));
+
+ // extract filename and absoluteFileName from typename
+ String tmp[] = fullqualifiedName.split("/");
+ int index = tmp.length;
+
+ String fileName = tmp[index-1];
+ String absoluteFileName = null;
+
+ typeNameToFileId.put(fileName, new Integer(fileSectionIdCounter));
+
+ if (tmp.length >= 2)
+ {
+ absoluteFileName = fullqualifiedName;
+ }
+
+ if (absoluteFileName != null)
+ {
+ out.append("+ " );
+ }
+
+ out.append(fileSectionIdCounter + " " + fileName + "\n");
+
+ if (absoluteFileName != null)
+ {
+ out.append(absoluteFileName + "\n");
+ }
+
+ fileSectionIdCounter++;
+ }
+
+ // add basename to smap
+ int baseClassFileId = -1;
+ typeNameToFileId.put(newBaseSourceunitName, new Integer(fileSectionIdCounter));
+ baseClassFileId = typeNameToFileId.get(newBaseSourceunitName).intValue();
+
+ if (absoluteBaseSourceunitName != null)
+ {
+ out.append("+ " );
+ }
+
+ out.append(baseClassFileId + " " + newBaseSourceunitName + "\n");
+
+ if (absoluteBaseSourceunitName != null)
+ {
+ out.append(absoluteBaseSourceunitName + "\n");
+ }
+
+
+ // print LineSection
+ out.append("*L" + "\n");
+
+ TreeMap<Integer, String> lineInfos = new TreeMap<Integer, String>();
+ StringBuffer lineBuffer = new StringBuffer();
+ for (Iterator<String> iter = mappings.keySet().iterator(); iter.hasNext();)
+ {
+ String typeName = iter.next();
+ int[][] linemappings = mappings.get(typeName);
+ int fileId = typeNameToFileId.get(typeName).intValue();
+
+ for (int idx = 0; idx < linemappings.length; idx++)
+ {
+ int[] singleLineMapping = linemappings[idx];
+
+ Integer inputStartLine = new Integer( singleLineMapping[0]);
+ int inputOffset = singleLineMapping[1];
+ int outputLine = singleLineMapping[2];
+
+ if (inputOffset == 0)
+ {
+ lineBuffer.append(inputStartLine.intValue());
+ lineBuffer.append("#" + fileId);
+ lineBuffer.append(":" + outputLine + "\n");
+ }
+ else
+ {
+ lineBuffer.append(inputStartLine.intValue());
+ lineBuffer.append("#" + fileId);
+ lineBuffer.append("," + inputOffset);
+ lineBuffer.append(":" + outputLine + "\n");
+ }
+
+ lineInfos.put(inputStartLine, lineBuffer.toString());
+ lineBuffer.delete(0, lineBuffer.length());
+ }
+ }
+
+ //add given mappings to itself (basemappings)
+ if (baseMappings != null && baseMappings.length > 0)
+ {
+ for (int idx = 0; idx < baseMappings.length; idx++)
+ {
+ int key = baseMappings[idx][0];
+ int value = baseMappings[idx][1];
+
+ lineBuffer.append(key);
+ lineBuffer.append("#" + baseClassFileId);
+ lineBuffer.append(":" + value + "\n");
+
+ lineInfos.put(new Integer(key), lineBuffer.toString());
+ lineBuffer.delete(0, lineBuffer.length());
+ }
+ }
+
+ //add mappings to itself,
+ //endlinenumber is the maximum linenumber of all entries in linenumbertables of all methods;
+ //endlinenumber is not the endlinenumber of sourcefile, cause it is available at this time
+ TreeMap<Integer, int[]> baseToBaselineInfos = new TreeMap<Integer, int[]>();
+ for (int idx = 1; idx <= endlineNumber; idx++)
+ {
+ Integer currentLineNumber = new Integer(idx);
+ if (!lineInfos.containsKey(currentLineNumber))
+ {
+ Integer previousLineNumber = currentLineNumber-1;
+ if (baseToBaselineInfos.containsKey(previousLineNumber))
+ {
+ int[] oldValues = baseToBaselineInfos.get(previousLineNumber);
+ int intputStartline = oldValues[0];
+ int repeatCount= oldValues[1]+1;
+ int newValues[] = {intputStartline, repeatCount};
+ baseToBaselineInfos.put(currentLineNumber, newValues);
+ }
+ else
+ {
+ baseToBaselineInfos.put(currentLineNumber, new int[]{currentLineNumber.intValue(), 1});
+ }
+ }
+ }
+
+ lineBuffer = new StringBuffer();
+ for (Iterator<Integer> iter = baseToBaselineInfos.keySet().iterator(); iter.hasNext();)
+ {
+ Integer key= iter.next();
+ int[] endValues = baseToBaselineInfos.get(key);
+ int inputStartLine = endValues[0];
+ int repeatCount = endValues[1];
+
+ lineBuffer.append(inputStartLine);
+ lineBuffer.append("#" + baseClassFileId);
+
+ if (repeatCount > 1)
+ lineBuffer.append("," + repeatCount);
+
+ lineBuffer.append(":" + inputStartLine + "\n");
+ lineInfos.put(new Integer(inputStartLine), lineBuffer.toString());
+ lineBuffer.delete(0, lineBuffer.length());
+ }
+
+
+ for (Iterator<Integer> iter = lineInfos.keySet().iterator(); iter.hasNext();)
+ {
+ Integer inputStartline= iter.next();
+ String lineInfo = lineInfos.get(inputStartline);
+
+ out.append(lineInfo);
+ }
+
+ // print EndStratumSection
+ out.append("*E");
+
+ return out.toString().getBytes();
+ }
+
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest001.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest001.java
new file mode 100644
index 0000000..cbd467c
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest001.java
@@ -0,0 +1,136 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTJStratumGenerationTest001.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.smap;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.objectteams.otdt.core.compiler.ISMAPConstants;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.FileInfo;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.LineInfo;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.RoleSmapGenerator;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.SmapStratum;
+
+/**
+ * @author ike
+ *
+ */
+public class OTJStratumGenerationTest001 extends AbstractSourceMapGeneratorTest
+{
+ private org.eclipse.jdt.core.ICompilationUnit _role;
+ private org.eclipse.jdt.core.ICompilationUnit _team;
+
+ public OTJStratumGenerationTest001(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new Suite(OTJStratumGenerationTest001.class);
+ }
+
+ public void setUpSuite() throws Exception
+ {
+ setTestProjectDir("JSR-045");
+ super.setUpSuite();
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ _role = getCompilationUnit(
+ getTestProjectDir(),
+ "src",
+ "roleFile.TeamA",
+ "RoleA.java");
+
+ _team = getCompilationUnit(
+ getTestProjectDir(),
+ "src",
+ "roleFile",
+ "TeamA.java");
+ }
+
+ public void testSimpleRoleSmapGeneration() throws JavaModelException
+ {
+ SmapStratum stratum = new SmapStratum(ISMAPConstants.OTJ_STRATUM_NAME);
+ FileInfo fileInfo = stratum.getOrCreateFileInfo("RoleA.java","roleFile/TeamA/RoleA.java");
+ LineInfo lineInfo = new LineInfo(1,1);
+ lineInfo.setRepeatCount(11);
+ LineInfo lineInfo1 = new LineInfo(ISMAPConstants.STEP_INTO_LINENUMBER,ISMAPConstants.STEP_INTO_LINENUMBER);
+ LineInfo lineInfo2 = new LineInfo(ISMAPConstants.STEP_OVER_LINENUMBER,ISMAPConstants.STEP_OVER_LINENUMBER);
+ fileInfo.addLineInfo(lineInfo);
+ fileInfo.addLineInfo(lineInfo1);
+ fileInfo.addLineInfo(lineInfo2);
+
+ stratum.optimize();
+
+ TYPENAME = "__OT__RoleA";
+ List <SmapStratum>strata = new ArrayList<SmapStratum>();
+ strata.add(stratum);
+
+ expectedStrata.put(TYPENAME, strata);
+
+ try
+ {
+ parseAndCompile(new org.eclipse.jdt.core.ICompilationUnit[]{_team, _role});
+ }
+ catch (JavaModelException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
+ public void callback(CompilationUnitDeclaration cuDecl)
+ {
+ TypeDeclaration typeDecl = cuDecl.types[0];
+
+ assertNotNull("TypeDeclaration should not be null.", typeDecl);
+
+ if (typeDecl.memberTypes == null)
+ {
+ return;
+ }
+
+ TypeDeclaration [] members = typeDecl.memberTypes;
+ for (int idx = 0; idx < members.length; idx++)
+ {
+ TypeDeclaration decl = members[idx];
+ String typeName = String.valueOf(decl.name);
+
+ if (decl.isRole() && !decl.isInterface() && typeName.equals(TYPENAME))
+ {
+ RoleSmapGenerator rolefileSmapGenerator = new RoleSmapGenerator(decl);
+ rolefileSmapGenerator.addStratum("OTJ");
+ rolefileSmapGenerator.generate();
+ List actualStrata = rolefileSmapGenerator.getStrata();
+
+ assertEquals("Strata of type \"" + typeName + "\" should be equal.\n", expectedStrata.get(typeName), actualStrata);
+ }
+ }
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest002.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest002.java
new file mode 100644
index 0000000..157c164
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest002.java
@@ -0,0 +1,297 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTJStratumGenerationTest002.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.smap;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.objectteams.otdt.core.compiler.ISMAPConstants;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.FileInfo;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.LineInfo;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.RoleSmapGenerator;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.SmapStratum;
+
+/**
+ * @author ike
+ *
+ */
+public class OTJStratumGenerationTest002 extends AbstractSourceMapGeneratorTest
+{
+ private org.eclipse.jdt.core.ICompilationUnit _subTeam;
+ private org.eclipse.jdt.core.ICompilationUnit _superTeam;
+ private org.eclipse.jdt.core.ICompilationUnit _superSuperTeam;
+ private String _enclosingTypename;
+
+ public OTJStratumGenerationTest002(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new Suite(OTJStratumGenerationTest002.class);
+ }
+
+ public void setUpSuite() throws Exception
+ {
+ setTestProjectDir("JSR-045");
+ super.setUpSuite();
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ _subTeam = getCompilationUnit(
+ getTestProjectDir(),
+ "src",
+ "copyInheritance",
+ "SubTeam.java");
+
+ _superTeam = getCompilationUnit(
+ getTestProjectDir(),
+ "src",
+ "copyInheritance",
+ "SuperTeam.java");
+
+ _superSuperTeam = getCompilationUnit(
+ getTestProjectDir(),
+ "src",
+ "copyInheritance",
+ "SuperSuperTeam.java");
+ }
+ public void testSimpleCopyInheritanceSmapRoleA() throws JavaModelException
+ {
+ SmapStratum stratum_role = new SmapStratum(ISMAPConstants.OTJ_STRATUM_NAME);
+
+ // letters (a) ... indicate the order in which lines are assigned
+ // class position is used by ctor, initFields and getTeam
+
+ FileInfo fileInfo0 = stratum_role.getOrCreateFileInfo("SuperSuperTeam.java", "copyInheritance/SuperSuperTeam.java");
+ LineInfo lineInfo1_role0 = new LineInfo(4,25); // (c) class position (4) mapped to synthetic line 25
+ LineInfo lineInfo2_role0 = new LineInfo(8,29); // (e) method roleMethod0 (8..) mapped to synthetic lines 29-30
+ lineInfo2_role0.setRepeatCount(2);
+ LineInfo lineInfo3_role0 = new LineInfo(12,31); // (f) method roleMethod1 (12,14,15) mapped to synthetic lines 31,33,34
+ lineInfo3_role0.setRepeatCount(4); // repeat 4 although line numbers have a "hole" at comment line 32
+
+ fileInfo0.addLineInfo(lineInfo1_role0);
+ fileInfo0.addLineInfo(lineInfo2_role0);
+ fileInfo0.addLineInfo(lineInfo3_role0);
+
+ FileInfo fileInfo1 = stratum_role.getOrCreateFileInfo("SuperTeam.java", "copyInheritance/SuperTeam.java");
+ LineInfo lineInfo1_role1 = new LineInfo(4,24); // (b) class position (4) mapped to synthetic line 24
+ LineInfo lineInfo2_role1 = new LineInfo(11,26); // (d) roleMethod0 (11..) mapped to synthetic lines 26-28
+ lineInfo2_role1.setRepeatCount(3);
+ LineInfo lineInfo3_role1 = new LineInfo(8,35); // (g) method roleMethod2 (8..) mapped to synthetic lines 35-36
+ lineInfo3_role1.setRepeatCount(2);
+
+ fileInfo1.addLineInfo(lineInfo1_role1);
+ fileInfo1.addLineInfo(lineInfo2_role1);
+ fileInfo1.addLineInfo(lineInfo3_role1);
+
+
+ FileInfo fileInfo2 = stratum_role.getOrCreateFileInfo("SubTeam.java", "copyInheritance/SubTeam.java");
+
+ LineInfo lineInfo1_role2 = new LineInfo(1,1); // (a) all original lines from SubTeam
+ lineInfo1_role2.setRepeatCount(23);
+ LineInfo lineInfo2_role2 = new LineInfo(ISMAPConstants.STEP_INTO_LINENUMBER,ISMAPConstants.STEP_INTO_LINENUMBER);
+ LineInfo lineInfo3_role2 = new LineInfo(ISMAPConstants.STEP_OVER_LINENUMBER,ISMAPConstants.STEP_OVER_LINENUMBER);
+
+ fileInfo2.addLineInfo(lineInfo1_role2);
+ fileInfo2.addLineInfo(lineInfo2_role2);
+ fileInfo2.addLineInfo(lineInfo3_role2);
+
+ stratum_role.optimize();
+
+ HashMap<String, int[]> expectedMethodLineNumbers = new HashMap<String, int[]>();
+ expectedMethodLineNumbers.put("copyInheritance.SubTeam$__OT__RoleA.roleMethod0(LcopyInheritance/SubTeam$TSuper__OT__SuperTeam;)V", new int[]{26,27,28});
+ expectedMethodLineNumbers.put("copyInheritance.SubTeam$__OT__RoleA.roleMethod0(LcopyInheritance/SuperTeam$TSuper__OT__SuperSuperTeam;)V", new int[]{29,30});
+ expectedMethodLineNumbers.put("copyInheritance.SubTeam$__OT__RoleA.roleMethod1()V", new int[]{31,33,34});
+ expectedMethodLineNumbers.put("copyInheritance.SubTeam$__OT__RoleA.roleMethod2()V", new int[]{35,36});
+
+ TYPENAME = "__OT__RoleA";
+ _enclosingTypename= "SubTeam";
+
+ List <SmapStratum>strata_role1 = new ArrayList<SmapStratum>();
+ strata_role1.add(stratum_role);
+
+ expectedStrata.put(TYPENAME, strata_role1);
+
+ try
+ {
+ String outputPath = getWorkspaceRoot().getLocationURI().getPath()+"/"+getTestProjectDir()+"/bin";
+ parseAndCompile(new org.eclipse.jdt.core.ICompilationUnit[]{_superSuperTeam, _superTeam, _subTeam},
+ expectedMethodLineNumbers,
+ null/*classPaths*/,
+ outputPath); // need this so that class files are actually written for next phase
+
+ // recompile SubTeam only to check usage of byte code information (CopyInheritanceSrc):
+ String [] classPaths = getDefaultClassPaths();
+ int oldLen = classPaths.length;
+ System.arraycopy(classPaths, 0, classPaths=new String[oldLen+1], 1, oldLen);
+ classPaths[0] = outputPath;
+ parseAndCompile(new org.eclipse.jdt.core.ICompilationUnit[]{_subTeam},
+ expectedMethodLineNumbers,
+ classPaths, // needed for retrieving class files from previous phase
+ null/*outputPath*/);
+ }
+ catch (JavaModelException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
+ public void testSimpleCopyInheritanceSmapConfined()
+ {
+ SmapStratum stratum_role = new SmapStratum(ISMAPConstants.OTJ_STRATUM_NAME);
+
+ FileInfo fileInfo_role0 = stratum_role.getOrCreateFileInfo("Team.java", "org/objectteams/Team.java");
+ LineInfo lineInfo1_role0 = new LineInfo(OT_CONFINED_GET_TEAM_LINE, 25); // mapped line of _OT$getTeam() to synthetic line 25
+
+ fileInfo_role0.addLineInfo(lineInfo1_role0);
+
+ FileInfo fileInfo_role1 = stratum_role.getOrCreateFileInfo("SuperSuperTeam.java", "copyInheritance/SuperSuperTeam.java");
+ LineInfo lineInfo1_role1 = new LineInfo(2,24); // default ctor at team position (2) mapped to synthetic line 25
+
+ fileInfo_role1.addLineInfo(lineInfo1_role1);
+
+ // no contribution from SuperTeam$__OT__Confined
+
+ FileInfo fileInfo_role3 = stratum_role.getOrCreateFileInfo("SubTeam.java", "copyInheritance/SubTeam.java");
+ LineInfo lineInfo3_role3 = new LineInfo(1,1);
+ lineInfo3_role3.setRepeatCount(23); // all 23 lines of SubTeam.java unmapped
+ LineInfo lineInfo5_role3 = new LineInfo(65533,65533);
+ lineInfo5_role3.setRepeatCount(2);
+
+ fileInfo_role3.addLineInfo(lineInfo3_role3);
+ fileInfo_role3.addLineInfo(lineInfo5_role3);
+
+ TYPENAME = "__OT__Confined";
+ _enclosingTypename= "SubTeam";
+ List <SmapStratum>strata_role_confined = new ArrayList<SmapStratum>();
+ strata_role_confined.add(stratum_role);
+
+ expectedStrata.put(TYPENAME, strata_role_confined);
+
+ HashMap<String, int[]> expectedMethodLineNumbers = new HashMap<String, int[]>();
+ expectedMethodLineNumbers.put("copyInheritance.SubTeam$__OT__Confined._OT$getTeam()Lorg/objectteams/ITeam;", new int[]{25});
+
+ try
+ {
+ parseAndCompile(new org.eclipse.jdt.core.ICompilationUnit[]{_superSuperTeam, _superTeam, _subTeam}, expectedMethodLineNumbers);
+ }
+ catch (JavaModelException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
+ public void testCopyInheritanceOutOfOrderStatements() {
+ SmapStratum stratum_role = new SmapStratum(ISMAPConstants.OTJ_STRATUM_NAME);
+
+ FileInfo fileInfo0 = stratum_role.getOrCreateFileInfo("SuperTeam2.java", "copyInheritance/SuperTeam2.java");
+ LineInfo lineInfo1_role0 = new LineInfo(6,7); // class position (6) mapped to synthetic line 7
+ fileInfo0.addLineInfo(lineInfo1_role0);
+ LineInfo lineInfo2_role0 = new LineInfo(8,8); // method (8) mapped to synthetic line 8..
+ lineInfo2_role0.setRepeatCount(5);
+ fileInfo0.addLineInfo(lineInfo2_role0);
+
+ FileInfo fileInfo1 = stratum_role.getOrCreateFileInfo("SubTeam2.java", "copyInheritance/SubTeam2.java");
+ LineInfo lineInfo1_role1 = new LineInfo(1,1); // all 6 lines unmapped
+ lineInfo1_role1.setRepeatCount(6);
+ fileInfo1.addLineInfo(lineInfo1_role1);
+
+ LineInfo lineInfo2_role1 = new LineInfo(65533,65533);
+ lineInfo2_role1.setRepeatCount(2);
+
+ fileInfo1.addLineInfo(lineInfo2_role1);
+
+
+ TYPENAME = "__OT__R";
+ _enclosingTypename = "SubTeam2";
+
+ List <SmapStratum>strata_role = new ArrayList<SmapStratum>();
+ strata_role.add(stratum_role);
+
+ expectedStrata.put(TYPENAME, strata_role);
+
+ HashMap<String, int[]> expectedMethodLineNumbers = new HashMap<String, int[]>();
+ //expectedMethodLineNumbers.put("copyInheritance.SubTeam$__OT__Confined._OT$getTeam()Lorg/objectteams/Team;", new int[]{25});
+
+
+ try
+ {
+ ICompilationUnit superTeam = getCompilationUnit(
+ getTestProjectDir(),
+ "src",
+ "copyInheritance",
+ "SuperTeam2.java");
+
+ ICompilationUnit subTeam = getCompilationUnit(
+ getTestProjectDir(),
+ "src",
+ "copyInheritance",
+ "SubTeam2.java");
+ parseAndCompile(new org.eclipse.jdt.core.ICompilationUnit[]{superTeam, subTeam}, expectedMethodLineNumbers);
+ }
+ catch (JavaModelException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+ public void callback(CompilationUnitDeclaration cuDecl)
+ {
+ String cuDeclName = String.valueOf(cuDecl.getMainTypeName());
+ if (!_enclosingTypename.equals(cuDeclName))
+ return;
+
+ TypeDeclaration typeDecl = cuDecl.types[0];
+
+ assertNotNull("TypeDeclaration should not be null.", typeDecl);
+
+ assertTrue("Membertypes of TypeDeclaration should be greater than 0.", typeDecl.memberTypes.length > 0);
+
+ TypeDeclaration [] members = typeDecl.memberTypes;
+ for (int idx = 0; idx < members.length; idx++)
+ {
+ TypeDeclaration decl = members[idx];
+ String typeName = String.valueOf(decl.name);
+
+ if (decl.isRole() && !decl.isInterface() && typeName.equals(TYPENAME))
+ {
+ RoleSmapGenerator rolefileSmapGenerator = new RoleSmapGenerator(decl);
+ rolefileSmapGenerator.addStratum("OTJ");
+ rolefileSmapGenerator.generate();
+ List actualStrata = rolefileSmapGenerator.getStrata();
+ // note: using assert(String,String,String) helps debugging, since this one supports visual compare
+ assertEquals("Strata of type \"" + typeName + "\" should be equal.\n", expectedStrata.get(typeName).toString(), actualStrata.toString());
+ }
+ }
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest003.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest003.java
new file mode 100644
index 0000000..0511b7e
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest003.java
@@ -0,0 +1,200 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTJStratumGenerationTest003.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.smap;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.objectteams.otdt.core.compiler.ISMAPConstants;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.FileInfo;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.LineInfo;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.RoleSmapGenerator;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.SmapStratum;
+
+/**
+ * @author ike
+ *
+ */
+public class OTJStratumGenerationTest003 extends AbstractSourceMapGeneratorTest
+{
+ private org.eclipse.jdt.core.ICompilationUnit _team1;
+ private org.eclipse.jdt.core.ICompilationUnit _team2;
+ private org.eclipse.jdt.core.ICompilationUnit _role;
+ private String _enclosingTypename;
+ private String _packagePath;
+
+ public OTJStratumGenerationTest003(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new Suite(OTJStratumGenerationTest003.class);
+ }
+
+ public void setUpSuite() throws Exception
+ {
+ setTestProjectDir("JSR-045");
+ super.setUpSuite();
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ _packagePath = "roleFileAndCopyInh";
+
+ _team1 = getCompilationUnit(
+ getTestProjectDir(),
+ "src",
+ _packagePath,
+ "SubTeam.java");
+
+ _team2 = getCompilationUnit(
+ getTestProjectDir(),
+ "src",
+ _packagePath,
+ "SuperTeam.java");
+
+ _role = getCompilationUnit(
+ getTestProjectDir(),
+ "src",
+ "roleFileAndCopyInh.SuperTeam",
+ "RoleA.java");
+ }
+
+ public void testSmapGeneration1() throws JavaModelException
+ {
+
+ TYPENAME = "__OT__RoleA";
+ _enclosingTypename = "SubTeam";
+
+ String roleFileSourceName = "RoleA.java";
+
+ SmapStratum stratum_role = new SmapStratum(ISMAPConstants.OTJ_STRATUM_NAME);
+ FileInfo fileInfo1 = stratum_role.getOrCreateFileInfo(
+ roleFileSourceName, _packagePath + "/" + "SuperTeam" + "/" + roleFileSourceName);
+
+ LineInfo lineInfo1 = new LineInfo(5,1); // role (5..) mapped to synthetic line 1 (no own lines in SubTeam.RoleA).
+ LineInfo lineInfo2 = new LineInfo(9,2); // method roleMethod (9..) mapped to synthetic line 2..
+ lineInfo2.setRepeatCount(2);
+ LineInfo lineInfo3 = new LineInfo(ISMAPConstants.STEP_INTO_LINENUMBER,ISMAPConstants.STEP_INTO_LINENUMBER);
+ LineInfo lineInfo4 = new LineInfo(ISMAPConstants.STEP_OVER_LINENUMBER,ISMAPConstants.STEP_OVER_LINENUMBER);
+
+ fileInfo1.addLineInfo(lineInfo1);
+ fileInfo1.addLineInfo(lineInfo2);
+ fileInfo1.addLineInfo(lineInfo3);
+ fileInfo1.addLineInfo(lineInfo4);
+
+ stratum_role.optimize();
+
+ List<SmapStratum> strata_role1 = new ArrayList<SmapStratum>();
+ strata_role1.add(stratum_role);
+
+ expectedStrata.put(TYPENAME, strata_role1);
+
+ try
+ {
+ parseAndCompile(new org.eclipse.jdt.core.ICompilationUnit[]{_team2, _team1, _role});
+ }
+ catch (JavaModelException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
+ public void testSmapGeneration2()
+ {
+ SmapStratum stratum_role = new SmapStratum(ISMAPConstants.OTJ_STRATUM_NAME);
+
+ FileInfo fileInfo = stratum_role.getOrCreateFileInfo("Team.java", "org/objectteams/Team.java");
+ LineInfo lineInfo1 = new LineInfo(OT_CONFINED_GET_TEAM_LINE,22); // getTeam mapped to synthetic line 22
+ fileInfo.addLineInfo(lineInfo1);
+
+ FileInfo fileInfo1 = stratum_role.getOrCreateFileInfo("SuperTeam.java", "roleFileAndCopyInh/SuperTeam.java");
+ LineInfo lineInfo2 = new LineInfo(3,21); // class position to first synthetic line 21
+ fileInfo1.addLineInfo(lineInfo2);
+
+ FileInfo fileInfo2 = stratum_role.getOrCreateFileInfo("SubTeam.java", "roleFileAndCopyInh/SubTeam.java");
+ LineInfo lineInfo3 = new LineInfo(1,1); // all lines of SubTeam unmapped
+ lineInfo3.setRepeatCount(20);
+ LineInfo lineInfo5 = new LineInfo(ISMAPConstants.STEP_INTO_LINENUMBER,ISMAPConstants.STEP_INTO_LINENUMBER);
+ LineInfo lineInfo6 = new LineInfo(ISMAPConstants.STEP_OVER_LINENUMBER,ISMAPConstants.STEP_OVER_LINENUMBER);
+ fileInfo2.addLineInfo(lineInfo3);
+ fileInfo2.addLineInfo(lineInfo5);
+ fileInfo2.addLineInfo(lineInfo6);
+
+ stratum_role.optimize();
+
+ TYPENAME = "__OT__Confined";
+ _enclosingTypename = "SubTeam";
+ List<SmapStratum> strata_role2 = new ArrayList<SmapStratum>();
+ strata_role2.add(stratum_role);
+
+ expectedStrata.put(TYPENAME, strata_role2);
+
+ try
+ {
+ parseAndCompile(new org.eclipse.jdt.core.ICompilationUnit[]{_team2, _team1, _role});
+ }
+ catch (JavaModelException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
+ public void callback(CompilationUnitDeclaration cuDecl)
+ {
+ String cuDeclName = String.valueOf(cuDecl.getMainTypeName());
+ if (!_enclosingTypename.equals(cuDeclName))
+ return;
+
+
+ TypeDeclaration typeDecl = cuDecl.types[0];
+
+ assertNotNull("TypeDeclaration should not be null.", typeDecl);
+
+ assertTrue("Membertypes of TypeDeclaration should be greater than 0.", typeDecl.memberTypes.length > 0);
+
+ TypeDeclaration [] members = typeDecl.memberTypes;
+ for (int idx = 0; idx < members.length; idx++)
+ {
+ TypeDeclaration decl = members[idx];
+ String typeName = String.valueOf(decl.name);
+
+ if (decl.isRole() && !decl.isInterface() && typeName.equals(TYPENAME))
+ {
+ RoleSmapGenerator roleSmapGenerator = new RoleSmapGenerator(decl);
+ roleSmapGenerator.addStratum("OTJ");
+ roleSmapGenerator.generate();
+ List actualStrata = roleSmapGenerator.getStrata();
+
+ assertEquals("Strata of type \"" + typeName + "\" should be equal.\n", expectedStrata.get(typeName).toString(), actualStrata.toString());
+ }
+ }
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest004.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest004.java
new file mode 100644
index 0000000..46db4b5
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest004.java
@@ -0,0 +1,182 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTJStratumGenerationTest004.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.smap;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.objectteams.otdt.core.compiler.ISMAPConstants;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.FileInfo;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.LineInfo;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.RoleSmapGenerator;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.SmapStratum;
+
+/**
+ * @author ike
+ *
+ */
+public class OTJStratumGenerationTest004 extends AbstractSourceMapGeneratorTest
+{
+ private org.eclipse.jdt.core.ICompilationUnit _team1;
+ @SuppressWarnings("unused")
+ private org.eclipse.jdt.core.ICompilationUnit _team2;
+ private org.eclipse.jdt.core.ICompilationUnit _role;
+ private String _enclosingTypename;
+
+ public OTJStratumGenerationTest004(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new Suite(OTJStratumGenerationTest004.class);
+ }
+
+ public void setUpSuite() throws Exception
+ {
+ setTestProjectDir("JSR-045");
+ super.setUpSuite();
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ _team1 = getCompilationUnit(
+ getTestProjectDir(),
+ "src",
+ "roleAndTeam",
+ "TeamA.java");
+
+ _role = getCompilationUnit(
+ getTestProjectDir(),
+ "src",
+ "roleAndTeam.TeamA",
+ "RoleA.java");
+ }
+
+ public void testSmapGeneration1() throws JavaModelException
+ {
+ TYPENAME = "__OT__RoleA";
+ _enclosingTypename = "TeamA";
+
+ SmapStratum stratum_role1 = new SmapStratum(ISMAPConstants.OTJ_STRATUM_NAME);
+ FileInfo fileInfo1 = stratum_role1.getOrCreateFileInfo("RoleA.java", "roleAndTeam/TeamA/RoleA.java");
+ LineInfo lineInfo1 = new LineInfo(1,1);
+ lineInfo1.setRepeatCount(11);
+ LineInfo lineInfo2 = new LineInfo(ISMAPConstants.STEP_INTO_LINENUMBER,ISMAPConstants.STEP_INTO_LINENUMBER);
+ LineInfo lineInfo3 = new LineInfo(ISMAPConstants.STEP_OVER_LINENUMBER,ISMAPConstants.STEP_OVER_LINENUMBER);
+
+ fileInfo1.addLineInfo(lineInfo1);
+ fileInfo1.addLineInfo(lineInfo2);
+ fileInfo1.addLineInfo(lineInfo3);
+
+ stratum_role1.optimize();
+
+ List<SmapStratum> strata_role1 = new ArrayList<SmapStratum>();
+ strata_role1.add(stratum_role1);
+
+ expectedStrata.put(TYPENAME, strata_role1);
+
+ try
+ {
+ parseAndCompile(new org.eclipse.jdt.core.ICompilationUnit[]{_team1, _role});
+ }
+ catch (JavaModelException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
+ public void testSmapGeneration2()
+ {
+ TYPENAME = "__OT__Confined";
+ _enclosingTypename = "TeamA";
+
+ SmapStratum stratum_role2 = new SmapStratum(ISMAPConstants.OTJ_STRATUM_NAME);
+ FileInfo fileInfo1 = stratum_role2.getOrCreateFileInfo("Team.java", "org/objectteams/Team.java");
+ LineInfo lineInfo1 = new LineInfo(OT_CONFINED_GET_TEAM_LINE,16);
+ fileInfo1.addLineInfo(lineInfo1);
+
+ FileInfo fileInfo2 = stratum_role2.getOrCreateFileInfo("TeamA.java", "roleAndTeam/TeamA.java");
+ LineInfo lineInfo2 = new LineInfo(1,1);
+ lineInfo2.setRepeatCount(15);
+ LineInfo lineInfo3 = new LineInfo(ISMAPConstants.STEP_INTO_LINENUMBER,ISMAPConstants.STEP_INTO_LINENUMBER);
+ LineInfo lineInfo4 = new LineInfo(ISMAPConstants.STEP_OVER_LINENUMBER,ISMAPConstants.STEP_OVER_LINENUMBER);
+ fileInfo2.addLineInfo(lineInfo2);
+ fileInfo2.addLineInfo(lineInfo3);
+ fileInfo2.addLineInfo(lineInfo4);
+
+ stratum_role2.optimize();
+
+ List<SmapStratum> strata_role2 = new ArrayList<SmapStratum>();
+ strata_role2.add(stratum_role2);
+
+ expectedStrata.put(TYPENAME, strata_role2);
+
+ try
+ {
+ parseAndCompile(new org.eclipse.jdt.core.ICompilationUnit[]{_team1, _role});
+ }
+ catch (JavaModelException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
+ public void callback(CompilationUnitDeclaration cuDecl)
+ {
+ String cuDeclName = String.valueOf(cuDecl.getMainTypeName());
+ if (!_enclosingTypename.equals(cuDeclName))
+ return;
+
+
+ TypeDeclaration typeDecl = cuDecl.types[0];
+
+ assertNotNull("TypeDeclaration should not be null.", typeDecl);
+
+ assertTrue("Membertypes of TypeDeclaration should be greater than 0.", typeDecl.memberTypes.length > 0);
+
+ TypeDeclaration [] members = typeDecl.memberTypes;
+ for (int idx = 0; idx < members.length; idx++)
+ {
+ TypeDeclaration decl = members[idx];
+ String typeName = String.valueOf(decl.name);
+
+ if (decl.isRole() && !decl.isInterface() && typeName.equals(TYPENAME))
+ {
+ RoleSmapGenerator rolefileSmapGenerator = new RoleSmapGenerator(decl);
+ rolefileSmapGenerator.addStratum("OTJ");
+ rolefileSmapGenerator.generate();
+ List actualStrata = rolefileSmapGenerator.getStrata();
+
+ assertEquals("Strata of type \"" + typeName + "\" should be equal.\n", expectedStrata.get(typeName).toString(), actualStrata.toString());
+ }
+ }
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest005.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest005.java
new file mode 100644
index 0000000..2261508
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest005.java
@@ -0,0 +1,265 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTJStratumGenerationTest005.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.smap;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.objectteams.otdt.core.compiler.ISMAPConstants;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.FileInfo;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.LineInfo;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.RoleSmapGenerator;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.SmapStratum;
+
+/**
+ * @author ike
+ *
+ */
+public class OTJStratumGenerationTest005 extends AbstractSourceMapGeneratorTest
+{
+ private org.eclipse.jdt.core.ICompilationUnit _superTeam;
+ private org.eclipse.jdt.core.ICompilationUnit _subTeam;
+ private org.eclipse.jdt.core.ICompilationUnit _baseClass;
+ private String _enclosingTypename;
+
+
+ public OTJStratumGenerationTest005(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new Suite(OTJStratumGenerationTest005.class);
+ }
+
+ public void setUpSuite() throws Exception
+ {
+ setTestProjectDir("JSR-045");
+ super.setUpSuite();
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ _superTeam = getCompilationUnit(
+ getTestProjectDir(),
+ "src",
+ "callout",
+ "SuperTeam.java");
+
+ _subTeam = getCompilationUnit(
+ getTestProjectDir(),
+ "src",
+ "callout",
+ "SubTeam.java");
+
+ _baseClass = getCompilationUnit(
+ getTestProjectDir(),
+ "src",
+ "callout",
+ "BaseClass.java");
+ }
+
+ public void testSmapGeneration1() throws JavaModelException
+ {
+ SmapStratum stratum_role1 = new SmapStratum(ISMAPConstants.OTJ_STRATUM_NAME);
+ FileInfo fileInfo_role1 = stratum_role1.getOrCreateFileInfo("SuperTeam.java", "callout/SuperTeam.java");
+ LineInfo lineInfo1_role1 = new LineInfo(1,1);
+ lineInfo1_role1.setRepeatCount(10);
+ LineInfo lineInfo2 = new LineInfo(ISMAPConstants.STEP_INTO_LINENUMBER,ISMAPConstants.STEP_INTO_LINENUMBER);
+ LineInfo lineInfo3 = new LineInfo(ISMAPConstants.STEP_OVER_LINENUMBER,ISMAPConstants.STEP_OVER_LINENUMBER);
+
+ fileInfo_role1.addLineInfo(lineInfo1_role1);
+ fileInfo_role1.addLineInfo(lineInfo2);
+ fileInfo_role1.addLineInfo(lineInfo3);
+
+ stratum_role1.optimize();
+
+ TYPENAME = "__OT__RoleA";
+ _enclosingTypename = "SuperTeam";
+ List<SmapStratum> strata_role1 = new ArrayList<SmapStratum>();
+ strata_role1.add(stratum_role1);
+
+ expectedStrata.put(TYPENAME, strata_role1);
+
+ try
+ {
+ parseAndCompile(new org.eclipse.jdt.core.ICompilationUnit[]{_baseClass, _superTeam, _subTeam});
+ }
+ catch (JavaModelException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
+ public void testSmapGeneration2()
+ {
+ SmapStratum stratum_role2 = new SmapStratum(ISMAPConstants.OTJ_STRATUM_NAME);;
+
+ FileInfo fileinfo = stratum_role2.getOrCreateFileInfo("Team.java", "org/objectteams/Team.java");
+ LineInfo lineInfo1 = new LineInfo(OT_CONFINED_GET_TEAM_LINE,11);
+ fileinfo.addLineInfo(lineInfo1);
+
+ FileInfo fileInfo_role2 = stratum_role2.getOrCreateFileInfo("SuperTeam.java", "callout/SuperTeam.java");
+ LineInfo lineInfo2 = new LineInfo(1,1);
+ lineInfo2.setRepeatCount(10);
+ LineInfo lineInfo3 = new LineInfo(ISMAPConstants.STEP_INTO_LINENUMBER,ISMAPConstants.STEP_INTO_LINENUMBER);
+ LineInfo lineInfo4 = new LineInfo(ISMAPConstants.STEP_OVER_LINENUMBER,ISMAPConstants.STEP_OVER_LINENUMBER);
+ fileInfo_role2.addLineInfo(lineInfo2);
+ fileInfo_role2.addLineInfo(lineInfo3);
+ fileInfo_role2.addLineInfo(lineInfo4);
+
+ stratum_role2.optimize();
+
+ TYPENAME = "__OT__Confined";
+ _enclosingTypename = "SuperTeam";
+ List<SmapStratum> strata_role2 = new ArrayList<SmapStratum>();
+ strata_role2.add(stratum_role2);
+
+ expectedStrata.put(TYPENAME, strata_role2);
+
+ try
+ {
+ parseAndCompile(new org.eclipse.jdt.core.ICompilationUnit[]{_baseClass, _superTeam, _subTeam});
+ }
+ catch (JavaModelException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
+ public void testSmapGeneration3() throws JavaModelException
+ {
+ SmapStratum stratum_role1 = new SmapStratum(ISMAPConstants.OTJ_STRATUM_NAME);
+
+ FileInfo fileInfo1_role1 = stratum_role1.getOrCreateFileInfo("SuperTeam.java", "callout/SuperTeam.java");
+ LineInfo fileInfo1_lineInfo1 = new LineInfo(4,10);
+ LineInfo fileInfo1_lineInfo2 = new LineInfo(8,11);
+ fileInfo1_role1.addLineInfo(fileInfo1_lineInfo1);
+ fileInfo1_role1.addLineInfo(fileInfo1_lineInfo2);
+ FileInfo fileInfo2_role1 = stratum_role1.getOrCreateFileInfo("SubTeam.java", "callout/SubTeam.java");
+ LineInfo fileInfo2_lineInfo1 = new LineInfo(1,1);
+ fileInfo2_lineInfo1.setRepeatCount(9);
+ LineInfo fileInfo2_lineInfo4 = new LineInfo(ISMAPConstants.STEP_INTO_LINENUMBER,ISMAPConstants.STEP_INTO_LINENUMBER);
+ LineInfo fileInfo2_lineInfo5 = new LineInfo(ISMAPConstants.STEP_OVER_LINENUMBER,ISMAPConstants.STEP_OVER_LINENUMBER);
+
+ fileInfo2_role1.addLineInfo(fileInfo2_lineInfo1);
+ fileInfo2_role1.addLineInfo(fileInfo2_lineInfo4);
+ fileInfo2_role1.addLineInfo(fileInfo2_lineInfo5);
+
+ stratum_role1.optimize();
+
+ TYPENAME = "__OT__RoleA";
+ _enclosingTypename = "SubTeam";
+ List<SmapStratum> strata_role1 = new ArrayList<SmapStratum>();
+ strata_role1.add(stratum_role1);
+
+ expectedStrata.put(TYPENAME, strata_role1);
+
+ try
+ {
+ parseAndCompile(new org.eclipse.jdt.core.ICompilationUnit[]{_baseClass, _superTeam, _subTeam});
+ }
+ catch (JavaModelException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
+ public void testSmapGeneration4()
+ {
+ SmapStratum stratum_role2 = new SmapStratum(ISMAPConstants.OTJ_STRATUM_NAME);
+
+ FileInfo fileinfo = stratum_role2.getOrCreateFileInfo("Team.java", "org/objectteams/Team.java");
+ LineInfo lineInfo1 = new LineInfo(OT_CONFINED_GET_TEAM_LINE,11);
+ fileinfo.addLineInfo(lineInfo1);
+
+ FileInfo fileInfo1 = stratum_role2.getOrCreateFileInfo("SuperTeam.java", "callout/SuperTeam.java");
+ LineInfo lineInfo2 = new LineInfo(2,10);
+ fileInfo1.addLineInfo(lineInfo2);
+
+ FileInfo fileInfo2 = stratum_role2.getOrCreateFileInfo("SubTeam.java", "callout/SubTeam.java");
+ LineInfo lineInfo3 = new LineInfo(1,1);
+ lineInfo3.setRepeatCount(9);
+ LineInfo lineInfo5 = new LineInfo(ISMAPConstants.STEP_INTO_LINENUMBER,ISMAPConstants.STEP_INTO_LINENUMBER);
+ LineInfo lineInfo6 = new LineInfo(ISMAPConstants.STEP_OVER_LINENUMBER,ISMAPConstants.STEP_OVER_LINENUMBER);
+ fileInfo2.addLineInfo(lineInfo3);
+ fileInfo2.addLineInfo(lineInfo5);
+ fileInfo2.addLineInfo(lineInfo6);
+
+ stratum_role2.optimize();
+
+ TYPENAME = "__OT__Confined";
+ _enclosingTypename = "SubTeam";
+ List<SmapStratum> strata_role2 = new ArrayList<SmapStratum>();
+ strata_role2.add(stratum_role2);
+
+ expectedStrata.put(TYPENAME, strata_role2);
+
+ try
+ {
+ parseAndCompile(new org.eclipse.jdt.core.ICompilationUnit[]{_baseClass, _superTeam, _subTeam});
+ }
+ catch (JavaModelException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
+ public void callback(CompilationUnitDeclaration cuDecl)
+ {
+ String cuDeclName = String.valueOf(cuDecl.getMainTypeName());
+ if (!_enclosingTypename.equals(cuDeclName))
+ return;
+
+
+ TypeDeclaration typeDecl = cuDecl.types[0];
+
+ assertNotNull("TypeDeclaration should not be null.", typeDecl);
+
+ assertTrue("Membertypes of TypeDeclaration should be greater than 0.", typeDecl.memberTypes.length > 0);
+
+ TypeDeclaration [] members = typeDecl.memberTypes;
+ for (int idx = 0; idx < members.length; idx++)
+ {
+ TypeDeclaration decl = members[idx];
+ String typeName = String.valueOf(decl.name);
+
+ if (decl.isRole() && !decl.isInterface() && typeName.equals(TYPENAME))
+ {
+ RoleSmapGenerator rolefileSmapGenerator = new RoleSmapGenerator(decl);
+ rolefileSmapGenerator.addStratum("OTJ");
+ rolefileSmapGenerator.generate();
+ List actualStrata = rolefileSmapGenerator.getStrata();
+
+ assertEquals("Strata of type \"" + typeName + "\" should be equal.\n", expectedStrata.get(typeName).toString(), actualStrata.toString());
+ }
+ }
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest006.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest006.java
new file mode 100644
index 0000000..d208996
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest006.java
@@ -0,0 +1,271 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTJStratumGenerationTest006.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.smap;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.objectteams.otdt.core.compiler.ISMAPConstants;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.FileInfo;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.LineInfo;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.RoleSmapGenerator;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.SmapStratum;
+
+/**
+ * @author ike
+ *
+ */
+public class OTJStratumGenerationTest006 extends AbstractSourceMapGeneratorTest
+{
+ private org.eclipse.jdt.core.ICompilationUnit _superTeam;
+ private org.eclipse.jdt.core.ICompilationUnit _subTeam;
+ private org.eclipse.jdt.core.ICompilationUnit _baseClass;
+ private String _enclosingTypename;
+
+
+ public OTJStratumGenerationTest006(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new Suite(OTJStratumGenerationTest006.class);
+ }
+
+ public void setUpSuite() throws Exception
+ {
+ setTestProjectDir("JSR-045");
+ super.setUpSuite();
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ _superTeam = getCompilationUnit(
+ getTestProjectDir(),
+ "src",
+ "calloutOverride",
+ "SuperTeam.java");
+
+ _subTeam = getCompilationUnit(
+ getTestProjectDir(),
+ "src",
+ "calloutOverride",
+ "SubTeam.java");
+
+ _baseClass = getCompilationUnit(
+ getTestProjectDir(),
+ "src",
+ "calloutOverride",
+ "BaseClass.java");
+ }
+
+ public void testSmapGeneration1() throws JavaModelException
+ {
+ TYPENAME = "__OT__RoleA";
+ _enclosingTypename = "SuperTeam";
+
+ SmapStratum stratum_role1 = new SmapStratum(ISMAPConstants.OTJ_STRATUM_NAME);
+ FileInfo fileInfo_role1 = stratum_role1.getOrCreateFileInfo("SuperTeam.java", "calloutOverride/SuperTeam.java");
+ LineInfo lineInfo1_role1 = new LineInfo(1,1);
+ lineInfo1_role1.setRepeatCount(16);
+ LineInfo lineInfo1_role2 = new LineInfo(ISMAPConstants.STEP_INTO_LINENUMBER,ISMAPConstants.STEP_INTO_LINENUMBER);
+ LineInfo lineInfo1_role3 = new LineInfo(ISMAPConstants.STEP_OVER_LINENUMBER,ISMAPConstants.STEP_OVER_LINENUMBER);
+
+ fileInfo_role1.addLineInfo(lineInfo1_role1);
+ fileInfo_role1.addLineInfo(lineInfo1_role2);
+ fileInfo_role1.addLineInfo(lineInfo1_role3);
+ List<SmapStratum> strata_role1 = new ArrayList<SmapStratum>();
+ strata_role1.add(stratum_role1);
+
+ stratum_role1.optimize();
+
+ expectedStrata.put(TYPENAME, strata_role1);
+
+ try
+ {
+ parseAndCompile(new org.eclipse.jdt.core.ICompilationUnit[]{_baseClass, _superTeam, _subTeam});
+ }
+ catch (JavaModelException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
+ public void testSmapGeneration2()
+ {
+ SmapStratum stratum_role2 = new SmapStratum(ISMAPConstants.OTJ_STRATUM_NAME);
+
+ FileInfo fileinfo = stratum_role2.getOrCreateFileInfo("Team.java", "org/objectteams/Team.java");
+ LineInfo lineInfo1 = new LineInfo(OT_CONFINED_GET_TEAM_LINE,17);
+ fileinfo.addLineInfo(lineInfo1);
+
+ FileInfo fileinfo2 = stratum_role2.getOrCreateFileInfo("SuperTeam.java", "calloutOverride/SuperTeam.java");
+ LineInfo lineInfo2 = new LineInfo(1,1);
+ lineInfo2.setRepeatCount(16);
+ LineInfo lineInfo3 = new LineInfo(ISMAPConstants.STEP_INTO_LINENUMBER,ISMAPConstants.STEP_INTO_LINENUMBER);
+ LineInfo lineInfo4 = new LineInfo(ISMAPConstants.STEP_OVER_LINENUMBER,ISMAPConstants.STEP_OVER_LINENUMBER);
+ fileinfo2.addLineInfo(lineInfo2);
+ fileinfo2.addLineInfo(lineInfo3);
+ fileinfo2.addLineInfo(lineInfo4);
+
+ stratum_role2.optimize();
+
+ TYPENAME = "__OT__Confined";
+ _enclosingTypename = "SuperTeam";
+ List<SmapStratum> strata_role2 = new ArrayList<SmapStratum>();
+ strata_role2.add(stratum_role2);
+
+ expectedStrata.put(TYPENAME, strata_role2);
+
+ try
+ {
+ parseAndCompile(new org.eclipse.jdt.core.ICompilationUnit[]{_baseClass, _superTeam, _subTeam});
+ }
+ catch (JavaModelException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
+ public void testSmapGeneration3() throws JavaModelException
+ {
+ TYPENAME = "__OT__RoleA";
+ _enclosingTypename = "SubTeam";
+
+ SmapStratum stratum_role1 = new SmapStratum(ISMAPConstants.OTJ_STRATUM_NAME);
+ FileInfo fileInfo1 = stratum_role1.getOrCreateFileInfo("SuperTeam.java", "calloutOverride/SuperTeam.java");
+ LineInfo lineInfo1 = new LineInfo(4,15);
+ LineInfo lineInfo2 = new LineInfo(8,18);
+ lineInfo2.setRepeatCount(2);
+ LineInfo lineInfo3 = new LineInfo(13,16);
+ lineInfo3.setRepeatCount(2);
+
+ fileInfo1.addLineInfo(lineInfo1);
+ fileInfo1.addLineInfo(lineInfo2);
+ fileInfo1.addLineInfo(lineInfo3);
+
+ FileInfo fileInfo2 = stratum_role1.getOrCreateFileInfo("SubTeam.java", "calloutOverride/SubTeam.java");
+ LineInfo lineInfo4 = new LineInfo(1,1);
+ lineInfo4.setRepeatCount(14);
+ LineInfo lineInfo7 = new LineInfo(ISMAPConstants.STEP_INTO_LINENUMBER,ISMAPConstants.STEP_INTO_LINENUMBER);
+ LineInfo lineInfo8 = new LineInfo(ISMAPConstants.STEP_OVER_LINENUMBER,ISMAPConstants.STEP_OVER_LINENUMBER);
+
+ fileInfo2.addLineInfo(lineInfo4);
+ fileInfo2.addLineInfo(lineInfo7);
+ fileInfo2.addLineInfo(lineInfo8);
+
+ stratum_role1.optimize();
+
+ List<SmapStratum> strata_role1 = new ArrayList<SmapStratum>();
+ strata_role1.add(stratum_role1);
+
+ expectedStrata.put(TYPENAME, strata_role1);
+
+ try
+ {
+ parseAndCompile(new org.eclipse.jdt.core.ICompilationUnit[]{_baseClass, _superTeam, _subTeam});
+ }
+ catch (JavaModelException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
+ public void testSmapGeneration4()
+ {
+ SmapStratum stratum_role2 = new SmapStratum(ISMAPConstants.OTJ_STRATUM_NAME);
+
+ FileInfo fileinfo = stratum_role2.getOrCreateFileInfo("Team.java", "org/objectteams/Team.java");
+ LineInfo lineInfo1 = new LineInfo(OT_CONFINED_GET_TEAM_LINE,16);
+ fileinfo.addLineInfo(lineInfo1);
+
+ FileInfo fileInfo2 = stratum_role2.getOrCreateFileInfo("SuperTeam.java", "calloutOverride/SuperTeam.java");
+ LineInfo lineInfo2 = new LineInfo(2,15);
+ fileInfo2.addLineInfo(lineInfo2);
+
+ FileInfo fileInfo3 = stratum_role2.getOrCreateFileInfo("SubTeam.java", "calloutOverride/SubTeam.java");
+ LineInfo lineInfo3 = new LineInfo(1,1);
+ lineInfo3.setRepeatCount(14);
+ LineInfo lineInfo5 = new LineInfo(ISMAPConstants.STEP_INTO_LINENUMBER,ISMAPConstants.STEP_INTO_LINENUMBER);
+ LineInfo lineInfo6 = new LineInfo(ISMAPConstants.STEP_OVER_LINENUMBER,ISMAPConstants.STEP_OVER_LINENUMBER);
+ fileInfo3.addLineInfo(lineInfo3);
+ fileInfo3.addLineInfo(lineInfo5);
+ fileInfo3.addLineInfo(lineInfo6);
+
+ stratum_role2.optimize();
+
+ TYPENAME = "__OT__Confined";
+ _enclosingTypename = "SubTeam";
+ List<SmapStratum> strata_role2 = new ArrayList<SmapStratum>();
+ strata_role2.add(stratum_role2);
+
+ expectedStrata.put(TYPENAME, strata_role2);
+
+ try
+ {
+ parseAndCompile(new org.eclipse.jdt.core.ICompilationUnit[]{_baseClass, _superTeam, _subTeam});
+ }
+ catch (JavaModelException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
+ public void callback(CompilationUnitDeclaration cuDecl)
+ {
+ String cuDeclName = String.valueOf(cuDecl.getMainTypeName());
+ if (!_enclosingTypename.equals(cuDeclName))
+ return;
+
+
+ TypeDeclaration typeDecl = cuDecl.types[0];
+
+ assertNotNull("TypeDeclaration should not be null.", typeDecl);
+
+ assertTrue("Membertypes of TypeDeclaration should be greater than 0.", typeDecl.memberTypes.length > 0);
+
+ TypeDeclaration [] members = typeDecl.memberTypes;
+ for (int idx = 0; idx < members.length; idx++)
+ {
+ TypeDeclaration decl = members[idx];
+ String typeName = String.valueOf(decl.name);
+
+ if (decl.isRole() && !decl.isInterface() && typeName.equals(TYPENAME))
+ {
+ RoleSmapGenerator rolefileSmapGenerator = new RoleSmapGenerator(decl);
+ rolefileSmapGenerator.addStratum("OTJ");
+ rolefileSmapGenerator.generate();
+ List actualStrata = rolefileSmapGenerator.getStrata();
+
+ assertEquals("Strata of type \"" + typeName + "\" should be equal.\n", expectedStrata.get(typeName).toString(), actualStrata.toString());
+ }
+ }
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest007.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest007.java
new file mode 100644
index 0000000..2549ea8
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest007.java
@@ -0,0 +1,280 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTJStratumGenerationTest007.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.smap;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.objectteams.otdt.core.compiler.ISMAPConstants;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.FileInfo;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.LineInfo;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.LineInfoReminder;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.RoleSmapGenerator;
+import org.eclipse.objectteams.otdt.internal.core.compiler.smap.SmapStratum;
+
+/**
+ * @author ike
+ *
+ */
+public class OTJStratumGenerationTest007 extends AbstractSourceMapGeneratorTest
+{
+ private org.eclipse.jdt.core.ICompilationUnit _teamA;
+
+ @SuppressWarnings("unused")
+ private org.eclipse.jdt.core.ICompilationUnit _tea1m2;
+
+ private org.eclipse.jdt.core.ICompilationUnit _teamB;
+
+ private org.eclipse.jdt.core.ICompilationUnit _baseClass;
+
+ private String _enclosingTypename;
+
+ private String _packagePath;
+
+ private boolean _buildPartially;
+
+ public OTJStratumGenerationTest007(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new Suite(OTJStratumGenerationTest007.class);
+ }
+
+ public void setUpSuite() throws Exception
+ {
+ setTestProjectDir("JSR-045");
+ super.setUpSuite();
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ _packagePath = "callin_after_before";
+
+ _teamA = getCompilationUnit(
+ getTestProjectDir(),
+ "src",
+ _packagePath,
+ "TeamA.java");
+
+ _teamB = getCompilationUnit(
+ getTestProjectDir(),
+ "src",
+ _packagePath,
+ "TeamB.java");
+
+ _baseClass = getCompilationUnit(
+ getTestProjectDir(),
+ "src",
+ _packagePath,
+ "BaseClass.java");
+ }
+
+ public void testSmapGeneration1() throws JavaModelException
+ {
+ TYPENAME = "__OT__RoleA";
+ _enclosingTypename = "TeamA";
+ String enclTypeSourceName = _enclosingTypename + ".java";
+ _buildPartially = false;
+
+ SmapStratum stratum_role1 = new SmapStratum(
+ ISMAPConstants.OTJ_STRATUM_NAME);
+ FileInfo fileInfo_role1 = stratum_role1.getOrCreateFileInfo(
+ enclTypeSourceName, _packagePath + "/" + enclTypeSourceName);
+ LineInfo lineInfo1_role1 = new LineInfo(1, 1);
+ lineInfo1_role1.setRepeatCount(15);
+ LineInfo lineInfo1_role2 = new LineInfo(ISMAPConstants.STEP_INTO_LINENUMBER,ISMAPConstants.STEP_INTO_LINENUMBER);
+ LineInfo lineInfo1_role3 = new LineInfo(ISMAPConstants.STEP_OVER_LINENUMBER,ISMAPConstants.STEP_OVER_LINENUMBER);
+
+
+ fileInfo_role1.addLineInfo(lineInfo1_role1);
+ fileInfo_role1.addLineInfo(lineInfo1_role2);
+ fileInfo_role1.addLineInfo(lineInfo1_role3);
+
+ List<SmapStratum> strata_role1 = new ArrayList<SmapStratum>();
+ strata_role1.add(stratum_role1);
+
+ stratum_role1.optimize();
+
+ expectedStrata.put(TYPENAME, strata_role1);
+
+ try
+ {
+ parseAndCompile(new org.eclipse.jdt.core.ICompilationUnit[] {
+ _baseClass, _teamA, _teamB });
+ }
+ catch (JavaModelException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
+ public void testSmapGeneration2() throws JavaModelException
+ {
+ TYPENAME = "__OT__RoleA";
+ _enclosingTypename = "TeamA";
+ String enclTypeSourceName = _enclosingTypename + ".java";
+ _buildPartially = true;
+
+ SmapStratum stratum_role1 = new SmapStratum(
+ ISMAPConstants.OTJ_STRATUM_NAME);
+ FileInfo fileInfo_role1 = stratum_role1.getOrCreateFileInfo(
+ enclTypeSourceName, _packagePath + "/" + enclTypeSourceName);
+ fileInfo_role1.addLineInfo(new LineInfo(ISMAPConstants.STEP_OVER_LINENUMBER,ISMAPConstants.STEP_OVER_LINENUMBER));
+
+ List<SmapStratum> strata_role1 = new ArrayList<SmapStratum>();
+ strata_role1.add(stratum_role1);
+
+ expectedStrata.put(TYPENAME, strata_role1);
+
+ try
+ {
+ parseAndCompile(new org.eclipse.jdt.core.ICompilationUnit[] {
+ _baseClass, _teamA, _teamB });
+ }
+ catch (JavaModelException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
+ public void testSmapGeneration3() throws JavaModelException
+ {
+ TYPENAME = "__OT__RoleB";
+ _enclosingTypename = "TeamB";
+ String enclTypeSourceName = _enclosingTypename + ".java";
+ _buildPartially = false;
+
+ SmapStratum stratum_role1 = new SmapStratum(
+ ISMAPConstants.OTJ_STRATUM_NAME);
+ FileInfo fileInfo_role1 = stratum_role1.getOrCreateFileInfo(
+ enclTypeSourceName, _packagePath + "/" + enclTypeSourceName);
+ LineInfo lineInfo1_role1 = new LineInfo(1, 1);
+ lineInfo1_role1.setRepeatCount(13);
+ LineInfo lineInfo1_role2 = new LineInfo(ISMAPConstants.STEP_INTO_LINENUMBER,ISMAPConstants.STEP_INTO_LINENUMBER);
+ LineInfo lineInfo1_role3 = new LineInfo(ISMAPConstants.STEP_OVER_LINENUMBER,ISMAPConstants.STEP_OVER_LINENUMBER);
+
+ fileInfo_role1.addLineInfo(lineInfo1_role1);
+ fileInfo_role1.addLineInfo(lineInfo1_role2);
+ fileInfo_role1.addLineInfo(lineInfo1_role3);
+
+ stratum_role1.optimize();
+
+ List<SmapStratum> strata_role1 = new ArrayList<SmapStratum>();
+ strata_role1.add(stratum_role1);
+
+ expectedStrata.put(TYPENAME, strata_role1);
+
+ try
+ {
+ parseAndCompile(new org.eclipse.jdt.core.ICompilationUnit[] {
+ _baseClass, _teamA, _teamB });
+ }
+ catch (JavaModelException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
+
+ public void testSmapGeneration4() throws JavaModelException
+ {
+ TYPENAME = "__OT__RoleB";
+ _enclosingTypename = "TeamB";
+ String enclTypeSourceName = _enclosingTypename + ".java";
+ _buildPartially = true;
+
+ SmapStratum stratum_role1 = new SmapStratum(
+ ISMAPConstants.OTJ_STRATUM_NAME);
+ FileInfo fileInfo_role1 = stratum_role1.getOrCreateFileInfo(
+ enclTypeSourceName, _packagePath + "/" + enclTypeSourceName);
+ fileInfo_role1.addLineInfo(new LineInfo(ISMAPConstants.STEP_OVER_LINENUMBER,ISMAPConstants.STEP_OVER_LINENUMBER));
+
+ List<SmapStratum> strata_role1 = new ArrayList<SmapStratum>();
+ strata_role1.add(stratum_role1);
+
+ expectedStrata.put(TYPENAME, strata_role1);
+
+ try
+ {
+ parseAndCompile(new org.eclipse.jdt.core.ICompilationUnit[] {
+ _baseClass, _teamA, _teamB });
+ }
+ catch (JavaModelException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
+ public void callback(CompilationUnitDeclaration cuDecl)
+ {
+ String cuDeclName = String.valueOf(cuDecl.getMainTypeName());
+ if (!_enclosingTypename.equals(cuDeclName))
+ return;
+
+ TypeDeclaration typeDecl = cuDecl.types[0];
+
+ assertNotNull("TypeDeclaration should not be null.", typeDecl);
+
+ assertTrue("Membertypes of TypeDeclaration should be greater than 0.",
+ typeDecl.memberTypes.length > 0);
+
+ TypeDeclaration[] members = typeDecl.memberTypes;
+ for (int idx = 0; idx < members.length; idx++)
+ {
+ TypeDeclaration decl = members[idx];
+ String typeName = String.valueOf(decl.name);
+
+ if (decl.isRole() && !decl.isInterface()
+ && typeName.equals(TYPENAME))
+ {
+ RoleSmapGenerator rolefileSmapGenerator = new RoleSmapGenerator(decl);
+ if (_buildPartially)
+ {
+ rolefileSmapGenerator.addStratum("OTJ");
+ SmapStratum stratum = (SmapStratum)rolefileSmapGenerator.getStrata().get(0);
+ rolefileSmapGenerator.generatePartialOTJSmap(stratum, new LineInfoReminder());
+ }
+ else
+ {
+ rolefileSmapGenerator.addStratum("OTJ");
+ rolefileSmapGenerator.generate();
+ }
+
+ List actualStrata = rolefileSmapGenerator.getStrata();
+
+ assertEquals("Strata of type \"" + typeName
+ + "\" should be equal.\n",
+ expectedStrata.get(typeName).toString(), actualStrata.toString());
+ }
+ }
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/Requestor.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/Requestor.java
new file mode 100644
index 0000000..ef9ac20
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/Requestor.java
@@ -0,0 +1,129 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: Requestor.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.compiler.smap;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import junit.framework.Assert;
+import junit.framework.AssertionFailedError;
+
+import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.core.tests.util.Util;
+import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.core.util.IClassFileReader;
+import org.eclipse.jdt.core.util.ILineNumberAttribute;
+import org.eclipse.jdt.core.util.IMethodInfo;
+import org.eclipse.jdt.internal.compiler.ClassFile;
+import org.eclipse.jdt.internal.compiler.CompilationResult;
+import org.eclipse.jdt.internal.compiler.ICompilerRequestor;
+import org.eclipse.jdt.internal.core.util.ClassFileReader;
+
+// from org.eclipse.jdt.core.tests.compiler.regression.Requestor
+// added capability to check generated line numbers.
+public class Requestor extends Assert implements ICompilerRequestor {
+ public boolean hasErrors = false;
+ public String outputPath;
+ private boolean forceOutputGeneration;
+ public Hashtable expectedProblems = new Hashtable();
+ public String problemLog = "";
+ public ICompilerRequestor clientRequestor;
+ public boolean showCategory = false;
+ public boolean showWarningToken = false;
+ HashMap<String, int[]> lineNumbers = new HashMap<String, int[]>();
+
+
+public Requestor(boolean forceOutputGeneration, ICompilerRequestor clientRequestor, boolean showCategory, boolean showWarningToken, HashMap<String, int[]> lineNumbers) {
+ this.forceOutputGeneration = forceOutputGeneration;
+ this.clientRequestor = clientRequestor;
+ this.showCategory = showCategory;
+ this.showWarningToken = showWarningToken;
+ this.lineNumbers = lineNumbers;
+}
+public void acceptResult(CompilationResult compilationResult) {
+ this.hasErrors |= compilationResult.hasErrors();
+ this.problemLog += Util.getProblemLog(compilationResult, this.showCategory, this.showWarningToken);
+ outputClassFiles(compilationResult);
+ if (this.clientRequestor != null) {
+ this.clientRequestor.acceptResult(compilationResult);
+ }
+}
+protected void outputClassFiles(CompilationResult unitResult) {
+ if ((unitResult != null) && (!unitResult.hasErrors() || forceOutputGeneration)) {
+ ClassFile[]classFiles = unitResult.getClassFiles();
+ for (int i = 0, fileCount = classFiles.length; i < fileCount; i++) {
+ // retrieve the key and the corresponding classfile
+ ClassFile classFile = classFiles[i];
+ if (outputPath != null) {
+ String relativeName =
+ new String(classFile.fileName()).replace('/', File.separatorChar) + ".class";
+ try {
+ org.eclipse.jdt.internal.compiler.util.Util.writeToDisk(true, outputPath, relativeName, classFile);
+ } catch(IOException e) {
+ e.printStackTrace();
+ }
+ }
+ if (this.lineNumbers != null) {
+ ClassFileReader cfr;
+ try {
+ cfr = new ClassFileReader(classFile.getBytes(), IClassFileReader.METHOD_INFOS|IClassFileReader.METHOD_BODIES);
+ } catch (ClassFormatException e) {
+ throw new AssertionFailedError("Can't read class file: "+e.getMessage());
+ }
+ for (IMethodInfo method : cfr.getMethodInfos()) {
+ String fullMethodDesignator = String.valueOf(
+ CharOperation.concatWith(
+ classFile.getCompoundName(),
+ CharOperation.concat(method.getName(), method.getDescriptor()),
+ '.'));
+ int[] expectedNumbers = this.lineNumbers.get(fullMethodDesignator);
+ if (expectedNumbers != null) {
+ this.lineNumbers.remove(fullMethodDesignator);
+ ILineNumberAttribute lineNumberAttribute = method.getCodeAttribute().getLineNumberAttribute();
+ int[][] table = lineNumberAttribute.getLineNumberTable();
+ Assert.assertEquals("wrong number of line numbers", expectedNumbers.length, table.length);
+ for (int n=0; n<expectedNumbers.length; n++)
+ Assert.assertEquals("wrong line numeber", expectedNumbers[n], table[n][1]);
+ }
+ }
+ }
+ }
+ }
+}
+public void checkAllLineNumbersSeen() {
+ if (this.lineNumbers != null) {
+ if (!this.lineNumbers.isEmpty()) {
+ String methods = "";
+ for (Map.Entry<String, int[]> entry : this.lineNumbers.entrySet()) {
+ System.out.print("Unmatched line numbers for method "+entry.getKey());
+ for(int l : entry.getValue())
+ System.out.print(" "+l);
+ System.out.println();
+ methods += " "+entry.getKey();
+ }
+ Assert.fail("Unmatched line numbers"+methods);
+ }
+ }
+}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/formatter/org/eclipse/objectteams/otdt/core/tests/formatter/FormatterTests.java b/testplugins/org.eclipse.objectteams.otdt.tests/formatter/org/eclipse/objectteams/otdt/core/tests/formatter/FormatterTests.java
new file mode 100644
index 0000000..85303fd
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/formatter/org/eclipse/objectteams/otdt/core/tests/formatter/FormatterTests.java
@@ -0,0 +1,229 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: FormatterTests.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.core.tests.formatter;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import junit.framework.Test;
+
+import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.formatter.CodeFormatter;
+import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
+
+import org.eclipse.jdt.core.tests.util.Util;
+import org.eclipse.jdt.internal.formatter.DefaultCodeFormatter;
+import org.eclipse.jdt.internal.formatter.DefaultCodeFormatterOptions;
+import org.eclipse.objectteams.otdt.tests.AbstractJavaModelTests;
+import org.eclipse.text.edits.TextEdit;
+
+/**
+ * Test infra-structure copied from org.eclipse.jdt.core.tests.formatter.FormatterRegressionTests.
+ *
+ * @author stephan
+ */
+@SuppressWarnings("restriction")
+public class FormatterTests extends AbstractJavaModelTests {
+
+ public static final int UNKNOWN_KIND = 0;
+ public static final String IN = "_in";
+ public static final String OUT = "_out";
+ public static final boolean DEBUG = false;
+ private static final String LINE_SEPARATOR = System.getProperty("line.separator");
+ private long time;
+
+ static {
+// TESTS_NUMBERS = new int[] { 620 } ;
+ }
+ public static Test suite() {
+ return buildModelTestSuite(FormatterTests.class);
+ }
+
+ public FormatterTests(String name) {
+ super(name);
+ }
+
+ /**
+ * Returns the OS path to the directory that contains this plugin.
+ */
+ protected String getPluginDirectoryPath() {
+ try {
+ URL platformURL = Platform.getBundle("org.eclispe.objectteams.otdt.tests").getEntry("/");
+ return new File(FileLocator.toFileURL(platformURL).getFile()).getAbsolutePath();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public String getSourceWorkspacePath() {
+ return getPluginDirectoryPath() + java.io.File.separator + "workspace";
+ }
+
+ private String runFormatter(CodeFormatter codeFormatter, String source, int kind, int indentationLevel, int offset, int length, String lineSeparator) {
+// long time = System.currentTimeMillis();
+ TextEdit edit = codeFormatter.format(kind, source, offset, length, indentationLevel, lineSeparator);//$NON-NLS-1$
+// System.out.println((System.currentTimeMillis() - time) + " ms");
+ if (edit == null) return null;
+// System.out.println(edit.getChildrenSize() + " edits");
+ String result = org.eclipse.jdt.internal.core.util.Util.editedString(source, edit);
+
+ if (length == source.length()) {
+// time = System.currentTimeMillis();
+ edit = codeFormatter.format(kind, result, 0, result.length(), indentationLevel, lineSeparator);//$NON-NLS-1$
+// System.out.println((System.currentTimeMillis() - time) + " ms");
+ if (edit == null) return null;
+// assertEquals("Should not have edits", 0, edit.getChildren().length);
+ final String result2 = org.eclipse.jdt.internal.core.util.Util.editedString(result, edit);
+ if (!result.equals(result2)) {
+ assertSourceEquals("Different reformatting", Util.convertToIndependantLineDelimiter(result), Util.convertToIndependantLineDelimiter(result2));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Create project and set the jar placeholder.
+ */
+ public void setUpSuite() throws Exception {
+ // ensure autobuilding is turned off
+ IWorkspaceDescription description = getWorkspace().getDescription();
+ if (description.isAutoBuilding()) {
+ description.setAutoBuilding(false);
+ getWorkspace().setDescription(description);
+ }
+ setUpJavaProject("Formatter", "1.5"); //$NON-NLS-1$ $NON-NLS-2$
+ if (DEBUG) {
+ this.time = System.currentTimeMillis();
+ }
+ }
+
+ /**
+ * Reset the jar placeholder and delete project.
+ */
+ public void tearDownSuite() throws Exception {
+ this.deleteProject("Formatter"); //$NON-NLS-1$
+ if (DEBUG) {
+ System.out.println("Time spent = " + (System.currentTimeMillis() - this.time));//$NON-NLS-1$
+ }
+ super.tearDown();
+ }
+
+ private String getIn(String compilationUnitName) {
+ assertNotNull(compilationUnitName);
+ int dotIndex = compilationUnitName.indexOf('.');
+ assertTrue(dotIndex != -1);
+ return compilationUnitName.substring(0, dotIndex) + IN + compilationUnitName.substring(dotIndex);
+ }
+
+ private String getOut(String compilationUnitName) {
+ assertNotNull(compilationUnitName);
+ int dotIndex = compilationUnitName.indexOf('.');
+ assertTrue(dotIndex != -1);
+ return compilationUnitName.substring(0, dotIndex) + OUT + compilationUnitName.substring(dotIndex);
+ }
+
+ private void assertLineEquals(String actualContents, String originalSource, String expectedContents, boolean checkNull) {
+ if (actualContents == null) {
+ assertTrue("actualContents is null", checkNull);
+ assertEquals(expectedContents, originalSource);
+ return;
+ }
+ assertSourceEquals("Different source", Util.convertToIndependantLineDelimiter(expectedContents), actualContents);
+ }
+
+ private void runTest(String packageName, String compilationUnitName) {
+ DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
+ preferences.number_of_empty_lines_to_preserve = 0;
+ DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
+ runTest(codeFormatter, packageName, compilationUnitName, CodeFormatter.K_COMPILATION_UNIT, 0);
+ }
+
+ private void runTest(CodeFormatter codeFormatter, String packageName, String compilationUnitName, int kind, int indentationLevel) {
+ runTest(codeFormatter, packageName, compilationUnitName, kind, indentationLevel, false, 0, -1);
+ }
+ private void runTest(CodeFormatter codeFormatter, String packageName, String compilationUnitName, int kind, int indentationLevel, boolean checkNull, int offset, int length) {
+ runTest(codeFormatter, packageName, compilationUnitName, kind, indentationLevel, checkNull, offset, length, null);
+ }
+
+ private void runTest(CodeFormatter codeFormatter, String packageName, String compilationUnitName, int kind, int indentationLevel, boolean checkNull, int offset, int length, String lineSeparator) {
+ try {
+ ICompilationUnit sourceUnit = getCompilationUnit("Formatter" , "", packageName, getIn(compilationUnitName)); //$NON-NLS-1$ //$NON-NLS-2$
+ String s = sourceUnit.getSource();
+ assertNotNull(s);
+ ICompilationUnit outputUnit = getCompilationUnit("Formatter" , "", packageName, getOut(compilationUnitName)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertNotNull(outputUnit);
+ String result;
+ if (length == -1) {
+ result = runFormatter(codeFormatter, s, kind, indentationLevel, offset, s.length(), lineSeparator);
+ } else {
+ result = runFormatter(codeFormatter, s, kind, indentationLevel, offset, length, lineSeparator);
+ }
+ assertLineEquals(result, s, outputUnit.getSource(), checkNull);
+ } catch (JavaModelException e) {
+ e.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ String getSource(ASTNode astNode, char[] source) {
+ String result = new String(CharOperation.subarray(source, astNode.getStartPosition() + 1, astNode.getStartPosition() + astNode.getLength() - 1));
+ if (result.endsWith("\\n")) {
+ return result.substring(0, result.length() - 2) + LINE_SEPARATOR;
+ }
+ return result;
+ }
+
+ public void test001() {
+ runTest("test001", "T1.java");//$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public void test002() {
+ runTest("test002", "T1.java");//$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public void test003() {
+ runTest("test003", "T1.java");//$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public void test004() {
+ runTest("test004", "T1.java");//$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public void test005() {
+ runTest("test005", "T1.java");//$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public void test006() {
+ runTest("test006", "T1.java");//$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public void test007() {
+ runTest("test007", "Class1.java");//$NON-NLS-1$ //$NON-NLS-2$
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/hierarchy/org/eclipse/objectteams/otdt/tests/hierarchy/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.tests/hierarchy/org/eclipse/objectteams/otdt/tests/hierarchy/AllTests.java
new file mode 100644
index 0000000..270f57f
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/hierarchy/org/eclipse/objectteams/otdt/tests/hierarchy/AllTests.java
@@ -0,0 +1,44 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: AllTests.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.hierarchy;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author anklam
+ *
+ * @version $Id: AllTests.java 23494 2010-02-05 23:06:44Z stephan $
+ */
+public class AllTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("All CompleteRoleHierarchy Tests");
+
+ //$JUnit-BEGIN$
+ suite.addTest(CompleteRoleHierarchyWithClasses.suite());
+ suite.addTest(OTTypeHierarchyTests.suite());
+ suite.addTest(ITypeIOTTypeTest.suite());
+ //$JUnit-END$
+
+ return suite;
+ }
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/hierarchy/org/eclipse/objectteams/otdt/tests/hierarchy/CompleteRoleHierarchyWithClasses.java b/testplugins/org.eclipse.objectteams.otdt.tests/hierarchy/org/eclipse/objectteams/otdt/tests/hierarchy/CompleteRoleHierarchyWithClasses.java
new file mode 100644
index 0000000..f67bda4
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/hierarchy/org/eclipse/objectteams/otdt/tests/hierarchy/CompleteRoleHierarchyWithClasses.java
@@ -0,0 +1,560 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: CompleteRoleHierarchyWithClasses.java 23494 2010-02-05 23:06:44Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.tests.hierarchy;
+
+import java.util.ArrayList;
+
+import junit.framework.Test;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.objectteams.otdt.core.IRoleType;
+import org.eclipse.objectteams.otdt.internal.core.OTTypeHierarchy;
+import org.eclipse.objectteams.otdt.tests.otmodel.FileBasedModelTest;
+
+/**
+ * @author jwloka
+ * @version $Id: CompleteRoleHierarchyWithClasses.java 23494 2010-02-05 23:06:44Z stephan $
+ */
+/*
+ * The testdata setting looks like this:
+ *
+ * SuperSuperTeam
+ * R1 SuperClass
+ * /\ /\
+ * | |
+ * SuperTeam |
+ * R1------------------------------------------------> AClass
+ * /\ explicit inheritance /\
+ * | ~~~~~~~~~~~~~~~~~~~~ |'''''''''''''''''|
+ * ATeam | |
+ * R1 SubClass1 SubClass2
+ * /\ /\ /\
+ * |'''''''''''''''''''| |''''''''''''|'''''''''''''| |
+ * SubTeam1 SubTeam2 | | | |
+ * R1 R1------------------>SubSubClass11 SubSubClass12 |
+ * /\ | |
+ * |'''''''''''| | |
+ * SubSubTeam11 SubSubTeam12 | |
+ * R1 R1-----------------| |