Bug 74761

Summary: [1.5] Invalid compiler binding for qualified raw type reference
Product: [Eclipse Project] JDT Reporter: Frederic Fusier <frederic_fusier>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 3.1 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Frederic Fusier CLA 2004-09-23 07:50:18 EDT
Using build I200409212000.

With following test case:
X.java
  package p;
  public class X<T> {
    class Member {}
  }
Y.java
  package p;
  public class Y {
    p.X.Member m;
  }

The binding reference "p.X.Member" is a MemberTypeBinding instead of expected
ParameterizedTypeBinding...
Also member type binding enclosing type is a SourceTypeBinding instead of
expected RawTypeBinding...
Comment 1 Frederic Fusier CLA 2004-09-23 08:05:18 EDT
Similar to bug 74544.
Here problem comes from QualifiedTypeReference.getTypeBinding(Scope).
Replace code:
qualifiedType = this.resolvedType.isGenericType()
	? scope.environment().createRawType((ReferenceBinding)this.resolvedType,
qualifiedType)
	: (ReferenceBinding) this.resolvedType;

with:
ReferenceBinding currentType = (ReferenceBinding) this.resolvedType;
if (this.resolvedType.isGenericType()) {
	qualifiedType = scope.environment().createRawType(currentType, qualifiedType);
} else {
	qualifiedType = (qualifiedType != null && qualifiedType.isRawType())
		? scope.createParameterizedType(currentType, null, qualifiedType)
		: currentType;
}

fixes the problem
Comment 2 Philipe Mulet CLA 2004-09-23 16:49:16 EDT
Sounds like the right fix. Pls add a regression test as well in 
GenericTypeTest.

Post M2.
Comment 3 Frederic Fusier CLA 2004-09-27 12:33:47 EDT
Previous fix does not resolve all problems...
Following test case still fails with it:
X.java
  package p;
  public class X<T> {
	class Member {
		class Sub {}
	}
  }
Y.java
  package p;
  public class Y {
	p.X.Member.Sub s;
	p.X<Exception>.Member.Sub es = s;
  }

We need also to test whether qualified type is a parameterized type or not:
qualifiedType = (qualifiedType != null &&
		 (qualifiedType.isRawType() ||
		  qualifiedType.isParameterizedType()))
Comment 4 Frederic Fusier CLA 2004-09-27 13:13:38 EDT
Fixed.

[jdt-core-internal]
Test cases 308 and 309 added to GenericTypeTests
Comment 5 David Audel CLA 2004-11-02 11:47:19 EST
Verified for 3.1M3 with build I20041101