### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java,v retrieving revision 1.415 diff -u -r1.415 ProblemReporter.java --- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 20 Jul 2010 02:25:58 -0000 1.415 +++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 27 Jul 2010 17:38:44 -0000 @@ -3667,8 +3667,13 @@ if (type.isParameterizedType()) { List missingTypes = type.collectMissingTypes(null); if (missingTypes != null) { + ReferenceContext savedContext = this.referenceContext; for (Iterator iterator = missingTypes.iterator(); iterator.hasNext(); ) { - invalidType(location, (TypeBinding) iterator.next()); + try { + invalidType(location, (TypeBinding) iterator.next()); + } finally { + this.referenceContext = savedContext; + } } return; } @@ -3692,10 +3697,10 @@ break; case ProblemReasons.NonStaticReferenceInStaticContext : id = IProblem.NonStaticTypeFromStaticInvocation; - break; + break; case ProblemReasons.IllegalSuperTypeVariable : - id = IProblem.IllegalTypeVariableSuperReference; - break; + id = IProblem.IllegalTypeVariableSuperReference; + break; case ProblemReasons.NoError : // 0 default : needImplementation(location); // want to fail to see why we were here... #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java,v retrieving revision 1.64 diff -u -r1.64 ASTModelBridgeTests.java --- src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java 11 May 2010 05:22:54 -0000 1.64 +++ src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java 27 Jul 2010 17:38:44 -0000 @@ -44,7 +44,7 @@ // All specified tests which do not belong to the class are skipped... static { // TESTS_PREFIX = "testBug86380"; -// TESTS_NAMES = new String[] { "testCreateBindings23" }; +// TESTS_NAMES = new String[] { "test320802" }; // TESTS_NUMBERS = new int[] { 83230 }; // TESTS_RANGE = new int[] { 83304, -1 }; } @@ -2222,5 +2222,79 @@ deleteFile(filePath); } } + public void test320802() throws CoreException { + String filePath = "/P/src/X.java"; + String filePathY = "/P/src/p/Y.java"; + try { + String contents = + "import p.Y;\n" + + "public class X {\n" + + " Y y;\n" + + " public X() {\n" + + " this.y = new Y();\n" + + " }\n" + + "}"; + createFile(filePath, contents); + ICompilationUnit compilationUnit = getCompilationUnit("P", "src", "", "X.java"); + assertTrue(compilationUnit.exists()); + String contents2 = + "package p;\n" + + "public class Y {}"; + createFolder("/P/src/p"); + createFile(filePathY, contents2); + ICompilationUnit compilationUnit2 = getCompilationUnit("P", "src", "p", "Y.java"); + assertTrue(compilationUnit2.exists()); + + final CompilationUnit[] asts = new CompilationUnit[1]; + BindingRequestor requestor = new BindingRequestor() { + public void acceptAST(ICompilationUnit source, CompilationUnit ast) { + asts[0] = ast; + } + }; + resolveASTs( + new ICompilationUnit[] {compilationUnit}, + new String[0], + requestor, + getJavaProject("P"), + this.workingCopy.getOwner() + ); + assertNotNull("No ast", asts[0]); + final IProblem[] problems = asts[0].getProblems(); + String expectedProblems = + "1. ERROR in /P/src/X.java (at line 3)\n" + + " Y y;\n" + + " ^^^^^^^^^^^^\n" + + "MissingType1 cannot be resolved to a type\n" + + "----------\n" + + "2. ERROR in /P/src/X.java (at line 3)\n" + + " Y y;\n" + + " ^^^^^^^^^^^^\n" + + "MissingType2 cannot be resolved to a type\n" + + "----------\n" + + "3. ERROR in /P/src/X.java (at line 5)\n" + + " this.y = new Y();\n" + + " ^^^^^^\n" + + "MissingType1 cannot be resolved to a type\n" + + "----------\n" + + "4. ERROR in /P/src/X.java (at line 5)\n" + + " this.y = new Y();\n" + + " ^^^^^^\n" + + "MissingType2 cannot be resolved to a type\n" + + "----------\n" + + "5. ERROR in /P/src/X.java (at line 5)\n" + + " this.y = new Y();\n" + + " ^^^^^^^^^^^^\n" + + "MissingType1 cannot be resolved to a type\n" + + "----------\n" + + "6. ERROR in /P/src/X.java (at line 5)\n" + + " this.y = new Y();\n" + + " ^^^^^^^^^^^^\n" + + "MissingType2 cannot be resolved to a type\n" + + "----------\n"; + assertProblems("Wrong problems", expectedProblems, problems, contents.toCharArray()); + } finally { + deleteFile(filePath); + } + } }