diff options
author | Till Brychcy | 2017-10-29 20:50:59 +0000 |
---|---|---|
committer | Till Brychcy | 2017-11-06 11:45:10 +0000 |
commit | 9b27fbf26574b796246129bd7cabbca6c1f5293c (patch) | |
tree | fe5abdde8bf47dc1b7cd69c0ab5ca55cff818f99 /org.eclipse.jdt.core.tests.builder | |
parent | 72a56bd17a4cabfafe0bcce39692b113cbc9ad8f (diff) | |
download | eclipse.jdt.core-9b27fbf26574b796246129bd7cabbca6c1f5293c.tar.gz eclipse.jdt.core-9b27fbf26574b796246129bd7cabbca6c1f5293c.tar.xz eclipse.jdt.core-9b27fbf26574b796246129bd7cabbca6c1f5293c.zip |
Bug 526376 - Duplicated line in IncrementalImageBuilder
Change-Id: I7bd40ec3dc736ac9b5453d68469c1a9158ac6daa
Diffstat (limited to 'org.eclipse.jdt.core.tests.builder')
5 files changed, 123 insertions, 75 deletions
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuilderTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuilderTests.java index 1ddc0e36a4..ad3e562ced 100644 --- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuilderTests.java +++ b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuilderTests.java @@ -189,7 +189,7 @@ public class BuilderTests extends TestCase { /** Verifies that given classes have been compiled in the specified order. */ protected void expectingCompilingOrder(String[] expected) { - expectingCompiling(this.debugRequestor.getCompiledClasses(), expected, "unexpected compiling order"); //$NON-NLS-1$ + expectingCompiling(this.debugRequestor.getCompiledFiles(), expected, "unexpected compiling order"); //$NON-NLS-1$ } private void expectingCompiling(String[] actual, String[] expected, String message) { @@ -197,20 +197,24 @@ public class BuilderTests extends TestCase { for (int i = 0; i < actual.length; i++) System.out.println(actual[i]); - StringBuffer actualBuffer = new StringBuffer("{"); //$NON-NLS-1$ + StringBuffer actualBuffer = new StringBuffer("{ "); //$NON-NLS-1$ for (int i = 0; i < actual.length; i++) { if (i > 0) - actualBuffer.append(","); //$NON-NLS-1$ + actualBuffer.append(", "); //$NON-NLS-1$ + actualBuffer.append("\""); actualBuffer.append(actual[i]); + actualBuffer.append("\""); } - actualBuffer.append('}'); - StringBuffer expectedBuffer = new StringBuffer("{"); //$NON-NLS-1$ + actualBuffer.append(" }"); + StringBuffer expectedBuffer = new StringBuffer("{ "); //$NON-NLS-1$ for (int i = 0; i < expected.length; i++) { if (i > 0) - expectedBuffer.append(","); //$NON-NLS-1$ + expectedBuffer.append(", "); //$NON-NLS-1$ + expectedBuffer.append("\""); expectedBuffer.append(expected[i]); + expectedBuffer.append("\""); } - expectedBuffer.append('}'); + expectedBuffer.append(" }"); assertEquals(message, expectedBuffer.toString(), actualBuffer.toString()); } diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyCompilerRequestor.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyCompilerRequestor.java index d31f74e785..90bda84ed6 100644 --- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyCompilerRequestor.java +++ b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyCompilerRequestor.java @@ -10,19 +10,21 @@ *******************************************************************************/ package org.eclipse.jdt.core.tests.builder; -import java.util.Vector; +import java.util.ArrayList; import org.eclipse.jdt.internal.compiler.ClassFile; import org.eclipse.jdt.internal.compiler.CompilationResult; import org.eclipse.jdt.internal.compiler.IDebugRequestor; import org.eclipse.jdt.internal.core.util.Util; -@SuppressWarnings({"rawtypes", "unchecked"}) public class EfficiencyCompilerRequestor implements IDebugRequestor { private boolean isActive = false; - private Vector compiledClasses = new Vector(10); + private ArrayList<String> compiledClasses = new ArrayList<>(); + private ArrayList<String> compiledFiles = new ArrayList<>(); + public void acceptDebugResult(CompilationResult result){ + this.compiledFiles.add(new String(result.fileName)); ClassFile[] classFiles = result.getClassFiles(); Util.sort(classFiles, new Util.Comparer() { public int compare(Object a, Object b) { @@ -33,16 +35,21 @@ public class EfficiencyCompilerRequestor implements IDebugRequestor { }); for (int i = 0; i < classFiles.length; i++) { String className = new String(classFiles[i].fileName()); - this.compiledClasses.addElement(className.replace('/', '.')); + this.compiledClasses.add(className.replace('/', '.')); } } String[] getCompiledClasses(){ - return (String [])this.compiledClasses.toArray(new String[0]); + return this.compiledClasses.toArray(new String[0]); + } + + String[] getCompiledFiles(){ + return this.compiledFiles.toArray(new String[0]); } public void clearResult(){ this.compiledClasses.clear(); + this.compiledFiles.clear(); } public void reset() { diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyTests.java index c6bfe99ee8..874be1a796 100644 --- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyTests.java +++ b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyTests.java @@ -94,7 +94,7 @@ public class EfficiencyTests extends BuilderTests { incrementalBuild(projectPath); expectingCompiledClasses(new String[]{"p2.Collaborator", "p1.Indicted"}); //$NON-NLS-1$ //$NON-NLS-2$ - expectingCompilingOrder(new String[]{"p1.Indicted", "p2.Collaborator"}); //$NON-NLS-1$ //$NON-NLS-2$ + expectingCompilingOrder(new String[] { "/Project/src/p1/Indicted.java", "/Project/src/p2/Collaborator.java" }); } public void testMethodAddition() throws JavaModelException { @@ -146,7 +146,7 @@ public class EfficiencyTests extends BuilderTests { incrementalBuild(projectPath); expectingCompiledClasses(new String[]{"p1.X", "p2.Y"}); //$NON-NLS-1$ //$NON-NLS-2$ - expectingCompilingOrder(new String[]{"p1.X", "p2.Y" }); //$NON-NLS-1$ //$NON-NLS-2$ + expectingCompilingOrder(new String[] { "/Project/src/p1/X.java", "/Project/src/p2/Y.java" }); } public void testLocalTypeAddition() throws JavaModelException { @@ -198,7 +198,7 @@ public class EfficiencyTests extends BuilderTests { incrementalBuild(projectPath); expectingCompiledClasses(new String[]{"p1.X", "p1.X$1"}); //$NON-NLS-1$ //$NON-NLS-2$ - expectingCompilingOrder(new String[]{"p1.X", "p1.X$1" }); //$NON-NLS-1$ //$NON-NLS-2$ + expectingCompilingOrder(new String[] { "/Project/src/p1/X.java" }); } public void testLocalTypeAddition2() throws JavaModelException { @@ -256,7 +256,7 @@ public class EfficiencyTests extends BuilderTests { incrementalBuild(projectPath); expectingCompiledClasses(new String[]{"p1.X", "p1.X$1", "p1.X$2"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - expectingCompilingOrder(new String[]{"p1.X", "p1.X$1", "p1.X$2" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + expectingCompilingOrder(new String[] { "/Project/src/p1/X.java" }); } public void testLocalTypeRemoval() throws JavaModelException { @@ -308,7 +308,7 @@ public class EfficiencyTests extends BuilderTests { incrementalBuild(projectPath); expectingCompiledClasses(new String[]{"p1.X"}); //$NON-NLS-1$ - expectingCompilingOrder(new String[]{"p1.X" }); //$NON-NLS-1$ + expectingCompilingOrder(new String[] { "/Project/src/p1/X.java" }); } public void testLocalTypeRemoval2() throws JavaModelException { @@ -366,7 +366,7 @@ public class EfficiencyTests extends BuilderTests { incrementalBuild(projectPath); expectingCompiledClasses(new String[]{"p1.X", "p1.X$1"}); //$NON-NLS-1$ //$NON-NLS-2$ - expectingCompilingOrder(new String[]{"p1.X", "p1.X$1" }); //$NON-NLS-1$ //$NON-NLS-2$ + expectingCompilingOrder(new String[] { "/Project/src/p1/X.java" }); } // http://dev.eclipse.org/bugs/show_bug.cgi?id=196200 - variation public void testMissingType001() throws JavaModelException { @@ -406,6 +406,7 @@ public class EfficiencyTests extends BuilderTests { incrementalBuild(projectPath); expectingCompiledClasses(new String[]{"p1.X", "p2.Y","p2.Z"}); //$NON-NLS-1$ //$NON-NLS-2$ - expectingCompilingOrder(new String[]{"p2.Z", "p2.Y", "p1.X" }); //$NON-NLS-1$ //$NON-NLS-2$ + expectingCompilingOrder( + new String[] { "/Project/src/p2/Z.java", "/Project/src/p2/Y.java", "/Project/src/p1/X.java" }); } } diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java index 6614ee15b1..92e1569c43 100644 --- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java +++ b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java @@ -1255,4 +1255,31 @@ public class IncrementalTests extends BuilderTests { env.removeProject(projectPath2); env.removeProject(projectPath1); } + + public void testBug526376() throws JavaModelException { + IPath projectPath = env.addProject("Project"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // 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", "A", + "package p; \n"+ + "public class A extends B {} \n"); + + fullBuild(projectPath); + + env.addClass(root, "p", "B", + "package p; \n"+ + "public class B {}\n"); + + incrementalBuild(projectPath); + expectingCompilingOrder(new String[] { "/Project/src/p/B.java", "/Project/src/p/A.java" }); + expectingNoProblems(); + env.removeProject(projectPath); + } + } diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java index 8e56fc7d37..ea93215875 100644 --- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java +++ b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java @@ -286,7 +286,7 @@ public class MultiProjectTests extends BuilderTests { fullBuild(); env.waitForAutoBuild(); - expectingCompilingOrder(new String[]{"p1.X", "p3.Z", "p2.Y"}); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ + expectingCompilingOrder(new String[] { "/P1/src/p1/X.java", "/P3/src/p3/Z.java", "/P2/src/p2/Y.java" }); IPath workspaceRootPath = env.getWorkspaceRootPath(); expectingOnlySpecificProblemsFor(workspaceRootPath,new Problem[]{ new Problem("p3", "W cannot be resolved to a type", c3, 31, 32, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR),//$NON-NLS-1$ //$NON-NLS-2$ @@ -424,7 +424,8 @@ public class MultiProjectTests extends BuilderTests { fullBuild(); env.waitForAutoBuild(); - expectingCompilingOrder(new String[]{"p1.X", "p2.Y", "p3.Z", "p1.X", "p2.Y", "p3.Z", "p1.X"});//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$//$NON-NLS-6$//$NON-NLS-7$ + expectingCompilingOrder(new String[] { "/P1/src/p1/X.java", "/P2/src/p2/Y.java", "/P3/src/p3/Z.java", + "/P1/src/p1/X.java", "/P2/src/p2/Y.java", "/P3/src/p3/Z.java", "/P1/src/p1/X.java" }); expectingOnlySpecificProblemFor(p1, new Problem("p1", "A cycle was detected in the build path of project 'P1'. The cycle consists of projects {P1, P2, P3}", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING));//$NON-NLS-1$ //$NON-NLS-2$ expectingOnlySpecificProblemFor(p2,new Problem("p2", "A cycle was detected in the build path of project 'P2'. The cycle consists of projects {P1, P2, P3}", p2, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING));//$NON-NLS-1$ //$NON-NLS-2$ expectingOnlySpecificProblemFor(p3,new Problem("p3", "A cycle was detected in the build path of project 'P3'. The cycle consists of projects {P1, P2, P3}", p3, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING));//$NON-NLS-1$ //$NON-NLS-2$ @@ -522,7 +523,8 @@ public class MultiProjectTests extends BuilderTests { env.waitForManualRefresh(); fullBuild(); env.waitForAutoBuild(); - expectingCompilingOrder(new String[]{"p1.X", "p2.Y", "p3.Z", "p1.X", "p2.Y", "p3.Z", "p1.X"});//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$//$NON-NLS-7$ + expectingCompilingOrder(new String[] { "/P1/src/p1/X.java", "/P2/src/p2/Y.java", "/P3/src/p3/Z.java", + "/P1/src/p1/X.java", "/P2/src/p2/Y.java", "/P3/src/p3/Z.java", "/P1/src/p1/X.java" }); expectingOnlySpecificProblemFor(p1,new Problem("p1", "A cycle was detected in the build path of project 'P1'. The cycle consists of projects {P1, P2, P3}", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING));//$NON-NLS-1$ //$NON-NLS-2$ expectingOnlySpecificProblemsFor(p2,new Problem[]{ new Problem("p2", "The method bar(Y, int) in the type X is not applicable for the arguments (Y)", c2, 106, 109, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR),//$NON-NLS-1$ //$NON-NLS-2$ @@ -624,7 +626,8 @@ public class MultiProjectTests extends BuilderTests { fullBuild(); env.waitForAutoBuild(); - expectingCompilingOrder(new String[]{"p1.X", "p2.Y", "p3.Z", "p1.X", "p2.Y", "p3.Z", "p1.X"});//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$//$NON-NLS-7$ + expectingCompilingOrder(new String[] { "/P1/src/p1/X.java", "/P2/src/p2/Y.java", "/P3/src/p3/Z.java", + "/P1/src/p1/X.java", "/P2/src/p2/Y.java", "/P3/src/p3/Z.java", "/P1/src/p1/X.java" }); expectingOnlySpecificProblemFor(p1,new Problem("p1", "A cycle was detected in the build path of project 'P1'. The cycle consists of projects {P1, P2, P3}", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING));//$NON-NLS-1$ //$NON-NLS-2$ expectingOnlySpecificProblemFor(p2,new Problem("p2", "A cycle was detected in the build path of project 'P2'. The cycle consists of projects {P1, P2, P3}", p2, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING));//$NON-NLS-1$ //$NON-NLS-2$ expectingOnlySpecificProblemFor(p3,new Problem("p3", "A cycle was detected in the build path of project 'P3'. The cycle consists of projects {P1, P2, P3}", p3, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING));//$NON-NLS-1$ //$NON-NLS-2$ @@ -640,7 +643,7 @@ public class MultiProjectTests extends BuilderTests { ); incrementalBuild(); env.waitForAutoBuild(); - expectingCompilingOrder(new String[]{"p1.X", "p2.Y", "p3.Z"}); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ + expectingCompilingOrder(new String[] { "/P1/src/p1/X.java", "/P2/src/p2/Y.java", "/P3/src/p3/Z.java" }); expectingOnlySpecificProblemFor(p1,new Problem("p1", "A cycle was detected in the build path of project 'P1'. The cycle consists of projects {P1, P2, P3}", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING));//$NON-NLS-1$ //$NON-NLS-2$ expectingOnlySpecificProblemsFor(p2,new Problem[]{ new Problem("p2", "The method bar(Y, int) in the type X is not applicable for the arguments (Y)", c2, 106, 109, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR),//$NON-NLS-1$ //$NON-NLS-2$ @@ -731,7 +734,7 @@ public class MultiProjectTests extends BuilderTests { fullBuild(); env.waitForAutoBuild(); - expectingCompilingOrder(new String[]{"p2.Y", "p3.Z", "p2.Y"});//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ + expectingCompilingOrder(new String[] { "/P2/src/p2/Y.java", "/P3/src/p3/Z.java", "/P2/src/p2/Y.java" }); expectingOnlySpecificProblemFor(p1,new Problem("p1", "A cycle was detected in the build path of project 'P1'. The cycle consists of projects {P1, P2, P3}", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING));//$NON-NLS-1$ //$NON-NLS-2$ expectingOnlySpecificProblemsFor(p2,new Problem[]{ new Problem("p2", "X cannot be resolved to a type", c2, 87, 88, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR),//$NON-NLS-1$ //$NON-NLS-2$ @@ -757,7 +760,8 @@ public class MultiProjectTests extends BuilderTests { ); incrementalBuild(); env.waitForAutoBuild(); - expectingCompilingOrder(new String[]{"p1.X", "p2.Y", "p3.Z", "p1.X", "p2.Y"}); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ + expectingCompilingOrder(new String[] { "/P1/src/p1/X.java", "/P2/src/p2/Y.java", "/P3/src/p3/Z.java", + "/P1/src/p1/X.java", "/P2/src/p2/Y.java" }); expectingOnlySpecificProblemFor(p1,new Problem("p1", "A cycle was detected in the build path of project 'P1'. The cycle consists of projects {P1, P2, P3}", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING));//$NON-NLS-1$ //$NON-NLS-2$ expectingOnlySpecificProblemFor(p2,new Problem("p2", "A cycle was detected in the build path of project 'P2'. The cycle consists of projects {P1, P2, P3}", p2, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING));//$NON-NLS-1$ //$NON-NLS-2$ expectingOnlySpecificProblemFor(p3,new Problem("p3", "A cycle was detected in the build path of project 'P3'. The cycle consists of projects {P1, P2, P3}", p3, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING));//$NON-NLS-1$ //$NON-NLS-2$ @@ -774,13 +778,13 @@ public class MultiProjectTests extends BuilderTests { public void testCycle5() throws JavaModelException { Hashtable options = JavaCore.getOptions(); Hashtable newOptions = JavaCore.getOptions(); - newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING); //$NON-NLS-1$ + newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING); // $NON-NLS-1$ JavaCore.setOptions(newOptions); - //---------------------------- - // Project1 - //---------------------------- + // ---------------------------- + // Project1 + // ---------------------------- IPath p1 = env.addProject("P1"); //$NON-NLS-1$ env.addExternalJars(p1, Util.getJavaClassLibs()); // remove old package fragment root so that names don't collide @@ -789,17 +793,17 @@ public class MultiProjectTests extends BuilderTests { env.setOutputFolder(p1, "bin"); //$NON-NLS-1$ IPath c1 = env.addClass(root1, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ - "package p1;\n"+ //$NON-NLS-1$ - "import p2.*;\n"+ //$NON-NLS-1$ - "import p22.*;\n"+ //$NON-NLS-1$ - "public class X {\n"+ //$NON-NLS-1$ - " Y y;\n"+ //$NON-NLS-1$ - "}\n" //$NON-NLS-1$ - ); + "package p1;\n" + //$NON-NLS-1$ + "import p2.*;\n" + //$NON-NLS-1$ + "import p22.*;\n" + //$NON-NLS-1$ + "public class X {\n" + //$NON-NLS-1$ + " Y y;\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); - //---------------------------- - // Project2 - //---------------------------- + // ---------------------------- + // Project2 + // ---------------------------- IPath p2 = env.addProject("P2"); //$NON-NLS-1$ env.addExternalJars(p2, Util.getJavaClassLibs()); // remove old package fragment root so that names don't collide @@ -808,14 +812,13 @@ public class MultiProjectTests extends BuilderTests { env.setOutputFolder(p2, "bin"); //$NON-NLS-1$ IPath c2 = env.addClass(root2, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ - "package p2;\n"+ //$NON-NLS-1$ - "import p1.*;\n"+ //$NON-NLS-1$ - "import p11.*;\n"+ //$NON-NLS-1$ - "public class Y {\n"+ //$NON-NLS-1$ - " X x;\n"+ //$NON-NLS-1$ - "}\n" //$NON-NLS-1$ - ); - + "package p2;\n" + //$NON-NLS-1$ + "import p1.*;\n" + //$NON-NLS-1$ + "import p11.*;\n" + //$NON-NLS-1$ + "public class Y {\n" + //$NON-NLS-1$ + " X x;\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); // for Project1 env.addRequiredProject(p1, p2); @@ -823,43 +826,49 @@ public class MultiProjectTests extends BuilderTests { env.addRequiredProject(p2, p1); try { - env.setBuildOrder(new String[]{"P1", "P2"});//$NON-NLS-1$ //$NON-NLS-2$ + env.setBuildOrder(new String[] { "P1", "P2" });//$NON-NLS-1$ //$NON-NLS-2$ env.waitForManualRefresh(); fullBuild(); env.waitForAutoBuild(); - expectingCompilingOrder(new String[]{"p1.X", "p2.Y", "p1.X", "p2.Y"});//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ - expectingOnlySpecificProblemsFor(p1,new Problem[]{ - new Problem("p1", "The import p22 cannot be resolved", c1, 32, 35, CategorizedProblem.CAT_IMPORT, IMarker.SEVERITY_ERROR),//$NON-NLS-1$ //$NON-NLS-2$ - new Problem("p1", "A cycle was detected in the build path of project 'P1'. The cycle consists of projects {P1, P2}", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING)//$NON-NLS-1$ //$NON-NLS-2$ - }); - expectingOnlySpecificProblemsFor(p2,new Problem[]{ - new Problem("p2", "The import p11 cannot be resolved", c2, 32, 35, CategorizedProblem.CAT_IMPORT, IMarker.SEVERITY_ERROR),//$NON-NLS-1$ //$NON-NLS-2$ - new Problem("p2", "A cycle was detected in the build path of project 'P2'. The cycle consists of projects {P1, P2}", p2, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING)//$NON-NLS-1$ //$NON-NLS-2$ - }); + expectingCompilingOrder(new String[] { "/P1/src/p1/X.java", "/P2/src/p2/Y.java", "/P1/src/p1/X.java", + "/P2/src/p2/Y.java" }); + expectingOnlySpecificProblemsFor(p1, new Problem[] { + new Problem("p1", "The import p22 cannot be resolved", c1, 32, 35, CategorizedProblem.CAT_IMPORT, //$NON-NLS-1$ //$NON-NLS-2$ + IMarker.SEVERITY_ERROR), new Problem("p1", //$NON-NLS-1$ + "A cycle was detected in the build path of project 'P1'. The cycle consists of projects {P1, P2}", //$NON-NLS-1$ + p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING) }); + expectingOnlySpecificProblemsFor(p2, new Problem[] { + new Problem("p2", "The import p11 cannot be resolved", c2, 32, 35, CategorizedProblem.CAT_IMPORT, //$NON-NLS-1$ //$NON-NLS-2$ + IMarker.SEVERITY_ERROR), new Problem("p2", //$NON-NLS-1$ + "A cycle was detected in the build path of project 'P2'. The cycle consists of projects {P1, P2}", //$NON-NLS-1$ + p2, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING) }); env.addClass(root1, "p11", "XX", //$NON-NLS-1$ //$NON-NLS-2$ - "package p11;\n"+ //$NON-NLS-1$ - "public class XX {\n"+ //$NON-NLS-1$ - "}\n" //$NON-NLS-1$ - ); + "package p11;\n" + //$NON-NLS-1$ + "public class XX {\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); env.addClass(root2, "p22", "YY", //$NON-NLS-1$ //$NON-NLS-2$ - "package p22;\n"+ //$NON-NLS-1$ - "public class YY {\n"+ //$NON-NLS-1$ - "}\n" //$NON-NLS-1$ - ); + "package p22;\n" + //$NON-NLS-1$ + "public class YY {\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); incrementalBuild(); env.waitForAutoBuild(); - expectingCompilingOrder(new String[]{"p11.XX", "p22.YY", "p2.Y", "p1.X"});//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ - expectingOnlySpecificProblemsFor(p1,new Problem[]{ - new Problem("p1", "The import p22 is never used", c1, 32, 35, CategorizedProblem.CAT_UNNECESSARY_CODE, IMarker.SEVERITY_WARNING),//$NON-NLS-1$ //$NON-NLS-2$ - new Problem("p1", "A cycle was detected in the build path of project 'P1'. The cycle consists of projects {P1, P2}", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING)//$NON-NLS-1$ //$NON-NLS-2$ - }); - expectingOnlySpecificProblemsFor(p2,new Problem[]{ - new Problem("p2", "The import p11 is never used", c2, 32, 35, CategorizedProblem.CAT_UNNECESSARY_CODE, IMarker.SEVERITY_WARNING),//$NON-NLS-1$ //$NON-NLS-2$ - new Problem("p2", "A cycle was detected in the build path of project 'P2'. The cycle consists of projects {P1, P2}", p2, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING)//$NON-NLS-1$ //$NON-NLS-2$ - }); + expectingCompilingOrder(new String[] { "/P1/src/p11/XX.java", "/P2/src/p22/YY.java", "/P2/src/p2/Y.java", + "/P1/src/p1/X.java" }); + expectingOnlySpecificProblemsFor(p1, new Problem[] { + new Problem("p1", "The import p22 is never used", c1, 32, 35, //$NON-NLS-1$ //$NON-NLS-2$ + CategorizedProblem.CAT_UNNECESSARY_CODE, IMarker.SEVERITY_WARNING), new Problem("p1", //$NON-NLS-1$ + "A cycle was detected in the build path of project 'P1'. The cycle consists of projects {P1, P2}", //$NON-NLS-1$ + p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING) }); + expectingOnlySpecificProblemsFor(p2, new Problem[] { + new Problem("p2", "The import p11 is never used", c2, 32, 35, //$NON-NLS-1$ //$NON-NLS-2$ + CategorizedProblem.CAT_UNNECESSARY_CODE, IMarker.SEVERITY_WARNING), new Problem("p2", //$NON-NLS-1$ + "A cycle was detected in the build path of project 'P2'. The cycle consists of projects {P1, P2}", //$NON-NLS-1$ + p2, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING) }); JavaCore.setOptions(options); } finally { |