Bug 93044 - [1.5][compiler] Eclipse compiler & javac disprepency?
Summary: [1.5][compiler] Eclipse compiler & javac disprepency?
Status: RESOLVED WORKSFORME
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: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-27 19:35 EDT by Mark Hobson CLA
Modified: 2005-04-28 04:26 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 Mark Hobson CLA 2005-04-27 19:35:21 EDT
The following code compiles and runs under eclipse-3.1M6, but fails under javac:

import java.lang.annotation.RetentionPolicy;
 
public class Test
{
	public static void main(String[] args)
	{
		Class<? extends Enum<?>> c = RetentionPolicy.class;
		System.out.println(Enum.valueOf(c, "CLASS"));
	}
}

Javac reports the following error:

Test.java:8: <T>valueOf(java.lang.Class<T>,java.lang.String) in java.lang.Enum
cannot be applied to (java.lang.Class<capture of ? extends
java.lang.Enum<?>>,java.lang.String)
                System.out.println(Enum.valueOf(c, "CLASS"));
                                       ^
1 error

Eclipse should produce an error (see
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6209030).
Comment 1 Philipe Mulet CLA 2005-04-28 03:58:17 EDT
Added GenericTypeTest#test631.

This got addressed along with changes near capture conversion since M6.
Comment 2 Philipe Mulet CLA 2005-04-28 04:05:00 EDT
fyi, we now produce the error:

Bound mismatch: The generic method valueOf(Class<T>, String) of type Enum<E> is
not applicable for the arguments (Class<capture-of ? extends Enum<?>>, String)
since the type capture-of ? extends Enum<?> is not a valid substitute for the
bounded parameter <T extends Enum<T>>
Comment 3 Mark Hobson CLA 2005-04-28 04:26:09 EDT
Great, thanks for the info.