[jboss-jira] [JBoss JIRA] Commented: (JBRULES-537) BigDecimalFactory and BigIntegerFactory don't compile with java 1.5 source

Mark Proctor (JIRA) jira-events at jboss.com
Wed Nov 1 19:33:41 EST 2006


    [ http://jira.jboss.com/jira/browse/JBRULES-537?page=comments#action_12346133 ] 
            
Mark Proctor commented on JBRULES-537:
--------------------------------------

Evaluators can  be used  to compare  objects/primitives of different types. If we cast  how can we comapare  Integer to  a BigInteger?

> BigDecimalFactory and BigIntegerFactory don't compile with java 1.5 source
> --------------------------------------------------------------------------
>
>                 Key: JBRULES-537
>                 URL: http://jira.jboss.com/jira/browse/JBRULES-537
>             Project: JBoss Rules
>          Issue Type: Task
>      Security Level: Public(Everyone can see) 
>          Components: All
>    Affects Versions: 3.1-m1
>            Reporter: Geoffrey De Smet
>         Assigned To: Mark Proctor
>            Priority: Minor
>   Original Estimate: 10 minutes
>  Remaining Estimate: 10 minutes
>
> jbossrules\drools-core\src\main\java\org\drools\base\evaluators\BigIntegerFactory.java and BigIntegerFactory.java
> won't compile in 1.5 source because BigDecimal isn't a 100% backwards compatible from java 1.5 to 1.4,
> due to them generifying it.
> The fix is easy: just add some casts, the JVM does this at runtime anyway.
> For example:
>             final BigDecimal comp = (BigDecimal) extractor.getValue( object1 );
>             return comp.compareTo( object2.getValue() ) < 0;
> This code turns red in java source=1.5 in IntelliJ IDEA  (and in Eclipse I would expect the same?)
> Turn it into:
>             ...
>             return comp.compareTo( (BigDecimal) object2.getValue() ) < 0;
> I didn't create a patch as it's fast to fix: just copy-paste (BigDecimal) in the 2 classes's use of the compareTo method.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list