Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 161352 Details for
Bug 303830
"X cannot be resolved or is not a field" erroneously reported
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix + updated regression tests
patch_303830.txt (text/plain), 10.05 KB, created by
Olivier Thomann
on 2010-03-08 15:14:22 EST
(
hide
)
Description:
Proposed fix + updated regression tests
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2010-03-08 15:14:22 EST
Size:
10.05 KB
patch
obsolete
>### 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.405 >diff -u -r1.405 ProblemReporter.java >--- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 13 Jan 2010 18:58:47 -0000 1.405 >+++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 8 Mar 2010 20:13:20 -0000 >@@ -3283,15 +3283,17 @@ > (int) nameRef.sourcePositions[index-1]); > return; > } >- id = IProblem.UndefinedField; >-/* also need to check that the searchedType is the receiver type >- if (searchedType.isHierarchyInconsistent()) >- severity = SecondaryError; >-*/ >- break; >- case ProblemReasons.NotVisible : > String fieldName = new String(nameRef.tokens[index]); > this.handle( >+ id, >+ new String[] {fieldName, new String(field.declaringClass.readableName())}, >+ new String[] {fieldName, new String(field.declaringClass.shortReadableName())}, >+ nodeSourceStart(field, nameRef), >+ nodeSourceEnd(field, nameRef)); >+ return; >+ case ProblemReasons.NotVisible : >+ fieldName = new String(nameRef.tokens[index]); >+ this.handle( > IProblem.NotVisibleField, > new String[] {fieldName, new String(field.declaringClass.readableName())}, > new String[] {fieldName, new String(field.declaringClass.shortReadableName())}, >#P org.eclipse.jdt.core.tests.builder >Index: src/org/eclipse/jdt/core/tests/builder/DependencyTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/DependencyTests.java,v >retrieving revision 1.31 >diff -u -r1.31 DependencyTests.java >--- src/org/eclipse/jdt/core/tests/builder/DependencyTests.java 17 Aug 2009 17:46:07 -0000 1.31 >+++ src/org/eclipse/jdt/core/tests/builder/DependencyTests.java 8 Mar 2010 20:13:20 -0000 >@@ -390,7 +390,7 @@ > incrementalBuild(projectPath); > expectingOnlyProblemsFor(new IPath[] {cPath, xPath}); > expectingSpecificProblemFor(cPath, new Problem("C", "i cannot be resolved to a variable", cPath, 50, 51, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ >- expectingSpecificProblemFor(xPath, new Problem("X", "c.i cannot be resolved or is not a field", xPath, 55, 58, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ >+ expectingSpecificProblemFor(xPath, new Problem("X", "i cannot be resolved or is not a field", xPath, 57, 58, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ > > env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ > "package p1;\n"+ //$NON-NLS-1$ >#P org.eclipse.jdt.core.tests.compiler >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.8 >diff -u -r1.8 FieldAccessTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/FieldAccessTest.java 27 Jun 2008 16:04:45 -0000 1.8 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/FieldAccessTest.java 8 Mar 2010 20:13:20 -0000 >@@ -19,7 +19,7 @@ > public class FieldAccessTest extends AbstractRegressionTest { > static { > // TESTS_NAMES = new String[] { "test000" }; >-// TESTS_NUMBERS = new int[] { 5, 6 }; >+// TESTS_NUMBERS = new int[] { 21 }; > // TESTS_RANGE = new int[] { 21, 50 }; > } > >@@ -623,6 +623,32 @@ > true, > options); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=303830 >+public void test021() { >+ Map options = getCompilerOptions(); >+ options.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE); >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "import java.util.ArrayList;\n" + >+ "\n" + >+ "public class X {\n" + >+ " public void bar() {\n" + >+ " ArrayList myList = new ArrayList();\n" + >+ " int len = myList.length;\n" + >+ " }\n" + >+ "}" >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 6)\n" + >+ " int len = myList.length;\n" + >+ " ^^^^^^\n" + >+ "length cannot be resolved or is not a field\n" + >+ "----------\n", >+ null, >+ true, >+ options); >+} > public static Class testClass() { > return FieldAccessTest.class; > } >Index: src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java,v >retrieving revision 1.815 >diff -u -r1.815 GenericTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 3 Mar 2010 18:18:51 -0000 1.815 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 8 Mar 2010 20:13:23 -0000 >@@ -2124,8 +2124,8 @@ > "----------\n" + > "1. ERROR in X.java (at line 9)\n" + > " super(xt.t);\n" + >- " ^^^^\n" + >- "xt.t cannot be resolved or is not a field\n" + >+ " ^\n" + >+ "t cannot be resolved or is not a field\n" + > "----------\n" + > "2. WARNING in X.java (at line 12)\n" + > " X x = new X();\n" + >@@ -36692,8 +36692,8 @@ > "----------\n" + > "7. ERROR in Y.java (at line 9)\n" + > " E e2 = e2.e;\n" + >- " ^^^^\n" + >- "e2.e cannot be resolved or is not a field\n" + >+ " ^\n" + >+ "e cannot be resolved or is not a field\n" + > "----------\n"); > } > >Index: src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java,v >retrieving revision 1.82 >diff -u -r1.82 LookupTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java 21 Feb 2010 03:31:31 -0000 1.82 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java 8 Mar 2010 20:13:23 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 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 >@@ -651,8 +651,8 @@ > "----------\n" + > "1. ERROR in p1\\A.java (at line 17)\n" + > " System.out.println(foo.rating + bar.other); \n" + >- " ^^^^^^^^^\n" + >- "bar.other cannot be resolved or is not a field\n" + >+ " ^^^^^\n" + >+ "other cannot be resolved or is not a field\n" + > "----------\n" > ); > } >@@ -688,8 +688,8 @@ > "----------\n" + > "2. ERROR in p1\\A.java (at line 13)\n" + > " System.out.println(foo.rating + bar.other); \n" + >- " ^^^^^^^^^\n" + >- "bar.other cannot be resolved or is not a field\n" + >+ " ^^^^^\n" + >+ "other cannot be resolved or is not a field\n" + > "----------\n"); > } > /** >@@ -2886,8 +2886,8 @@ > "----------\n" + > "1. ERROR in X.java (at line 5)\n" + > " System.out.println(y.length);\n" + >- " ^^^^^^^^\n" + >- "y.length cannot be resolved or is not a field\n" + >+ " ^^^^^^\n" + >+ "length cannot be resolved or is not a field\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=185422 - variation >Index: src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java,v >retrieving revision 1.77 >diff -u -r1.77 StaticImportTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java 13 Jan 2010 16:35:57 -0000 1.77 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java 8 Mar 2010 20:13:23 -0000 >@@ -2485,8 +2485,8 @@ > "----------\n" + > "1. ERROR in p1\\A.java (at line 7)\n" + > " int v2 = b.fooC;\n" + >- " ^^^^^^\n" + >- "b.fooC cannot be resolved or is not a field\n" + >+ " ^^^^\n" + >+ "fooC cannot be resolved or is not a field\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=256375 >Index: src/org/eclipse/jdt/core/tests/eval/NegativeCodeSnippetTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/NegativeCodeSnippetTest.java,v >retrieving revision 1.23 >diff -u -r1.23 NegativeCodeSnippetTest.java >--- src/org/eclipse/jdt/core/tests/eval/NegativeCodeSnippetTest.java 17 Aug 2009 17:46:06 -0000 1.23 >+++ src/org/eclipse/jdt/core/tests/eval/NegativeCodeSnippetTest.java 8 Mar 2010 20:13:23 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 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 >@@ -129,7 +129,7 @@ > evaluateWithExpectedProblem( > ("String s = \"\";\n" + > "s.length").toCharArray(), >- "s.length cannot be resolved or is not a field\n"); >+ "length cannot be resolved or is not a field\n"); > } > /** > * Test a code snippet which is valid but the evaluation context imports have problems.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 303830
:
161335
|
161350
|
161352
|
161359