-
Bug
-
Resolution: Not a Bug
-
Major
-
None
-
7.73.0.Final
-
None
-
-
Set a Value
-
NEW
-
NEW
-
---
-
---
Before executable model, you could cast a primitive type (and its boxed counterparts if I'm not mistaken) to String.
After enabling executable model, an error happens when trying to build a DRL that contains such construct.
For example:
// DRL directly from drools/issues/CastTest_intToString.drl package drools.issues; global drools.issues.model.RegardsManager regardsManager; dialect "mvel" rule "Send regards to all Tesla owners" when $v:drools.issues.model.vehicles.ElectricCar(maker=='Tesla') then insert(regardsManager.requestSendRegards("Hi, owner of a Tesla!").withParam("score", (String) $v.score )); end //
withParam is defined as:
public SendRegards withParam(String name, String value) { params.put(name, Objects.requireNonNull(value)); return this; }
and score is an integer.
With all above, MVEL runtime works well while executable model yields this:
[main] ERROR drools.issues.executor.DroolsInternalFactory - KieBuilder has errors (releaseId=drools.issues.rules:CastTest_intToString.drl:1.0.0): Error Messages: Message [id=1, level=ERROR, path=src/main/java/drools/issues/P56/LambdaConsequence56D5C9B4A166C62ADD965E3D4746CC56.java, line=20, column=968 text=Cannot cast from int to String] Message [id=2, level=ERROR, path=src/main/java/drools/issues/P56/LambdaConsequence56D5C9B4A166C62ADD965E3D4746CC56.java, line=0, column=0 text=Java source of src/main/java/drools/issues/P56/LambdaConsequence56D5C9B4A166C62ADD965E3D4746CC56.java in error: package drools.issues.P56; import static drools.issues.RulesB8F478785D3CFF51934B126DCB0906E0.*; import drools.issues.*; import org.drools.modelcompiler.dsl.pattern.D; @org.drools.compiler.kie.builder.MaterializedLambda() public enum LambdaConsequence56D5C9B4A166C62ADD965E3D4746CC56 implements org.drools.model.functions.Block3<org.drools.model.Drools, drools.issues.model.vehicles.ElectricCar, drools.issues.model.RegardsManager>, org.drools.model.functions.HashedExpression { INSTANCE; public static final String EXPRESSION_HASH = "73EB858AA97EF361030B94C86DFB98FD"; public java.lang.String getExpressionHash() { return EXPRESSION_HASH; } @Override() public void execute(org.drools.model.Drools drools, drools.issues.model.vehicles.ElectricCar $v, drools.issues.model.RegardsManager regardsManager) throws java.lang.Exception { drools.insert(regardsManager.requestSendRegards("Hi, owner of a Tesla!").withParam("score", ((java.lang.String) $v.getScore()))); } } ] --- Warning Messages: --- Info Messages:
- is related to
-
DROOLS-7201 Migration guide : non executable model to executable model
- Resolved