APIdia Launch Partner
Top Description Constructors Methods
sun.invoke.util

public Class VerifyType

extends Object
Class Inheritance
Imports
java.lang.invoke.MethodType

This class centralizes information about the JVM verifier and its requirements about type correctness.
Author
jrose

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static boolean

Returns:

whether the retyping can be done without motion or reformatting
isNullConversion
(Class<?>
the type of a stacked value
src
,
Class<?>
the type by which we'd like to treat it
dst
,
boolean
if false, we treat any interface as if it were Object
keepInterfaces
)

True if a value can be stacked as the source type and unstacked as the destination type, without violating the JVM's type consistency.

public static boolean

Returns:

whether the retyping can be done without motion or reformatting
isNullConversion
(MethodType
the type of call being made
call
,
MethodType
the type of the method handle receiving the call
recv
,
boolean keepInterfaces)

True if a method handle can receive a call under a slightly different method type, without moving or reformatting any stack elements.

public static boolean
isNullType(Class<?> type)

Is the given type java.lang.Null or an equivalent null-only type?

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

VerifyTypeback to summary
private VerifyType()

Method Detail

isNullConversionback to summary
public static boolean isNullConversion(Class<?> src, Class<?> dst, boolean keepInterfaces)

True if a value can be stacked as the source type and unstacked as the destination type, without violating the JVM's type consistency.

If both types are references, we apply the verifier's subclass check (or subtyping, if keepInterfaces). If the src type is a type guaranteed to be null (Void) it can be converted to any other reference type.

If both types are primitives, we apply the verifier's primitive conversions. These do not include Java conversions such as long to double, since those require computation and (in general) stack depth changes. But very simple 32-bit viewing changes, such as byte to int, are null conversions, because they do not require any computation. These conversions are from any type to a wider type up to 32 bits, as long as the conversion is not signed to unsigned (byte to char).

The primitive type 'void' does not interconvert with any other type, even though it is legal to drop any type from the stack and "return void". The stack effects, though are different between void and any other type, so it is safer to report a non-trivial conversion.

Parameters
src:Class<?>

the type of a stacked value

dst:Class<?>

the type by which we'd like to treat it

keepInterfaces:boolean

if false, we treat any interface as if it were Object

Returns:boolean

whether the retyping can be done without motion or reformatting

isNullConversionback to summary
public static boolean isNullConversion(MethodType call, MethodType recv, boolean keepInterfaces)

True if a method handle can receive a call under a slightly different method type, without moving or reformatting any stack elements.

Parameters
call:MethodType

the type of call being made

recv:MethodType

the type of the method handle receiving the call

Returns:boolean

whether the retyping can be done without motion or reformatting

isNullTypeback to summary
public static boolean isNullType(Class<?> type)

Is the given type java.lang.Null or an equivalent null-only type?