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 114162 Details for
Bug 161977
[compiler] Identical branches in org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding#syntheticMethods
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
161977.txt (text/plain), 6.53 KB, created by
Philipe Mulet
on 2008-10-03 04:43:09 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2008-10-03 04:43:09 EDT
Size:
6.53 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java,v >retrieving revision 1.163 >diff -u -r1.163 SourceTypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 1 Oct 2008 21:16:38 -0000 1.163 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 3 Oct 2008 08:42:37 -0000 >@@ -1453,45 +1453,26 @@ > } > // TODO (philippe) could be a performance issue since some senders are building the list just to count them > public SyntheticMethodBinding[] syntheticMethods() { >- >- if (this.synthetics == null || this.synthetics[SourceTypeBinding.METHOD_EMUL] == null || this.synthetics[SourceTypeBinding.METHOD_EMUL].size() == 0) return null; >- >+ if (this.synthetics == null >+ || this.synthetics[SourceTypeBinding.METHOD_EMUL] == null >+ || this.synthetics[SourceTypeBinding.METHOD_EMUL].size() == 0) { >+ return null; >+ } > // difficult to compute size up front because of the embedded arrays so assume there is only 1 > int index = 0; > SyntheticMethodBinding[] bindings = new SyntheticMethodBinding[1]; >- Iterator fieldsOrMethods = this.synthetics[SourceTypeBinding.METHOD_EMUL].keySet().iterator(); >- while (fieldsOrMethods.hasNext()) { >- >- Object fieldOrMethod = fieldsOrMethods.next(); >- >- if (fieldOrMethod instanceof MethodBinding) { >- >- SyntheticMethodBinding[] methodAccessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(fieldOrMethod); >- int numberOfAccessors = 0; >- if (methodAccessors[0] != null) numberOfAccessors++; >- if (methodAccessors[1] != null) numberOfAccessors++; >- if (index + numberOfAccessors > bindings.length) >- System.arraycopy(bindings, 0, (bindings = new SyntheticMethodBinding[index + numberOfAccessors]), 0, index); >- if (methodAccessors[0] != null) >- bindings[index++] = methodAccessors[0]; // super access >- if (methodAccessors[1] != null) >- bindings[index++] = methodAccessors[1]; // normal access or bridge >- >- } else { >- >- SyntheticMethodBinding[] fieldAccessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(fieldOrMethod); >- int numberOfAccessors = 0; >- if (fieldAccessors[0] != null) numberOfAccessors++; >- if (fieldAccessors[1] != null) numberOfAccessors++; >- if (index + numberOfAccessors > bindings.length) >- System.arraycopy(bindings, 0, (bindings = new SyntheticMethodBinding[index + numberOfAccessors]), 0, index); >- if (fieldAccessors[0] != null) >- bindings[index++] = fieldAccessors[0]; // read access >- if (fieldAccessors[1] != null) >- bindings[index++] = fieldAccessors[1]; // write access >+ Iterator methodArrayIterator = this.synthetics[SourceTypeBinding.METHOD_EMUL].values().iterator(); >+ while (methodArrayIterator.hasNext()) { >+ SyntheticMethodBinding[] methodAccessors = (SyntheticMethodBinding[]) methodArrayIterator.next(); >+ for (int i = 0, max = methodAccessors.length; i < max; i++) { >+ if (methodAccessors[i] != null) { >+ if (index+1 > bindings.length) { >+ System.arraycopy(bindings, 0, (bindings = new SyntheticMethodBinding[index + 1]), 0, index); >+ } >+ bindings[index++] = methodAccessors[i]; >+ } > } > } >- > // sort them in according to their own indexes > int length; > SyntheticMethodBinding[] sortedBindings = new SyntheticMethodBinding[length = bindings.length]; >@@ -1505,9 +1486,7 @@ > * Answer the collection of synthetic fields to append into the classfile > */ > public FieldBinding[] syntheticFields() { >- > if (this.synthetics == null) return null; >- > int fieldSize = this.synthetics[SourceTypeBinding.FIELD_EMUL] == null ? 0 : this.synthetics[SourceTypeBinding.FIELD_EMUL].size(); > int literalSize = this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL] == null ? 0 :this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].size(); > int totalSize = fieldSize + literalSize; >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java,v >retrieving revision 1.20 >diff -u -r1.20 SyntheticMethodBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java 1 Oct 2008 21:16:38 -0000 1.20 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java 3 Oct 2008 08:42:37 -0000 >@@ -275,8 +275,7 @@ > this.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccSynthetic; > this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); > SourceTypeBinding sourceType = (SourceTypeBinding) accessedConstructor.declaringClass; >- SyntheticMethodBinding[] knownSyntheticMethods = >- sourceType.syntheticMethods(); >+ SyntheticMethodBinding[] knownSyntheticMethods = sourceType.syntheticMethods(); > this.index = knownSyntheticMethods == null ? 0 : knownSyntheticMethods.length; > > this.selector = accessedConstructor.selector; >@@ -314,7 +313,7 @@ > if (knownSyntheticMethods[i] == null) > continue; > if (CharOperation.equals(this.selector, knownSyntheticMethods[i].selector) >- && areParametersEqual(knownSyntheticMethods[i])) { >+ && areParametersEqual(knownSyntheticMethods[i])) { > needRename = true; > break check; > } >Index: compiler/org/eclipse/jdt/internal/compiler/ClassFile.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java,v >retrieving revision 1.181 >diff -u -r1.181 ClassFile.java >--- compiler/org/eclipse/jdt/internal/compiler/ClassFile.java 1 Oct 2008 21:16:38 -0000 1.181 >+++ compiler/org/eclipse/jdt/internal/compiler/ClassFile.java 3 Oct 2008 08:42:36 -0000 >@@ -734,9 +734,7 @@ > public void addFieldInfos() { > SourceTypeBinding currentBinding = this.referenceBinding; > FieldBinding[] syntheticFields = currentBinding.syntheticFields(); >- int fieldCount = >- currentBinding.fieldCount() >- + (syntheticFields == null ? 0 : syntheticFields.length); >+ int fieldCount = currentBinding.fieldCount() + (syntheticFields == null ? 0 : syntheticFields.length); > > // write the number of fields > if (fieldCount > 0xFFFF) {
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 161977
: 114162