- 
    Bug 
- 
    Resolution: Fixed
- 
     P2 P2
- 
    8u40, 9
- 
    None
- 
        b37
- 
        generic
- 
        generic
- 
        Verified
| Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build | 
|---|---|---|---|---|---|---|
| JDK-8085127 | emb-9 | Vladimir Ivanov | P2 | Resolved | Fixed | team | 
| JDK-8065479 | 8u45 | Vladimir Ivanov | P2 | Resolved | Fixed | b01 | 
| JDK-8063127 | 8u40 | Vladimir Ivanov | P2 | Closed | Fixed | b15 | 
| JDK-8070031 | emb-8u47 | Vladimir Ivanov | P2 | Resolved | Fixed | team | 
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
public class NullProvider {
public static Boolean getBoolean() { return null; }
public static void main(String[] args) throws Throwable {
MethodHandle mh = MethodHandles.lookup().findStatic(NullProvider.class, "getBoolean", MethodType.methodType(Boolean.class));
mh = MethodHandles.explicitCastArguments(mh, MethodType.methodType(boolean.class));
System.out.println(mh.invoke());
}
}
throws:
Exception in thread "main" java.lang.NullPointerException
at sun.invoke.util.ValueConversions.unboxBoolean(ValueConversions.java:95)
at jdk.nashorn.test.models.NullProvider.main(NullProvider.java:13)
Expected result would be printing "false", as per documentation for explicitCastArgument that says "If T0 is a reference and T1 a primitive, and if the reference is null at runtime, a zero value is introduced."
This happens with 9 builds (e.g. just reproduced it with 9 b34). 8 builds (e.g. recent 8u40 early access release builds) seem to behave okay.
- backported by
- 
                    JDK-8065479 NPE with explicitCastArguments unboxing null -           
- Resolved
 
-         
- 
                    JDK-8070031 NPE with explicitCastArguments unboxing null -           
- Resolved
 
-         
- 
                    JDK-8085127 NPE with explicitCastArguments unboxing null -           
- Resolved
 
-         
- 
                    JDK-8063127 NPE with explicitCastArguments unboxing null -           
- Closed
 
-         
- blocks
- 
                    JDK-8059443 Logical NOT operator throws NullPointerException for null Boolean return values -           
- Resolved
 
-         
- relates to
- 
                    JDK-8141423 [mlvm] revise MH::explicitCastArguments usage -           
- Open
 
-         
- 
                    JDK-8060717 [TESTBUG] Improve test coverage of MethodHandles.explicitCastArguments() -           
- Resolved
 
-