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 45703 Details for
Bug 149573
[1.5][compiler] Improve readable name of wildcard captures
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
149573.txt (text/plain), 6.97 KB, created by
Philipe Mulet
on 2006-07-04 09:21:56 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2006-07-04 09:21:56 EDT
Size:
6.97 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java,v >retrieving revision 1.84 >diff -u -r1.84 ParameterizedTypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java 25 Jun 2006 21:33:33 -0000 1.84 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java 4 Jul 2006 13:23:58 -0000 >@@ -97,7 +97,7 @@ > for (int i = 0; i < length; i++) { > TypeBinding argument = originalArguments[i]; > if (argument.kind() == Binding.WILDCARD_TYPE && ((WildcardBinding)argument).otherBounds == null) { // no capture for intersection types >- capturedArguments[i] = new CaptureBinding((WildcardBinding) argument, contextType, position); >+ capturedArguments[i] = new CaptureBinding((WildcardBinding) argument, contextType, position, this.environment.nextCaptureID()); > } else { > capturedArguments[i] = argument; > } >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java,v >retrieving revision 1.72 >diff -u -r1.72 LookupEnvironment.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java 11 May 2006 10:14:34 -0000 1.72 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java 4 Jul 2006 13:23:56 -0000 >@@ -62,6 +62,7 @@ > private SimpleLookupTable uniqueRawTypeBindings; > private SimpleLookupTable uniqueWildcardBindings; > private SimpleLookupTable uniqueParameterizedGenericMethodBindings; >+ private int captureID = 1; > > public CompilationUnitDeclaration unitBeingCompleted = null; // only set while completing units > >@@ -1148,6 +1149,9 @@ > : new MethodVerifier15(this); // covariance only if sourceLevel is >= 1.5 > return verifier; > } >+public int nextCaptureID() { >+ return this.captureID++; >+} > public void reset() { > this.defaultPackage = new PackageBinding(this); // assume the default package always exists > this.defaultImports = null; >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java,v >retrieving revision 1.42 >diff -u -r1.42 TypeConstants.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java 29 Mar 2006 02:45:27 -0000 1.42 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java 4 Jul 2006 13:23:58 -0000 >@@ -43,7 +43,8 @@ > char[] WILDCARD_MINUS = { '-' }; > char[] WILDCARD_STAR = { '*' }; > char[] WILDCARD_PLUS = { '+' }; >- char[] WILDCARD_CAPTURE_NAME = "capture-of ".toCharArray(); //$NON-NLS-1$ >+ char[] WILDCARD_CAPTURE_NAME_PREFIX = "capture$".toCharArray(); //$NON-NLS-1$ >+ char[] WILDCARD_CAPTURE_NAME_SUFFIX = "-of ".toCharArray(); //$NON-NLS-1$ > char[] WILDCARD_CAPTURE = { '!' }; > char[] BYTE = "byte".toCharArray(); //$NON-NLS-1$ > char[] SHORT = "short".toCharArray(); //$NON-NLS-1$ >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding.java,v >retrieving revision 1.18 >diff -u -r1.18 CaptureBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding.java 29 Mar 2006 02:40:11 -0000 1.18 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding.java 4 Jul 2006 13:23:54 -0000 >@@ -18,18 +18,20 @@ > > public TypeBinding lowerBound; > public WildcardBinding wildcard; >+ public int captureID; > > /* information to compute unique binding key */ > public ReferenceBinding sourceType; > public int position; > >- public CaptureBinding(WildcardBinding wildcard, ReferenceBinding sourceType, int position) { >- super(TypeConstants.WILDCARD_CAPTURE_NAME, null, 0); >+ public CaptureBinding(WildcardBinding wildcard, ReferenceBinding sourceType, int position, int captureID) { >+ super(TypeConstants.WILDCARD_CAPTURE_NAME_PREFIX, null, 0); > this.wildcard = wildcard; > this.modifiers = ClassFileConstants.AccPublic | ExtraCompilerModifiers.AccGenericSignature; // treat capture as public > this.fPackage = wildcard.fPackage; > this.sourceType = sourceType; > this.position = position; >+ this.captureID = captureID; > } > > /* >@@ -54,8 +56,15 @@ > } > > public String debugName() { >+ > if (this.wildcard != null) { >- return String.valueOf(TypeConstants.WILDCARD_CAPTURE_NAME) + this.wildcard.debugName(); >+ StringBuffer buffer = new StringBuffer(10); >+ buffer >+ .append(TypeConstants.WILDCARD_CAPTURE_NAME_PREFIX) >+ .append(this.captureID) >+ .append(TypeConstants.WILDCARD_CAPTURE_NAME_SUFFIX) >+ .append(this.wildcard.debugName()); >+ return buffer.toString(); > } > return super.debugName(); > } >@@ -156,21 +165,45 @@ > > public char[] readableName() { > if (this.wildcard != null) { >- return CharOperation.concat(TypeConstants.WILDCARD_CAPTURE_NAME, this.wildcard.readableName()); >+ StringBuffer buffer = new StringBuffer(10); >+ buffer >+ .append(TypeConstants.WILDCARD_CAPTURE_NAME_PREFIX) >+ .append(this.captureID) >+ .append(TypeConstants.WILDCARD_CAPTURE_NAME_SUFFIX) >+ .append(this.wildcard.readableName()); >+ int length = buffer.length(); >+ char[] name = new char[length]; >+ buffer.getChars(0, length, name, 0); >+ return name; > } > return super.readableName(); > } > > public char[] shortReadableName() { > if (this.wildcard != null) { >- return CharOperation.concat(TypeConstants.WILDCARD_CAPTURE_NAME, this.wildcard.shortReadableName()); >+ StringBuffer buffer = new StringBuffer(10); >+ buffer >+ .append(TypeConstants.WILDCARD_CAPTURE_NAME_PREFIX) >+ .append(this.captureID) >+ .append(TypeConstants.WILDCARD_CAPTURE_NAME_SUFFIX) >+ .append(this.wildcard.shortReadableName()); >+ int length = buffer.length(); >+ char[] name = new char[length]; >+ buffer.getChars(0, length, name, 0); >+ return name; > } >- return super.shortReadableName(); >+ return super.shortReadableName(); > } > > public String toString() { > if (this.wildcard != null) { >- return String.valueOf(TypeConstants.WILDCARD_CAPTURE_NAME) + this.wildcard.toString(); >+ StringBuffer buffer = new StringBuffer(10); >+ buffer >+ .append(TypeConstants.WILDCARD_CAPTURE_NAME_PREFIX) >+ .append(this.captureID) >+ .append(TypeConstants.WILDCARD_CAPTURE_NAME_SUFFIX) >+ .append(this.wildcard); >+ return buffer.toString(); > } > return super.toString(); > }
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 149573
:
45702
|
45703
|
45830