[jboss-jira] [JBoss JIRA] (JASSIST-241) VerifyError: Expecting a stackmap frame - Switch case statement Java 7
Patson Luk (JIRA)
issues at jboss.org
Tue Jan 13 15:38:49 EST 2015
Patson Luk created JASSIST-241:
----------------------------------
Summary: VerifyError: Expecting a stackmap frame - Switch case statement Java 7
Key: JASSIST-241
URL: https://issues.jboss.org/browse/JASSIST-241
Project: Javassist
Issue Type: Feature Request
Affects Versions: 3.19.0-GA
Environment: jdk7
Reporter: Patson Luk
Assignee: Shigeru Chiba
This could be a duplicate of issue 215 and 205.
Tested it on the master (3.19.0-GA) with java 7. Running the below class
{code}
import java.util.Random;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtMethod;
public class TestDriver {
public static void main(String[] args) throws Exception {
ClassPool pool = ClassPool.getDefault();
CtClass cc = pool.get("TestClass");
CtMethod testMethod = cc.getMethod("test", "(Ljava/lang/Object;)V");
testMethod.insertAfter("System.out.println(\"inserted!\");");
cc.toClass();
//invoke it
TestClass.test(new Object());
}
}
class TestClass {
public static void test(Object o) {
//part 1
if (o == null) {
return;
}
//part 2
int oper = new Random().nextInt();
switch (oper) {
case 1:
break;
}
}
}
{code}
Triggers error message as below:
{quote}
Exception in thread "main" java.lang.VerifyError: Expecting a stackmap frame at branch target 9 in method TestClass.test(Ljava/lang/Object;)V at offset 1
at TestDriver.main(TestDriver.java:19)
{quote}
*Please take note that:*
# This is observed on Java 7. When the same code is run on Java 6, it is fine
# Both the "part 1" - return statement (commented in the code above) and "part 2" - switch/case statement have to be there to trigger the error. If either of those are commented out, then the code runs fine
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)
More information about the jboss-jira
mailing list