mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8198831: Lazy initialization of ValueConversions MethodHandles
Reviewed-by: shade
This commit is contained in:
parent
9093953813
commit
16a61139e2
1 changed files with 15 additions and 13 deletions
|
@ -377,7 +377,7 @@ public class ValueConversions {
|
|||
MethodType type = MethodType.methodType(wrap.primitiveType());
|
||||
switch (wrap) {
|
||||
case VOID:
|
||||
mh = EMPTY;
|
||||
mh = Handles.EMPTY;
|
||||
break;
|
||||
case OBJECT:
|
||||
case INT: case LONG: case FLOAT: case DOUBLE:
|
||||
|
@ -400,7 +400,8 @@ public class ValueConversions {
|
|||
throw new IllegalArgumentException("cannot find zero constant for " + wrap);
|
||||
}
|
||||
|
||||
private static final MethodHandle CAST_REFERENCE, IGNORE, EMPTY;
|
||||
private static class Handles {
|
||||
static final MethodHandle CAST_REFERENCE, IGNORE, EMPTY;
|
||||
static {
|
||||
try {
|
||||
MethodType idType = MethodType.genericMethodType(1);
|
||||
|
@ -412,14 +413,15 @@ public class ValueConversions {
|
|||
throw newInternalError("uncaught exception", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static MethodHandle ignore() {
|
||||
return IGNORE;
|
||||
return Handles.IGNORE;
|
||||
}
|
||||
|
||||
/** Return a method that casts its second argument (an Object) to the given type (a Class). */
|
||||
public static MethodHandle cast() {
|
||||
return CAST_REFERENCE;
|
||||
return Handles.CAST_REFERENCE;
|
||||
}
|
||||
|
||||
/// Primitive conversions.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue