Bug 76313

Summary: [1.5] Error while using parametrized static factory
Product: [Eclipse Project] JDT Reporter: Karsten Becker <java>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.org
Version: 3.1   
Target Milestone: 3.1 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard:

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