Bug 111689 - [1.5] [compiler] Compiler gets confused on class SomeClass<T extends OtherClass<T,T>>
Summary: [1.5] [compiler] Compiler gets confused on class SomeClass<T extends OtherCla...
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.2 M3   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-05 16:24 EDT by marc downie CLA
Modified: 2005-10-06 04:55 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description marc downie CLA 2005-10-05 16:24:53 EDT
The following code compiles just fine in javac and eclipse:

---Bug.java

public class Bug {
	
	public interface AClass<X extends AClass, Y extends AClass>
	{

		public interface BClass<T extends BClass, U extends BClass> extends AClass<T, U>
		{
		}
	}

	
	public class CClass<T extends AClass.BClass<T,T>> 
	{
		
	}

}

however, separating out the AClass into a separate file:

---AClass.java
public interface AClass<X extends AClass>
{
	public interface BClass<T extends BClass> extends AClass<T>
	{
	}
}

---Bug.java
public class Bug
{
	public class CClass<T extends AClass.BClass<T>>
	{
		
	}
}

gives an error in Bug.java (a red underline on the 'T') saying: "Bound mismatch: The type T is not a valid 
substitute for the bounded parameter <T extends AClass.BClass> of the type AClass<X>.BClass<T>". 
The "<X>" in "AClass<X>.BClass<T>" here looks a little suspect.

"public class CClass<T extends AClass<T>>" works in both eclipse and javac as you'd expect, as does 
"public class CClass<T extends BClass<T>>" if BClass is moved to a new file. Static importing BClass 
out of an AClass, however, doesn't change eclipse's failure. 

Javac compiles all cases without comment.
Comment 1 Philipe Mulet CLA 2005-10-06 04:55:18 EDT
Cannot reproduce in 3.1.1 nor 3.2m2.
Added GenericTypeTest#test838