Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 337795 - [1.7][compiler] Missing unchecked warning at varargs method/ctor declaration site
Summary: [1.7][compiler] Missing unchecked warning at varargs method/ctor declaration ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7.1   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-22 03:26 EST by Srikanth Sankaran CLA
Modified: 2011-08-05 02:54 EDT (History)
3 users (show)

See Also:


Attachments
Patch under test (52.90 KB, patch)
2011-02-23 05:57 EST, Srikanth Sankaran CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Srikanth Sankaran CLA 2011-02-22 03:26:32 EST
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.
Comment 1 Srikanth Sankaran CLA 2011-02-22 03:30:56 EST
I'll follow up on this.
Comment 2 Srikanth Sankaran CLA 2011-02-23 05:57:34 EST
Created attachment 189584 [details]
Patch under test
Comment 3 Srikanth Sankaran CLA 2011-02-23 07:46:48 EST
Fix released in BETA_JAVA7 branch only.
Comment 4 Stephan Herrmann CLA 2011-06-30 09:08:47 EDT
Verified using patch feature 1.0.0-20110623-0900