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 161335 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 + regression test
patch_303830.txt (text/plain), 3.12 KB, created by
Olivier Thomann
on 2010-03-08 14:20:12 EST
(
hide
)
Description:
Proposed fix + regression test
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2010-03-08 14:20:12 EST
Size:
3.12 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 19:10:50 -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.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 19:10:50 -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,27 @@ > true, > options); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=303830 >+public void test021() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "import java.util.ArrayList;\n" + >+ "\n" + >+ "public class X {\n" + >+ " public void bar() {\n" + >+ " ArrayList<String> myList = new ArrayList<String>();\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"); >+} > public static Class testClass() { > return FieldAccessTest.class; > }
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