### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.builder Index: src/org/eclipse/jdt/core/tests/builder/Java50Tests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Java50Tests.java,v retrieving revision 1.12 diff -u -r1.12 Java50Tests.java --- src/org/eclipse/jdt/core/tests/builder/Java50Tests.java 5 Feb 2008 09:07:05 -0000 1.12 +++ src/org/eclipse/jdt/core/tests/builder/Java50Tests.java 13 May 2008 15:09:56 -0000 @@ -108,6 +108,63 @@ expectingNoProblems(); } + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=231293 + public void testMissingRequiredBinaries() throws JavaModelException { + + IPath p1 = env.addProject("P1", "1.5"); //$NON-NLS-1$ + IPath p2 = env.addProject("P2"); //$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.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$ + IPath p2bin = env.setOutputFolder(p2, "bin"); //$NON-NLS-1$ + + env.addClass(root2, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class Y {\n"+ //$NON-NLS-1$ + " public void foo(int i) {}\n"+ //$NON-NLS-1$ + " public void foo(int i, Z z) {}\n"+ //$NON-NLS-1$ + "}\n"+ //$NON-NLS-1$ + "class Z {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + + env.addClassFolder(p1, p2bin, false); + env.removeFile(p2bin.append("p2/Z.class")); //$NON-NLS-1$ + + env.addClass(root1, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " void test(p2.Y y) { y.foo(1); }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(p1); + expectingNoProblems(); + + IPath xx = env.addClass(root1, "p1", "XX", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class XX {\n"+ //$NON-NLS-1$ + " void test(p2.Y y) { y.foo('c'); }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(p1); + expectingOnlySpecificProblemsFor(p1,new Problem[]{ + new Problem("p1", "The project was not built since its build path is incomplete. Cannot find the class file for p2.Z. Fix the build path then try building this project", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR),//$NON-NLS-1$ //$NON-NLS-2$ + new Problem("p1", "The type p2.Z cannot be resolved. It is indirectly referenced from required .class files", xx, 51, 61, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR)//$NON-NLS-1$ //$NON-NLS-2$ + }); + } + public void testParameterizedMemberType() throws JavaModelException { IPath projectPath = env.addProject("Project", "1.5"); env.addExternalJars(projectPath, Util.getJavaClassLibs()); #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java,v retrieving revision 1.330 diff -u -r1.330 Scope.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 12 May 2008 17:23:11 -0000 1.330 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 13 May 2008 15:09:57 -0000 @@ -766,23 +766,12 @@ // Internal use only public MethodBinding findExactMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) { - boolean checkArgsForRawTypes = false; - // in 1.5 mode or higher, we're expecting that an exact match with more than 2 args is not that common - // so save some time by not calling findExactMatch & use that time to handle the more common cases with 1 or 2 args. - switch (argumentTypes.length) { - case 0 : break; - case 1 : - case 2 : - checkArgsForRawTypes = compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5; - default : - if (compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) - return null; // skip find exact match since its less likely to find a match & raw type check is not worth it - } CompilationUnitScope unitScope = compilationUnitScope(); unitScope.recordTypeReferences(argumentTypes); MethodBinding exactMethod = receiverType.getExactMethod(selector, argumentTypes, unitScope); if (exactMethod != null && exactMethod.typeVariables == Binding.NO_TYPE_VARIABLES && !exactMethod.isBridge()) { - if (checkArgsForRawTypes) + // in >= 1.5 mode, ensure the exactMatch did not match raw types + if (compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) for (int i = argumentTypes.length; --i >= 0;) if (argumentTypes[i].isRawType()) return null;