mvel / mvel

MVEL (MVFLEX Expression Language)
http://mvel.documentnode.com/
Apache License 2.0
1.08k stars 307 forks source link

Mvel not working with Java 10 (11) #159

Open rady66 opened 6 years ago

rady66 commented 6 years ago

Mvel is throwing exceptions with Java 10

java.lang.VerifyError: (class: ASMAccessorImpl_12980986021528934154020, method: setValue signature: (Ljava/lang/Object;Ljava/lang/Object;Lorg/mvel2/integration/VariableResolverFactory;Ljava/lang/Object;)Ljava/lang/Object;) Illegal type in constant pool
    at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3090)
    at java.base/java.lang.Class.getConstructor0(Class.java:3295)
    at java.base/java.lang.Class.newInstance(Class.java:532)
    at org.mvel//org.mvel2.optimizers.impl.asm.ASMAccessorOptimizer._initializeAccessor(ASMAccessorOptimizer.java:757)
    at org.mvel//org.mvel2.optimizers.impl.asm.ASMAccessorOptimizer.optimizeSetAccessor(ASMAccessorOptimizer.java:663)
    at org.mvel//org.mvel2.optimizers.dynamic.DynamicSetAccessor.optimize(DynamicSetAccessor.java:83)
    at org.mvel//org.mvel2.optimizers.dynamic.DynamicSetAccessor.setValue(DynamicSetAccessor.java:60)
    at org.mvel//org.mvel2.compiler.CompiledAccExpression.setValue(CompiledAccExpression.java:59)
    at org.mvel//org.mvel2.ast.DeepAssignmentNode.getReducedValueAccelerated(DeepAssignmentNode.java:90)
    at org.mvel//org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:42)
    at org.mvel//org.mvel2.MVEL.executeExpression(MVEL.java:968)
lichtin commented 6 years ago

Does perhaps this code section need an update for Java 10/11?

    final String javaVersion = PropertyTools.getJavaVersion();
    if (javaVersion.startsWith("1.4")) {
      OPCODES_VERSION = Opcodes.V1_4;
    } else if (javaVersion.startsWith("1.5")) {
      OPCODES_VERSION = Opcodes.V1_5;
    } else if (javaVersion.startsWith("1.6")
            || javaVersion.startsWith("1.7")
            || javaVersion.startsWith("1.8")
            || javaVersion.startsWith("9")) {
      OPCODES_VERSION = Opcodes.V1_6;
    } else {
      OPCODES_VERSION = Opcodes.V1_2;
    }
rady66 commented 6 years ago

yes, exactly. I tested a similar to that change and it works fine on Java 10 (except for a few unit test failing during the build): https://github.com/mvel/mvel/commit/2134f0cb3c8f9c23d5b2f1ade2b4c7975f318013#diff-13015e8c0d4e0fe95f6368f7618c1a58

horacimacias commented 6 years ago

can you please provide some input on how to try the patched build? I believe I'm facing the same issue

zregvart commented 6 years ago

I've managed to get MVEL working on Java 10 by using a dependency from jitpack.io.

This is what needs to be added to your Maven POM.

I would appreciate an official release published to Maven Central.

Maia-Everett commented 4 years ago

Is this fixed in 2.4.8? Using the jitpack snapshot for now but looking for the possibility of upgrading.