### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core 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.99 diff -u -r1.99 BinaryTypeBinding.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 6 Sep 2006 18:14:13 -0000 1.99 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 23 Nov 2006 16:49:45 -0000 @@ -273,7 +273,7 @@ if (wrapper.signature[wrapper.start] == '<') { // ParameterPart = '<' ParameterSignature(s) '>' wrapper.start++; // skip '<' - this.typeVariables = createTypeVariables(wrapper, this); + this.typeVariables = createTypeVariables(wrapper, true); wrapper.start++; // skip '>' this.tagBits |= TagBits.HasUnresolvedTypeVariables; this.modifiers |= ExtraCompilerModifiers.AccGenericSignature; @@ -424,7 +424,7 @@ // (Ljava/lang/Class;)TA; // ParameterPart = '<' ParameterSignature(s) '>' wrapper.start++; // skip '<' - typeVars = createTypeVariables(wrapper, this); + typeVars = createTypeVariables(wrapper, false); wrapper.start++; // skip '>' } @@ -549,7 +549,7 @@ } } } -private TypeVariableBinding[] createTypeVariables(SignatureWrapper wrapper, Binding declaringElement) { +private TypeVariableBinding[] createTypeVariables(SignatureWrapper wrapper, boolean assignVariables) { // detect all type variables first char[] typeSignature = wrapper.signature; int depth = 0, length = typeSignature.length; @@ -576,7 +576,7 @@ pendingVariable = false; int colon = CharOperation.indexOf(':', typeSignature, i); char[] variableName = CharOperation.subarray(typeSignature, i, colon); - variables.add(new TypeVariableBinding(variableName, declaringElement, rank++)); + variables.add(new TypeVariableBinding(variableName, this, rank++)); } } } @@ -584,6 +584,10 @@ // initialize type variable bounds - may refer to forward variables TypeVariableBinding[] result; variables.toArray(result = new TypeVariableBinding[rank]); + // when creating the type variables for a type, the type must remember them before initializing each variable + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=163680 + if (assignVariables) + this.typeVariables = result; for (int i = 0; i < rank; i++) { initializeTypeVariable(result[i], result, wrapper); }