-
Bug
-
Resolution: Fixed
-
P3
-
8, 9
-
b117
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8163664 | 8u121 | Michael Haupt | P3 | Resolved | Fixed | b01 |
JDK-8155737 | 8u112 | Michael Haupt | P3 | Resolved | Fixed | b01 |
JDK-8167790 | emb-8u121 | Unassigned | P3 | Resolved | Fixed | b01 |
When passing an array class to MHs.Lookup.findConstructor(), that method will return a handle that, when invoked, creates an instance of Object. This is not in concordance with the bytecode behaviour rules for Lookup methods. Rather, a NoSuchMethodException should be thrown.
A sample jshell session follows.
-> import java.lang.invoke.*
-> MethodHandle mh = MethodHandles.lookup().findConstructor(String[].class, MethodType.methodType(void.class));
| Added variable mh of type MethodHandle with initial value MethodHandle()Object
-> mh.invoke().getClass()
| Expression value is: class java.lang.Object
| assigned to temporary variable $3 of type Class<? extends Object>
To round off the fix, and to provide more convenience, corresponding methods for array creation handle generation could be added to MethodHandles.
A sample jshell session follows.
-> import java.lang.invoke.*
-> MethodHandle mh = MethodHandles.lookup().findConstructor(String[].class, MethodType.methodType(void.class));
| Added variable mh of type MethodHandle with initial value MethodHandle()Object
-> mh.invoke().getClass()
| Expression value is: class java.lang.Object
| assigned to temporary variable $3 of type Class<? extends Object>
To round off the fix, and to provide more convenience, corresponding methods for array creation handle generation could be added to MethodHandles.
- backported by
-
JDK-8155737 MHs.Lookup.findConstructor returns handles for array classes
- Resolved
-
JDK-8163664 MHs.Lookup.findConstructor returns handles for array classes
- Resolved
-
JDK-8167790 MHs.Lookup.findConstructor returns handles for array classes
- Resolved