Top Description Inners Fields Constructors Methods
org.codehaus.groovy.vmplugin.v9

public Class Java9

extends Java8
Class Inheritance
Imports
groovy.lang.GroovyClassLoader, .GroovyRuntimeException, .MetaClass, .MetaMethod, org.codehaus.groovy.GroovyBugError, org.codehaus.groovy.reflection.CachedClass, .CachedMethod, .ReflectionUtils, org.codehaus.groovy.runtime.DefaultGroovyMethods, org.codehaus.groovy.vmplugin.v8.Java8, java.lang.invoke.MethodHandle, .MethodHandles, java.lang.module.ModuleDescriptor, .ModuleFinder, .ModuleReference, java.lang.reflect.AccessibleObject, .Constructor, .InvocationHandler, .InvocationTargetException, .Member, .Method, .Modifier, .Proxy, java.math.BigInteger, java.net.URI, java.util.ArrayList, .Arrays, .HashMap, .HashSet, .LinkedHashMap, .LinkedList, .List, .Map, .Optional, .Set, java.util.concurrent.ConcurrentHashMap, java.util.logging.Level, .Logger, java.util.stream.Collectors

Additional Java 9 based functions will be added here as needed.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private static final Map<String, Set<String>>
private static final Map<String, Set<String>>
private static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
checkAccessible(final Class<?>
callerClass the callerClass to invoke setAccessible
accessingClass
,
final Class<?>
the type of member owner
declaringClass
,
final int
modifiers of member
memberModifiers
,
final boolean
whether to allow illegal access
allowIllegalAccess
)

Overrides org.codehaus.groovy.vmplugin.v8.Java8.checkAccessible.

Implements org.codehaus.groovy.vmplugin.VMPlugin.checkAccessible.

check whether the member can be accessed or not
public boolean

Returns:

the check result
checkCanSetAccessible
(AccessibleObject
the accessible object to check
accessibleObject
,
Class<?>
the callerClass to invoke setAccessible
callerClass
)

Overrides org.codehaus.groovy.vmplugin.v8.Java8.checkCanSetAccessible.

Implements org.codehaus.groovy.vmplugin.VMPlugin.checkCanSetAccessible.

This method may be used by a caller in class C to check whether to enable access to a member of declaring class D successfully if Java8#checkCanSetAccessible(java.lang.reflect.AccessibleObject, java.lang.Class) returns true and any of the following hold:

1) C and D are in the same module.

private static Set<String>
private static Map<String, Set<String>>
doFindClasses(URI uri, String packageName, List<String> defaultPackageNames)

private CachedMethod
doTransformMetaMethod(MetaClass metaClass, CachedMethod metaMethod, Class<?> caller)

private static Set<String>
private static List<Class<?>>
private Optional<CachedMethod>
getAccessibleMetaMethod(CachedMethod metaMethod, Class<?>[] params, Class<?> caller, Class<?> sc, boolean declared)

public Map<String, Set<String>>
getDefaultImportClasses(String[]
the default import package names, e.g. java.lang.
packageNames
)

Overrides default org.codehaus.groovy.vmplugin.VMPlugin.getDefaultImportClasses.

Returns the default import classes: class name -> the relevant package names
public Object
getInvokeSpecialHandle(final Method method, final Object receiver)

Overrides org.codehaus.groovy.vmplugin.v8.Java8.getInvokeSpecialHandle.

Implements org.codehaus.groovy.vmplugin.VMPlugin.getInvokeSpecialHandle.

Returns a handle with bound receiver to invokeSpecial the given method.
private static List<CachedMethod>
getMetaMethods(CachedMethod metaMethod, Class<?>[] params, Class<?> sc, boolean declared)

private CachedMethod
getOrTransformMetaMethod(MetaClass metaClass, Class<?> caller, CachedMethod cachedMethod)

public int
private static boolean
isExported(final ModuleDescriptor descriptor, final String pn)

private static boolean
isOpen(final ModuleDescriptor descriptor, final String pn)

private static String[]
public static MethodHandles.Lookup
private static CachedMethod
public MetaMethod
transformMetaMethod(MetaClass
meta class
metaClass
,
MetaMethod
the original meta method
metaMethod
,
Class<?>
caller class, whose method sets accessible for methods
caller
)

Overrides org.codehaus.groovy.vmplugin.v8.Java8.transformMetaMethod.

Implements org.codehaus.groovy.vmplugin.VMPlugin.transformMetaMethod.

transform meta method
public boolean
trySetAccessible(AccessibleObject
the accessible object
ao
)

Overrides org.codehaus.groovy.vmplugin.v8.Java8.trySetAccessible.

Implements org.codehaus.groovy.vmplugin.VMPlugin.trySetAccessible.

Set the accessible flag for this reflected object to true if possible.
Inherited from org.codehaus.groovy.vmplugin.v8.Java8:
configureAnnotationconfigureAnnotationNodeFromDefinitionconfigureClassNodeconfigureTypeVariableDefinitionconfigureTypeVariableReferencefillParameterNamesgetElementCodegetPluginDefaultGroovyMethodsgetPluginStaticGroovyMethodsinvalidateCallSitesinvokeHandlemakeParameterprocessParameterssetAdditionalClassInformationtransformMetaMethod

Field Detail

CONCEALED_PACKAGES_TO_OPENback to summary
private static final Map<String, Set<String>> CONCEALED_PACKAGES_TO_OPEN
EXPORTED_PACKAGES_TO_OPENback to summary
private static final Map<String, Set<String>> EXPORTED_PACKAGES_TO_OPEN
MULTIPLYback to summary
private static final String MULTIPLY

Constructor Detail

Java9back to summary
public Java9()

Method Detail

checkAccessibleback to summary
public boolean checkAccessible(final Class<?> accessingClass, final Class<?> declaringClass, final int memberModifiers, final boolean allowIllegalAccess)

Overrides org.codehaus.groovy.vmplugin.v8.Java8.checkAccessible.

Implements org.codehaus.groovy.vmplugin.VMPlugin.checkAccessible.

Doc from org.codehaus.groovy.vmplugin.VMPlugin.checkAccessible.

check whether the member can be accessed or not

Parameters
accessingClass:Class<?>

callerClass the callerClass to invoke setAccessible

declaringClass:Class<?>

the type of member owner

memberModifiers:int

modifiers of member

allowIllegalAccess:boolean

whether to allow illegal access

Returns:boolean

the result of checking

Annotations
@Override
checkCanSetAccessibleback to summary
public boolean checkCanSetAccessible(AccessibleObject accessibleObject, Class<?> callerClass)

Overrides org.codehaus.groovy.vmplugin.v8.Java8.checkCanSetAccessible.

Implements org.codehaus.groovy.vmplugin.VMPlugin.checkCanSetAccessible.

This method may be used by a caller in class C to check whether to enable access to a member of declaring class D successfully if Java8#checkCanSetAccessible(java.lang.reflect.AccessibleObject, java.lang.Class) returns true and any of the following hold:

1) C and D are in the same module. 2) The member is public and D is public in a package that the module containing D exports to at least the module containing C. 3) The member is protected static, D is public in a package that the module containing D exports to at least the module containing C, and C is a subclass of D. 4) D is in a package that the module containing D opens to at least the module containing C. All packages in unnamed and open modules are open to all modules and so this method always succeeds when D is in an unnamed or open module.

Parameters
accessibleObject:AccessibleObject

the accessible object to check

callerClass:Class<?>

the callerClass to invoke setAccessible

Returns:boolean

the check result

concealedPackageListback to summary
private static Set<String> concealedPackageList(final Module module)
doFindClassesback to summary
private static Map<String, Set<String>> doFindClasses(URI uri, String packageName, List<String> defaultPackageNames)
doTransformMetaMethodback to summary
private CachedMethod doTransformMetaMethod(MetaClass metaClass, CachedMethod metaMethod, Class<?> caller)
exportedPackageListback to summary
private static Set<String> exportedPackageList(final Module module)
findSuperclassesback to summary
private static List<Class<?>> findSuperclasses(Class<?> clazz)
getAccessibleMetaMethodback to summary
private Optional<CachedMethod> getAccessibleMetaMethod(CachedMethod metaMethod, Class<?>[] params, Class<?> caller, Class<?> sc, boolean declared)
getDefaultImportClassesback to summary
public Map<String, Set<String>> getDefaultImportClasses(String[] packageNames)

Overrides default org.codehaus.groovy.vmplugin.VMPlugin.getDefaultImportClasses.

Doc from org.codehaus.groovy.vmplugin.VMPlugin.getDefaultImportClasses.

Returns the default import classes: class name -> the relevant package names

Parameters
packageNames:String[]

the default import package names, e.g. java.lang.

Returns:Map<String, Set<String>>

the default import classes

Annotations
@Override
getInvokeSpecialHandleback to summary
public Object getInvokeSpecialHandle(final Method method, final Object receiver)

Overrides org.codehaus.groovy.vmplugin.v8.Java8.getInvokeSpecialHandle.

Implements org.codehaus.groovy.vmplugin.VMPlugin.getInvokeSpecialHandle.

Doc from org.codehaus.groovy.vmplugin.VMPlugin.getInvokeSpecialHandle.

Returns a handle with bound receiver to invokeSpecial the given method. This method will require at least Java 7, but since the source has to compile on older Java versions as well it is not marked to return a MethodHandle and uses Object instead

Returns:Object

null in case of jdk<7, otherwise a handle that takes the method call arguments for the invokespecial call

Annotations
@Override
getMetaMethodsback to summary
private static List<CachedMethod> getMetaMethods(CachedMethod metaMethod, Class<?>[] params, Class<?> sc, boolean declared)
getOrTransformMetaMethodback to summary
private CachedMethod getOrTransformMetaMethod(MetaClass metaClass, Class<?> caller, CachedMethod cachedMethod)
getVersionback to summary
public int getVersion()

Overrides org.codehaus.groovy.vmplugin.v8.Java8.getVersion.

Implements org.codehaus.groovy.vmplugin.VMPlugin.getVersion.

Doc from org.codehaus.groovy.vmplugin.VMPlugin.getVersion.

Gives the version the plugin is made for

Returns:int

7 for jdk7, 8 for jdk8, 9 for jdk9 or higher

Annotations
@Override
isExportedback to summary
private static boolean isExported(final ModuleDescriptor descriptor, final String pn)
isOpenback to summary
private static boolean isOpen(final ModuleDescriptor descriptor, final String pn)
JAVA8_PACKAGESback to summary
private static String[] JAVA8_PACKAGES()
ofback to summary
public static MethodHandles.Lookup of(final Class<?> targetClass)

Hides org.codehaus.groovy.vmplugin.v8.Java8.of.

transformBigIntegerMetaMethodback to summary
private static CachedMethod transformBigIntegerMetaMethod(CachedMethod metaMethod, Class<?>[] params)
transformMetaMethodback to summary
public MetaMethod transformMetaMethod(MetaClass metaClass, MetaMethod metaMethod, Class<?> caller)

Overrides org.codehaus.groovy.vmplugin.v8.Java8.transformMetaMethod.

Implements org.codehaus.groovy.vmplugin.VMPlugin.transformMetaMethod.

Doc from org.codehaus.groovy.vmplugin.VMPlugin.transformMetaMethod.

transform meta method

Parameters
metaClass:MetaClass

meta class

metaMethod:MetaMethod

the original meta method

caller:Class<?>

caller class, whose method sets accessible for methods

Returns:MetaMethod

the transformed meta method

Annotations
@Override
trySetAccessibleback to summary
public boolean trySetAccessible(AccessibleObject ao)

Overrides org.codehaus.groovy.vmplugin.v8.Java8.trySetAccessible.

Implements org.codehaus.groovy.vmplugin.VMPlugin.trySetAccessible.

Doc from org.codehaus.groovy.vmplugin.VMPlugin.trySetAccessible.

Set the accessible flag for this reflected object to true if possible.

Parameters
ao:AccessibleObject

the accessible object

Returns:boolean

true if the accessible flag is set to true; false if access cannot be enabled.

Annotations
@Override
org.codehaus.groovy.vmplugin.v9 back to summary

private Class Java9.BigIntegerMultiplyMethodHolder

extends Object
Class Inheritance
  • java.lang.Object
  • org.codehaus.groovy.vmplugin.v9.Java9.BigIntegerMultiplyMethodHolder

Field Summary

Modifier and TypeField and Description
private static final Method

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

MULTIPLY_METHODback to summary
private static final Method MULTIPLY_METHOD

Constructor Detail

BigIntegerMultiplyMethodHolderback to summary
private BigIntegerMultiplyMethodHolder()
org.codehaus.groovy.vmplugin.v9 back to summary

private Class Java9.LookupHolder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final Constructor<MethodHandles.Lookup>
private static final Method

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOOKUP_Constructorback to summary
private static final Constructor<MethodHandles.Lookup> LOOKUP_Constructor
PRIVATE_LOOKUPback to summary
private static final Method PRIVATE_LOOKUP

Constructor Detail

LookupHolderback to summary
private LookupHolder()