Bug 81017 - [generics]Type erasure not performed for classes implementing generic interfaces
Summary: [generics]Type erasure not performed for classes implementing generic interfaces
Status: RESOLVED DUPLICATE of bug 79687
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 blocker (vote)
Target Milestone: 3.1 M5   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-14 17:42 EST by Christophe Avare CLA
Modified: 2005-01-11 11:04 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 Christophe Avare CLA 2004-12-14 17:42:52 EST
Generic support is going better every day!
But the following case appears to be legal but is rejected:

Some interfaces:

interface IKey {
  String getKey();
}

interface IFactory<T extends IKey> {
  T create();
}

Based on a default (abstract) implementation of IFactory:

abstract class DefaultFactory<T extends IKey> implements IFactory<T> {
}

and a concrete implementation of IKey:
class Key implements IKey { ... }

I want to make a specialized factory for Key:

class KeyFactory extends DefaultFactory<Key> {
...
  public Key create() {...}
}

The create() method raises the compile error:

Type safety: The return type Key of the method create() of type KeyFactory needs
unchecked conversion to conform to the return type T of inherited method

This set of classes compiles and works as expected under the Sun javac.
Eclipse JDT behaves like if the method signature is not resolved through the
hierarchy of classes that implements generic interfaces.
Comment 1 Jerome Lanneluc CLA 2004-12-15 04:38:01 EST

*** This bug has been marked as a duplicate of 79687 ***