JDK-7035513 : JSR 292: MHs.constant() doesn't accept primitives
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 7
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2011-04-11
  • Updated: 2012-03-22
  • Resolved: 2011-05-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7Resolved
Related Reports
Duplicate :  
Relates :  
Description
The following test case:

public class Test {
    public static void main(String[] args) throws Exception {
        java.lang.invoke.MethodHandles.constant(boolean.class, true);
    }
}

throws an exception:

Exception in thread "main" java.lang.ExceptionInInitializerError
	at Test.main(Test.java:5)
Caused by: java.lang.IllegalArgumentException: no leading reference parameter: true
	at java.lang.invoke.MethodHandleStatics.newIllegalArgumentException(MethodHandleStatics.java:81)
	at java.lang.invoke.MethodHandle.bindTo(MethodHandle.java:1009)
	at java.lang.invoke.MethodHandles.constant(MethodHandles.java:1625)
...

Comments
EVALUATION The following suggestion can be found in mlvm-dev list: (http://mail.openjdk.java.net/pipermail/mlvm-dev/2011-April/002765.html) "The line in MethodHandles.constant() code: return identity(type).bindTo(w.convert(value, type)); has to become return insertArguments(identity(type), 0, w.convert(value, type));"
11-04-2011