Bug 76313 - [1.5] Error while using parametrized static factory
Summary: [1.5] Error while using parametrized static factory
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 M3   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 77142 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-10-14 16:54 EDT by Karsten Becker CLA
Modified: 2004-11-04 10:00 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 Karsten Becker CLA 2004-10-14 16:54:19 EDT
Hi,
This code works fine for javac:
public class Test<T> {
	private T data;
	private Test(T data){ this.data=data; }
	public static <S> Test<S> createObject(S data){
		return new Test<S>(data);
	}
	public static void main(String[] args) {
		Test<String> res=Test.createObject("Hallo");
	}
}
Comment 1 Karsten Becker CLA 2004-10-14 17:02:53 EDT
I also would expect the following to work:
Test<String> res=Test.<String>createObject("Hallo");
Comment 2 Philipe Mulet CLA 2004-10-27 08:10:53 EDT
Resolved along with fix for bug 77052.
Added regression test: GenericTypeTest#test340.

*** This bug has been marked as a duplicate of 77052 ***
Comment 3 Philipe Mulet CLA 2004-10-27 18:43:54 EDT
Actually, this wasn't a dup.
Comment 4 Philipe Mulet CLA 2004-10-27 18:48:28 EDT
Fixed (generic static method of raw type remains generic)
Comment 5 Philipe Mulet CLA 2004-10-27 18:51:56 EDT
*** Bug 77142 has been marked as a duplicate of this bug. ***
Comment 6 Dave Latham CLA 2004-10-28 14:34:25 EDT
I tried this out in N20041028, and the compiler no longer gives an error, but it
still gives a warning, which javac doesn't:

Type safety: The method createObject(String) belongs to the raw type Test.
References to generic type Test<T> should be parameterized
Comment 7 Philipe Mulet CLA 2004-10-28 15:58:56 EDT
The warning disappeared today with my latest changes. 
Comment 8 David Audel CLA 2004-11-04 10:00:59 EST
Verified for 3.1M3 with build I200411040100