JDK-6526448 : Unecessary checkcast generated
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2007-02-19
  • Updated: 2010-04-04
  • Resolved: 2007-03-26
Related Reports
Duplicate :  
Description
JDK1.6 (final) compiles:

  Serializable zz = null;
  String[] ss = (String[])zz;

to:

201: aconst_null
202: astore  16
204: aload   16
206: checkcast       #54; //class "[Ljava/lang/String;"
209: checkcast       #54; //class "[Ljava/lang/String;"
212: astore  17

Why the double checkcast?