Community
Participate
Working Groups
3.2RC3 I recently observed that our regression tests were not performing in 1.6 mode (they reverted to 1.5 compliance). When fixing this, AutoboxingTest#test109 failed. junit.framework.AssertionFailedError: Unexpected target error running resulting class file for X.java: java.lang.ClassFormatError: Illegal class name "" in class file X at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.lang.ClassLoader.defineClass(ClassLoader.java:465) at at junit.framework.Assert.fail(Assert.java:47) at junit.framework.Assert.assertTrue(Assert.java:20) at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runConformTest(AbstractRegressionTest.java:445) at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runConformTest(AbstractRegressionTest.java:317) at org.eclipse.jdt.core.tests.compiler.regression.AutoBoxingTest.test109(AutoBoxingTest.java:3261) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:589) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22) at junit.extensions.TestDecorator.run(TestDecorator.java:28) at org.eclipse.jdt.core.tests.util.CompilerTestSetup.run(CompilerTestSetup.java:48) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:457) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:670) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:58) at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:24) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:589) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336) at org.eclipse.core.launcher.Main.basicRun(Main.java:280) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952)
Testcase: public class X { public static void main(String[] args) { int foo = 0; String bar = "zero"; System.out.println((foo != 0) ? foo : bar); } }
GenericTypeTest#test0894,0896 and 0897 exhibit the same issue.
Problem is located in StackMapTable attribute: We produce: Stack map table: number of frames 2 [pc: 19, full, stack: {PrintStream}, locals: {String[], int, String}] [pc: 20, full, stack: {PrintStream, }, locals: {String[], int, }] Instead of: Stack map table: number of frames 2 [pc: 19, full, stack: {PrintStream}, locals: {String[], int, String}] [pc: 20, full, stack: {PrintStream, Serializable}, locals: {String[], int, String}] Note that I had to change the disassembler to be resilient to empty names.
Created attachment 41095 [details] Patch for disassembler (to make it more resilient) This isn't the fix to the problem, but a way for the disassembler tool to avoid crashing when such badness occurs.
I suspect some mishandling of intersection types.
Created attachment 41100 [details] Proposed patch Allows computing a constant pool from a wildcard & intersection type (by inferring it from its erasure). This makes the scenario work, and is consistent with other definitions of constantPoolName, now in the past it was assumed that no wildcard/intersection type would ever need to be computed a constantpool name, which is false due to StackMapTable attribute requiring these. So this is a safe fix.
Created attachment 41102 [details] Regression test Ensure we have a test showing the included constant pool name for an intersection type (other tests are not disassembling)
Created attachment 41118 [details] Better patch This version of the patch is also improving the erasure for the intersection type from Object to Comparable (more precise type).
Added StackMapAttributeTest#_test008 Will queue the fix for 3.2.1, as there are more issues to address with intersection types, and we should address them all at once. (i.e. erasure change is exposing bug 141330)
Released for 3.2.1 integration.
Released for 3.3 M1 while merging TARGET_321 in HEAD
Verified for 3.3 M1 using build I20060807-2000.
Verified for 3.2.1 using build M20060908-1655