Package org.jboss.byteman.jigsaw
Class JigsawAccessEnabler
- java.lang.Object
-
- org.jboss.byteman.jigsaw.JigsawAccessEnabler
-
- All Implemented Interfaces:
AccessEnabler
public class JigsawAccessEnabler extends Object implements AccessEnabler
Implementation of AccessEnabler for use in a Jigsaw enabled JDK runtime n.b. this class is only exemplary and must not be compiled into the Byteman jar. It is supposed to be generated at runtime and installed by the classloader for the org.jboss.byteman.jigsaw module created by the LayerFactory.
-
-
Field Summary
Fields Modifier and Type Field Description boolean
DEBUG
flag to allow debug trace to be generated
-
Constructor Summary
Constructors Constructor Description JigsawAccessEnabler(Instrumentation inst)
create an AccessEnabler that is capable of ensuring access when running inside a Jigsaw enabled JDK.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccessibleConstructorInvoker
createConstructorInvoker(Constructor constructor)
AccessibleFieldGetter
createFieldGetter(Field field)
AccessibleFieldSetter
createFieldSetter(Field field)
AccessibleMethodInvoker
createMethodInvoker(Method method)
void
ensureAccess(AccessibleObject accessible)
ensure that accessible can be accessed using reflection or a method handleboolean
requiresAccess(Class<?> klazz)
test whether reference to the class from a classpath class requires the use of reflection or a method handle and possibly also module jiggery-pokery.boolean
requiresAccess(AccessibleObject accessible)
test whether access to the accessible from a classpath class requires the use of reflection or a method handle and possibly also module jiggery-pokery.
-
-
-
Constructor Detail
-
JigsawAccessEnabler
public JigsawAccessEnabler(Instrumentation inst)
create an AccessEnabler that is capable of ensuring access when running inside a Jigsaw enabled JDK. This constructor throws an exception if it is not provided with a non-null Instrumentation instance as argument, effectively limiting the use of this class to JVMTI agents.- Parameters:
inst
- the instrumentation instance we need to use to enable access
-
-
Method Detail
-
requiresAccess
public boolean requiresAccess(Class<?> klazz)
test whether reference to the class from a classpath class requires the use of reflection or a method handle and possibly also module jiggery-pokery.- Specified by:
requiresAccess
in interfaceAccessEnabler
- Parameters:
klazz
- the class to be checked- Returns:
- true if reference to the class from a classpath class requires the use of reflection or a method handle and possibly module jiggery-pokery otherwise false.
-
requiresAccess
public boolean requiresAccess(AccessibleObject accessible)
Description copied from interface:AccessEnabler
test whether access to the accessible from a classpath class requires the use of reflection or a method handle and possibly also module jiggery-pokery.- Specified by:
requiresAccess
in interfaceAccessEnabler
- Parameters:
accessible
- this must be a Member- Returns:
- true if access requires reflection or a method handle and possibly also module jiggery-pokery otherwise false.
-
ensureAccess
public void ensureAccess(AccessibleObject accessible)
ensure that accessible can be accessed using reflection or a method handle- Specified by:
ensureAccess
in interfaceAccessEnabler
- Parameters:
accessible
- this must be a Member
-
createMethodInvoker
public AccessibleMethodInvoker createMethodInvoker(Method method)
- Specified by:
createMethodInvoker
in interfaceAccessEnabler
-
createConstructorInvoker
public AccessibleConstructorInvoker createConstructorInvoker(Constructor constructor)
- Specified by:
createConstructorInvoker
in interfaceAccessEnabler
-
createFieldGetter
public AccessibleFieldGetter createFieldGetter(Field field)
- Specified by:
createFieldGetter
in interfaceAccessEnabler
-
createFieldSetter
public AccessibleFieldSetter createFieldSetter(Field field)
- Specified by:
createFieldSetter
in interfaceAccessEnabler
-
-