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 172987 Details for
Bug 318171
fieldHiding-Warning does not appear if classes are in different packages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch under consideration
patch.txt (text/plain), 2.83 KB, created by
Srikanth Sankaran
on 2010-06-29 04:32:05 EDT
(
hide
)
Description:
Patch under consideration
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2010-06-29 04:32:05 EDT
Size:
2.83 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java,v >retrieving revision 1.100 >diff -u -r1.100 FieldDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java 7 Jan 2010 20:18:49 -0000 1.100 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java 29 Jun 2010 08:31:23 -0000 >@@ -149,8 +149,9 @@ > checkHiding: { > SourceTypeBinding declaringType = classScope.enclosingSourceType(); > checkHidingSuperField: { >- if (declaringType.superclass == null) break checkHidingSuperField; >- FieldBinding existingVariable = classScope.findField(declaringType.superclass, this.name, this, false /*do not resolve hidden field*/); >+ ReferenceBinding superClass = declaringType.superclass; >+ if (superClass == null) break checkHidingSuperField; >+ FieldBinding existingVariable = superClass.getField(this.name, false); > if (existingVariable == null) break checkHidingSuperField; // keep checking outer scenario > if (!existingVariable.isValidBinding()) break checkHidingSuperField; // keep checking outer scenario > if (existingVariable.original() == this.binding) break checkHidingSuperField; // keep checking outer scenario >#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.11 >diff -u -r1.11 FieldAccessTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/FieldAccessTest.java 11 May 2010 18:53:50 -0000 1.11 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/FieldAccessTest.java 29 Jun 2010 08:31:26 -0000 >@@ -679,6 +679,29 @@ > "OLD_FIELD cannot be resolved or is not a field\n" + > "----------\n"); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318171 >+public void test023() { >+ this.runNegativeTest( >+ new String[] { >+ "p1/A.java", >+ "package p1;\n" + >+ "public abstract class A {\n" + >+ " protected int field;\n" + >+ "}\n", >+ "p2/B.java", >+ "package p2;\n" + >+ "import p1.A;\n" + >+ "public abstract class B extends A {\n" + >+ " protected int field;\n" + >+ "}\n" >+ }, >+ "----------\n" + >+ "1. WARNING in p2\\B.java (at line 4)\n" + >+ " protected int field;\n" + >+ " ^^^^^\n" + >+ "The field B.field is hiding a field from type A\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 318171
:
172987
|
172990
|
172992