### Eclipse Workspace Patch 1.0 #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.38 diff -u -r1.38 StackMapAttributeTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java 19 Mar 2009 23:20:10 -0000 1.38 +++ src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java 27 Apr 2009 14:51:34 -0000 @@ -31,7 +31,7 @@ static { // TESTS_PREFIX = "testBug95521"; // TESTS_NAMES = new String[] { "testBug83127a" }; -// TESTS_NUMBERS = new int[] { 40, 41 }; +// TESTS_NUMBERS = new int[] { 42 }; // TESTS_RANGE = new int[] { 23 -1,}; } public static Test suite() { @@ -6235,4 +6235,39 @@ " [pc: 11, append: {java.lang.Object}]\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput); } + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=260031 + public void test042() throws Exception { + this.runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " private static void foo(Class c, int n) { }\n" + + " public static void main(String... args) {\n" + + " foo(Integer.class, (args == null ? -1 : 1));\n" + + " }\n" + + "}", + }, + ""); + + String expectedOutput = + " // Stack: 2, Locals: 1\n" + + " public static void main(java.lang.String... args);\n" + + " 0 ldc [26]\n" + + " 2 aload_0 [args]\n" + + " 3 ifnonnull 10\n" + + " 6 iconst_m1\n" + + " 7 goto 11\n" + + " 10 iconst_1\n" + + " 11 invokestatic X.foo(java.lang.Class, int) : void [28]\n" + + " 14 return\n" + + " Line numbers:\n" + + " [pc: 0, line: 4]\n" + + " [pc: 14, line: 5]\n" + + " Local variable table:\n" + + " [pc: 0, pc: 15] local: args index: 0 type: java.lang.String[]\n" + + " Stack map table: number of frames 2\n" + + " [pc: 10, same_locals_1_stack_item, stack: {java.lang.Class}]\n" + + " [pc: 11, full, stack: {java.lang.Class, int}, locals: {java.lang.String[]}]\n"; + checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput); + } } #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.186 diff -u -r1.186 ClassFile.java --- compiler/org/eclipse/jdt/internal/compiler/ClassFile.java 19 Mar 2009 23:20:17 -0000 1.186 +++ compiler/org/eclipse/jdt/internal/compiler/ClassFile.java 27 Apr 2009 14:51:36 -0000 @@ -7427,13 +7427,9 @@ frame.addStackItem(TypeBinding.FLOAT); break; case ClassFileConstants.ClassTag: - int utf8index = u2At(poolContents, 1, - constantPoolOffsets[index]); - char[] classSignature = utf8At(poolContents, - constantPoolOffsets[utf8index] + 3, u2At( - poolContents, 1, - constantPoolOffsets[utf8index])); - frame.addStackItem(new VerificationTypeInfo(0, classSignature)); + frame.addStackItem(new VerificationTypeInfo( + TypeIds.T_JavaLangClass, + ConstantPool.JavaLangClassConstantPoolName)); } pc += 2; break; @@ -7453,14 +7449,9 @@ frame.addStackItem(TypeBinding.FLOAT); break; case ClassFileConstants.ClassTag: - int utf8index = u2At(poolContents, 1, - constantPoolOffsets[index]); - char[] classSignature = utf8At(poolContents, - constantPoolOffsets[utf8index] + 3, u2At( - poolContents, 1, - constantPoolOffsets[utf8index])); - frame.addStackItem(new VerificationTypeInfo(0, - classSignature)); + frame.addStackItem(new VerificationTypeInfo( + TypeIds.T_JavaLangClass, + ConstantPool.JavaLangClassConstantPoolName)); } pc += 3; break;