Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/jcl/src/java.base/share/classes/java/lang/invoke/ConvertHandle.java
12521 views
1
/*[INCLUDE-IF Sidecar17 & !OPENJDK_METHODHANDLES]*/
2
/*******************************************************************************
3
* Copyright (c) 2009, 2020 IBM Corp. and others
4
*
5
* This program and the accompanying materials are made available under
6
* the terms of the Eclipse Public License 2.0 which accompanies this
7
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
8
* or the Apache License, Version 2.0 which accompanies this distribution and
9
* is available at https://www.apache.org/licenses/LICENSE-2.0.
10
*
11
* This Source Code may also be made available under the following
12
* Secondary Licenses when the conditions for such availability set
13
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
14
* General Public License, version 2 with the GNU Classpath
15
* Exception [1] and GNU General Public License, version 2 with the
16
* OpenJDK Assembly Exception [2].
17
*
18
* [1] https://www.gnu.org/software/classpath/license.html
19
* [2] http://openjdk.java.net/legal/assembly-exception.html
20
*
21
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
22
*******************************************************************************/
23
package java.lang.invoke;
24
25
import java.lang.invoke.MethodHandles.Lookup;
26
import java.util.concurrent.ConcurrentHashMap;
27
/*[IF JAVA_SPEC_VERSION >= 15]*/
28
import java.util.List;
29
/*[ENDIF] JAVA_SPEC_VERSION >= 15 */
30
31
import com.ibm.oti.util.Msg;
32
33
abstract class ConvertHandle extends MethodHandle {
34
@VMCONSTANTPOOL_FIELD
35
final MethodHandle next;
36
37
ConvertHandle(MethodHandle handle, MethodType type, byte kind, Object thunkArg) {
38
super(type, kind, thunkArg);
39
if ((handle == null) || (type == null)) {
40
throw new IllegalArgumentException();
41
}
42
this.next = handle;
43
}
44
45
ConvertHandle(ConvertHandle originalHandle, MethodType newType) {
46
super(originalHandle, newType);
47
this.next = originalHandle.next;
48
this.requiresBoxing = originalHandle.requiresBoxing;
49
}
50
51
@VMCONSTANTPOOL_FIELD
52
boolean requiresBoxing = false;
53
54
/*
55
* Determine if the arguments can be converted from the MethodType fromType to that of toType.
56
* Return conversions are handled by FilterReturnHandle.
57
*/
58
final void checkConversion(MethodType toType, MethodType fromType) {
59
Class<?>[] toArgs = toType.ptypes();
60
Class<?>[] fromArgs = fromType.ptypes();
61
62
if (toArgs.length != fromArgs.length) {
63
throwWrongMethodTypeException(fromType, toType, toArgs.length);
64
}
65
66
boolean isExplicitCast = (kind == KIND_EXPLICITCAST);
67
68
// Ensure argsToCollect can be converted to type of array
69
for (int i = 0; i < toArgs.length; i++ ) {
70
Class<?> toClass = toArgs[i];
71
Class<?> fromClass = fromArgs[i];
72
73
// identity conversion
74
if (fromClass == toClass) {
75
continue;
76
}
77
78
boolean toIsPrimitive = toClass.isPrimitive();
79
boolean fromIsPrimitive = fromClass.isPrimitive();
80
81
// both are reference types, then apply a cast at runtime
82
if (!toIsPrimitive && !fromIsPrimitive) {
83
continue;
84
}
85
86
// primitive to primitive conversion
87
if (toIsPrimitive && fromIsPrimitive) {
88
// if not explicitCast, only widening primitive conversions allowed
89
if (isExplicitCast || FilterHelpers.checkIfWideningPrimitiveConversion(fromClass, toClass)) {
90
continue;
91
}
92
throwWrongMethodTypeException(fromType, toType, i);
93
}
94
95
// unbox + widening primitive conversion
96
if (toIsPrimitive) {
97
if (isExplicitCast) {
98
continue;
99
} else {
100
// fromClass is reference type { Object, Number, Boolean, Byte, Integer, etc }
101
Class<?> unwrappedFromClass = MethodTypeHelper.unwrapPrimitive(fromClass);
102
if ((toClass == unwrappedFromClass) ||
103
fromClass.isAssignableFrom(MethodTypeHelper.wrapPrimitive(toClass)) ||
104
FilterHelpers.checkIfWideningPrimitiveConversion(unwrappedFromClass, toClass)) {
105
continue;
106
}
107
}
108
throwWrongMethodTypeException(fromType, toType, i);
109
}
110
111
// toClass is reference type
112
// primitive wrapper is subclass of fromClass
113
if (toClass.isAssignableFrom(MethodTypeHelper.wrapPrimitive(fromClass))) {
114
requiresBoxing = true;
115
continue;
116
}
117
throwWrongMethodTypeException(fromType, toType, i);
118
}
119
}
120
121
static final void throwWrongMethodTypeException(MethodType fromType, MethodType toType, int index) throws WrongMethodTypeException {
122
/*[MSG "K05cb", "No conversion from '{0}' to '{1} at index ({2})"]*/
123
throw new WrongMethodTypeException(Msg.getString("K05cb", fromType.toString(), toType.toString(), Integer.toString(index))); //$NON-NLS-1$
124
}
125
126
/*[IF ]*/
127
protected void dumpDetailsTo(java.io.PrintStream out, String prefix, java.util.Set<MethodHandle> alreadyDumped) {
128
super.dumpDetailsTo(out, prefix, alreadyDumped);
129
next.dumpTo(out, prefix, "next: ", alreadyDumped); //$NON-NLS-1$
130
}
131
/*[ENDIF]*/
132
133
static final class FilterHelpers {
134
/* shared privileged lookup object */
135
static Lookup privilegedLookup = MethodHandles.Lookup.internalPrivilegedLookup;
136
137
/* local cache of previously looked up filters */
138
static final ConcurrentHashMap<MethodType, MethodHandle> cachedReturnFilters = new ConcurrentHashMap<MethodType, MethodHandle>();
139
140
/*
141
* Return conversions: explicit vs asType handled by the boolean isExplicitCast
142
*/
143
static MethodHandle getReturnFilter(Class<?> fromReturn, Class<?> toReturn, boolean isExplicitCast) {
144
assert(fromReturn != toReturn);
145
try {
146
if (fromReturn == void.class) {
147
Object constantValue = null;
148
if (toReturn.isPrimitive()) {
149
if (toReturn == boolean.class) {
150
constantValue = Boolean.valueOf(false);
151
} else if (toReturn == char.class) {
152
constantValue = Character.valueOf((char)0);
153
} else {
154
/* covers all other cases as byte can be widened to any other primitive */
155
constantValue = Byte.valueOf((byte)0);
156
}
157
}
158
return MethodHandles.constant(toReturn, constantValue);
159
}
160
MethodType filterType = MethodType.methodType(toReturn, fromReturn);
161
if (fromReturn.isPrimitive()) {
162
if (toReturn.isPrimitive()) {
163
return getPrimitiveReturnFilter(filterType, isExplicitCast);
164
} else {
165
return getBoxingReturnFilter(filterType);
166
}
167
} else { // fromReturn is an object
168
if (!toReturn.isPrimitive()) {
169
return getCastFilter(filterType, isExplicitCast);
170
} else if (toReturn == void.class) {
171
MethodHandle filter = privilegedLookup.findStatic(FilterHelpers.class, "popObject", MethodType.methodType(void.class, Object.class)); //$NON-NLS-1$
172
return filter.cloneWithNewType(filterType);
173
} else {
174
return getUnboxingReturnFilter(filterType, isExplicitCast);
175
}
176
}
177
} catch(IllegalAccessException e) {
178
throw new Error(e);
179
} catch (NoSuchMethodException e) {
180
throw new Error(e);
181
}
182
}
183
184
185
/* JLSv3: 5.1.2: allowed widening primitive conversions
186
* byte to short, int, long, float, or double
187
* short to int, long, float, or double
188
* char to int, long, float, or double
189
* int to long, float, or double
190
* long to float or double
191
* float to double
192
*/
193
static boolean checkIfWideningPrimitiveConversion(Class<?> from, Class<?> to) {
194
if (!from.isPrimitive() || !to.isPrimitive()) {
195
return false;
196
}
197
if ((from == boolean.class) || (to == boolean.class) || (from == double.class) || (to == char.class)) {
198
return false;
199
}
200
201
return primitiveIndex1(to) > primitiveIndex1(from);
202
}
203
204
/*
205
* doesn't handle boolean or non-primitive. Also, can't widen to char.
206
* so it's a widening conversion if primitiveIndex1(to) > primitiveIndex1(from)
207
*
208
*/
209
private static int primitiveIndex1(Class<?> c) {
210
int ch = c.getName().charAt(0);
211
int shift = (ch ^ (ch >> 3)) & 0x7;
212
/* values for shift:
213
0 - double
214
2 - float
215
1 - long
216
4 - int
217
7 - char
218
5 - short
219
6 - byte
220
*/
221
return (021230546 >> (3*shift)) & 7; // octal value is 0x21230546 in hex
222
}
223
224
static MethodHandle getPrimitiveReturnFilter(MethodType type, boolean isExplicitCast) throws IllegalAccessException, NoSuchMethodException {
225
Class<?> fromClass = type.parameterType(0);
226
Class<?> toClass = type.returnType();
227
228
if (!isExplicitCast) {
229
if ((type.returnType() != void.class) && !checkIfWideningPrimitiveConversion(fromClass, toClass)) {
230
throw new WrongMethodTypeException();
231
}
232
}
233
MethodHandle filter = cachedReturnFilters.get(type);
234
if (filter == null) {
235
MethodHandle previous;
236
String to = MethodTypeHelper.getBytecodeStringName(toClass);
237
String from = MethodTypeHelper.getBytecodeStringName(type.parameterType(0));
238
filter = privilegedLookup.findStatic(FilterHelpers.class, from + "2" + to, type); //$NON-NLS-1$
239
if ((previous = cachedReturnFilters.putIfAbsent(type, filter)) != null) {
240
filter = previous;
241
}
242
}
243
return filter;
244
}
245
246
/*[IF ]*/
247
/* From 292 javadoc:
248
* If T0 is a primitive and T1 a reference, a boxing conversion is applied if one exists,
249
* possibly followed by a reference conversion to a superclass. T1 must be a wrapper
250
* class or a supertype of one.
251
*/
252
/*[ENDIF]*/
253
/*
254
* Constructors of the Wrapper type provide the filter.
255
*/
256
static MethodHandle getBoxingReturnFilter(MethodType type) throws IllegalAccessException, NoSuchMethodException {
257
Class<?> wrapper = MethodTypeHelper.wrapPrimitive(type.parameterType(0));
258
if (!type.returnType().isAssignableFrom(wrapper)) {
259
throw new WrongMethodTypeException();
260
}
261
MethodHandle filter = cachedReturnFilters.get(type);
262
if (filter == null) {
263
MethodHandle previous;
264
filter = privilegedLookup.findStatic(wrapper, "valueOf", MethodType.methodType(wrapper, type.parameterType(0))); //$NON-NLS-1$
265
if ((previous = cachedReturnFilters.putIfAbsent(type, filter)) != null) {
266
filter = previous;
267
}
268
}
269
if (type.returnType() != wrapper) {
270
filter = filter.cloneWithNewType(type);
271
}
272
return filter;
273
}
274
275
static MethodHandle getUnboxingReturnFilter(MethodType type, boolean isExplicitCast) throws IllegalAccessException, NoSuchMethodException {
276
Class<?> toUnbox = type.parameterType(0);
277
Class<?> returnType = type.returnType();
278
279
if (toUnbox.equals(Object.class)) {
280
String methodName;
281
if (isExplicitCast) {
282
methodName = "explicitObject2"; //$NON-NLS-1$
283
} else {
284
methodName = "object2"; //$NON-NLS-1$
285
}
286
methodName += MethodTypeHelper.getBytecodeStringName(returnType);
287
return privilegedLookup.findStatic(FilterHelpers.class, methodName, MethodType.methodType(returnType, Object.class));
288
289
} else if (toUnbox.equals(Number.class)) {
290
/* Widening conversions need to validate the conversion at runtime */
291
if (!isExplicitCast) {
292
if ((returnType != boolean.class) || (returnType != char.class)) {
293
return privilegedLookup.findStatic(FilterHelpers.class, "number2" + MethodTypeHelper.getBytecodeStringName(returnType), MethodType.methodType(returnType, Number.class)); //$NON-NLS-1$
294
}
295
} else {
296
/* special case these - can't be handled by the <type>Value() methods on Number */
297
if ((returnType == boolean.class) || (returnType == char.class)) {
298
String methodName = "explicitNumber2" + MethodTypeHelper.getBytecodeStringName(returnType); //$NON-NLS-1$
299
return privilegedLookup.findStatic(FilterHelpers.class, methodName, MethodType.methodType(returnType, Number.class));
300
}
301
String methodName = MethodTypeHelper.getBytecodeStringName(returnType) + "Value"; //$NON-NLS-1$
302
return privilegedLookup.findVirtual(Number.class, methodName, MethodType.methodType(returnType));
303
}
304
305
} else if (toUnbox.equals(Boolean.class)) {
306
/* Boolean can be unboxed but there are no widening conversions */
307
MethodHandle filter = privilegedLookup.findVirtual(Boolean.class, "booleanValue", MethodType.methodType(boolean.class)); //$NON-NLS-1$
308
if (returnType.equals(boolean.class)) {
309
return filter;
310
}
311
if (isExplicitCast) {
312
return MethodHandles.filterReturnValue(filter, getPrimitiveReturnFilter(MethodType.methodType(returnType, boolean.class), isExplicitCast));
313
}
314
315
} else if (toUnbox.equals(Character.class)) {
316
/* Character unboxes to char */
317
MethodHandle filter = privilegedLookup.findVirtual(Character.class, "charValue", MethodType.methodType(char.class)); //$NON-NLS-1$
318
if (returnType.equals(char.class)) {
319
return filter;
320
}
321
/* widen the return if possible */
322
return MethodHandles.filterReturnValue(filter, getPrimitiveReturnFilter(MethodType.methodType(returnType, char.class), isExplicitCast));
323
324
} else if (MethodTypeHelper.WRAPPER_SET.contains(toUnbox)) {
325
/* remaining wrappers may have widening conversions - can be handled by toUnbox#'type'Value() methods (ie: Number subclasses)*/
326
Class<?> unwrapped = MethodTypeHelper.unwrapPrimitive(toUnbox);
327
boolean justUnwrap = returnType.equals(unwrapped);
328
if (justUnwrap || isExplicitCast || checkIfWideningPrimitiveConversion(unwrapped, returnType)) {
329
330
if (isExplicitCast && !justUnwrap) {
331
/* Special case Boolean/Character --> (!boolean/!char) as it requires a two-step filter */
332
if ((returnType == char.class) || (returnType == boolean.class)) {
333
// get the unboxed version and filter with necessary conversion
334
MethodHandle unbox = privilegedLookup.findVirtual(toUnbox, unwrapped.getName()+"Value", MethodType.methodType(unwrapped)); //$NON-NLS-1$
335
MethodHandle filter = getPrimitiveReturnFilter(MethodType.methodType(returnType, unwrapped), isExplicitCast);
336
return MethodHandles.filterReturnValue(unbox, filter);
337
}
338
}
339
340
return privilegedLookup.findVirtual(toUnbox, returnType.getName()+"Value", MethodType.methodType(returnType)); //$NON-NLS-1$;
341
}
342
}
343
344
throw new WrongMethodTypeException();
345
}
346
347
/*
348
* object to object conversion: use Class#cast(Object)
349
*/
350
static MethodHandle getCastFilter(MethodType type, boolean isExplicitCast) throws IllegalAccessException, NoSuchMethodException{
351
Class<?> returnClass = type.returnType();
352
if (isExplicitCast && returnClass.isInterface()) {
353
// Interfaces are passed unchecked
354
MethodType filterType = MethodType.methodType(Object.class, Object.class);
355
return privilegedLookup.findStatic(FilterHelpers.class, "explicitCastInterfaceUnchecked", filterType); //$NON-NLS-1$
356
}
357
MethodHandleCache methodHandleCache = MethodHandleCache.getCache(returnClass);
358
return methodHandleCache.getClassCastHandle();
359
}
360
361
public static Object explicitCastInterfaceUnchecked(Object o) {
362
return o;
363
}
364
365
public static boolean explicitObject2Z(Object o) {
366
if (o == null) {
367
return false;
368
} else if (o instanceof Boolean) {
369
return ((Boolean)o).booleanValue();
370
} else if (o instanceof Character) {
371
return ((byte)(((Character)o).charValue()) & 1) == 1;
372
} else {
373
// assume number - will throw ClassCast if required
374
return (((Number)o).byteValue() & 1) == 1;
375
}
376
}
377
378
public static byte explicitObject2B(Object o) {
379
if (o == null) {
380
return 0;
381
} else if (o instanceof Boolean) {
382
return (byte)(((Boolean)o).booleanValue() ? 1 : 0);
383
} else if (o instanceof Character) {
384
return (byte)((Character)o).charValue();
385
} else {
386
// assume number - will throw ClassCast if required
387
return ((Number)o).byteValue();
388
}
389
}
390
public static short explicitObject2S(Object o) {
391
if (o == null) {
392
return 0;
393
} else if (o instanceof Boolean) {
394
return (short)(((Boolean)o).booleanValue() ? 1 : 0);
395
} else if (o instanceof Character) {
396
return (short)((Character)o).charValue();
397
} else {
398
// assume number - will throw ClassCast if required
399
return ((Number)o).shortValue();
400
}
401
}
402
public static char explicitObject2C(Object o) {
403
if (o == null) {
404
return 0;
405
} else if (o instanceof Boolean) {
406
return (char)(((Boolean)o).booleanValue() ? 1 : 0);
407
} else if (o instanceof Character) {
408
return ((Character)o).charValue();
409
} else {
410
// assume number - will throw ClassCast if required
411
return (char)((Number)o).intValue();
412
}
413
}
414
public static int explicitObject2I(Object o) {
415
if (o == null) {
416
return 0;
417
} else if (o instanceof Boolean) {
418
return ((Boolean)o).booleanValue() ? 1 : 0;
419
} else if (o instanceof Character) {
420
return ((Character)o).charValue();
421
} else {
422
// assume number - will throw ClassCast if required
423
return ((Number)o).intValue();
424
}
425
}
426
public static long explicitObject2J(Object o) {
427
if (o == null) {
428
return 0;
429
} else if (o instanceof Boolean) {
430
return ((Boolean)o).booleanValue() ? 1 : 0;
431
} else if (o instanceof Character) {
432
return ((Character)o).charValue();
433
} else {
434
// assume number - will throw ClassCast if required
435
return ((Number)o).longValue();
436
}
437
}
438
public static float explicitObject2F(Object o) {
439
if (o == null) {
440
return 0;
441
} else if (o instanceof Boolean) {
442
return ((Boolean)o).booleanValue() ? 1 : 0;
443
} else if (o instanceof Character) {
444
return ((Character)o).charValue();
445
} else {
446
// assume number - will throw ClassCast if required
447
return ((Number)o).floatValue();
448
}
449
}
450
public static double explicitObject2D(Object o) {
451
if (o == null) {
452
return 0;
453
} else if (o instanceof Boolean) {
454
return ((Boolean)o).booleanValue() ? 1 : 0;
455
} else if (o instanceof Character) {
456
return ((Character)o).charValue();
457
} else {
458
// assume number - will throw ClassCast if required
459
return ((Number)o).doubleValue();
460
}
461
}
462
463
public static boolean explicitNumber2Z(Number n) {
464
if (n == null) {
465
return false;
466
}
467
return (n.byteValue() & 1) == 1;
468
}
469
470
public static char explicitNumber2C(Number n) {
471
if (n == null) {
472
return 0;
473
}
474
return (char)n.intValue();
475
}
476
477
/* Move exception allocation out of line */
478
private static final ClassCastException newClassCastException() {
479
return new ClassCastException();
480
}
481
482
public static boolean object2Z(Object o) {
483
return ((Boolean)o).booleanValue();
484
}
485
public static char object2C(Object o) {
486
return ((Character)o).charValue();
487
}
488
public static byte object2B(Object o) {
489
return number2B((Number)o);
490
}
491
public static short object2S(Object o) {
492
return number2S((Number)o);
493
}
494
public static int object2I(Object o) {
495
o.getClass(); // implicit nullcheck
496
if (o instanceof Number) {
497
return number2I((Number) o);
498
} else if (o instanceof Character) {
499
return ((Character)o).charValue();
500
}
501
throw newClassCastException();
502
}
503
public static float object2F(Object o) {
504
o.getClass(); // implicit nullcheck
505
if (o instanceof Number) {
506
return number2F((Number) o);
507
} else if (o instanceof Character) {
508
return ((Character)o).charValue();
509
}
510
throw newClassCastException();
511
}
512
public static double object2D(Object o) {
513
o.getClass(); // implicit nullcheck
514
if (o instanceof Number) {
515
return number2D((Number) o);
516
} else if (o instanceof Character) {
517
return ((Character)o).charValue();
518
}
519
throw newClassCastException();
520
}
521
public static long object2J(Object o) {
522
o.getClass(); // implicit nullcheck
523
if (o instanceof Number) {
524
return number2J((Number)o);
525
} else if (o instanceof Character) {
526
return ((Character)o).charValue();
527
}
528
throw newClassCastException();
529
}
530
531
public static byte number2B(Number n) {
532
/* Number can be { Byte, Short, Integer, Long, Float, Double}
533
* Number -> byte:
534
* Byte -> byte
535
*/
536
return ((Byte)n).byteValue(); //Implicit nullcheck;
537
}
538
public static short number2S(Number n) {
539
/* Number can be { Byte, Short, Integer, Long, Float, Double}
540
* Number -> short:
541
* Byte -> byte -> short
542
* Short -> short
543
*/
544
if ((n instanceof Short) || (n instanceof Byte)) {
545
return n.shortValue();
546
}
547
n.getClass(); // implicit nullcheck.
548
throw newClassCastException();
549
}
550
public static int number2I(Number n) {
551
/* Number can be { Byte, Short, Integer, Long, Float, Double}
552
* Number -> int:
553
* Byte -> byte -> int
554
* Short -> short -> int
555
* Integer-> int
556
*/
557
if ((n instanceof Integer) || (n instanceof Byte) || (n instanceof Short)) {
558
return n.intValue();
559
}
560
n.getClass(); // implicit nullcheck.
561
throw newClassCastException();
562
}
563
public static long number2J(Number n) {
564
/* Number can be { Byte, Short, Integer, Long, Float, Double}
565
* Number -> long:
566
* Byte -> byte -> long
567
* Short -> short -> long
568
* Integer-> int -> long
569
* Long -> long
570
*/
571
if ((n instanceof Long) || (n instanceof Integer) || (n instanceof Byte) || (n instanceof Short)) {
572
return n.longValue();
573
}
574
n.getClass(); // implicit nullcheck.
575
throw newClassCastException();
576
}
577
578
public static float number2F(Number n) {
579
/* Number can be { Byte, Short, Integer, Long, Float, Double}
580
* Number -> float:
581
* Byte -> byte -> float
582
* Short -> short -> float
583
* Integer-> int -> float
584
* Long -> long -> float
585
* Float -> float
586
*/
587
if ((n instanceof Float) || (n instanceof Integer) || (n instanceof Long) || (n instanceof Byte) || (n instanceof Short)) {
588
return n.floatValue();
589
}
590
n.getClass(); // implicit nullcheck.
591
throw newClassCastException();
592
}
593
public static double number2D(Number n) {
594
/* Number can be { Byte, Short, Integer, Long, Float, Double}
595
* Number -> double:
596
* Byte -> byte -> double
597
* Short -> short -> double
598
* Integer-> int -> double
599
* Long -> long -> double
600
* Float -> float -> double
601
* Double -> double
602
*/
603
if ((n instanceof Double) || (n instanceof Float) || (n instanceof Integer) || (n instanceof Long) || (n instanceof Byte) || (n instanceof Short)) {
604
return n.doubleValue();
605
}
606
n.getClass(); // implicit nullcheck.
607
throw newClassCastException();
608
}
609
610
public static void popObject(Object o) { }
611
612
public static double V2D() { return 0; }
613
public static long V2J() { return 0; }
614
public static float V2F() { return 0; }
615
public static int V2I() { return 0; }
616
public static char V2C() { return 0; }
617
public static short V2S() { return 0; }
618
public static byte V2B() { return 0; }
619
public static boolean V2Z() { return false; }
620
public static Object V2object() { return null; }
621
622
public static double Z2D(boolean j) { return j ? 1 : 0; }
623
public static long Z2J(boolean j) { return j ? 1 : 0; }
624
public static float Z2F(boolean j) { return j ? 1 : 0; }
625
public static int Z2I(boolean j) { return j ? 1 : 0; }
626
public static char Z2C(boolean j) { return (char)(j ? 1 : 0); }
627
public static short Z2S(boolean j) { return (short)(j ? 1 : 0); }
628
public static byte Z2B(boolean j) { return (byte)(j ? 1 : 0); }
629
public static void Z2V(boolean j) { }
630
public static Object Z2object(boolean j) { return Boolean.valueOf(j); }
631
632
public static double B2D(byte j) { return j; }
633
public static long B2J(byte j) { return j; }
634
public static float B2F(byte j) { return j; }
635
public static int B2I(byte j) { return j; }
636
public static char B2C(byte j) { return (char)j; }
637
public static short B2S(byte j) { return j; }
638
public static boolean B2Z(byte j) { return (byte)(j & 1) == 1; }
639
public static void B2V(byte j) { }
640
public static Object B2object(byte j) { return Byte.valueOf(j); }
641
642
public static double S2D(short j) { return j; }
643
public static long S2J(short j) { return j; }
644
public static float S2F(short j) { return j; }
645
public static int S2I(short j) { return j; }
646
public static char S2C(short j) { return (char)j; }
647
public static byte S2B(short j) { return (byte)j; }
648
public static boolean S2Z(short j) { return (((byte)j) & 1) == 1; }
649
public static void S2V(short j) { }
650
public static Object S2object(short j) { return Short.valueOf(j); }
651
652
public static double C2D(char j) { return j; }
653
public static long C2J(char j) { return j; }
654
public static float C2F(char j) { return j; }
655
public static int C2I(char j) { return j; }
656
public static short C2S(char j) { return (short)j; }
657
public static byte C2B(char j) { return (byte)j; }
658
public static boolean C2Z(char j) { return (((byte)j) & 1) == 1; }
659
public static void C2V(char j) { }
660
public static Object C2object(char j) { return Character.valueOf(j); }
661
662
public static boolean I2Z(int i) {return (((byte)i) & 1) == 1; }
663
public static byte I2B(int i) { return (byte)i; }
664
public static short I2S(int i) { return (short)i; }
665
public static char I2C(int i) { return (char)i; }
666
public static float I2F(int i) { return i; }
667
public static long I2J(int i) { return i; }
668
public static double I2D(int i) { return i; }
669
public static void I2V(int j) { }
670
public static Object I2object(int j) { return Integer.valueOf(j); }
671
672
public static float J2F(long j) { return j; }
673
public static double J2D(long j) { return j; }
674
public static int J2I(long j) { return (int)j; }
675
public static char J2C(long j) { return (char)j; }
676
public static short J2S(long j) { return (short)j; }
677
public static byte J2B(long j) { return (byte)j; }
678
public static boolean J2Z(long j) { return (((byte)j) & 1) == 1; }
679
public static void J2V(long j) { }
680
public static Object J2object(long j) { return Long.valueOf(j); }
681
682
public static long F2J(float j) { return (long)j; }
683
public static double F2D(float j) { return j; }
684
public static int F2I(float j) { return (int)j; }
685
public static char F2C(float j) { return (char)j; }
686
public static short F2S(float j) { return (short)j; }
687
public static byte F2B(float j) { return (byte)j; }
688
public static boolean F2Z(float j) { return (((byte)j) & 1) == 1; }
689
public static void F2V(float j) { }
690
public static Object F2object(float j) { return Float.valueOf(j); }
691
692
public static float D2F(double j) { return (float) j; }
693
public static long D2J(double j) { return (long) j; }
694
public static int D2I(double j) { return (int)j; }
695
public static char D2C(double j) { return (char)j; }
696
public static short D2S(double j) { return (short)j; }
697
public static byte D2B(double j) { return (byte)j; }
698
public static boolean D2Z(double j) { return (((byte)j) & 1) == 1; }
699
public static void D2V(double j) { }
700
public static Object D2object(double j) { return Double.valueOf(j); }
701
702
static void load(){}
703
}
704
705
/*[IF JAVA_SPEC_VERSION >= 15]*/
706
@Override
707
boolean addRelatedMHs(List<MethodHandle> relatedMHs) {
708
relatedMHs.add(next);
709
return true;
710
}
711
/*[ENDIF] JAVA_SPEC_VERSION >= 15 */
712
713
// {{{ JIT support
714
static { FilterHelpers.load(); } // JIT will need FilterHelpers loaded to compile thunks
715
// }}} JIT support
716
717
final void compareWithConvert(ConvertHandle left, Comparator c) {
718
c.compareChildHandle(left.next, this.next);
719
}
720
}
721
722