+1. Nice catch. Feels like an implementation detail, but the JVM specification is indeed unclear on the behavior in case there's a bytecode method doing this:
public static func(I)Z 0 iload 0 1 ireturn I went spelunking in the JVM spec, and the closest I could find is in section 2.3.4 says "The Java Virtual Machine encodes boolean array components using 1 to represent true and 0 to represent false. Where Java programming language boolean values are mapped by compilers to values of Java Virtual Machine type int, the compilers must use the same encoding." So I guess we better stick to that. Attila. On Mon, Nov 13, 2017 at 7:21 AM, Priya Lakshmi Muthuswamy < priya.lakshmi.muthusw...@oracle.com> wrote: > Hi, > > Please review JDK-8190391 : nashorn: "!!" of nonzero even integer var > becomes false when returned > > JBS : https://bugs.openjdk.java.net/browse/JDK-8190391 > webrev : http://cr.openjdk.java.net/~pmuthuswamy/8190391/webrev.00/ > > Thanks, > Priya >