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 115077 Details for
Bug 146768
[compiler] Should be more resilient with duplicate fields/methods
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch with testcase for duplicate fields
patch.txt (text/plain), 3.39 KB, created by
Kent Johnson
on 2008-10-14 15:52:40 EDT
(
hide
)
Description:
Proposed patch with testcase for duplicate fields
Filename:
MIME Type:
Creator:
Kent Johnson
Created:
2008-10-14 15:52:40 EDT
Size:
3.39 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java,v >retrieving revision 1.162 >diff -u -r1.162 ClassScope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 3 Oct 2008 16:20:02 -0000 1.162 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 14 Oct 2008 19:47:23 -0000 >@@ -91,7 +91,6 @@ > // iterate the field declarations to create the bindings, lose all duplicates > FieldBinding[] fieldBindings = new FieldBinding[count]; > HashtableOfObject knownFieldNames = new HashtableOfObject(count); >- boolean duplicate = false; > count = 0; > for (int i = 0; i < size; i++) { > FieldDeclaration field = fields[i]; >@@ -105,19 +104,6 @@ > checkAndSetModifiersForField(fieldBinding, field); > > if (knownFieldNames.containsKey(field.name)) { >- duplicate = true; >- FieldBinding previousBinding = (FieldBinding) knownFieldNames.get(field.name); >- if (previousBinding != null) { >- for (int f = 0; f < i; f++) { >- FieldDeclaration previousField = fields[f]; >- if (previousField.binding == previousBinding) { >- problemReporter().duplicateFieldInType(sourceType, previousField); >- previousField.binding = null; >- break; >- } >- } >- } >- knownFieldNames.put(field.name, null); // ensure that the duplicate field is found & removed > problemReporter().duplicateFieldInType(sourceType, field); > field.binding = null; > } else { >@@ -128,20 +114,6 @@ > } > } > // remove duplicate fields >- if (duplicate) { >- FieldBinding[] newFieldBindings = new FieldBinding[fieldBindings.length]; >- // we know we'll be removing at least 1 duplicate name >- size = count; >- count = 0; >- for (int i = 0; i < size; i++) { >- FieldBinding fieldBinding = fieldBindings[i]; >- if (knownFieldNames.get(fieldBinding.name) != null) { >- fieldBinding.id = count; >- newFieldBindings[count++] = fieldBinding; >- } >- } >- fieldBindings = newFieldBindings; >- } > if (count != fieldBindings.length) > System.arraycopy(fieldBindings, 0, fieldBindings = new FieldBinding[count], 0, count); > sourceType.tagBits &= ~(TagBits.AreFieldsSorted|TagBits.AreFieldsComplete); // in case some static imports reached already into this type >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java,v >retrieving revision 1.130 >diff -u -r1.130 EnumTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java 3 Oct 2008 16:20:03 -0000 1.130 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java 14 Oct 2008 19:47:27 -0000 >@@ -176,12 +176,7 @@ > "}" > }, > "----------\n" + >- "1. ERROR in X.java (at line 3)\n" + >- " BLEU, \n" + >- " ^^^^\n" + >- "Duplicate field X.BLEU\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 6)\n" + >+ "1. ERROR in X.java (at line 6)\n" + > " BLEU;\n" + > " ^^^^\n" + > "Duplicate field X.BLEU\n" +
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 146768
:
115077
|
115301
|
115727