Bug 93204 - [1.5][compiler] EnumSet.of within generic class
Summary: [1.5][compiler] EnumSet.of within generic class
Status: VERIFIED FIXED
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.1 M7   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-28 20:03 EDT by Michael Forster CLA
Modified: 2005-05-11 13:32 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Forster CLA 2005-04-28 20:03:40 EDT
The following code does not compile with the Eclipse Compiler (3.1M6 and
I20050426-1700), but it does with the Sun JDK Compiler (1.5.0_02).

----------------------------------------------------------------------

package bugreport;

import java.util.EnumSet;
import java.util.Set;

public class Bug<T>
{
    enum E { A, B }

    Set<E> set = EnumSet.of(E.A);
}

----------------------------------------------------------------------

The error message is:

    Type mismatch: cannot convert from EnumSet<Bug<T>.E> to Set<Bug.E>
Comment 1 Philipe Mulet CLA 2005-04-29 09:56:03 EDT
Interestingly, removing the <T> parameter from type Bug makes the problem go away.
Comment 2 Philipe Mulet CLA 2005-04-29 11:53:19 EDT
Added EnumTest#test102.

Several issues got surfaced. Lack of conversion to raw type for implict enum
references (through type of enum constant, or argument in supertype Enum<E>).
Also the qualified name E.A needed some intermediate raw conversion.

Fixed
Comment 3 Olivier Thomann CLA 2005-05-11 13:32:09 EDT
Verified in I20050510-0010