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 38510 Details for
Bug 104293
[1.5][DOM] Extract local doesn't replace all occurences of expression.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch implementing method canonicalization
104293.txt (text/plain), 25.22 KB, created by
Philipe Mulet
on 2006-04-13 09:59:14 EDT
(
hide
)
Description:
Patch implementing method canonicalization
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2006-04-13 09:59:14 EDT
Size:
25.22 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java,v >retrieving revision 1.193 >diff -u -r1.193 ASTConverter15Test.java >--- src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 12 Apr 2006 19:02:46 -0000 1.193 >+++ src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 13 Apr 2006 13:38:06 -0000 >@@ -6481,8 +6481,9 @@ > > /* > * Check unique instance of generic method bindings >+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=104293 > */ >- public void _test0214() throws JavaModelException { >+ public void test0214() throws JavaModelException { > this.workingCopy = getWorkingCopy("/Converter15/src/X.java", true/*resolve*/); > String contents = > "public class X {\n" + >@@ -6529,7 +6530,7 @@ > invocation = (MethodInvocation) expression; > IMethodBinding methodBinding2 = invocation.resolveMethodBinding(); > >- assertTrue("Not equals", methodBinding == methodBinding2); >+ assertTrue("Not identical", methodBinding == methodBinding2); > } > > } >\ No newline at end of file >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/util/BindingKeyResolver.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BindingKeyResolver.java,v >retrieving revision 1.34 >diff -u -r1.34 BindingKeyResolver.java >--- model/org/eclipse/jdt/internal/core/util/BindingKeyResolver.java 29 Mar 2006 03:14:01 -0000 1.34 >+++ model/org/eclipse/jdt/internal/core/util/BindingKeyResolver.java 13 Apr 2006 13:38:15 -0000 >@@ -37,7 +37,6 @@ > import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; > import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; > import org.eclipse.jdt.internal.compiler.lookup.PackageBinding; >-import org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding; > import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; > import org.eclipse.jdt.internal.compiler.lookup.RawTypeBinding; > import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; >@@ -204,9 +203,9 @@ > return; > TypeBinding[] arguments = getTypeBindingArguments(); > if (arguments.length != this.methodBinding.typeVariables().length) >- this.methodBinding = new ParameterizedGenericMethodBinding(this.methodBinding, (RawTypeBinding) null, this.environment); >+ this.methodBinding = this.environment.createParameterizedGenericMethod(this.methodBinding, (RawTypeBinding) null); > else >- this.methodBinding = new ParameterizedGenericMethodBinding(this.methodBinding, arguments, this.environment); >+ this.methodBinding = this.environment.createParameterizedGenericMethod(this.methodBinding, arguments); > this.compilerBinding = this.methodBinding; > } > >Index: codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java,v >retrieving revision 1.284 >diff -u -r1.284 CompletionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 12 Apr 2006 10:07:26 -0000 1.284 >+++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 13 Apr 2006 13:38:11 -0000 >@@ -3886,7 +3886,7 @@ > continue next; > > if (minTypeArgLength != 0) { >- method = new ParameterizedGenericMethodBinding(method, typeArgTypes, scope.environment()); >+ method = scope.environment().createParameterizedGenericMethod(method, typeArgTypes); > } > > if (minArgLength > method.parameters.length) >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.133 >diff -u -r1.133 ClassScope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 10 Apr 2006 18:56:11 -0000 1.133 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 13 Apr 2006 13:38:12 -0000 >@@ -621,7 +621,7 @@ > fieldBinding.modifiers = modifiers; > } > >- public void checkForErasedCandidateCollisions() { >+ public void checkParameterizedSuperTypeCollisions() { > // check for parameterized interface collisions (when different parameterizations occur) > SourceTypeBinding sourceType = referenceContext.binding; > ReferenceBinding[] interfaces = sourceType.superInterfaces; >@@ -687,7 +687,7 @@ > ReferenceBinding[] memberTypes = referenceContext.binding.memberTypes; > if (memberTypes != null && memberTypes != Binding.NO_MEMBER_TYPES) > for (int i = 0, size = memberTypes.length; i < size; i++) >- ((SourceTypeBinding) memberTypes[i]).scope.checkForErasedCandidateCollisions(); >+ ((SourceTypeBinding) memberTypes[i]).scope.checkParameterizedSuperTypeCollisions(); > } > > private void checkForInheritedMemberTypes(SourceTypeBinding sourceType) { >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java,v >retrieving revision 1.47 >diff -u -r1.47 ParameterizedGenericMethodBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java 29 Mar 2006 02:45:27 -0000 1.47 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java 13 Apr 2006 13:38:14 -0000 >@@ -46,7 +46,7 @@ > // incompatible due to wrong arity > return new ProblemMethodBinding(originalMethod, originalMethod.selector, substitutes, ProblemReasons.TypeParameterArityMismatch); > } >- methodSubstitute = new ParameterizedGenericMethodBinding(originalMethod, substitutes, scope.environment()); >+ methodSubstitute = scope.environment().createParameterizedGenericMethod(originalMethod, substitutes); > break computeSubstitutes; > } > >@@ -172,7 +172,7 @@ > return null; // incompatible > if (substitutes.length == 0) { > // raw generic method inferred >- return new ParameterizedGenericMethodBinding(originalMethod, (RawTypeBinding)null, scope.environment()); >+ return scope.environment().createParameterizedGenericMethod(originalMethod, (RawTypeBinding)null); > } > // apply inferred variable substitutions - replacing unresolved variable with original ones in param method > TypeBinding[] resolvedSubstitutes = substitutes; >@@ -186,7 +186,7 @@ > resolvedSubstitutes[i] = substitutes[i]; > } > } >- return new ParameterizedGenericMethodBinding(originalMethod, resolvedSubstitutes, scope.environment()); >+ return scope.environment().createParameterizedGenericMethod(originalMethod, resolvedSubstitutes); > } > > private static TypeBinding[] resolveSubstituteConstraints(Scope scope, TypeVariableBinding[] typeVariables, TypeBinding[] substitutes, boolean considerEXTENDSConstraints, Map collectedSubstitutes) { >@@ -493,7 +493,7 @@ > TypeBinding[] rawArguments = new TypeBinding[length]; > for (int i = 0; i < length; i++) > rawArguments[i] = environment.convertToRawType(originalVariables[i].erasure()); >- this.tiebreakMethod = new ParameterizedGenericMethodBinding(this.originalMethod, rawArguments, this.environment); >+ this.tiebreakMethod = this.environment.createParameterizedGenericMethod(this.originalMethod, rawArguments); > // } > } > return this.tiebreakMethod; >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java,v >retrieving revision 1.81 >diff -u -r1.81 MethodBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java 29 Mar 2006 02:45:27 -0000 1.81 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java 13 Apr 2006 13:38:13 -0000 >@@ -304,7 +304,7 @@ > // must substitute to detect cases like: > // <T1 extends X<T1>> void dup() {} > // <T2 extends X<T2>> Object dup() {return null;} >- return new ParameterizedGenericMethodBinding(method, vars, env); >+ return env.createParameterizedGenericMethod(method, vars); > } > /* > * declaringUniqueKey dot selector genericSignature >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java,v >retrieving revision 1.99 >diff -u -r1.99 CompilationUnitScope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java 10 Apr 2006 18:55:29 -0000 1.99 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java 13 Apr 2006 13:38:12 -0000 >@@ -192,13 +192,17 @@ > System.arraycopy(resolvedImports, 0, resolvedImports = new ImportBinding[index], 0, index); > imports = resolvedImports; > } >-void checkParameterizedTypeBounds() { >+ >+/** >+ * Perform deferred check specific to parameterized types: bound checks, supertype collisions >+ */ >+void checkParameterizedTypes() { > if (compilerOptions().sourceLevel < ClassFileConstants.JDK1_5) return; > > for (int i = 0, length = topLevelTypes.length; i < length; i++) { > ClassScope scope = topLevelTypes[i].scope; > scope.checkParameterizedTypeBounds(); >- scope.checkForErasedCandidateCollisions(); >+ scope.checkParameterizedSuperTypeCollisions(); > } > } > /* >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java,v >retrieving revision 1.54 >diff -u -r1.54 MethodVerifier15.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java 4 Apr 2006 15:49:55 -0000 1.54 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java 13 Apr 2006 13:38:13 -0000 >@@ -445,7 +445,7 @@ > arguments[i] = inheritedTypeVariables[i].upperBound(); > } > ParameterizedGenericMethodBinding substitute = >- new ParameterizedGenericMethodBinding(inheritedMethod, arguments, this.environment); >+ this.environment.createParameterizedGenericMethod(inheritedMethod, arguments); > > // interface I { <T> void foo(T t); } > // class X implements I { public <T extends I> void foo(T t) {} } >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.68 >diff -u -r1.68 LookupEnvironment.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java 29 Mar 2006 02:45:27 -0000 1.68 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java 13 Apr 2006 13:38:13 -0000 >@@ -26,6 +26,7 @@ > import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable; > > public class LookupEnvironment implements ProblemReasons, TypeConstants { >+ > final static int BUILD_FIELDS_AND_METHODS = 4; > final static int BUILD_TYPE_HIERARCHY = 1; > final static int CHECK_AND_SET_IMPORTS = 2; >@@ -60,6 +61,7 @@ > private SimpleLookupTable uniqueParameterizedTypeBindings; > private SimpleLookupTable uniqueRawTypeBindings; > private SimpleLookupTable uniqueWildcardBindings; >+ private SimpleLookupTable uniqueParameterizedGenericMethodBindings; > > public CompilationUnitDeclaration unitBeingCompleted = null; // only set while completing units > >@@ -79,6 +81,7 @@ > this.uniqueParameterizedTypeBindings = new SimpleLookupTable(3); > this.uniqueRawTypeBindings = new SimpleLookupTable(3); > this.uniqueWildcardBindings = new SimpleLookupTable(3); >+ this.uniqueParameterizedGenericMethodBindings = new SimpleLookupTable(3); > this.accessRestrictions = new HashMap(3); > > this.classFilePool = ClassFilePool.newInstance(); >@@ -198,7 +201,7 @@ > > for (int i = this.lastCompletedUnitIndex + 1; i <= this.lastUnitIndex; i++) { > CompilationUnitScope unitScope = (this.unitBeingCompleted = this.units[i]).scope; >- unitScope.checkParameterizedTypeBounds(); >+ unitScope.checkParameterizedTypes(); > unitScope.buildFieldsAndMethods(); > this.units[i] = null; // release unnecessary reference to the parsed unit > } >@@ -249,7 +252,7 @@ > > (this.unitBeingCompleted = parsedUnit).scope.checkAndSetImports(); > parsedUnit.scope.connectTypeHierarchy(); >- parsedUnit.scope.checkParameterizedTypeBounds(); >+ parsedUnit.scope.checkParameterizedTypes(); > if (buildFieldsAndMethods) > parsedUnit.scope.buildFieldsAndMethods(); > this.unitBeingCompleted = null; >@@ -556,17 +559,92 @@ > return packageBinding; > } > >+public ParameterizedGenericMethodBinding createParameterizedGenericMethod(MethodBinding genericMethod, RawTypeBinding rawType) { >+ >+ // cached info is array of already created parameterized types for this type >+ ParameterizedGenericMethodBinding[] cachedInfo = (ParameterizedGenericMethodBinding[])this.uniqueParameterizedGenericMethodBindings.get(genericMethod); >+ boolean needToGrow = false; >+ int index = 0; >+ if (cachedInfo != null){ >+ nextCachedMethod : >+ // iterate existing parameterized for reusing one with same type arguments if any >+ for (int max = cachedInfo.length; index < max; index++){ >+ ParameterizedGenericMethodBinding cachedMethod = cachedInfo[index]; >+ if (cachedMethod == null) break nextCachedMethod; >+ if (!cachedMethod.isRaw) continue nextCachedMethod; >+ if (cachedMethod.declaringClass != (rawType == null ? genericMethod.declaringClass : rawType)) continue nextCachedMethod; >+ return cachedMethod; >+ } >+ needToGrow = true; >+ } else { >+ cachedInfo = new ParameterizedGenericMethodBinding[5]; >+ this.uniqueParameterizedGenericMethodBindings.put(genericMethod, cachedInfo); >+ } >+ // grow cache ? >+ int length = cachedInfo.length; >+ if (needToGrow && index == length){ >+ System.arraycopy(cachedInfo, 0, cachedInfo = new ParameterizedGenericMethodBinding[length*2], 0, length); >+ this.uniqueParameterizedGenericMethodBindings.put(genericMethod, cachedInfo); >+ } >+ // add new binding >+ ParameterizedGenericMethodBinding parameterizedGenericMethod = new ParameterizedGenericMethodBinding(genericMethod, rawType, this); >+ cachedInfo[index] = parameterizedGenericMethod; >+ return parameterizedGenericMethod; >+} >+ >+public ParameterizedGenericMethodBinding createParameterizedGenericMethod(MethodBinding genericMethod, TypeBinding[] typeArguments) { >+ >+ // cached info is array of already created parameterized types for this type >+ ParameterizedGenericMethodBinding[] cachedInfo = (ParameterizedGenericMethodBinding[])this.uniqueParameterizedGenericMethodBindings.get(genericMethod); >+ int argLength = typeArguments == null ? 0: typeArguments.length; >+ boolean needToGrow = false; >+ int index = 0; >+ if (cachedInfo != null){ >+ nextCachedMethod : >+ // iterate existing parameterized for reusing one with same type arguments if any >+ for (int max = cachedInfo.length; index < max; index++){ >+ ParameterizedGenericMethodBinding cachedMethod = cachedInfo[index]; >+ if (cachedMethod == null) break nextCachedMethod; >+ if (cachedMethod.isRaw) continue nextCachedMethod; >+ TypeBinding[] cachedArguments = cachedMethod.typeArguments; >+ int cachedArgLength = cachedArguments == null ? 0 : cachedArguments.length; >+ if (argLength != cachedArgLength) continue nextCachedMethod; >+ for (int j = 0; j < cachedArgLength; j++){ >+ if (typeArguments[j] != cachedArguments[j]) continue nextCachedMethod; >+ } >+ // all arguments match, reuse current >+ return cachedMethod; >+ } >+ needToGrow = true; >+ } else { >+ cachedInfo = new ParameterizedGenericMethodBinding[5]; >+ this.uniqueParameterizedGenericMethodBindings.put(genericMethod, cachedInfo); >+ } >+ // grow cache ? >+ int length = cachedInfo.length; >+ if (needToGrow && index == length){ >+ System.arraycopy(cachedInfo, 0, cachedInfo = new ParameterizedGenericMethodBinding[length*2], 0, length); >+ this.uniqueParameterizedGenericMethodBindings.put(genericMethod, cachedInfo); >+ } >+ // add new binding >+ ParameterizedGenericMethodBinding parameterizedGenericMethod = new ParameterizedGenericMethodBinding(genericMethod, typeArguments, this); >+ cachedInfo[index] = parameterizedGenericMethod; >+ return parameterizedGenericMethod; >+} >+ > public ParameterizedTypeBinding createParameterizedType(ReferenceBinding genericType, TypeBinding[] typeArguments, ReferenceBinding enclosingType) { > > // cached info is array of already created parameterized types for this type > ParameterizedTypeBinding[] cachedInfo = (ParameterizedTypeBinding[])this.uniqueParameterizedTypeBindings.get(genericType); > int argLength = typeArguments == null ? 0: typeArguments.length; > boolean needToGrow = false; >+ int index = 0; > if (cachedInfo != null){ > nextCachedType : > // iterate existing parameterized for reusing one with same type arguments if any >- for (int i = 0, max = cachedInfo.length; i < max; i++){ >- ParameterizedTypeBinding cachedType = cachedInfo[i]; >+ for (int max = cachedInfo.length; index < max; index++){ >+ ParameterizedTypeBinding cachedType = cachedInfo[index]; >+ if (cachedType == null) break nextCachedType; > if (cachedType.type != genericType) continue nextCachedType; // remain of unresolved type > if (cachedType.enclosingType() != enclosingType) continue nextCachedType; > TypeBinding[] cachedArguments = cachedType.arguments; >@@ -580,18 +658,18 @@ > } > needToGrow = true; > } else { >- cachedInfo = new ParameterizedTypeBinding[1]; >+ cachedInfo = new ParameterizedTypeBinding[5]; > this.uniqueParameterizedTypeBindings.put(genericType, cachedInfo); > } > // grow cache ? >- if (needToGrow){ >- int length = cachedInfo.length; >- System.arraycopy(cachedInfo, 0, cachedInfo = new ParameterizedTypeBinding[length+1], 0, length); >+ int length = cachedInfo.length; >+ if (needToGrow && index == length){ >+ System.arraycopy(cachedInfo, 0, cachedInfo = new ParameterizedTypeBinding[length*2], 0, length); > this.uniqueParameterizedTypeBindings.put(genericType, cachedInfo); > } > // add new binding > ParameterizedTypeBinding parameterizedType = new ParameterizedTypeBinding(genericType,typeArguments, enclosingType, this); >- cachedInfo[cachedInfo.length-1] = parameterizedType; >+ cachedInfo[index] = parameterizedType; > return parameterizedType; > } > >@@ -599,11 +677,13 @@ > // cached info is array of already created raw types for this type > RawTypeBinding[] cachedInfo = (RawTypeBinding[])this.uniqueRawTypeBindings.get(genericType); > boolean needToGrow = false; >+ int index = 0; > if (cachedInfo != null){ > nextCachedType : > // iterate existing parameterized for reusing one with same type arguments if any >- for (int i = 0, max = cachedInfo.length; i < max; i++){ >- RawTypeBinding cachedType = cachedInfo[i]; >+ for (int max = cachedInfo.length; index < max; index++){ >+ RawTypeBinding cachedType = cachedInfo[index]; >+ if (cachedType == null) break nextCachedType; > if (cachedType.type != genericType) continue nextCachedType; // remain of unresolved type > if (cachedType.enclosingType() != enclosingType) continue nextCachedType; > // all enclosing type match, reuse current >@@ -615,14 +695,14 @@ > this.uniqueRawTypeBindings.put(genericType, cachedInfo); > } > // grow cache ? >- if (needToGrow){ >- int length = cachedInfo.length; >- System.arraycopy(cachedInfo, 0, cachedInfo = new RawTypeBinding[length+1], 0, length); >+ int length = cachedInfo.length; >+ if (needToGrow && index == length){ >+ System.arraycopy(cachedInfo, 0, cachedInfo = new RawTypeBinding[length*2], 0, length); > this.uniqueRawTypeBindings.put(genericType, cachedInfo); > } > // add new binding > RawTypeBinding rawType = new RawTypeBinding(genericType, enclosingType, this); >- cachedInfo[cachedInfo.length-1] = rawType; >+ cachedInfo[index] = rawType; > return rawType; > > } >@@ -634,11 +714,13 @@ > genericType = ReferenceBinding.LUB_GENERIC; > WildcardBinding[] cachedInfo = (WildcardBinding[])this.uniqueWildcardBindings.get(genericType); > boolean needToGrow = false; >+ int index = 0; > if (cachedInfo != null){ > nextCachedType : > // iterate existing wildcards for reusing one with same information if any >- for (int i = 0, max = cachedInfo.length; i < max; i++){ >- WildcardBinding cachedType = cachedInfo[i]; >+ for (int max = cachedInfo.length; index < max; index++){ >+ WildcardBinding cachedType = cachedInfo[index]; >+ if (cachedType == null) break nextCachedType; > if (cachedType.genericType != genericType) continue nextCachedType; // remain of unresolved type > if (cachedType.rank != rank) continue nextCachedType; > if (cachedType.boundKind != boundKind) continue nextCachedType; >@@ -656,18 +738,18 @@ > } > needToGrow = true; > } else { >- cachedInfo = new WildcardBinding[1]; >+ cachedInfo = new WildcardBinding[10]; > this.uniqueWildcardBindings.put(genericType, cachedInfo); > } > // grow cache ? >- if (needToGrow){ >- int length = cachedInfo.length; >- System.arraycopy(cachedInfo, 0, cachedInfo = new WildcardBinding[length+1], 0, length); >+ int length = cachedInfo.length; >+ if (needToGrow && index == length){ >+ System.arraycopy(cachedInfo, 0, cachedInfo = new WildcardBinding[length*2], 0, length); > this.uniqueWildcardBindings.put(genericType, cachedInfo); > } > // add new binding > WildcardBinding wildcard = new WildcardBinding(genericType, rank, bound, otherBounds, boundKind, this); >- cachedInfo[cachedInfo.length-1] = wildcard; >+ cachedInfo[index] = wildcard; > return wildcard; > } > >@@ -1027,6 +1109,7 @@ > this.uniqueParameterizedTypeBindings = new SimpleLookupTable(3); > this.uniqueRawTypeBindings = new SimpleLookupTable(3); > this.uniqueWildcardBindings = new SimpleLookupTable(3); >+ this.uniqueParameterizedGenericMethodBindings = new SimpleLookupTable(3); > > for (int i = this.units.length; --i >= 0;) > this.units[i] = null; >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java,v >retrieving revision 1.27 >diff -u -r1.27 RawTypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java 29 Mar 2006 02:45:26 -0000 1.27 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java 13 Apr 2006 13:38:14 -0000 >@@ -54,7 +54,7 @@ > if (originalMethod.typeVariables == Binding.NO_TYPE_VARIABLES || originalMethod.isStatic()) { > return super.createParameterizedMethod(originalMethod); > } >- return new ParameterizedGenericMethodBinding(originalMethod, this, this.environment); >+ return this.environment.createParameterizedGenericMethod(originalMethod, this); > } > > public int kind() { >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java,v >retrieving revision 1.475 >diff -u -r1.475 GenericTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 10 Apr 2006 18:55:43 -0000 1.475 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 13 Apr 2006 13:38:32 -0000 >@@ -30407,4 +30407,32 @@ > }, > ""); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=108045 >+public void test0968() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", //================================ >+ "import java.util.*;\n" + >+ "public class X<T0> extends ArrayList<T0> implements I<T0> {\n" + >+ "}\n" + >+ "interface I<T1> extends Collection {\n" + >+ "}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " public class X<T0> extends ArrayList<T0> implements I<T0> {\n" + >+ " ^\n" + >+ "The interface Collection cannot be implemented more than once with different arguments: Collection<T0> and Collection\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 2)\n" + >+ " public class X<T0> extends ArrayList<T0> implements I<T0> {\n" + >+ " ^\n" + >+ "The serializable class X does not declare a static final serialVersionUID field of type long\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 4)\n" + >+ " interface I<T1> extends Collection {\n" + >+ " ^^^^^^^^^^\n" + >+ "Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + >+ "----------\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 104293
: 38510