Integer add operation now yields Double instead of Long with JDK 1.8.0_101?

Frantzius, Jörg Joerg.Frantzius at
Thu Sep 29 16:30:09 UTC 2016


we have a JUnit test that first evaluates a Javascript file containing this:

function add(a, b) {
    return a + b;

The Java JUnit test itself then evaluates

engine.eval("add(4, 5)")

Just until 1.8.0_91, this used to return a 9L Long number. With 1.8.0_101, this suddenly returns a Double object 9D.

When directly evaluating the addition operation:

eval("4 + 5")

an Integer 9 is returned, both with 1.8.0_101 and 1.8.0_91.

Is this intended behaviour, or is this a bug?

Thx for responses + regards,


Dipl. Inf. Jörg von Frantzius, Technical Director

E-Mail joerg.frantzius at

Phone +49 30 283921-318
Fax +49 30 283921-29

Aperto AG – An IBM Company
Chausseestraße 5, D-10115 Berlin<>

HRB 77049 B, AG Berlin Charlottenburg
Vorstand: Dirk Buddensiek (Vorsitzender), Kai Großmann, Stephan Haagen, Daniel Simon
Aufsichtsrat: Matthew Candy (Vorsitzender)

More information about the nashorn-dev mailing list