]
Jiri Locker commented on DROOLS-1368:
-------------------------------------
This is caused by a coincidence of several factors:
* LeadingExam is not used in the rules therefore it doesn't have its own
TypeDeclaration
* when LeadingExam's period property is updated, Drools looks for a settable property
in associated TypeDeclaration, which is looked for by traversing the class hierarchy and
finally is resolved for the Exam superclass
* Exam's period property is used in the rules but Exam only declares an abstract
getter for "period" therefore period is not considered a settable property by
Exam's TypeDeclaration
Property reactive KieSession.update(fh, h, propName) fails in
polymorfic case with "Unknown property"
-----------------------------------------------------------------------------------------------------
Key: DROOLS-1368
URL:
https://issues.jboss.org/browse/DROOLS-1368
Project: Drools
Issue Type: Bug
Components: core engine
Reporter: Geoffrey De Smet
Assignee: Mario Fusco
Priority: Critical
I call
{code}
kieSession.update(factHandle, entity, variableName);
{code}
with entity being an instance of LeadingExam, which extends Exam, which extends
AbstractPersistable.
AbstractPersistable has setId(...).
Exam has setTopic(...), setRoom(...).
LeadingExam has setPeriod(...).
I get this:
{code}
java.lang.RuntimeException: Unknown property: period
at
org.drools.core.reteoo.PropertySpecificUtil.setPropertyOnMask(PropertySpecificUtil.java:102)
at
org.drools.core.reteoo.PropertySpecificUtil.calculatePatternMask(PropertySpecificUtil.java:94)
at
org.drools.core.reteoo.PropertySpecificUtil.calculatePositiveMask(PropertySpecificUtil.java:65)
at org.drools.core.common.NamedEntryPoint.update(NamedEntryPoint.java:313)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.update(StatefulKnowledgeSessionImpl.java:1605)
at
org.optaplanner.core.impl.score.director.drools.DroolsScoreDirector.update(DroolsScoreDirector.java:169)
at
org.optaplanner.core.impl.score.director.drools.DroolsScoreDirector.afterVariableChanged(DroolsScoreDirector.java:156)
at
org.optaplanner.core.impl.heuristic.selector.move.generic.ChangeMove.doMoveOnGenuineVariables(ChangeMove.java:75)
at org.optaplanner.core.impl.heuristic.move.AbstractMove.doMove(AbstractMove.java:34)
at
org.optaplanner.core.impl.heuristic.move.CompositeMove.doMove(CompositeMove.java:110)
at
org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider.doMove(ConstructionHeuristicDecider.java:125)
at
org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider.decideNextStep(ConstructionHeuristicDecider.java:98)
at
org.optaplanner.core.impl.constructionheuristic.DefaultConstructionHeuristicPhase.solve(DefaultConstructionHeuristicPhase.java:74)
at org.optaplanner.core.impl.solver.AbstractSolver.runPhases(AbstractSolver.java:87)
at org.optaplanner.core.impl.solver.DefaultSolver.solve(DefaultSolver.java:160)
at
org.optaplanner.examples.common.app.SolverPerformanceTest.runSpeedTest(SolverPerformanceTest.java:65)
at
org.optaplanner.examples.examination.app.ExaminationPerformanceTest.solveComp_set5FastAssert(ExaminationPerformanceTest.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at
org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
at
org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.lang.Thread.run(Thread.java:745)
{code}
Debugging PropertySpecificUtil shows that settableProperties include "id",
"room", "topic", but not "period".
Note that there is also FollowingExam which also extends Exam.
FollowingExam also has setPeriod(...).