java.lang.VerifyError

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I tried to speed up dynamic instance creation by compiling constructor invocations with SpEL. Unfortunately I get a VerifyError when I try to evaluate the expression via {{getValue();}}. I added a test case that demonstrates the issue. The test case passes when {{SpelCompilerMode.OFF}} is used. Tested this with (java version "1.8.0_20") and compile target java6. {code:java} package test; import org.junit.Assert; import org.junit.Test; import org.springframework.expression.Expression; import org.springframework.expression.spel.SpelCompilerMode; import org.springframework.expression.spel.SpelParserConfiguration; import org.springframework.expression.spel.standard.SpelExpressionParser; /** * @author Thomas Darimont */ public class CompiledSpelBug { @Test public void compiledConstructorInvocations(){ SpelExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(SpelCompilerMode.IMMEDIATE, Thread.currentThread().getContextClassLoader())); Expression expr = parser.parseExpression("new test.CompiledSpelBug.Obj([0])"); Obj o = (Obj)expr.getValue(new Object[]{"test"}); Assert.assertEquals("test",o.param1); //the next line fails with: //java.lang.VerifyError: (class: spel/Ex2, method: getValue signature: (Ljava/lang/Object;Lorg/springframework/expression/ EvaluationContext;)Ljava/lang/Object;) Incompatible argument to function o = (Obj)expr.getValue(new Object[]{"test"}); Assert.assertEquals("test",o.param1); } public static class Obj{ private final String param1; public Obj(String param1){ this.param1 = param1; } } } {code} StackTrace with Spring Framework 4.1: {code} java.lang.VerifyError: (class: spel/Ex2, method: getValue signature: (Ljava/lang/Object;Lorg/springframework/expression/EvaluationContext;)Ljava/lang/Object;) Incompatible argument to function at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2658) at java.lang.Class.getConstructor0(Class.java:2964) at java.lang.Class.newInstance(Class.java:403) at org.springframework.expression.spel.standard.SpelCompiler.compile(SpelCompiler.java:106) at org.springframework.expression.spel.standard.SpelExpression.compileExpression(SpelExpression.java:464) at org.springframework.expression.spel.standard.SpelExpression.checkCompile(SpelExpression.java:434) at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:153) at bob.spel.CompiledSpelBug.foo(CompiledSpelBug.java:24) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.junit.runner.JUnitCore.run(JUnitCore.java:160) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) {code} StackTrace with Spring Framework 4.1.1: {code} java.lang.IllegalStateException: Failed to instantiate CompiledExpression at org.springframework.expression.spel.standard.SpelCompiler.compile(SpelCompiler.java:111) at org.springframework.expression.spel.standard.SpelExpression.compileExpression(SpelExpression.java:464) at org.springframework.expression.spel.standard.SpelExpression.checkCompile(SpelExpression.java:434) at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:153) at bob.spel.CompiledSpelBug.compiledConstructorInvocations(CompiledSpelBug.java:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.junit.runner.JUnitCore.run(JUnitCore.java:160) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) Caused by: java.lang.VerifyError: (class: spel/Ex2, method: getValue signature: (Ljava/lang/Object;Lorg/springframework/expression/EvaluationContext;)Ljava/lang/Object;) Incompatible argument to function at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2658) at java.lang.Class.getConstructor0(Class.java:2964) at java.lang.Class.newInstance(Class.java:403) at org.springframework.expression.spel.standard.SpelCompiler.compile(SpelCompiler.java:108) ... 30 more {code}
    via by Thomas Darimont,
  • I tried to speed up dynamic instance creation by compiling constructor invocations with SpEL. Unfortunately I get a VerifyError when I try to evaluate the expression via {{getValue();}}. I added a test case that demonstrates the issue. The test case passes when {{SpelCompilerMode.OFF}} is used. Tested this with (java version "1.8.0_20") and compile target java6. {code:java} package test; import org.junit.Assert; import org.junit.Test; import org.springframework.expression.Expression; import org.springframework.expression.spel.SpelCompilerMode; import org.springframework.expression.spel.SpelParserConfiguration; import org.springframework.expression.spel.standard.SpelExpressionParser; /** * @author Thomas Darimont */ public class CompiledSpelBug { @Test public void compiledConstructorInvocations(){ SpelExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(SpelCompilerMode.IMMEDIATE, Thread.currentThread().getContextClassLoader())); Expression expr = parser.parseExpression("new test.CompiledSpelBug.Obj([0])"); Obj o = (Obj)expr.getValue(new Object[]{"test"}); Assert.assertEquals("test",o.param1); //the next line fails with: //java.lang.VerifyError: (class: spel/Ex2, method: getValue signature: (Ljava/lang/Object;Lorg/springframework/expression/ EvaluationContext;)Ljava/lang/Object;) Incompatible argument to function o = (Obj)expr.getValue(new Object[]{"test"}); Assert.assertEquals("test",o.param1); } public static class Obj{ private final String param1; public Obj(String param1){ this.param1 = param1; } } } {code} StackTrace with Spring Framework 4.1: {code} java.lang.VerifyError: (class: spel/Ex2, method: getValue signature: (Ljava/lang/Object;Lorg/springframework/expression/EvaluationContext;)Ljava/lang/Object;) Incompatible argument to function at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2658) at java.lang.Class.getConstructor0(Class.java:2964) at java.lang.Class.newInstance(Class.java:403) at org.springframework.expression.spel.standard.SpelCompiler.compile(SpelCompiler.java:106) at org.springframework.expression.spel.standard.SpelExpression.compileExpression(SpelExpression.java:464) at org.springframework.expression.spel.standard.SpelExpression.checkCompile(SpelExpression.java:434) at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:153) at bob.spel.CompiledSpelBug.foo(CompiledSpelBug.java:24) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.junit.runner.JUnitCore.run(JUnitCore.java:160) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) {code} StackTrace with Spring Framework 4.1.1: {code} java.lang.IllegalStateException: Failed to instantiate CompiledExpression at org.springframework.expression.spel.standard.SpelCompiler.compile(SpelCompiler.java:111) at org.springframework.expression.spel.standard.SpelExpression.compileExpression(SpelExpression.java:464) at org.springframework.expression.spel.standard.SpelExpression.checkCompile(SpelExpression.java:434) at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:153) at bob.spel.CompiledSpelBug.compiledConstructorInvocations(CompiledSpelBug.java:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.junit.runner.JUnitCore.run(JUnitCore.java:160) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) Caused by: java.lang.VerifyError: (class: spel/Ex2, method: getValue signature: (Ljava/lang/Object;Lorg/springframework/expression/EvaluationContext;)Ljava/lang/Object;) Incompatible argument to function at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2658) at java.lang.Class.getConstructor0(Class.java:2964) at java.lang.Class.newInstance(Class.java:403) at org.springframework.expression.spel.standard.SpelCompiler.compile(SpelCompiler.java:108) ... 30 more {code}
    via by Thomas Darimont,
  • GitHub comment 75#55487477
    via GitHub by kindlychung
    ,
  • Tests fail in JDK8
    via GitHub by ALRubinger
    ,
  • maximum size of String Array in Java
    via Stack Overflow by nerd
    ,
    • java.lang.VerifyError: (class: spel/Ex2, method: getValue signature: (Ljava/lang/Object;Lorg/springframework/expression/EvaluationContext;)Ljava/lang/Object;) Incompatible argument to function at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2658) at java.lang.Class.getConstructor0(Class.java:2964) at java.lang.Class.newInstance(Class.java:403) at org.springframework.expression.spel.standard.SpelCompiler.compile(SpelCompiler.java:106) at org.springframework.expression.spel.standard.SpelExpression.compileExpression(SpelExpression.java:464) at org.springframework.expression.spel.standard.SpelExpression.checkCompile(SpelExpression.java:434) at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:153) at bob.spel.CompiledSpelBug.foo(CompiledSpelBug.java:24) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.junit.runner.JUnitCore.run(JUnitCore.java:160) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

    Users with the same issue

    esaaresaar
    1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    asvidasvid
    10 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    AkshayAkshay
    2 times, last one,
    25 more bugmates