### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/ClassFile.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java,v retrieving revision 1.176 diff -u -r1.176 ClassFile.java --- compiler/org/eclipse/jdt/internal/compiler/ClassFile.java 7 Jul 2008 17:08:07 -0000 1.176 +++ compiler/org/eclipse/jdt/internal/compiler/ClassFile.java 8 Jul 2008 14:01:48 -0000 @@ -8348,10 +8348,17 @@ poolContents, 1, constantPoolOffsets[utf8index])); int classNameLength = className.length; - System.arraycopy(className, 0, (constantPoolName = new char[classNameLength + 3]), 2, classNameLength); - constantPoolName[0] = '['; - constantPoolName[1] = 'L'; - constantPoolName[classNameLength + 2] = ';'; + if (className[0] != '[') { + // this is a type name (class or interface). So we add appropriate '[', 'L' and ';'. + System.arraycopy(className, 0, (constantPoolName = new char[classNameLength + 3]), 2, classNameLength); + constantPoolName[0] = '['; + constantPoolName[1] = 'L'; + constantPoolName[classNameLength + 2] = ';'; + } else { + // if class name is already an array, we just need to add one dimension + System.arraycopy(className, 0, (constantPoolName = new char[classNameLength + 1]), 1, classNameLength); + constantPoolName[0] = '['; + } frame.stackItems[frame.numberOfStackItems - 1] = new VerificationTypeInfo(0, constantPoolName); pc += 3; break; #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java,v retrieving revision 1.36 diff -u -r1.36 StackMapAttributeTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java 8 Jul 2008 02:01:45 -0000 1.36 +++ src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java 8 Jul 2008 14:01:49 -0000 @@ -6096,4 +6096,25 @@ }, "SUCCESS"); } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=237931 + public void test039() { + this.runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " public String[][] foo(String s) {\n" + + " return\n" + + " new String[][] { {\" \", s != null ? s : \"\" },\n" + + " {\" \", s != null ? s : \"\" },\n" + + " {\" \", s != null ? s : \"\" },\n" + + " {\" \", s != null ? s : \"\" } };\n" + + " }\n" + + " public static void main(String[] args) {\n" + + " System.out.println(\"SUCCESS\");\n" + + " }\n" + + "}", + }, + "SUCCESS"); + } }