Top Description Constructors Methods
jdk.dynalink.internal

public Class InternalTypeUtilities

extends Object
Class Inheritance
Imports
java.util.ArrayList, .HashSet, .Iterator, .List, .Set, jdk.dynalink.linker.support.TypeUtilities

Various static utility methods for testing type relationships; internal to Dynalink.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static boolean

Returns:

true if either c1 is assignable from c2 or c2 is assignable from c1.
areAssignable
(final Class<?>
one type
c1
,
final Class<?>
another type
c2
)

Returns true if either of the types is assignable from the other.

public static boolean

Returns:

true if it is safe to strongly reference the class from referred in referred.
canReferenceDirectly
(final ClassLoader
the referrer class loader.
referrerLoader
,
final ClassLoader
the referred class loader
referredLoader
)

Return true if it is safe to strongly reference a class from the referred class loader from a class associated with the referring class loader without risking a class loader memory leak.

private static void
collectAssignables(final Class<?> c1, final Class<?> c2, final Set<Class<?>> s)

private static Set<Class<?>>
getAssignables(final Class<?> c1, final Class<?> c2)

public static Class<?>

Returns:

their most common superclass or superinterface for purposes of lossless conversions. If they have several unrelated superinterfaces as their most specific common type, or the types themselves are completely unrelated interfaces, java.lang.Object is returned.
getCommonLosslessConversionType
(final Class<?>
one type
c1
,
final Class<?>
another type
c2
)

Given two types represented by c1 and c2, returns a type that is their most specific common supertype for purposes of lossless conversions.

private static Class<?>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

InternalTypeUtilitiesback to summary
private InternalTypeUtilities()

Method Detail

areAssignableback to summary
public static boolean areAssignable(final Class<?> c1, final Class<?> c2)

Returns true if either of the types is assignable from the other.

Parameters
c1:Class<?>

one type

c2:Class<?>

another type

Returns:boolean

true if either c1 is assignable from c2 or c2 is assignable from c1.

canReferenceDirectlyback to summary
public static boolean canReferenceDirectly(final ClassLoader referrerLoader, final ClassLoader referredLoader)

Return true if it is safe to strongly reference a class from the referred class loader from a class associated with the referring class loader without risking a class loader memory leak. Generally, it is only safe to reference classes from the same or ancestor class loader. null indicates the system class loader; classes from it can always be directly referenced, and it can only directly reference classes from itself. This method can be used by language runtimes to ensure they are using weak references in their linkages when they need to link to methods in unrelated class loaders.

Parameters
referrerLoader:ClassLoader

the referrer class loader.

referredLoader:ClassLoader

the referred class loader

Returns:boolean

true if it is safe to strongly reference the class from referred in referred.

Exceptions
SecurityException:
if the caller does not have the RuntimePermission("getClassLoader") permission and the method needs to traverse the parent class loader chain.
collectAssignablesback to summary
private static void collectAssignables(final Class<?> c1, final Class<?> c2, final Set<Class<?>> s)
getAssignablesback to summary
private static Set<Class<?>> getAssignables(final Class<?> c1, final Class<?> c2)
getCommonLosslessConversionTypeback to summary
public static Class<?> getCommonLosslessConversionType(final Class<?> c1, final Class<?> c2)

Given two types represented by c1 and c2, returns a type that is their most specific common supertype for purposes of lossless conversions.

Parameters
c1:Class<?>

one type

c2:Class<?>

another type

Returns:Class<?>

their most common superclass or superinterface for purposes of lossless conversions. If they have several unrelated superinterfaces as their most specific common type, or the types themselves are completely unrelated interfaces, java.lang.Object is returned.

getMostSpecificCommonTypeUnequalNonprimitivesback to summary
private static Class<?> getMostSpecificCommonTypeUnequalNonprimitives(final Class<?> c1, final Class<?> c2)