as of JDK 1.8.0_101, the following JUnit test fails:

    public void testLongIsNumber() {
        jdk.nashorn.api.scripting.ScriptObjectMirror isNumberFunction = 
eval("function isNumber(arg) {\n" +
            "    return typeof arg === 'number';\n" +
            "}\n" +
        Object result = isNumberFunction.call(isNumberFunction, 1L);
        assertTrue((boolean) result);

This breaks e.g. Nodyn, where Long numbers resulting from java.io.File.length() 
are passed into https://nodejs.org/api/util.html#util_util_isnumber_object , 
resulting in some „if" clause now taking the wrong turn. I guess this is a 
side-effect of https://bugs.openjdk.java.net/browse/JDK-8144020 .

While I’m probably able to patch this in Nodyn, I find it a bit frightening 
that any other code out there that relies on Longs being typeof ‚number‘ will 
break now, in particular because there is a lot of JDK API that returns Long...



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

E-Mail joerg.frantz...@aperto.com

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 
Aufsichtsrat: Matthew Candy (Vorsitzender)

Reply via email to