Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSasikanth Bharadwaj2016-04-06 09:09:12 +0000
committerSasikanth Bharadwaj2016-04-14 08:00:06 +0000
commitf4352a992f8742782ece3cd33ca34f62137b0589 (patch)
treeba31377f0de41816297a7119e330629f0a64e3f0 /org.eclipse.jdt.core.tests.builder
parent0c390a453816d4fd49ee8d7fef056ad77daeaeec (diff)
downloadeclipse.jdt.core-f4352a992f8742782ece3cd33ca34f62137b0589.tar.gz
eclipse.jdt.core-f4352a992f8742782ece3cd33ca34f62137b0589.tar.xz
eclipse.jdt.core-f4352a992f8742782ece3cd33ca34f62137b0589.zip
Fixed bug 461074 - "indirectly referenced from required .class files"
error for unreachable reference of type in overriding method declaration in a library on classpath Change-Id: I9daec40c4724b7d6a64db9d2652c9406a93b97de
Diffstat (limited to 'org.eclipse.jdt.core.tests.builder')
-rw-r--r--org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java151
1 files changed, 150 insertions, 1 deletions
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 3ca58177ed..e36849fa98 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* 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
@@ -1840,4 +1840,153 @@ public void test438923() throws JavaModelException {
env.removeProject(p2);
env.removeProject(p3);
}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=461074, "indirectly referenced from required .class files" error for unreachable reference of type in overriding method declaration in a library on classpath
+public void test461074() throws JavaModelException {
+ //----------------------------
+ // Project1
+ //----------------------------
+ IPath p1 = env.addProject("SampleMissing"); //$NON-NLS-1$
+ env.addExternalJars(p1, Util.getJavaClassLibs());
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(p1, ""); //$NON-NLS-1$
+ IPath root1 = env.addPackageFragmentRoot(p1, "src"); //$NON-NLS-1$
+ env.setOutputFolder(p1, "bin"); //$NON-NLS-1$
+
+ env.addClass(root1, "pack.missing", "MissingType", //$NON-NLS-1$ //$NON-NLS-2$
+ "package pack.missing;\n" +
+ "public class MissingType {\n" +
+ "}\n"
+ );
+
+ //----------------------------
+ // Project2
+ //----------------------------
+ IPath p2 = env.addProject("SampleLib", "1.5"); //$NON-NLS-1$
+ env.addExternalJars(p2, Util.getJavaClassLibs());
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(p2, ""); //$NON-NLS-1$
+ IPath root2 = env.addPackageFragmentRoot(p2, "src"); //$NON-NLS-1$
+ env.setOutputFolder(p2, "bin"); //$NON-NLS-1$
+
+ env.addClass(root2, "pack.lib", "TopClass", //$NON-NLS-1$ //$NON-NLS-2$
+ "package pack.lib;\n" +
+ "public class TopClass {\n" +
+ " Object get() { return null; }\n" +
+ "}\n"
+ );
+ env.addClass(root2, "pack.lib", "SuperClass", //$NON-NLS-1$ //$NON-NLS-2$
+ "package pack.lib;\n" +
+ "import pack.missing.MissingType;\n" +
+ "public class SuperClass extends TopClass {\n" +
+ " @Override\n" +
+ " MissingType get() { return null; }\n" +
+ "}\n"
+ );
+
+ //----------------------------
+ // Project3
+ //----------------------------
+ IPath p3 = env.addProject("SampleTest", "1.5"); //$NON-NLS-1$
+ env.addExternalJars(p3, Util.getJavaClassLibs());
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(p3, ""); //$NON-NLS-1$
+ IPath root3 = env.addPackageFragmentRoot(p3, "src"); //$NON-NLS-1$
+ env.setOutputFolder(p3, "bin"); //$NON-NLS-1$
+
+ env.addClass(root3, "pack.test", "Test", //$NON-NLS-1$ //$NON-NLS-2$
+ "package pack.test;\n" +
+ "import pack.lib.SuperClass;\n" +
+ "public class Test extends SuperClass {/*empty*/}\n"
+ );
+
+ // for Project1
+ env.addRequiredProject(p2, p1);
+ env.addRequiredProject(p3, p2);
+ env.waitForManualRefresh();
+ fullBuild();
+ env.waitForAutoBuild();
+ expectingNoProblems();
+ env.setBuildOrder(null);
+ env.removeProject(p1);
+ env.removeProject(p2);
+ env.removeProject(p3);
+}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=461074, "indirectly referenced from required .class files" error for unreachable reference of type in overriding method declaration in a library on classpath
+public void test461074_error() throws JavaModelException {
+ //----------------------------
+ // Project1
+ //----------------------------
+ IPath p1 = env.addProject("SampleMissing"); //$NON-NLS-1$
+ env.addExternalJars(p1, Util.getJavaClassLibs());
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(p1, ""); //$NON-NLS-1$
+ IPath root1 = env.addPackageFragmentRoot(p1, "src"); //$NON-NLS-1$
+ env.setOutputFolder(p1, "bin"); //$NON-NLS-1$
+
+ env.addClass(root1, "pack.missing", "MissingType", //$NON-NLS-1$ //$NON-NLS-2$
+ "package pack.missing;\n" +
+ "public class MissingType {\n" +
+ "}\n"
+ );
+
+ //----------------------------
+ // Project2
+ //----------------------------
+ IPath p2 = env.addProject("SampleLib", "1.5"); //$NON-NLS-1$
+ env.addExternalJars(p2, Util.getJavaClassLibs());
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(p2, ""); //$NON-NLS-1$
+ IPath root2 = env.addPackageFragmentRoot(p2, "src"); //$NON-NLS-1$
+ env.setOutputFolder(p2, "bin"); //$NON-NLS-1$
+
+ env.addClass(root2, "pack.lib", "TopClass", //$NON-NLS-1$ //$NON-NLS-2$
+ "package pack.lib;\n" +
+ "public abstract class TopClass {\n" +
+ " abstract Object get();\n" +
+ "}\n"
+ );
+ env.addClass(root2, "pack.lib", "SuperClass", //$NON-NLS-1$ //$NON-NLS-2$
+ "package pack.lib;\n" +
+ "import pack.missing.MissingType;\n" +
+ "public class SuperClass extends TopClass {\n" +
+ " @Override\n" +
+ " MissingType get() { return null; }\n" +
+ "}\n"
+ );
+
+ //----------------------------
+ // Project3
+ //----------------------------
+ IPath p3 = env.addProject("SampleTest", "1.5"); //$NON-NLS-1$
+ env.addExternalJars(p3, Util.getJavaClassLibs());
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(p3, ""); //$NON-NLS-1$
+ IPath root3 = env.addPackageFragmentRoot(p3, "src"); //$NON-NLS-1$
+ env.setOutputFolder(p3, "bin"); //$NON-NLS-1$
+
+ IPath test = env.addClass(root3, "pack.test", "Test", //$NON-NLS-1$ //$NON-NLS-2$
+ "package pack.test;\n" +
+ "import pack.lib.SuperClass;\n" +
+ "public class Test extends SuperClass {/*empty*/}\n"
+ );
+
+ // for Project1
+ env.addRequiredProject(p2, p1);
+ env.addRequiredProject(p3, p2);
+ env.waitForManualRefresh();
+ fullBuild();
+ env.waitForAutoBuild();
+ expectingOnlySpecificProblemsFor(p3, new Problem[]{
+ new Problem("p3",
+ "The project was not built since its build path is incomplete. Cannot find the class file for pack.missing.MissingType. Fix the build path then try building this project",
+ p3, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR),
+ new Problem("p3",
+ "The type pack.missing.MissingType cannot be resolved. It is indirectly referenced from required .class files",
+ test, 0, 1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR),
+ });
+ env.setBuildOrder(null);
+ env.removeProject(p1);
+ env.removeProject(p2);
+ env.removeProject(p3);
+}
}

Back to the top