### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java,v retrieving revision 1.116 diff -u -r1.116 BlockScope.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java 3 Mar 2010 18:18:42 -0000 1.116 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java 15 Mar 2010 18:17:14 -0000 @@ -481,6 +481,12 @@ } if ((binding = findMemberType(nextName, referenceBinding)) == null) { if ((mask & Binding.FIELD) != 0) { + return new ProblemFieldBinding( + null, + referenceBinding, + nextName, + ProblemReasons.NotFound); + } else if ((mask & Binding.VARIABLE) != 0) { return new ProblemBinding( CharOperation.subarray(compoundName, 0, currentIndex), referenceBinding, 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.406 diff -u -r1.406 ProblemReporter.java --- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 9 Mar 2010 04:27:49 -0000 1.406 +++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 15 Mar 2010 18:17:14 -0000 @@ -3199,8 +3199,14 @@ nameRef.sourceEnd); return; } - id = IProblem.UndefinedField; - break; + String[] arguments = new String[] {new String(field.readableName())}; + this.handle( + id, + arguments, + arguments, + nodeSourceStart(field, nameRef), + nodeSourceEnd(field, nameRef)); + return; case ProblemReasons.NotVisible : char[] name = field.readableName(); name = CharOperation.lastSegment(name, '.'); #P org.eclipse.jdt.core.tests Index: Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java =================================================================== RCS file: /home/cvs/numbat/org.eclipse.jdt.core.tests/Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java,v retrieving revision 1.334 diff -u -r1.334 NegativeTest.java --- Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java 4 Mar 2010 16:43:56 -0000 1.334 +++ Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java 15 Mar 2010 18:17:15 -0000 @@ -4995,11 +4995,11 @@ " }\n" + "}", }, - "----------\n" + - "1. ERROR in p\\O.java (at line 4)\n" + - " System.out.println(Object.FOO);\n" + - " ^^^^^^^^^^\n" + - "Object.FOO cannot be resolved to a variable\n" + + "----------\n" + + "1. ERROR in p\\O.java (at line 4)\n" + + " System.out.println(Object.FOO);\n" + + " ^^^\n" + + "FOO cannot be resolved or is not a field\n" + "----------\n" ); } @@ -6052,29 +6052,6 @@ "----------\n" ); } -public void test159() { - this.runNegativeTest( - new String[] { - "p/A9.java", - "package p;\n" + - "/**\n" + - " * 1FA4ETM\n" + - " */\n" + - " \n" + - "class A9 {\n" + - " public static void main(String[] args) {\n" + - " System.out.println(Object.FOO); // error Object.FOO undefined\n" + - " }\n" + - "}", - }, - "----------\n" + - "1. ERROR in p\\A9.java (at line 8)\n" + - " System.out.println(Object.FOO); // error Object.FOO undefined\n" + - " ^^^^^^^^^^\n" + - "Object.FOO cannot be resolved to a variable\n" + - "----------\n" - ); -} public void test161() { this.runNegativeTest( new String[] { #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java,v retrieving revision 1.204 diff -u -r1.204 BatchCompilerTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 26 Feb 2010 18:35:50 -0000 1.204 +++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 15 Mar 2010 18:17:15 -0000 @@ -9204,8 +9204,8 @@ "----------\n" + /* expectedErrOutputString */ "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/Y.java (at line 3)\n" + " System.out.println(X.CONST);\n" + - " ^^^^^^^\n" + - "X.CONST cannot be resolved to a variable\n" + + " ^^^^^\n" + + "CONST cannot be resolved or is not a field\n" + "----------\n" + "1 problem (1 error)", false /* shouldFlushOutputDirectory */, @@ -9447,12 +9447,12 @@ sourceFilePath /* commandLine */ + " -proc:none " + commonOptions, "" /* expectedOutOutputString */, - "----------\n" + /* expectedErrOutputString */ - "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/Y.java (at line 3)\n" + - " System.out.println(X.CONST);\n" + - " ^^^^^^^\n" + - "X.CONST cannot be resolved to a variable\n" + - "----------\n" + + "----------\n" + + "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/Y.java (at line 3)\n" + + " System.out.println(X.CONST);\n" + + " ^^^^^\n" + + "CONST cannot be resolved or is not a field\n" + + "----------\n" + "1 problem (1 error)", false /* shouldFlushOutputDirectory */, null /* progress */); @@ -9729,61 +9729,61 @@ public void test241_jar_ref_in_jar(){ createCascadedJars(); this.runNegativeTest( - new String[] { - "src/p/X.java", - "package p;\n" + - "/** */\n" + - "public class X {\n" + - " int i = R.R2;\n" + - " int j = R.R3;\n" + - "}", - }, - "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\"" + new String[] { + "src/p/X.java", + "package p;\n" + + "/** */\n" + + "public class X {\n" + + " int i = R.R2;\n" + + " int j = R.R3;\n" + + "}", + }, + "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\"" + " -cp \"" + LIB_DIR + File.separator + "lib1.jar\"" + " -cp \"" + LIB_DIR + File.separator + "lib3.jar\"" + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" - + " -1.5 -g -preserveAllLocals" - + " -proceedOnError -referenceInfo" - + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", - "", - "----------\n" + - "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 5)\n" + - " int j = R.R3;\n" + - " ^^^^\n" + - "R.R3 cannot be resolved to a variable\n" + - "----------\n" + - "1 problem (1 error)", - true); + + " -1.5 -g -preserveAllLocals" + + " -proceedOnError -referenceInfo" + + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", + "", + "----------\n" + + "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 5)\n" + + " int j = R.R3;\n" + + " ^^\n" + + "R3 cannot be resolved or is not a field\n" + + "----------\n" + + "1 problem (1 error)", + true); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars // using only links, we adopt a depth first algorithm public void test242_jar_ref_in_jar(){ createCascadedJars(); this.runNegativeTest( - new String[] { - "src/p/X.java", - "package p;\n" + - "/** */\n" + - "public class X {\n" + - " int i = R.R2;\n" + - " int j = R.R3;\n" + - "}", - }, - "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\"" + new String[] { + "src/p/X.java", + "package p;\n" + + "/** */\n" + + "public class X {\n" + + " int i = R.R2;\n" + + " int j = R.R3;\n" + + "}", + }, + "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\"" + " -cp \"" + LIB_DIR + File.separator + "lib4.jar\"" + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" - + " -1.5 -g -preserveAllLocals" - + " -proceedOnError -referenceInfo" - + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", - "", - "----------\n" + - "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 5)\n" + - " int j = R.R3;\n" + - " ^^^^\n" + - "R.R3 cannot be resolved to a variable\n" + - "----------\n" + - "1 problem (1 error)", - true); + + " -1.5 -g -preserveAllLocals" + + " -proceedOnError -referenceInfo" + + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", + "", + "----------\n" + + "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 5)\n" + + " int j = R.R3;\n" + + " ^^\n" + + "R3 cannot be resolved or is not a field\n" + + "----------\n" + + "1 problem (1 error)", + true); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars // managing subdirectories and .. properly Index: src/org/eclipse/jdt/core/tests/compiler/regression/FieldAccessTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FieldAccessTest.java,v retrieving revision 1.9 diff -u -r1.9 FieldAccessTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/FieldAccessTest.java 9 Mar 2010 04:28:15 -0000 1.9 +++ src/org/eclipse/jdt/core/tests/compiler/regression/FieldAccessTest.java 15 Mar 2010 18:17:15 -0000 @@ -19,7 +19,7 @@ public class FieldAccessTest extends AbstractRegressionTest { static { // TESTS_NAMES = new String[] { "test000" }; -// TESTS_NUMBERS = new int[] { 21 }; +// TESTS_NUMBERS = new int[] { 22 }; // TESTS_RANGE = new int[] { 21, 50 }; } @@ -649,6 +649,36 @@ true, options); } +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=303830 +public void test022() { + this.runNegativeTest( + new String[] { + "X.java", + "public class X {\n" + + " static int NEW_FIELD;\n" + + "}", + "Y.java", + "public class Y {\n" + + " void foo() {\n" + + " int i = X.OLD_FIELD;\n" + + " }\n" + + " void bar() {\n" + + " int j = X.OLD_FIELD;\n" + + " }\n" + + "}" + }, + "----------\n" + + "1. ERROR in Y.java (at line 3)\n" + + " int i = X.OLD_FIELD;\n" + + " ^^^^^^^^^\n" + + "OLD_FIELD cannot be resolved or is not a field\n" + + "----------\n" + + "2. ERROR in Y.java (at line 6)\n" + + " int j = X.OLD_FIELD;\n" + + " ^^^^^^^^^\n" + + "OLD_FIELD cannot be resolved or is not a field\n" + + "----------\n"); +} public static Class testClass() { return FieldAccessTest.class; } #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java,v retrieving revision 1.173 diff -u -r1.173 ASTConverterTestAST3_2.java --- src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java 21 Feb 2010 03:31:38 -0000 1.173 +++ src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java 15 Mar 2010 18:17:16 -0000 @@ -7685,11 +7685,10 @@ true); assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType()); CompilationUnit unit = (CompilationUnit) node; - assertProblemsSize( - unit, + assertEquals( + "Wrong problem size", 2, - "Object.equ cannot be resolved to a variable\n" + - "Syntax error, insert \"AssignmentOperator Expression\" to complete Expression"); + unit.getProblems().length); node = getASTNode(unit, 0, 0); assertEquals("Not a field declaration statement", ASTNode.INITIALIZER, node.getNodeType()); Initializer initializer = (Initializer) node;