Bug 208873 - [compiler][1.5] compiler differences to javac
Summary: [compiler][1.5] compiler differences to javac
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M4   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-06 06:45 EST by Yves Harms CLA
Modified: 2007-12-11 11:51 EST (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 Yves Harms CLA 2007-11-06 06:45:46 EST
Build ID: I20070625-1500

Steps To Reproduce:
Build ID: I20070625-1500

Steps To Reproduce:
The class below compiles with eclipse but not with javac.
jdk1.5.0_13, WINXP, Eclipse 3.2.0

public class Test {
	
	public interface Loader{ 
	
		public <T extends Integer, K extends String> T load(final K key);
	
	}
	
	Loader loader;
	
	/**
	 * Gets a single data set. Tries to find it in the cache first.
	 * 
	 * @param <K>
	 * @param <T>
	 * @param key
	 * @return
	 * @throws ComoException
	 */
	public <K extends String, T extends Integer> T get(final K key) 
	{
		T data = this.loader.load(key);
		return null;
	}

More information:


More information:
Comment 1 Yves Harms CLA 2007-11-06 06:52:20 EST
correction: I'm working with Eclipse 3.3.0 (not 3.2.0)
Comment 2 Frederic Fusier CLA 2007-11-06 07:10:59 EST
Also reproduced with 3.4M3.

The javac output is:
java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b01)
Java HotSpot(TM) Client VM (build 1.5.0_13-b01, mixed mode)
Test.java:22: type parameters of <T>T cannot be determined; no unique maximal instance exists for type variable T with upper bounds T,java.lang.Integer
                T data = this.loader.load(key);
                                         ^
1 error
Comment 3 Maxime Daniel CLA 2007-11-07 03:35:29 EST
javac 1.6.0_03 complains as well, javac 7 does not.
Comment 4 Philipe Mulet CLA 2007-11-08 04:35:16 EST
This feels like a bug in javac, which would have been corrected in more recent versions.
The assignment to a type variable (T) seems to cause javac some grief when inferring from expected type (JLS 15.12.2.8).
Comment 5 Philipe Mulet CLA 2007-11-08 04:46:23 EST
I believe the known javac bug is http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5042462

Closing as invalid. We are already doing the right thing.
Added GenericTypeTest#test1212
Comment 6 Maxime Daniel CLA 2007-11-21 02:35:10 EST
Tests are in GenericTypeTest#1214 and 1215 indeed.
Comment 7 Kent Johnson CLA 2007-12-11 11:51:32 EST
Verified for 3.4M4 using build I20071210-1800.