Community
Participate
Working Groups
The class listed below compiles fine with javac but gives an error in the workspace and with ecj. The error is "Cannot create a generic array of Inner" As far as I can tell, there are no compiler settings that would affect this case. Also included below are the decompiled versions of the .class files created using javac. package test; public class Outer<C extends Object> { void foo() { class Inner { public int a; public int b; } Inner[] value = new Inner[3]; } } // Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov Date: 1/26/2011 11:21:22 AM // Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: Outer.java package test; public class Outer { public Outer() { } void foo() { /* block-local class not found */ class _cls1Inner {} _cls1Inner value[] = new _cls1Inner[3]; } } // Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov Date: 1/26/2011 11:22:27 AM // Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: Outer.java package test; // Referenced classes of package com.lgc.color: // Outer class Outer$1Inner { public int a; public int b; final Outer this$0; Outer$1Inner() { this$0 = Outer.this; super(); } }
Reproduced. Looks like a bug when we check the type of the array type. Investigating.
It would work for a static method. It looks like the enclosing type has to be reifiable and this is not the case here. This was changed to fix bug 130543. javac 1.6 (1.6_24) compile that code fine. javac 1.7 (b126) reports an error and javac 1.5 (1.5_22) reports an error. In this case the enclosing type is not reifiable, so it would make sense to report an error. Looking at http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6318240, it seems that this would be a bug in javac 1.6. Srikanth, I let you take a look at this and decide if this needs any action.
(In reply to comment #2) > It would work for a static method. It looks like the enclosing type has to be > reifiable and this is not the case here. This was changed to fix bug 130543. > > javac 1.6 (1.6_24) compile that code fine. javac 1.7 (b126) reports an error > and javac 1.5 (1.5_22) reports an error. > > In this case the enclosing type is not reifiable, so it would make sense to > report an error. > Looking at http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6318240, it seems > that this would be a bug in javac 1.6. > > Srikanth, I let you take a look at this and decide if this needs any action. Agree with the assessment. No action is called for. Resolving as INVALID.
Verified for 3.7M6.