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 174113 Details for
Bug 316956
[compiler] Private superclass and enclosing scope field names incorrectly reported as conflicting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Same patch after CVS synchronization.
patch.txt (text/plain), 6.68 KB, created by
Srikanth Sankaran
on 2010-07-12 23:54:01 EDT
(
hide
)
Description:
Same patch after CVS synchronization.
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2010-07-12 23:54:01 EDT
Size:
6.68 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#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.370 >diff -u -r1.370 Scope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 1 Jul 2010 04:39:19 -0000 1.370 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 13 Jul 2010 03:53:06 -0000 >@@ -1688,7 +1688,9 @@ > } > if (foundField.isValidBinding()) > // if a valid field was found, complain when another is found in an 'immediate' enclosing type (that is, not inherited) >- if (foundField.declaringClass != fieldBinding.declaringClass) >+ // but only if "valid field" was inherited in the first place. >+ if (foundField.declaringClass != fieldBinding.declaringClass && >+ foundField.declaringClass != foundActualReceiverType) // https://bugs.eclipse.org/bugs/show_bug.cgi?id=316956 > // i.e. have we found the same field - do not trust field identity yet > return new ProblemFieldBinding( > foundField, // closest match >#P org.eclipse.jdt.core.tests.compiler >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.85 >diff -u -r1.85 LookupTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java 5 Jul 2010 14:18:53 -0000 1.85 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java 13 Jul 2010 03:53:10 -0000 >@@ -3311,6 +3311,153 @@ > "The field A.B.length is not visible\n" + > "----------\n"); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=316956 >+public void test103() { >+ Map options = getCompilerOptions(); >+ CompilerOptions compOptions = new CompilerOptions(options); >+ if (compOptions.complianceLevel < ClassFileConstants.JDK1_4) return; >+ this.runNegativeTest( >+ new String[] { >+ "A.java",//------------------------------ >+ "public class A {\n" + >+ " private int x;\n" + >+ " static class B {\n" + >+ " private int x;\n" + >+ " private C c = new C() {\n" + >+ " void foo() {\n" + >+ " x = 3;\n" + >+ " }\n" + >+ " };\n" + >+ " }\n" + >+ " static class C {\n" + >+ " private int x;\n" + >+ " }\n" + >+ " }\n", >+ }, >+ "----------\n" + >+ "1. WARNING in A.java (at line 2)\n" + >+ " private int x;\n" + >+ " ^\n" + >+ "The field A.x is never read locally\n" + >+ "----------\n" + >+ "2. WARNING in A.java (at line 4)\n" + >+ " private int x;\n" + >+ " ^\n" + >+ "The field A.B.x is never read locally\n" + >+ "----------\n" + >+ "3. WARNING in A.java (at line 5)\n" + >+ " private C c = new C() {\n" + >+ " ^\n" + >+ "The field A.B.c is never read locally\n" + >+ "----------\n" + >+ "4. WARNING in A.java (at line 6)\n" + >+ " void foo() {\n" + >+ " ^^^^^\n" + >+ "The method foo() from the type new A.C(){} is never used locally\n" + >+ "----------\n" + >+ "5. WARNING in A.java (at line 7)\n" + >+ " x = 3;\n" + >+ " ^\n" + >+ "Write access to enclosing field A.B.x is emulated by a synthetic accessor method\n" + >+ "----------\n" + >+ "6. WARNING in A.java (at line 12)\n" + >+ " private int x;\n" + >+ " ^\n" + >+ "The field A.C.x is never read locally\n" + >+ "----------\n"); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=316956 >+public void test104() { >+ Map options = getCompilerOptions(); >+ CompilerOptions compOptions = new CompilerOptions(options); >+ if (compOptions.complianceLevel < ClassFileConstants.JDK1_4) return; >+ this.runNegativeTest( >+ new String[] { >+ "A.java",//------------------------------ >+ "public class A {\n" + >+ " private int x;\n" + >+ " static class B {\n" + >+ " private int x;\n" + >+ " private C c = new C() {\n" + >+ " void foo() {\n" + >+ " x = 3;\n" + >+ " }\n" + >+ " };\n" + >+ " }\n" + >+ " static class C {\n" + >+ " public int x;\n" + >+ " }\n" + >+ " }\n", >+ }, >+ "----------\n" + >+ "1. WARNING in A.java (at line 2)\n" + >+ " private int x;\n" + >+ " ^\n" + >+ "The field A.x is never read locally\n" + >+ "----------\n" + >+ "2. WARNING in A.java (at line 4)\n" + >+ " private int x;\n" + >+ " ^\n" + >+ "The field A.B.x is never read locally\n" + >+ "----------\n" + >+ "3. WARNING in A.java (at line 5)\n" + >+ " private C c = new C() {\n" + >+ " ^\n" + >+ "The field A.B.c is never read locally\n" + >+ "----------\n" + >+ "4. WARNING in A.java (at line 6)\n" + >+ " void foo() {\n" + >+ " ^^^^^\n" + >+ "The method foo() from the type new A.C(){} is never used locally\n" + >+ "----------\n"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=316956 >+public void test105() { >+ Map options = getCompilerOptions(); >+ CompilerOptions compOptions = new CompilerOptions(options); >+ if (compOptions.complianceLevel < ClassFileConstants.JDK1_4) return; >+ this.runNegativeTest( >+ new String[] { >+ "A.java",//------------------------------ >+ "public class A {\n" + >+ " private int x;\n" + >+ " private C c = new C() {\n" + >+ " void foo() {\n" + >+ " x = 3;\n" + >+ " }\n" + >+ " };\n" + >+ " static class C {\n" + >+ " private int x;\n" + >+ " }\n" + >+ " }\n", >+ }, >+ "----------\n" + >+ "1. WARNING in A.java (at line 2)\n" + >+ " private int x;\n" + >+ " ^\n" + >+ "The field A.x is never read locally\n" + >+ "----------\n" + >+ "2. WARNING in A.java (at line 3)\n" + >+ " private C c = new C() {\n" + >+ " ^\n" + >+ "The field A.c is never read locally\n" + >+ "----------\n" + >+ "3. WARNING in A.java (at line 4)\n" + >+ " void foo() {\n" + >+ " ^^^^^\n" + >+ "The method foo() from the type new A.C(){} is never used locally\n" + >+ "----------\n" + >+ "4. WARNING in A.java (at line 5)\n" + >+ " x = 3;\n" + >+ " ^\n" + >+ "Write access to enclosing field A.x is emulated by a synthetic accessor method\n" + >+ "----------\n" + >+ "5. WARNING in A.java (at line 9)\n" + >+ " private int x;\n" + >+ " ^\n" + >+ "The field A.C.x is never read locally\n" + >+ "----------\n"); >+} > public static Class testClass() { return LookupTest.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 316956
:
172705
|
173410
| 174113