JDK-8010732 : BigDecimal, BigInteger and Long handling in nashorn
  • Type: Bug
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 8
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 2013-03-25
  • Updated: 2013-08-15
  • Resolved: 2013-06-21
Sub Tasks
JDK-8017448 :  
Nashorn checks "instanceof Number" or Number.class.isAssignableFrom(objClass) in a number of places. THis is problematic as user would expect java.math.BigDecimal, java.math.BigInteger, java.lang.Long to be printed/shown not a doubles but as real "big" values.
After extensively redoing Nashorn to not work with AtomicInteger, AtomicLong, BigDecimal, BigInteger, DoubleAccumulator, DoubleAdder, LongAccumulator, LongAdder, I decided that this is a non-issue. JavaScript only works with doubles. These forms can be converted to double. The only issue is display. Since you can do toString() on these types, the default is to treat them as doubles and if the user needs more display precision, they can use toString().

Hi Jim - you had few ideas about replacing "instanceof Number" and assignable from to Number.class checks in many places. Will you please own this?