| Summary: | [1.7][compiler] Missing unchecked warning at varargs method/ctor declaration site | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Srikanth Sankaran <srikanth_sankaran> | ||||
| Component: | Core | Assignee: | Srikanth Sankaran <srikanth_sankaran> | ||||
| Status: | VERIFIED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | Olivier_Thomann, satyam.kandula, stephan.herrmann | ||||
| Version: | 3.7 | ||||||
| Target Milestone: | 3.7.1 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
I'll follow up on this. Created attachment 189584 [details]
Patch under test
Fix released in BETA_JAVA7 branch only. Verified using patch feature 1.0.0-20110623-0900 |
import java.util.List; public class X { public static void main( String[] args ) { String arg = "SUCCESS"; List<String> ls = Y.asList(arg, arg); System.out.println (ls); } } class Y { public static <T> List<T> asList(T ... a) { return null; } } The program above does not elicit any warnings when compiled with 1.5 and 1.6 javac. 1.7 compiler produces the newly mandated warning as shown below. C:\jtests>C:\jdk-7-ea-bin-b127-windows-i586-27_jan_2011\jdk7\jdk1.7.0\bin\javac -Xlint:unchecked -Xlint:rawtypes -Xlint:deprecation -sourcepath c:\jtests X.java X.java:11: warning: [unchecked] Possible heap pollution from parameterized varar g type T public static <T> List<T> asList(T ... a) { ^ where T is a type-variable: T extends Object declared in method <T>asList(T...) 1 warning This warning is missing from eclipse on the same code compiled with 1.7 mode.