FULL PRODUCT VERSION : java version "1.5.0" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64) Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing) ADDITIONAL OS VERSION INFORMATION : Microsoft Windows XP [Version 5.1.2600] A DESCRIPTION OF THE PROBLEM : javac report unchecked array creation for varargs parameters on code that is parameterized correctly STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : enable -Xlint:unchecked for javac and try to compile the code provided EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - compilation result should be fine ACTUAL - compilation warnings ERROR MESSAGES/STACK TRACES THAT OCCUR : nformation: Compilation completed successfully with 1 warnings Information: 0 errors Information: 1 warning C:\test\GenericVarArgsTest.java Warning: Warning: line (21)[unchecked] unchecked generic array creation of type Queue<SessionImpl>[] for varargs parameter REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- public class GenericVarArgsTest { public static void main( String[] args ) { Controller<SessionImpl> controller = new ControllerImpl<SessionImpl>( new QueueImpl(), new QueueImpl() ); } } interface Session { } class SessionImpl implements Session { } interface Queue <S extends Session> { } class QueueImpl implements Queue<SessionImpl> { } interface Controller <S extends Session> { } class ControllerImpl <S extends Session> implements Controller<S> { private Queue<S>[] queues; public ControllerImpl( Queue<S>... queues ) { this.queues = queues; } } ---------- END SOURCE ---------- ###@###.### 2005-2-10 22:48:58 GMT
|