[
https://issues.jboss.org/browse/DROOLS-18?page=com.atlassian.jira.plugin....
]
Michiel Vermandel edited comment on DROOLS-18 at 1/30/13 8:48 AM:
------------------------------------------------------------------
Hi, Mario, I think I found the problem.
My PlanningEntity has both a "getLead()" method and a "isLead()"
method.
getLead() returns the lead task of this task and isLead() checks if this task is the
lead.
I think that if I use "... task == lead ..." in a rule LHS condition, the
(mvel?)parser sometimes maps lead to getLead() - which is OK - and sometimes maps lead to
isLead() - which is not OK => Task.class <==> Boolean.class
I changed the isLead() method to isLeader() and I did not get the crash anymore.
was (Author: mvermand):
Hi, Mario, I think I found the problem.
My PlanningEntity has both a "getLead()" method and a "isLead()"
method.
getLead() returns the lead task of this task and isLead() checks if this task is the
lead.
I think that if I use "... task == lead ..." in a rule LHS condition, the
(mvel?)parser sometimes maps lead to getLead() - which is OK - and sometimes maps lead to
isLead() - which is not OK => Task.class <==> Boolean.class
[Error: incompatible types in statement: boolean (compared from:
class be.axi.planner.domain.Task)]
---------------------------------------------------------------------------------------------------
Key: DROOLS-18
URL:
https://issues.jboss.org/browse/DROOLS-18
Project: Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Environment: Windows 7 64Bit
Java 1.7.0
Drools-core 5.5.0.Final
Drools-compiler 5.5.0.Final
Mvel2 2.1.3.Final
Reporter: Michiel Vermandel
Assignee: Mario Fusco
Priority: Critical
In about one out of ten JUnit runs, I get a crash with stack trace.
The process terminates immediately.
Unit test output is 100% the same on successful runs.
Stack trace:
[Error: incompatible types in statement: boolean (compared from: class
be.axi.planner.domain.Task)]
[Near : {... this == lead ....}]
^
[Line: 1, Column: 1]
at org.mvel2.ast.BinaryOperation.<init>(BinaryOperation.java:84)
at org.mvel2.util.CompilerTools.finalizePayload(CompilerTools.java:118)
at org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:287)
at org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:62)
at org.mvel2.MVEL.compileExpression(MVEL.java:810)
at org.drools.base.mvel.MVELCompilationUnit.compile(MVELCompilationUnit.java:435)
at
org.drools.base.mvel.MVELCompilationUnit.getCompiledExpression(MVELCompilationUnit.java:238)
at
org.drools.rule.constraint.MvelConstraint.createMvelConditionEvaluator(MvelConstraint.java:206)
at org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:190)
at org.drools.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:157)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:350)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:311)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:903)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
at
org.drools.planner.core.score.director.drools.DroolsScoreDirector.afterEntityAdded(DroolsScoreDirector.java:103)
at
org.drools.planner.core.heuristic.selector.variable.PlanningVariableWalker.moveIterator(PlanningVariableWalker.java:145)
at
org.drools.planner.core.constructionheuristic.greedyFit.decider.DefaultGreedyDecider.decideNextStep(DefaultGreedyDecider.java:74)
at
org.drools.planner.core.constructionheuristic.greedyFit.DefaultGreedyFitSolverPhase.solve(DefaultGreedyFitSolverPhase.java:65)
at
org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:190)
at org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:155)
at be.axi.planner.app.InspectionSchedule.solve(InspectionSchedule.java:192)
at
be.axi.planner.testcore.AbstractPlanningTestClass.solve(AbstractPlanningTestClass.java:288)
at
be.axi.planner.testcore.AbstractPlanningTestClass.solve(AbstractPlanningTestClass.java:298)
at
be.axi.planner.testcore.AbstractPlanningTestClass.solve(AbstractPlanningTestClass.java:315)
at be.axi.planner.TaskGroupingTest.communitySuccess02(TaskGroupingTest.java:289)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at
org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira