Class CastException in OCLinEcore generated code [message #1833521] |
Thu, 15 October 2020 14:57 |
Stefan John Messages: 17 Registered: March 2018 |
Junior Member |
|
|
Hi,
I encountered a ClassCastException running Java code generated by OCLinEcore for a derived attribute. The respective OCLExpression works fine in the Interactive OCL console, though.
Here is an excerpt of the ecore model as well as the stacktrace:
class Plan
{
property stakeholders : Stakeholder[*|1] { ordered composes };
property backlog : Backlog[1] { composes };
property sprints : Sprint[*|1] { ordered composes };
attribute minTeamVelocity : ecore::EInt[1];
attribute maxTeamVelocity : ecore::EInt[1];
attribute derivedMinSprintCount : ecore::EInt[1] { derived volatile }
{
initial:
let
totalEffort : ecore::EInt = self.backlog.workitems->collect(Effort)->sum(),
dividedByMaxVelo : ecore::EInt = totalEffort.div(maxTeamVelocity)
in
if totalEffort.mod(maxTeamVelocity) > 0
then dividedByMaxVelo + 1
else dividedByMaxVelo
endif;
}
}
Exception in thread "main" java.lang.ClassCastException: class org.eclipse.ocl.pivot.internal.values.RealValueImpl cannot be cast to class org.eclipse.ocl.pivot.values.IntegerValue (org.eclipse.ocl.pivot.internal.values.RealValueImpl and org.eclipse.ocl.pivot.values.IntegerValue are in unnamed module of loader 'app')
at SprintPlanning.impl.PlanImpl.getDerivedMinSprintCount(PlanImpl.java:352)
at SprintPlanning.impl.PlanImpl.eGet(PlanImpl.java:420)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1050)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1042)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1037)
at org.eclipse.emf.henshin.interpreter.matching.constraints.AttributeConstraint.check(AttributeConstraint.java:97)
at org.eclipse.emf.henshin.interpreter.matching.constraints.DomainSlot.checkAttributeConstraint(DomainSlot.java:450)
at org.eclipse.emf.henshin.interpreter.matching.constraints.DomainSlot.instantiate(DomainSlot.java:197)
at org.eclipse.emf.henshin.interpreter.matching.conditions.ApplicationCondition.findMatch(ApplicationCondition.java:113)
at org.eclipse.emf.henshin.interpreter.matching.conditions.ApplicationCondition.findGraph(ApplicationCondition.java:74)
at org.eclipse.emf.henshin.interpreter.matching.constraints.SolutionFinder.findSolution(SolutionFinder.java:74)
at org.eclipse.emf.henshin.interpreter.matching.constraints.SolutionFinder.getNextSolution(SolutionFinder.java:91)
at org.eclipse.emf.henshin.interpreter.impl.EngineImpl$MatchFinder.computeNextMatch(EngineImpl.java:402)
at org.eclipse.emf.henshin.interpreter.impl.EngineImpl$MatchFinder.hasNext(EngineImpl.java:361)
at org.eclipse.emf.henshin.interpreter.impl.EngineImpl$MatchFinder.next(EngineImpl.java:374)
at org.eclipse.emf.henshin.interpreter.impl.EngineImpl$MatchFinder.next(EngineImpl.java:1)
at org.eclipse.emf.henshin.interpreter.impl.RuleApplicationImpl.execute(RuleApplicationImpl.java:105)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.executeRule(UnitApplicationImpl.java:190)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.doExecute(UnitApplicationImpl.java:114)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.execute(UnitApplicationImpl.java:98)
at utils.ExecuteHenshinRule.main(ExecuteHenshinRule.java:64)
If a bug report makes sense, I will provide a MWE. However, I might also be doing something terribly wrong, therefore, I prefer asking on the forums, first.
Regards,
Stefan
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02848 seconds