[jboss-jira] [JBoss JIRA] (DROOLS-1420) (int) ($p * 1_000.0) throws a misleading exception
Mario Fusco (JIRA)
issues at jboss.org
Thu Feb 2 11:49:00 EST 2017
[ https://issues.jboss.org/browse/DROOLS-1420?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mario Fusco resolved DROOLS-1420.
---------------------------------
Fix Version/s: 7.0.0.CR1
Resolution: Done
Fixed by https://github.com/droolsjbpm/drools/commit/d70058bb6ea7516a0054ef5063d94d173cda479f
> (int) ($p * 1_000.0) throws a misleading exception
> --------------------------------------------------
>
> Key: DROOLS-1420
> URL: https://issues.jboss.org/browse/DROOLS-1420
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Affects Versions: 7.0.0.Beta5
> Reporter: Geoffrey De Smet
> Assignee: Mario Fusco
> Fix For: 7.0.0.CR1
>
>
> This fails with *$p cannot be resolved to a variable*:
> {code}
> rule R when
> Cheese($p : price)
> then
> int b = (int) ($p * 1_000.0); // FAILS, because $p cannot be resolved ?!
> end
> {code}
> That error message is nonsense. It should just work. If it doesn't due to ECJ, it should say something like "cannot be cast".
> This works in java:
> {code}
> int a = 42;
> int b = ((int) (a * 1_000.0));
> {code}
> Removing the underscore fixes it:
> {code}
> rule R when
> Cheese($p : price)
> then
> int b = (int) ($p * 1000.0); // SUCCESS
> end
> {code}
> Regardless of an upstream ECJ problem (which should be reported if that's indeed the problem), the error message is wrong and send me on a wild goose hunt.
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
More information about the jboss-jira
mailing list