yurloc / iypt-planner

Helps organizers of IYPT tournament schedule juries
4 stars 0 forks source link

MVEL compiler bug on Windows with Java 8 #36

Open yurloc opened 9 years ago

yurloc commented 9 years ago

System configuration: Windows 8, 64bit, 8GB RAM, Java version 8u45.

Console output:

00:39:55.590 [Thread-38] INFO  o.d.p.c.l.DefaultLocalSearchSolverPhase - Phase localSearch ended: step total (12), time spend (1610), best score (-1hard/-3634soft).
00:39:55.590 [Thread-38] INFO  o.d.p.core.solver.DefaultSolver - Solving ended:time spend (1610), best score (-1hard/-3634soft), average calculate count per second (1705).
00:39:59.755 [Thread-39] INFO  o.d.p.core.solver.DefaultSolver - Solving started: time spend (10), score (null), new best score (null), random seed (not fixed).
00:40:01.809 [Thread-39] INFO  o.d.p.c.c.g.DefaultGreedyFitSolverPhase - Phase constructionHeuristic ended: step total (270), time spend (2064), best score (-2hard/-4377soft).
00:40:03.772 [AWT-EventQueue-0] INFO  o.d.p.c.s.BasicPlumbingTermination - Terminating solver early.
00:40:03.798 [Thread-39] INFO  o.d.p.c.l.DefaultLocalSearchSolverPhase - Phase localSearch ended: step total (22), time spend (4053), best score (-1hard/-3456soft).
00:40:03.798 [Thread-39] INFO  o.d.p.core.solver.DefaultSolver - Solving ended:time spend (4053), best score (-1hard/-3456soft), average calculate count per second (5850).
**** COMPILER BUG! REPORT THIS IMMEDIATELY AT http://jira.codehaus.org/browse/mvel2
Expression: @declare{"returnValueMethod"}
public static org.drools.spi.FieldValue @{methodName}(@foreach{declr : declarations} @{declr.typeName} @{declr.identifier} @end{","} @if{localDeclarations != empty && declarations != empty},@end{}
                                                      @foreach{declr : localDeclarations} @{declr.typeName} @{declr.identifier} @end{","} @if{globals != empty && (localDeclarations != empty || declarations != empty)},@end{}
                                                      @foreach{type : globalTypes, identifier : globals} @{type} @{identifier} @end{","} ) throws Exception {
    return org.drools.base.FieldFactory.getInstance().getFieldValue( @{text} );
}
@end{}

@declare{"predicateMethod"}
public static boolean @{methodName}(@foreach{declr : declarations} @{declr.typeName} @{declr.identifier} @end{","} @if{localDeclarations != empty && declarations != empty},@end{}
                                                      @foreach{declr : localDeclarations } @{declr.typeName} @{declr.identifier} @end{","} @if{globals != empty&& (localDeclarations != empty || declarations != empty)},@end{}
                                                      @foreach{type : globalTypes, identifier : globals} @{type} @{identifier} @end{","} ) throws Exception {
    return ( @{text} );
}
@end{}

@declare{"evalMethod"}
public static boolean @{methodName}(@foreach{declr : declarations} @{declr.typeName} @{declr.identifier} @end{","} @if{globals != empty && declarations != empty},@end{}
                                    @foreach{type : globalTypes, identifier : globals} @{type} @{identifier} @end{","} ) throws Exception {
    return ( @{text} );
}
@end{}

@declare{"accumulateInnerClass"}
public static class @{className} implements java.io.Serializable {

    private static final long    serialVersionUID = 510l;

    @if{supportsReverse == "true"}
    private java.util.Map reverseMap = new java.util.HashMap<Integer, ReverseSnapshot>();
    @end{}

    @foreach{type : attributesTypes, attr : attributes} private @{type} @{attr};

    @end{}

    public @{className}() {
    }

    public void init(@foreach{declr : declarations} @{declr.typeName} @{declr.identifier}@end{","}@if{globals != empty && declarations != empty},@end{}
                     @foreach{type : globalTypes, identifier : globals} @{type}@{identifier} @end{","}
                     ) throws Exception {
        @{initCode}
    }

    public void accumulate(org.drools.WorkingMemory workingMemory,
                           org.drools.common.InternalFactHandle handle,
                           org.drools.rule.Declaration[] innerDeclarations,
                           Object object @if{declarations != empty}, @end{}
                           @foreach{declr : declarations} @{declr.typeName} @{declr.identifier}@end{","}@if{globals != empty},@end{}
                           @foreach{type : globalTypes, identifier : globals} @{type} @{identifier} @end{","}@if{innerDeclarations != empty},@end{}
                           @foreach{declr : innerDeclarations}@{declr.extractor.extractToClassName} @{declr.identifier}@end{","}
                           ) throws Exception {
        @if{supportsReverse == "true"}
        this.reverseMap.put( Integer.valueOf( handle.getId() ),
                             new ReverseSnapshot(
                               @foreach{declr : declarations}@{declr.identifier}@end{","}@if{innerDeclarations != empty && declarations != empty},@end{}
                               @foreach{declr : innerDeclarations}@{declr.identifier}@end{","}
                              ) );
        @end{}
        @{actionCode}
    }

    public void reverse(org.drools.WorkingMemory workingMemory,
                           org.drools.common.InternalFactHandle handle,
                           Object object@if{globals != empty},@end{}
                           @foreach{type : globalTypes, identifier : globals} @{type} @{identifier} @end{","}
                           ) throws Exception {
        @if{supportsReverse == "true"}
        ReverseSnapshot snapshot = (ReverseSnapshot) this.reverseMap.remove( Integer.valueOf( handle.getId() ) );
        @foreach{declr : declarations}@{declr.typeName} @{declr.identifier} = snapshot.@{declr.identifier};@end{}
        @foreach{declr : innerDeclarations}@{declr.extractor.extractToClassName} @{declr.identifier} = snapshot.@{declr.identifier};@end{}
        @end{}
        @{reverseCode}
    }

    public Object getResult(@foreach{declr : declarations} @{declr.typeName} @{declr.identifier}@end{","}@if{globals != empty && declarations != empty},@end{}
                            @foreach{type : globalTypes, identifier : globals}@{type} @{identifier} @end{","}
                           ) throws Exception {
        return ( @{resultCode} );
    }

    public boolean supportsReverse() {
        return @{supportsReverse};
    }

    @if{supportsReverse == "true"}
    private static class ReverseSnapshot implements java.io.Serializable {
        @foreach{declr : declarations} public final @{declr.typeName} @{declr.identifier};@end{}
        @foreach{declr : innerDeclarations}public final @{declr.extractor.extractToClassName} @{declr.identifier};@end{}

        public ReverseSnapshot(@foreach{declr : declarations}final @{declr.typeName} @{declr.identifier}@end{","}@if{innerDeclarations != empty && declarations!= empty},@end{}
                               @foreach{declr : innerDeclarations}final @{declr.extractor.extractToClassName} @{declr.identifier}@end{","}
                              ) {
            @foreach{declr : declarations}this.@{declr.identifier} = @{declr.identifier};@end{}
            @foreach{declr : innerDeclarations}this.@{declr.identifier} = @{declr.identifier};@end{}
        }
    }
    @end{}
}
@end{}

@declare{"consequenceMethod"}
public static void @{methodName}(org.drools.spi.KnowledgeHelper drools@if{declarations != empty},@end{} @foreach{declr : declarations} @{declr.typeName} @{declr.identifier}, org.drools.FactHandle @{declr.identifier}__Handle__ @end{","}@if{globals != empty},@end{} @foreach{type : globalTypes, identifier : globals}  @{type} @{identifier} @end{","} ) throws Exception { org.drools.runtime.rule.RuleContext kcontext = drools;
    @{text}
}@end{}

@declare{"actionMethod"}
public static void @{methodName}(org.drools.spi.KnowledgeHelper drools@if{globals != empty},@end{} @foreach{type :globalTypes, identifier : globals}  @{type} @{identifier} @end{","} @if{variables != empty},@end{} @foreach{type2 :variableTypes, identifier2 : variables}  @{type2} @{identifier2} @end{","}, org.drools.spi.ProcessContext context ) throws Exception {
    org.drools.runtime.process.ProcessContext kcontext = context;
    @{text}
}
@end{}

@declare{"returnValueEvaluatorMethod"}
public static Object @{methodName}(org.drools.spi.ProcessContext context@if{globals != empty},@end{} @foreach{type : globalTypes, identifier : globals}  @{type} @{identifier} @end{","} @if{variables != empty},@end{} @foreach{type2 :variableTypes, identifier2 : variables}  @{type2} @{identifier2} @end{","} ) throws Exception {
    org.drools.runtime.process.ProcessContext kcontext = context;
    @{text}
}
@end{}

00:40:04.645 [AWT-EventQueue-0] ERROR org.iypt.planner.gui.PlannerWindow - Error during solution
java.lang.VerifyError: (class: ASMAccessorImpl_2761208651435254004620, method: getKnownEgressType signature: ()Ljava/lang/Class;) Illegal type in constant pool
        at java.lang.Class.getDeclaredConstructors0(Native Method) ~[na:1.8.0_45]
        at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) ~[na:1.8.0_45]
        at java.lang.Class.getConstructor0(Unknown Source) ~[na:1.8.0_45]
        at java.lang.Class.newInstance(Unknown Source) ~[na:1.8.0_45]
        at org.mvel2.optimizers.impl.asm.ASMAccessorOptimizer._initializeAccessor(ASMAccessorOptimizer.java:725) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.mvel2.optimizers.impl.asm.ASMAccessorOptimizer.compileAccessor(ASMAccessorOptimizer.java:859) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.mvel2.optimizers.impl.asm.ASMAccessorOptimizer.optimizeAccessor(ASMAccessorOptimizer.java:243) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.mvel2.optimizers.dynamic.DynamicGetAccessor.optimize(DynamicGetAccessor.java:90) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.mvel2.optimizers.dynamic.DynamicGetAccessor.getValue(DynamicGetAccessor.java:64) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:108) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:42) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.mvel2.MVEL.executeExpression(MVEL.java:930) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.mvel2.templates.res.CompiledExpressionNode.eval(CompiledExpressionNode.java:45) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.mvel2.templates.res.TextNode.eval(TextNode.java:42) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.mvel2.templates.res.CompiledForEachNode.eval(CompiledForEachNode.java:114) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.mvel2.templates.res.TextNode.eval(TextNode.java:42) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.mvel2.templates.res.TerminalNode.eval(TerminalNode.java:35) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.mvel2.templates.res.TextNode.eval(TextNode.java:42) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.mvel2.templates.res.CompiledIfNode.eval(CompiledIfNode.java:44) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.mvel2.templates.res.TextNode.eval(TextNode.java:42) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.mvel2.templates.res.CompiledExpressionNode.eval(CompiledExpressionNode.java:46) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.mvel2.templates.res.TextNode.eval(TextNode.java:42) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.mvel2.templates.TemplateRuntime.execute(TemplateRuntime.java:285) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.mvel2.templates.TemplateRuntime.execute(TemplateRuntime.java:247) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.mvel2.templates.TemplateRuntime.execute(TemplateRuntime.java:255) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.mvel2.templates.TemplateRuntime.execute(TemplateRuntime.java:207) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.drools.rule.builder.dialect.java.JavaRuleBuilderHelper.generateMethodTemplate(JavaRuleBuilderHelper.java:215) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.drools.rule.builder.dialect.asm.AbstractASMConsequenceBuilder.build(AbstractASMConsequenceBuilder.java:26) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:103) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:2830)~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.drools.compiler.PackageBuilder.compileRules(PackageBuilder.java:970) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.drools.compiler.PackageBuilder.compileAllRules(PackageBuilder.java:879) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:871) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:440) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:418) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.drools.planner.config.score.director.ScoreDirectorFactoryConfig.buildRuleBase(ScoreDirectorFactoryConfig.java:245) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.drools.planner.config.score.director.ScoreDirectorFactoryConfig.buildDroolsScoreDirectorFactory(ScoreDirectorFactoryConfig.java:225) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.drools.planner.config.score.director.ScoreDirectorFactoryConfig.buildScoreDirectorFactory(ScoreDirectorFactoryConfig.java:157) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.drools.planner.config.solver.SolverConfig.buildSolver(SolverConfig.java:142) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.drools.planner.config.XmlSolverFactory.buildSolver(XmlSolverFactory.java:104) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.iypt.planner.solver.TournamentSolver.solve(TournamentSolver.java:144) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.iypt.planner.gui.PlannerWindow$SolverTask.execute(PlannerWindow.java:578) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.iypt.planner.gui.PlannerWindow$SolverTask.execute(PlannerWindow.java:564) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at org.apache.pivot.util.concurrent.Task$ExecuteCallback.run(Task.java:42) ~[iypt-planner-0.2-SNAPSHOT-jar-with-dependencies_korrigiert.jar:na]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[na:1.8.0_45]
        at java.util.concurrent.FutureTask.run(Unknown Source) ~[na:1.8.0_45]
        at java.lang.Thread.run(Unknown Source) ~[na:1.8.0_45]

Jury planner version https://github.com/yurloc/iypt-planner/releases/tag/v0.2.0-alpha2, built with javac 1.7.0_79, MVEL 2.1.3.Final

yurloc commented 9 years ago

Could be the same as mikebrock/mvel#27. I hope this could be avoided by building with Java 8. Current workaround is to use Java 7 to run the planner application.

yurloc commented 9 years ago

Related reports:

rajmalarapu commented 7 years ago

Code within org.mvel2.optimizers.impl.asm.ASMAccessorOptimizer should be fixed as shown in below article: http://copyrightdev.tumblr.com/post/146315831773/getting-drools-5x-to-operate-smoothly-with-java-8

Also, this code issue has been fixed in mvel2 2.2.0.Final version.