Bug 109249

Summary: [1.5][compiler] Interfaces and generics
Product: [Eclipse Project] JDT Reporter: Sven Köhler <sven.koehler>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.2 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Sven Köhler CLA 2005-09-11 09:41:36 EDT
Hi,

assume these two interfaces:

public interface Transformable<T extends Transformable>
{
	public T transform();
}
public interface Volume<V extends Volume> extends Transformable<V>
{
//	public V transform();
}


Note that the line "public V transform();" is only a comment.
The interface Volume inherits the method transform from Transformable<V> - so
transform() should return something that extends Volume since V is known to
extend Vector.

Instead the code:
		Volume v1 = null;
		Volume v2 = v1.transform();
does not compile. v1.transform() returns Transformable instead of Volume.
I know that the code
		Volume<Volume> v1 = null;
		Volume v2 = v1.transform();
compiles fine, but if you comment out the "public V transform();", you will see
that the first code-example compiles clean again.

I think that this is a bug in both compilers: javac and JDT. The "public V
transform()" should be generated automatically if this is the only possibility
for generating proper byte-code.

Currently JDT confirms to the behaviour of javac.
Comment 1 Philipe Mulet CLA 2005-09-27 07:00:49 EDT
This is the essence of raw types and erasure mechanism. What specific portion of
the JLS 3rd edition do you think our compiler contradict ? If this is a language
semantic debate, then this is the wrong location for complaining; since the spec
is not owned by Eclipse.

Can you please clarify?
Comment 2 Philipe Mulet CLA 2005-10-18 06:36:22 EDT
Closing as invalid. Added GenericTypeTest#test828.