Bug 109249 - [1.5][compiler] Interfaces and generics
Summary: [1.5][compiler] Interfaces and generics
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M3   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-11 09:41 EDT by Sven Köhler CLA
Modified: 2005-10-18 06:36 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 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.