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 63416 Details for
Bug 180109
[compiler] JDT Throws ClassCastException on incremental build
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
patch.txt (text/plain), 40.92 KB, created by
Kent Johnson
on 2007-04-10 15:01:23 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Kent Johnson
Created:
2007-04-10 15:01:23 EDT
Size:
40.92 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.91 >diff -u -r1.91 ParameterizedTypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java 16 Mar 2007 18:28:58 -0000 1.91 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java 10 Apr 2007 19:00:05 -0000 >@@ -19,7 +19,7 @@ > */ > public class ParameterizedTypeBinding extends ReferenceBinding implements Substitution { > >- public ReferenceBinding type; >+ private ReferenceBinding type; // must ensure the type is resolved > public TypeBinding[] arguments; > public LookupEnvironment environment; > public char[] genericTypeSignature; >@@ -41,11 +41,11 @@ > // } > initialize(type, arguments); > if (type instanceof UnresolvedReferenceBinding) >- ((UnresolvedReferenceBinding) type).addWrapper(this); >+ ((UnresolvedReferenceBinding) type).addWrapper(this, environment); > if (arguments != null) { > for (int i = 0, l = arguments.length; i < l; i++) > if (arguments[i] instanceof UnresolvedReferenceBinding) >- ((UnresolvedReferenceBinding) arguments[i]).addWrapper(this); >+ ((UnresolvedReferenceBinding) arguments[i]).addWrapper(this, environment); > } > this.tagBits |= TagBits.HasUnresolvedTypeVariables; // cleared in resolve() > } >@@ -778,7 +778,14 @@ > } > return this.methods; > } >- >+ >+ /** >+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#qualifiedPackageName() >+ */ >+ public char[] qualifiedPackageName() { >+ return this.type.qualifiedPackageName(); >+ } >+ > /** > * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#qualifiedSourceName() > */ >@@ -840,6 +847,12 @@ > return this; > } > >+ public ReferenceBinding genericType() { >+ if (this.type instanceof UnresolvedReferenceBinding) >+ ((UnresolvedReferenceBinding) this.type).resolve(this.environment, false); >+ return this.type; >+ } >+ > /** > * @see org.eclipse.jdt.internal.compiler.lookup.Binding#shortReadableName() > */ >@@ -970,13 +983,6 @@ > } > > /** >- * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#qualifiedPackageName() >- */ >- public char[] qualifiedPackageName() { >- return this.type.qualifiedPackageName(); >- } >- >- /** > * @see java.lang.Object#toString() > */ > public String toString() { >@@ -1051,6 +1057,12 @@ > > } > >+ protected ReferenceBinding type() { >+ // can be an UnresolvedReferenceBinding >+ // most clients should call resolveType() >+ return this.type; >+ } >+ > public TypeVariableBinding[] typeVariables() { > if (this.arguments == null) { > // retain original type variables if not substituted (member type of parameterized type) >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.145 >diff -u -r1.145 ClassScope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 6 Mar 2007 02:38:51 -0000 1.145 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 10 Apr 2007 19:00:05 -0000 >@@ -1002,7 +1002,7 @@ > // abstract class X<K,V> implements java.util.Map<K,V> > // static abstract class M<K,V> implements Entry<K,V> > if (superType.isParameterizedType()) >- superType = ((ParameterizedTypeBinding) superType).type; >+ superType = ((ParameterizedTypeBinding) superType).genericType(); > compilationUnitScope().recordSuperTypeReference(superType); // to record supertypes > return detectHierarchyCycle(referenceContext.binding, (ReferenceBinding) superType, reference); > } >@@ -1016,7 +1016,7 @@ > // Answer whether a cycle was found between the sourceType & the superType > private boolean detectHierarchyCycle(SourceTypeBinding sourceType, ReferenceBinding superType, TypeReference reference) { > if (superType.isRawType()) >- superType = ((RawTypeBinding) superType).type; >+ superType = ((RawTypeBinding) superType).genericType(); > // by this point the superType must be a binary or source type > > if (sourceType == superType) { >@@ -1052,7 +1052,7 @@ > return true; > } > if (parentType.isParameterizedType()) >- parentType = ((ParameterizedTypeBinding) parentType).type; >+ parentType = ((ParameterizedTypeBinding) parentType).genericType(); > hasCycle |= detectHierarchyCycle(sourceType, parentType, reference); > if ((parentType.tagBits & TagBits.HierarchyHasProblems) != 0) { > sourceType.tagBits |= TagBits.HierarchyHasProblems; >@@ -1071,7 +1071,7 @@ > return true; > } > if (anInterface.isParameterizedType()) >- anInterface = ((ParameterizedTypeBinding) anInterface).type; >+ anInterface = ((ParameterizedTypeBinding) anInterface).genericType(); > hasCycle |= detectHierarchyCycle(sourceType, anInterface, reference); > if ((anInterface.tagBits & TagBits.HierarchyHasProblems) != 0) { > sourceType.tagBits |= TagBits.HierarchyHasProblems; >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.28 >diff -u -r1.28 RawTypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java 14 Apr 2006 08:34:05 -0000 1.28 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java 10 Apr 2007 19:00:05 -0000 >@@ -37,7 +37,7 @@ > for (int i = 0; i < typeSig.length-1; i++) sig.append(typeSig[i]); // copy all but trailing semicolon > sig.append('.').append(sourceName()).append('<').append('>').append(';'); > } else { >- sig.append(this.type.computeUniqueKey(false/*not a leaf*/)); >+ sig.append(genericType().computeUniqueKey(false/*not a leaf*/)); > sig.insert(sig.length()-1, "<>"); //$NON-NLS-1$ > } > >@@ -66,7 +66,7 @@ > */ > public String debugName() { > StringBuffer nameBuffer = new StringBuffer(10); >- nameBuffer.append(this.type.sourceName()).append("#RAW"); //$NON-NLS-1$ >+ nameBuffer.append(type().sourceName()).append("#RAW"); //$NON-NLS-1$ > return nameBuffer.toString(); > } > >@@ -86,7 +86,7 @@ > this.genericTypeSignature = new char[sigLength]; > sig.getChars(0, sigLength, this.genericTypeSignature, 0); > } else { >- this.genericTypeSignature = this.type.signature(); // erasure >+ this.genericTypeSignature = genericType().signature(); // erasure > } > } > return this.genericTypeSignature; >@@ -137,7 +137,7 @@ > } > > protected void initializeArguments() { >- TypeVariableBinding[] typeVariables = this.type.typeVariables(); >+ TypeVariableBinding[] typeVariables = genericType().typeVariables(); > int length = typeVariables.length; > TypeBinding[] typeArguments = new TypeBinding[length]; > for (int i = 0; i < length; i++) { >@@ -154,7 +154,7 @@ > if (isMemberType()) { > readableName = CharOperation.concat(enclosingType().readableName(), sourceName, '.'); > } else { >- readableName = CharOperation.concatWith(this.type.compoundName, '.'); >+ readableName = CharOperation.concatWith(type().compoundName, '.'); > } > return readableName; > } >@@ -167,7 +167,7 @@ > if (isMemberType()) { > shortReadableName = CharOperation.concat(enclosingType().shortReadableName(), sourceName, '.'); > } else { >- shortReadableName = this.type.sourceName; >+ shortReadableName = type().sourceName; > } > return shortReadableName; > } >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java,v >retrieving revision 1.27 >diff -u -r1.27 UnresolvedReferenceBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java 22 Dec 2006 16:02:08 -0000 1.27 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java 10 Apr 2007 19:00:06 -0000 >@@ -23,7 +23,13 @@ > this.fPackage = packageBinding; > this.wrappers = null; > } >-void addWrapper(TypeBinding wrapper) { >+void addWrapper(TypeBinding wrapper, LookupEnvironment environment) { >+ if (this.resolvedType != null) { >+ // the type reference B<B<T>.M> means a signature of <T:Ljava/lang/Object;>LB<LB<TT;>.M;>; >+ // when the ParameterizedType for Unresolved B is created with args B<T>.M, the Unresolved B is resolved before the wrapper is added >+ wrapper.swapUnresolved(this, this.resolvedType, environment); >+ return; >+ } > if (this.wrappers == null) { > this.wrappers = new TypeBinding[] {wrapper}; > } else { >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java,v >retrieving revision 1.103 >diff -u -r1.103 BinaryTypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 8 Jan 2007 15:48:21 -0000 1.103 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 10 Apr 2007 19:00:05 -0000 >@@ -162,6 +162,9 @@ > > this.sourceName = binaryType.getSourceName(); > this.modifiers = binaryType.getModifiers(); >+ >+ if ((binaryType.getTagBits() & TagBits.HasInconsistentHierarchy) != 0) >+ this.tagBits |= TagBits.HierarchyHasProblems; > > if (binaryType.isAnonymous()) { > this.tagBits |= TagBits.AnonymousTypeMask; >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.71 >diff -u -r1.71 MethodVerifier15.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java 28 Mar 2007 04:52:19 -0000 1.71 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java 10 Apr 2007 19:00:05 -0000 >@@ -675,9 +675,8 @@ > } > ParameterizedTypeBinding substituteReturnType = (ParameterizedTypeBinding) substituteMethod.returnType, > existingReturnType = (ParameterizedTypeBinding) existingMethod.returnType; >- if (substituteReturnType.type != existingReturnType.type) { >+ if (substituteReturnType.type() != existingReturnType.type()) > return false; >- } > for (int i = 0; i < substituteReturnType.arguments.length; i++) { > TypeBinding substituteArgumentType, existingArgumentType; > if (! (existingArgumentType = existingReturnType.arguments[i]).isCompatibleWith( >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.145 >diff -u -r1.145 SourceTypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 31 Mar 2007 18:41:36 -0000 1.145 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 10 Apr 2007 19:00:05 -0000 >@@ -1005,7 +1005,7 @@ > if ((otherType.tagBits & TagBits.HasDirectWildcard) == 0 && (!this.isMemberType() || !otherType.isMemberType())) > return false; // should have been identical > ParameterizedTypeBinding otherParamType = (ParameterizedTypeBinding) otherType; >- if (this != otherParamType.type) >+ if (this != otherParamType.type()) > return false; > if (!isStatic()) { // static member types do not compare their enclosing > ReferenceBinding enclosing = enclosingType(); >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java,v >retrieving revision 1.303 >diff -u -r1.303 Scope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 7 Mar 2007 17:06:33 -0000 1.303 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 10 Apr 2007 19:00:05 -0000 >@@ -241,7 +241,7 @@ > TypeBinding[] substitutedArguments = originalArguments; > if (originalArguments != null) { > if (substitution.isRawSubstitution()) { >- return originalParameterizedType.environment.createRawType(originalParameterizedType.type, substitutedEnclosing); >+ return originalParameterizedType.environment.createRawType(originalParameterizedType.genericType(), substitutedEnclosing); > } > substitutedArguments = substitute(substitution, originalArguments); > } >@@ -259,7 +259,7 @@ > // return originalParameterizedType.type; > // } > return originalParameterizedType.environment.createParameterizedType( >- originalParameterizedType.type, substitutedArguments, substitutedEnclosing); >+ originalParameterizedType.genericType(), substitutedArguments, substitutedEnclosing); > } > break; > >@@ -951,7 +951,7 @@ > ReferenceBinding[] itsInterfaces = currentType.superInterfaces(); > if (itsInterfaces == null) { // needed for statically imported types which don't know their hierarchy yet > ReferenceBinding sourceType = currentType.isParameterizedType() >- ? ((ParameterizedTypeBinding) enclosingType).type >+ ? ((ParameterizedTypeBinding) enclosingType).genericType() > : currentType; > if (sourceType.isHierarchyBeingConnected()) > return null; // looking for an undefined member type in its own superclass ref >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.76 >diff -u -r1.76 LookupEnvironment.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java 3 Apr 2007 13:53:46 -0000 1.76 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java 10 Apr 2007 19:00:05 -0000 >@@ -442,7 +442,7 @@ > break; > case Binding.PARAMETERIZED_TYPE : > ParameterizedTypeBinding paramType = (ParameterizedTypeBinding) originalType; >- needToConvert = paramType.type.isGenericType(); // only recursive call to enclosing type can find parameterizedType with arguments >+ needToConvert = paramType.genericType().isGenericType(); // only recursive call to enclosing type can find parameterizedType with arguments > break; > default : > needToConvert = false; >@@ -505,7 +505,7 @@ > break; > case Binding.PARAMETERIZED_TYPE : > ParameterizedTypeBinding paramType = (ParameterizedTypeBinding) originalType; >- needToConvert = paramType.type.isGenericType(); // only recursive call to enclosing type can find parameterizedType with arguments >+ needToConvert = paramType.genericType().isGenericType(); // only recursive call to enclosing type can find parameterizedType with arguments > break; > default : > needToConvert = false; >@@ -722,7 +722,7 @@ > 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.type() != genericType) continue nextCachedType; // remain of unresolved type > if (cachedType.enclosingType() != enclosingType) continue nextCachedType; > TypeBinding[] cachedArguments = cachedType.arguments; > int cachedArgLength = cachedArguments == null ? 0 : cachedArguments.length; >@@ -761,7 +761,7 @@ > 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.type() != genericType) continue nextCachedType; // remain of unresolved type > if (cachedType.enclosingType() != enclosingType) continue nextCachedType; > // all enclosing type match, reuse current > return cachedType; >@@ -1108,7 +1108,7 @@ > wrapper.start++; // skip '.' > char[] memberName = wrapper.nextWord(); > BinaryTypeBinding.resolveType(parameterizedType, this, false); >- ReferenceBinding memberType = parameterizedType.type.getMemberType(memberName); >+ ReferenceBinding memberType = parameterizedType.genericType().getMemberType(memberName); > if (wrapper.signature[wrapper.start] == '<') { > wrapper.start++; // skip '<' > typeArguments = getTypeArgumentsFromSignature(wrapper, staticVariables, enclosingType, memberType); >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java,v >retrieving revision 1.54 >diff -u -r1.54 ArrayBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java 16 Mar 2007 18:28:58 -0000 1.54 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java 10 Apr 2007 19:00:04 -0000 >@@ -31,7 +31,7 @@ > this.dimensions = dimensions; > this.environment = environment; > if (type instanceof UnresolvedReferenceBinding) >- ((UnresolvedReferenceBinding) type).addWrapper(this); >+ ((UnresolvedReferenceBinding) type).addWrapper(this, environment); > else > this.tagBits |= type.tagBits & (TagBits.HasTypeVariable | TagBits.HasDirectWildcard); > } >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java,v >retrieving revision 1.82 >diff -u -r1.82 TypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java 16 Mar 2007 18:28:58 -0000 1.82 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java 10 Apr 2007 19:00:06 -0000 >@@ -495,7 +495,7 @@ > > case Binding.PARAMETERIZED_TYPE: > ParameterizedTypeBinding parameterizedType = (ParameterizedTypeBinding) this; >- if (parameterizedType.type.isProvablyDistinctFrom(otherType.erasure(), depth)) >+ if (parameterizedType.genericType().isProvablyDistinctFrom(otherType.erasure(), depth)) > return true; > switch (otherType.kind()) { > case Binding.GENERIC_TYPE: >@@ -649,7 +649,7 @@ > return false; > ParameterizedTypeBinding paramType = (ParameterizedTypeBinding) this; > ParameterizedTypeBinding otherParamType = (ParameterizedTypeBinding) otherType; >- if (paramType.type != otherParamType.type) >+ if (paramType.type() != otherParamType.type()) > return false; > if (!paramType.isStatic()) { // static member types do not compare their enclosing > ReferenceBinding enclosing = enclosingType(); >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java,v >retrieving revision 1.62 >diff -u -r1.62 WildcardBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java 29 Mar 2007 12:06:04 -0000 1.62 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java 10 Apr 2007 19:00:06 -0000 >@@ -44,9 +44,9 @@ > initialize(genericType, bound, otherBounds); > > if (genericType instanceof UnresolvedReferenceBinding) >- ((UnresolvedReferenceBinding) genericType).addWrapper(this); >+ ((UnresolvedReferenceBinding) genericType).addWrapper(this, environment); > if (bound instanceof UnresolvedReferenceBinding) >- ((UnresolvedReferenceBinding) bound).addWrapper(this); >+ ((UnresolvedReferenceBinding) bound).addWrapper(this, environment); > this.tagBits |= TagBits.HasUnresolvedTypeVariables; // cleared in resolve() > } > >Index: search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java,v >retrieving revision 1.73 >diff -u -r1.73 MethodLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java 6 Mar 2007 02:38:49 -0000 1.73 >+++ search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java 10 Apr 2007 19:00:06 -0000 >@@ -527,7 +527,7 @@ > locator.reportBinaryMemberDeclaration(resource, method, methodBinding, info, SearchMatch.A_ACCURATE); > } else { > if (declaringClass instanceof ParameterizedTypeBinding) >- declaringClass = ((ParameterizedTypeBinding) declaringClass).type; >+ declaringClass = ((ParameterizedTypeBinding) declaringClass).genericType(); > ClassScope scope = ((SourceTypeBinding) declaringClass).scope; > if (scope != null) { > TypeDeclaration typeDecl = scope.referenceContext; >Index: search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java,v >retrieving revision 1.53 >diff -u -r1.53 TypeReferenceLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java 20 Oct 2006 11:02:03 -0000 1.53 >+++ search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java 10 Apr 2007 19:00:06 -0000 >@@ -600,7 +600,7 @@ > locator.reportBinaryMemberDeclaration(resource, type, typeBinding, info, SearchMatch.A_ACCURATE); > } else { > if (typeBinding instanceof ParameterizedTypeBinding) >- typeBinding = ((ParameterizedTypeBinding) typeBinding).type; >+ typeBinding = ((ParameterizedTypeBinding) typeBinding).genericType(); > ClassScope scope = ((SourceTypeBinding) typeBinding).scope; > if (scope != null) { > TypeDeclaration typeDecl = scope.referenceContext; >Index: search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java,v >retrieving revision 1.63 >diff -u -r1.63 PatternLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java 10 Nov 2006 17:54:00 -0000 1.63 >+++ search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java 10 Apr 2007 19:00:06 -0000 >@@ -442,7 +442,7 @@ > // Set match raw flag > boolean endPattern = patternTypeArguments==null ? true : depth>=patternTypeArguments.length; > TypeBinding[] argumentsBindings = parameterizedBinding.arguments; >- boolean isRaw = parameterizedBinding.isRawType()|| (argumentsBindings==null && parameterizedBinding.type.isGenericType()); >+ boolean isRaw = parameterizedBinding.isRawType()|| (argumentsBindings==null && parameterizedBinding.genericType().isGenericType()); > if (isRaw && !match.isRaw()) { > match.setRaw(isRaw); > } >@@ -452,7 +452,7 @@ > // verify if this is a reference to the generic type itself > if (!isRaw && patternHasTypeParameters && argumentsBindings != null) { > boolean needUpdate = false; >- TypeVariableBinding[] typeVariables = parameterizedBinding.type.typeVariables(); >+ TypeVariableBinding[] typeVariables = parameterizedBinding.genericType().typeVariables(); > for (int i=0, l=argumentsBindings.length; i<l; i++) { > if (argumentsBindings[i] != typeVariables[i]) { > needUpdate = true; >Index: search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java,v >retrieving revision 1.45 >diff -u -r1.45 FieldLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java 18 Jan 2007 14:50:24 -0000 1.45 >+++ search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java 10 Apr 2007 19:00:06 -0000 >@@ -266,7 +266,7 @@ > locator.reportBinaryMemberDeclaration(resource, field, fieldBinding, info, SearchMatch.A_ACCURATE); > } else { > if (declaringClass instanceof ParameterizedTypeBinding) >- declaringClass = ((ParameterizedTypeBinding) declaringClass).type; >+ declaringClass = ((ParameterizedTypeBinding) declaringClass).genericType(); > ClassScope scope = ((SourceTypeBinding) declaringClass).scope; > if (scope != null) { > TypeDeclaration typeDecl = scope.referenceContext; >Index: dom/org/eclipse/jdt/core/dom/TypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeBinding.java,v >retrieving revision 1.128 >diff -u -r1.128 TypeBinding.java >--- dom/org/eclipse/jdt/core/dom/TypeBinding.java 26 Mar 2007 17:30:24 -0000 1.128 >+++ dom/org/eclipse/jdt/core/dom/TypeBinding.java 10 Apr 2007 19:00:06 -0000 >@@ -438,7 +438,7 @@ > */ > public ITypeBinding getTypeDeclaration() { > if (this.binding instanceof ParameterizedTypeBinding) >- return this.resolver.getTypeBinding(((ParameterizedTypeBinding)this.binding).type); >+ return this.resolver.getTypeBinding(((ParameterizedTypeBinding)this.binding).genericType()); > return this; > } > >@@ -1175,7 +1175,7 @@ > if (isClass() || isInterface() || isEnum()) { > ReferenceBinding referenceBinding = (ReferenceBinding) this.binding; > if (referenceBinding.isRawType()) { >- return !((RawTypeBinding) referenceBinding).type.isBinaryBinding(); >+ return !((RawTypeBinding) referenceBinding).genericType().isBinaryBinding(); > } else if (referenceBinding.isParameterizedType()) { > ParameterizedTypeBinding parameterizedTypeBinding = (ParameterizedTypeBinding) referenceBinding; > org.eclipse.jdt.internal.compiler.lookup.TypeBinding erasure = parameterizedTypeBinding.erasure(); >Index: dom/org/eclipse/jdt/core/dom/MethodBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodBinding.java,v >retrieving revision 1.83 >diff -u -r1.83 MethodBinding.java >--- dom/org/eclipse/jdt/core/dom/MethodBinding.java 15 Mar 2007 16:06:40 -0000 1.83 >+++ dom/org/eclipse/jdt/core/dom/MethodBinding.java 10 Apr 2007 19:00:06 -0000 >@@ -79,7 +79,7 @@ > final ReferenceBinding declaringClassBinding = this.binding.declaringClass; > if (declaringClassBinding.isRawType()) { > RawTypeBinding rawTypeBinding = (RawTypeBinding) declaringClassBinding; >- if (rawTypeBinding.type.isBinaryBinding()) { >+ if (rawTypeBinding.genericType().isBinaryBinding()) { > return false; > } > return (this.binding.modifiers & ExtraCompilerModifiers.AccIsDefaultConstructor) != 0; >Index: compiler/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java,v >retrieving revision 1.17 >diff -u -r1.17 JavadocQualifiedTypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java 6 Mar 2007 02:38:48 -0000 1.17 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java 10 Apr 2007 19:00:04 -0000 >@@ -75,7 +75,7 @@ > if (isTypeUseDeprecated(this.resolvedType, scope)) > reportDeprecatedType(this.resolvedType, scope); > if (this.resolvedType instanceof ParameterizedTypeBinding) { >- this.resolvedType = ((ParameterizedTypeBinding)this.resolvedType).type; >+ this.resolvedType = ((ParameterizedTypeBinding)this.resolvedType).genericType(); > } > return this.resolvedType; > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java,v >retrieving revision 1.20 >diff -u -r1.20 JavadocSingleTypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java 6 Mar 2007 02:38:48 -0000 1.20 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java 10 Apr 2007 19:00:04 -0000 >@@ -87,7 +87,7 @@ > if (isTypeUseDeprecated(this.resolvedType, scope)) > reportDeprecatedType(this.resolvedType, scope); > if (this.resolvedType instanceof ParameterizedTypeBinding) { >- this.resolvedType = ((ParameterizedTypeBinding)this.resolvedType).type; >+ this.resolvedType = ((ParameterizedTypeBinding)this.resolvedType).genericType(); > } > return this.resolvedType; > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java,v >retrieving revision 1.41 >diff -u -r1.41 ParameterizedQualifiedTypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java 6 Mar 2007 02:38:48 -0000 1.41 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java 10 Apr 2007 19:00:04 -0000 >@@ -49,7 +49,7 @@ > } > if (type.isParameterizedType()) { > ParameterizedTypeBinding parameterizedType = (ParameterizedTypeBinding) type; >- ReferenceBinding currentType = parameterizedType.type; >+ ReferenceBinding currentType = parameterizedType.genericType(); > TypeVariableBinding[] typeVariables = currentType.typeVariables(); > TypeBinding[] argTypes = parameterizedType.arguments; > if (argTypes != null && typeVariables != null) { // argTypes may be null in error cases >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java,v >retrieving revision 1.36 >diff -u -r1.36 ParameterizedSingleTypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java 6 Mar 2007 02:38:48 -0000 1.36 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java 10 Apr 2007 19:00:04 -0000 >@@ -34,7 +34,7 @@ > > if (this.resolvedType.leafComponentType() instanceof ParameterizedTypeBinding) { > ParameterizedTypeBinding parameterizedType = (ParameterizedTypeBinding) this.resolvedType.leafComponentType(); >- ReferenceBinding currentType = parameterizedType.type; >+ ReferenceBinding currentType = parameterizedType.genericType(); > TypeVariableBinding[] typeVariables = currentType.typeVariables(); > TypeBinding[] argTypes = parameterizedType.arguments; > if (argTypes != null && typeVariables != null) { // may be null in error cases >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.147 >diff -u -r1.147 ClassFile.java >--- compiler/org/eclipse/jdt/internal/compiler/ClassFile.java 7 Apr 2007 16:29:22 -0000 1.147 >+++ compiler/org/eclipse/jdt/internal/compiler/ClassFile.java 10 Apr 2007 19:00:04 -0000 >@@ -255,6 +255,12 @@ > ClassFile classFile = ClassFile.getNewInstance(typeBinding); > classFile.initialize(typeBinding, null, true); > >+ if (typeBinding.hasMemberTypes()) { >+ // see bug 180109 >+ ReferenceBinding[] members = typeBinding.memberTypes; >+ for (int i = 0, l = members.length; i < l; i++) >+ classFile.recordInnerClasses(members[i]); >+ } > // TODO (olivier) handle cases where a field cannot be generated (name too long) > // TODO (olivier) handle too many methods > // inner attributes >Index: codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java,v >retrieving revision 1.135 >diff -u -r1.135 SelectionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java 6 Apr 2007 11:07:13 -0000 1.135 >+++ codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java 10 Apr 2007 19:00:04 -0000 >@@ -366,7 +366,7 @@ > return false; // not enough characters to decode an unicode > } > } >- >+ > if ((c1 = ScannerHelper.getNumericValue(source[pos++])) > 15 > || c1 < 0 > || (c2 = ScannerHelper.getNumericValue(source[pos++])) > 15 >@@ -560,7 +560,7 @@ > */ > private boolean isLocal(ReferenceBinding binding) { > if(binding instanceof ParameterizedTypeBinding) { >- return isLocal(((ParameterizedTypeBinding)binding).type); >+ return isLocal(((ParameterizedTypeBinding)binding).genericType()); > } > if (!(binding instanceof SourceTypeBinding)) return false; > if (binding instanceof LocalTypeBinding) return true; >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.322 >diff -u -r1.322 CompletionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 12 Mar 2007 09:42:26 -0000 1.322 >+++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 10 Apr 2007 19:00:03 -0000 >@@ -5768,7 +5768,7 @@ > completion.append('.'); > completion.append(parameterizedType.sourceName); > } else { >- completion.append(CharOperation.concatWith(parameterizedType.type.compoundName, '.')); >+ completion.append(CharOperation.concatWith(parameterizedType.genericType().compoundName, '.')); > } > if (parameterizedType.arguments != null) { > completion.append('<'); >@@ -6082,7 +6082,7 @@ > hasPotentialDefaultAbstractMethods = false; > } > if(currentType.isParameterizedType()) { >- currentType = ((ParameterizedTypeBinding)currentType).type.superclass(); >+ currentType = ((ParameterizedTypeBinding)currentType).genericType().superclass(); > } else { > currentType = currentType.superclass(); > } >Index: model/org/eclipse/jdt/internal/core/SelectionRequestor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java,v >retrieving revision 1.70 >diff -u -r1.70 SelectionRequestor.java >--- model/org/eclipse/jdt/internal/core/SelectionRequestor.java 6 Mar 2007 02:38:49 -0000 1.70 >+++ model/org/eclipse/jdt/internal/core/SelectionRequestor.java 10 Apr 2007 19:00:06 -0000 >@@ -281,7 +281,7 @@ > public void acceptLocalField(FieldBinding fieldBinding) { > IJavaElement res; > if(fieldBinding.declaringClass instanceof ParameterizedTypeBinding) { >- LocalTypeBinding localTypeBinding = (LocalTypeBinding)((ParameterizedTypeBinding)fieldBinding.declaringClass).type; >+ LocalTypeBinding localTypeBinding = (LocalTypeBinding)((ParameterizedTypeBinding)fieldBinding.declaringClass).genericType(); > res = findLocalElement(localTypeBinding.sourceStart()); > } else { > SourceTypeBinding typeBinding = (SourceTypeBinding)fieldBinding.declaringClass; >@@ -361,7 +361,7 @@ > public void acceptLocalType(TypeBinding typeBinding) { > IJavaElement res = null; > if(typeBinding instanceof ParameterizedTypeBinding) { >- LocalTypeBinding localTypeBinding = (LocalTypeBinding)((ParameterizedTypeBinding)typeBinding).type; >+ LocalTypeBinding localTypeBinding = (LocalTypeBinding)((ParameterizedTypeBinding)typeBinding).genericType(); > res = findLocalElement(localTypeBinding.sourceStart()); > } else if(typeBinding instanceof SourceTypeBinding) { > res = findLocalElement(((SourceTypeBinding)typeBinding).sourceStart()); >@@ -379,7 +379,7 @@ > public void acceptLocalTypeParameter(TypeVariableBinding typeVariableBinding) { > IJavaElement res; > if(typeVariableBinding.declaringElement instanceof ParameterizedTypeBinding) { >- LocalTypeBinding localTypeBinding = (LocalTypeBinding)((ParameterizedTypeBinding)typeVariableBinding.declaringElement).type; >+ LocalTypeBinding localTypeBinding = (LocalTypeBinding)((ParameterizedTypeBinding)typeVariableBinding.declaringElement).genericType(); > res = findLocalElement(localTypeBinding.sourceStart()); > } else { > SourceTypeBinding typeBinding = (SourceTypeBinding)typeVariableBinding.declaringElement; >#P org.eclipse.jdt.core.tests.builder >Index: src/org/eclipse/jdt/core/tests/builder/Java50Tests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Java50Tests.java,v >retrieving revision 1.8 >diff -u -r1.8 Java50Tests.java >--- src/org/eclipse/jdt/core/tests/builder/Java50Tests.java 6 Mar 2007 04:43:25 -0000 1.8 >+++ src/org/eclipse/jdt/core/tests/builder/Java50Tests.java 10 Apr 2007 19:00:08 -0000 >@@ -59,7 +59,81 @@ > "Problem : The annotation @Ann is disallowed for this location [ resource : </Project/p/Use.java> range : <11,17> category : <40> severity : <2>]" > ); > } >- >+ >+ public void testParameterizedMemberType() throws JavaModelException { >+ IPath projectPath = env.addProject("Project", "1.5"); >+ env.addExternalJars(projectPath, Util.getJavaClassLibs()); >+ env.setOutputFolder(projectPath, ""); >+ >+ IPath xPath = env.addClass(projectPath, "", "X", >+ "class X<T> extends A<T> {}" >+ ); >+ >+ IPath aPath = env.addClass(projectPath, "", "A", >+ "class A<T> extends B<B<T>.M> {}\n" + >+ "class B<T> extends Missing<T> {\n" + >+ " class M{}\n" + >+ "}\n" + >+ "class Missing<T> {}" >+ ); >+ >+ fullBuild(projectPath); >+ expectingNoProblems(); >+ >+ env.addClass(projectPath, "", "A", >+ "class A<T> extends B<B<T>.M> {}\n" + >+ "class B<T> extends Missing<T> {\n" + >+ " class M{}\n" + >+ "}" >+ ); >+ >+ incrementalBuild(projectPath); >+ expectingProblemsFor( >+ new IPath[] {aPath, xPath}, >+ "Problem : The hierarchy of the type A is inconsistent [ resource : </Project/A.java> range : <6,7> category : <40> severity : <2>]\n" + >+ "Problem : Missing cannot be resolved to a type [ resource : </Project/A.java> range : <51,58> category : <40> severity : <2>]\n" + >+ "Problem : The hierarchy of the type X is inconsistent [ resource : </Project/X.java> range : <6,7> category : <40> severity : <2>]" >+ ); >+ >+ env.addClass(projectPath, "", "X", >+ "class X<T> extends A<T> {}" >+ ); >+ >+ incrementalBuild(projectPath); >+ expectingProblemsFor( >+ new IPath[] {aPath, xPath}, >+ "Problem : The hierarchy of the type A is inconsistent [ resource : </Project/A.java> range : <6,7> category : <40> severity : <2>]\n" + >+ "Problem : Missing cannot be resolved to a type [ resource : </Project/A.java> range : <51,58> category : <40> severity : <2>]\n" + >+ "Problem : The hierarchy of the type X is inconsistent [ resource : </Project/X.java> range : <6,7> category : <40> severity : <2>]" >+ ); >+ >+ env.addClass(projectPath, "", "A", >+ "class A<T> extends B<B<T>.M> {}\n" + >+ "class B<T> extends Missing<T> {\n" + >+ " class M{}\n" + >+ "}" >+ ); >+ >+ incrementalBuild(projectPath); >+ expectingProblemsFor( >+ new IPath[] {aPath, xPath}, >+ "Problem : The hierarchy of the type A is inconsistent [ resource : </Project/A.java> range : <6,7> category : <40> severity : <2>]\n" + >+ "Problem : Missing cannot be resolved to a type [ resource : </Project/A.java> range : <51,58> category : <40> severity : <2>]\n" + >+ "Problem : The hierarchy of the type X is inconsistent [ resource : </Project/X.java> range : <6,7> category : <40> severity : <2>]" >+ ); >+ >+ env.addClass(projectPath, "", "A", >+ "class A<T> extends B<B<T>.M> {}\n" + >+ "class B<T> extends Missing<T> {\n" + >+ " class M{}\n" + >+ "}\n" + >+ "class Missing<T> {}" >+ ); >+ >+ incrementalBuild(projectPath); >+ expectingNoProblems(); >+ } >+ > public void testParameterizedType1() throws JavaModelException { > IPath projectPath = env.addProject("Project", "1.5"); > env.addExternalJars(projectPath, Util.getJavaClassLibs());
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 180109
:
62452
| 63416