[ 
https://issues.apache.org/jira/browse/SCXML-188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13876793#comment-13876793
 ] 

Ate Douma commented on SCXML-188:
---------------------------------

Thanks Sebb.

I've did some more research and actually I now think there should be no 
assumption made on the specific numeric return type, other than that it should 
be of type java.lang.Number.
The Javascript language only knows about Number [1], so mapping that to a 
concrete Java type always is going to be tricky.
I found a similar issue SOLR-4634 which Uwe Schindler IMO correctly fixed by 
only expecting a return type of java.lang.Number.

So, maybe we should conclude the current test never should have expected a 
Double in the first place, and it only just so happen to work because of 
same/similar implementations in OpenJDK 1.7/Oracle 1.6/1.7.
But saying OpenJDK 1.6 is returning a 'wrong' answer isn't right either.

So, I think we should fix this issue by only expecting a java.lang.Number 
result and checking its intValue being 12. Agreed?

[1] https://developer.mozilla.org/en-US/docs/Rhino/Runtime

> OpenJDK 1.6 Rhino ScriptEngine error causes JSEvaluationTest to fail
> --------------------------------------------------------------------
>
>                 Key: SCXML-188
>                 URL: https://issues.apache.org/jira/browse/SCXML-188
>             Project: Commons SCXML
>          Issue Type: Bug
>    Affects Versions: 2.0
>         Environment: continuum-ci.apache.org, OpenJDK 1.6.2 
> (6b27-1.12.6-1ubuntu0.12.04, amd64)
>            Reporter: Ate Douma
>
> On OpenJDK 1.7 and Sun/Oracle java 6 and 7 the following JS expression "1 + 1 
> + 2 + 3 + 5" returns a Double value (12.0)
> On OpenJDK 1.6 the returned value is an Integer (12), causing the 
> JSEvaluatorTest to fail.
> Seems like the OpenJDK Mozilla Rhino implementation/embedding is broken, and 
> until a newer version of OpenJDK 1.6 comes out which fixes this (unlikely any 
> time soon?) we might want to exclude support for OpenJDK 1.6 when using the 
> Rhino Javscript ScriptEngine.
>  
> The question is though: (how) can we handle this conditionally in the test?



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to