diff options
author | Markus Keller | 2012-10-09 13:40:11 +0000 |
---|---|---|
committer | Markus Keller | 2012-10-09 13:40:11 +0000 |
commit | 3216ec68094152185ac91bd3b6f494c168875f01 (patch) | |
tree | f66e3b32525f310759bd9edacee279ed070294ac /org.eclipse.ui.workbench.texteditor.tests | |
parent | 557ba618fc1d1f0161c453067e6b17fd848148b9 (diff) | |
download | eclipse.platform.text-3216ec68094152185ac91bd3b6f494c168875f01.tar.gz eclipse.platform.text-3216ec68094152185ac91bd3b6f494c168875f01.tar.xz eclipse.platform.text-3216ec68094152185ac91bd3b6f494c168875f01.zip |
don't fail just because the class file version is unknownv20121009-134011I20121016-2240I20121016-0800
Diffstat (limited to 'org.eclipse.ui.workbench.texteditor.tests')
-rw-r--r-- | org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/BytecodeOrderedTestSuite.java | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/BytecodeOrderedTestSuite.java b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/BytecodeOrderedTestSuite.java index 42d61fdec6d..028db98b731 100644 --- a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/BytecodeOrderedTestSuite.java +++ b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/BytecodeOrderedTestSuite.java @@ -96,19 +96,20 @@ public class BytecodeOrderedTestSuite extends TestSuite { } } - private static Test error(Class testClass, String testMethod, Exception exception) { - final Throwable e2= exception.fillInStackTrace(); + private static Test error(Class testClass, String testMethod, final Exception exception) { return new TestCase(testMethod + "(" + testClass.getName() + ")") { //$NON-NLS-1$ //$NON-NLS-2$ protected void runTest() throws Throwable { - throw e2; + throw exception; } }; } private void addDeclaredTestMethodNames(Class c, ArrayList methodNames) throws IOException { /* - * XXX: This method needs to be updated if a new major class file version - * or new constant pool tags are specified. + * XXX: This method needs to be updated if new constant pool tags are specified. + * Current supported major class file version: 51 (Java 1.7). + * + * See JVMS 7, 4.4 The Constant Pool. */ String className= c.getName(); int lastDot= className.lastIndexOf("."); @@ -118,11 +119,8 @@ public class BytecodeOrderedTestSuite extends TestSuite { int magic= is.readInt(); if (magic != 0xcafebabe) throw new IOException("bad magic bytes: 0x" + Integer.toHexString(magic)); - skip(is, 2); // minor_version + int minor= is.readUnsignedShort(); int major= is.readUnsignedShort(); - if (major > 51) { // major > Java 7 - addTest(error(c, "suite can't handle class file version", new RuntimeException(c.getName() + " (major = " + major + ")"))); - } int cpCount= is.readUnsignedShort(); String[] constantPoolStrings= new String[cpCount]; for (int i= 1; i < cpCount; i++) { @@ -165,7 +163,8 @@ public class BytecodeOrderedTestSuite extends TestSuite { skip(is, 4); break; default: - throw new IOException("unknown constant pool tag (" + i + "): " + tag); + throw new IOException("unknown constant pool tag " + tag + " at index " + i + + ". Class file version: " + major + "." + minor); } } skip(is, 2 * 3); // access_flags, this_class, super_class |