Bug 74761 - [1.5] Invalid compiler binding for qualified raw type reference
Summary: [1.5] Invalid compiler binding for qualified raw type reference
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M3   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-23 07:50 EDT by Frederic Fusier CLA
Modified: 2004-11-02 11:47 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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