Top Description Fields Constructors Methods
org.codehaus.groovy.vmplugin.v5

public Class Java5

extends Object
implements VMPlugin
Class Inheritance
All Implemented Interfaces
org.codehaus.groovy.vmplugin.VMPlugin
Known Direct Subclasses
org.codehaus.groovy.vmplugin.v6.Java6
Annotations
@Deprecated
Imports
groovy.lang.MetaClass, .MetaMethod, org.codehaus.groovy.GroovyBugError, org.codehaus.groovy.ast.AnnotatedNode, .AnnotationNode, .ClassHelper, .ClassNode, .CompileUnit, .ConstructorNode, .FieldNode, .GenericsType, .MethodNode, .PackageNode, .Parameter, org.codehaus.groovy.ast.expr.ClassExpression, .ConstantExpression, .Expression, .ListExpression, .PropertyExpression, org.codehaus.groovy.ast.stmt.ReturnStatement, org.codehaus.groovy.vmplugin.VMPlugin, .VMPluginFactory, java.lang.annotation.Annotation, .ElementType, .Retention, .RetentionPolicy, .Target, java.lang.reflect.AccessibleObject, .Array, .Constructor, .Field, .GenericArrayType, .InvocationTargetException, .MalformedParameterizedTypeException, .Member, .Method, .ParameterizedType, .ReflectPermission, .Type, .TypeVariable, .WildcardType, java.security.Permission, java.util.List

Deprecated

java 5 based functions

Field Summary

Modifier and TypeField and Description
private static final Permission
private static final Annotation[]
private static final Class<T>[]
private static final Method[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

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

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
)

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

The following scenarios can not set accessible, i.e. the return value is false 1) SecurityException occurred 2) the accessible object is a Constructor object for the Class class
public void
private void
public void
public void
private static ClassNode
public void
private ClassNode
private ClassNode
private ClassNode
private GenericsType[]
private ClassNode[]
private GenericsType[]
private GenericsType
public static GenericsType
public static ClassNode
private ClassNode
configureWildcardType(final WildcardType wildcardType)

protected void
fillParameterNames(String[] names, Member member)

private Annotation[][]

Returns:

array of arrays containing the annotations on the parameters of the given Constructor
getConstructorParameterAnnotations
(Constructor<?>
the Constructor for which to return parameter annotations
constructor
)

Synthetic parameters such as those added for inner class constructors may not be included in the parameter annotations array.

protected int
public Object
getInvokeSpecialHandle(Method m, Object receiver)

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

Returns a handle with bound receiver to invokeSpecial the given method.
public Class<T>[]
public Class<T>[]
public int
getVersion()

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

Gives the version the plugin is made for
public void
public Object
invokeHandle(Object
the handle
handle
,
Object[]
arguments for the method call, can be empty but not null
args
)

Implements org.codehaus.groovy.vmplugin.VMPlugin.invokeHandle.

Invokes a handle produced by #getInvokeSpecialdHandle
private ClassNode
private ClassNode[]
makeClassNodes(CompileUnit cu, Type[] types, Class<T>[] cls)

private void
makeInterfaceTypes(CompileUnit cu, ClassNode classNode, Class<T> clazz)

protected Parameter
makeParameter(CompileUnit cu, Type type, Class<T> cl, Annotation[] annotations, String name)

Deprecated
private Parameter[]
makeParameters(CompileUnit cu, Type[] types, Class<T>[] cls, Annotation[][] parameterAnnotations, Member member)

protected Parameter[]
processParameters(CompileUnit compileUnit, Method m)

Deprecated
public void
private void
private void
private static void
private static void
public MetaMethod
transformMetaMethod(MetaClass
meta class
metaClass
,
MetaMethod
the original meta method
metaMethod
,
Class<?>
caller class, whose method sets accessible for methods
caller
)

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

transform meta method
public MetaMethod
transformMetaMethod(MetaClass
meta class
metaClass
,
MetaMethod
the original meta method
metaMethod
)

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

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

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

Set the accessible flag for this reflected object to true if possible.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ACCESS_PERMISSIONback to summary
private static final Permission ACCESS_PERMISSION
EMPTY_ANNOTATION_ARRAYback to summary
private static final Annotation[] EMPTY_ANNOTATION_ARRAY
EMPTY_CLASS_ARRAYback to summary
private static final Class<T>[] EMPTY_CLASS_ARRAY
EMPTY_METHOD_ARRAYback to summary
private static final Method[] EMPTY_METHOD_ARRAY

Constructor Detail

Java5back to summary
public Java5()

Method Detail

annotationValueToExpressionback to summary
private Expression annotationValueToExpression(Object value)
checkAccessibleback to summary
public boolean checkAccessible(Class<?> callerClass, Class<?> declaringClass, int memberModifiers, boolean allowIllegalAccess)

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
callerClass: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)

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

The following scenarios can not set accessible, i.e. the return value is false 1) SecurityException occurred 2) the accessible object is a Constructor object for the Class class

Parameters
accessibleObject:AccessibleObject

the accessible object to check

callerClass:Class<?>

the callerClass to invoke setAccessible

Returns:boolean

the check result

Annotations
@Override
configureAnnotationback to summary
public void configureAnnotation(AnnotationNode node)

Implements org.codehaus.groovy.vmplugin.VMPlugin.configureAnnotation.

configureAnnotationback to summary
private void configureAnnotation(AnnotationNode node, Annotation annotation)
configureAnnotationFromDefinitionback to summary
public void configureAnnotationFromDefinition(AnnotationNode definition, AnnotationNode root)

Deprecated

Annotations
@Deprecated
configureAnnotationNodeFromDefinitionback to summary
public void configureAnnotationNodeFromDefinition(AnnotationNode definition, AnnotationNode root)

Implements org.codehaus.groovy.vmplugin.VMPlugin.configureAnnotationNodeFromDefinition.

configureClassback to summary
private static ClassNode configureClass(Class<T> c)
configureClassNodeback to summary
public void configureClassNode(CompileUnit compileUnit, ClassNode classNode)

Implements org.codehaus.groovy.vmplugin.VMPlugin.configureClassNode.

configureGenericArrayback to summary
private ClassNode configureGenericArray(GenericArrayType genericArrayType)
configureParameterizedTypeback to summary
private ClassNode configureParameterizedType(ParameterizedType parameterizedType)
configureTypeback to summary
private ClassNode configureType(Type type)
configureTypeArgumentsback to summary
private GenericsType[] configureTypeArguments(Type[] ta)
configureTypesback to summary
private ClassNode[] configureTypes(Type[] types)
configureTypeVariableback to summary
private GenericsType[] configureTypeVariable(TypeVariable<D extends GenericDeclaration>[] tvs)
configureTypeVariableDefinitionback to summary
private GenericsType configureTypeVariableDefinition(TypeVariable<D extends GenericDeclaration> tv)
configureTypeVariableDefinitionback to summary
public static GenericsType configureTypeVariableDefinition(ClassNode base, ClassNode[] cBounds)
configureTypeVariableReferenceback to summary
public static ClassNode configureTypeVariableReference(String name)
configureWildcardTypeback to summary
private ClassNode configureWildcardType(final WildcardType wildcardType)
fillParameterNamesback to summary
protected void fillParameterNames(String[] names, Member member)
getConstructorParameterAnnotationsback to summary
private Annotation[][] getConstructorParameterAnnotations(Constructor<?> constructor)

Synthetic parameters such as those added for inner class constructors may not be included in the parameter annotations array. This is the case when at least one parameter of an inner class constructor has an annotation with a RUNTIME retention (this occurs for JDK8 and below). This method will normalize the annotations array so that it contains the same number of elements as the array returned from Constructor#getParameterTypes(). If adjustment is required, the adjusted array will be prepended with a zero-length element. If no adjustment is required, the original array from Constructor#getParameterAnnotations() will be returned.

Parameters
constructor:Constructor<?>

the Constructor for which to return parameter annotations

Returns:Annotation[][]

array of arrays containing the annotations on the parameters of the given Constructor

getElementCodeback to summary
protected int getElementCode(ElementType value)
getInvokeSpecialHandleback to summary
public Object getInvokeSpecialHandle(Method m, Object receiver)

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
getPluginDefaultGroovyMethodsback to summary
public Class<T>[] getPluginDefaultGroovyMethods()

Implements org.codehaus.groovy.vmplugin.VMPlugin.getPluginDefaultGroovyMethods.

getPluginStaticGroovyMethodsback to summary
public Class<T>[] getPluginStaticGroovyMethods()

Implements org.codehaus.groovy.vmplugin.VMPlugin.getPluginStaticGroovyMethods.

getVersionback to summary
public int 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
invalidateCallSitesback to summary
public void invalidateCallSites()

Implements org.codehaus.groovy.vmplugin.VMPlugin.invalidateCallSites.

invokeHandleback to summary
public Object invokeHandle(Object handle, Object[] args) throws Throwable

Implements org.codehaus.groovy.vmplugin.VMPlugin.invokeHandle.

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

Invokes a handle produced by #getInvokeSpecialdHandle

Parameters
handle:Object

the handle

args:Object[]

arguments for the method call, can be empty but not null

Returns:Object

the result of the method call

Annotations
@Override
makeClassNodeback to summary
private ClassNode makeClassNode(CompileUnit cu, Type t, Class<T> c)
makeClassNodesback to summary
private ClassNode[] makeClassNodes(CompileUnit cu, Type[] types, Class<T>[] cls)
makeInterfaceTypesback to summary
private void makeInterfaceTypes(CompileUnit cu, ClassNode classNode, Class<T> clazz)
makeParameterback to summary
protected Parameter makeParameter(CompileUnit cu, Type type, Class<T> cl, Annotation[] annotations, String name)

Deprecated

Annotations
@Deprecated
makeParametersback to summary
private Parameter[] makeParameters(CompileUnit cu, Type[] types, Class<T>[] cls, Annotation[][] parameterAnnotations, Member member)
processParametersback to summary
protected Parameter[] processParameters(CompileUnit compileUnit, Method m)

Deprecated

Annotations
@Deprecated
setAdditionalClassInformationback to summary
public void setAdditionalClassInformation(ClassNode cn)

Implements org.codehaus.groovy.vmplugin.VMPlugin.setAdditionalClassInformation.

setAnnotationMetaDataback to summary
private void setAnnotationMetaData(Annotation[] annotations, AnnotatedNode an)
setGenericsTypesback to summary
private void setGenericsTypes(ClassNode cn)
setMethodDefaultValueback to summary
private static void setMethodDefaultValue(MethodNode mn, Method m)
setRetentionPolicyback to summary
private static void setRetentionPolicy(RetentionPolicy value, AnnotationNode node)
transformMetaMethodback to summary
public MetaMethod transformMetaMethod(MetaClass metaClass, MetaMethod metaMethod, Class<?> caller)

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
transformMetaMethodback to summary
public MetaMethod transformMetaMethod(MetaClass metaClass, MetaMethod metaMethod)

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

Returns:MetaMethod

the transformed meta method

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

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