Package: org.codehaus.groovy.vmplugin.v9

## [Java] Class Java9

- org.codehaus.groovy.vmplugin.v9.Java9

-     @Deprecated(since = "6.0.0", forRemoval = true)
      public class Java9
      extends Java8

  deprecated:
    Use Java17 instead. Groovy 6.0 requires JDK 17+.

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public boolean` | `checkAccessible(Class<?> accessingClass, Class<?> declaringClass, int memberModifiers, boolean allowIllegalAccess)` * check whether the member can be accessed or not * Parameters: `callerClass` - callerClass the callerClass to invoke `setAccessible` * `declaringClass` - the type of member owner * `memberModifiers` - modifiers of member * `allowIllegalAccess` - whether to allow illegal access * Returns: the result of checking
    `` | `public boolean` | `checkCanSetAccessible(AccessibleObject accessibleObject, Class<?> callerClass)` 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:
    `` | `public Map<String, Set<String>>` | `getDefaultImportClasses(String[] packageNames)` * Returns the default import classes: class name -> the relevant package names * * Parameters: `packageNames` - the default import package names, e.g. java.lang. * Returns: the default import classes * Since: 3.0.2
    `` | `public Class<?>[]` | `getPluginDefaultGroovyMethods()` * Returns plugin-specific default Groovy methods. * * Returns: the default Groovy method classes contributed by this plugin
    `` | `public int` | `getVersion()` * Gives the version the plugin is made for * Returns: 7 for jdk7, 8 for jdk8, 9 for jdk9 or higher
    `` | `protected Lookup` | `newLookup(Class<?> targetClass)` * Creates a lookup capable of accessing members declared by the target class. * * Parameters: `targetClass` - the lookup target * Returns: a lookup for the target class
    `` | `public MetaMethod` | `transformMetaMethod(MetaClass metaClass, MetaMethod metaMethod, Class<?> caller)` * transform meta method * * Parameters: `metaClass` - metaclass * `metaMethod` - the original meta method * `caller` - caller class, whose method sets accessible for methods * Returns: the transformed meta method
    `` | `public boolean` | `trySetAccessible(AccessibleObject ao)` * Set the `accessible` flag for this reflected object to `true` * if possible. * * throws: SecurityException if the request is denied by the security manager (legacy comment) Parameters: `ao` - the accessible object * Returns: `true` if the `accessible` flag is set to `true`; * `false` if access cannot be enabled. *

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Java8` | `checkAccessible, checkCanSetAccessible, configureAnnotation, configureClassNode, configureTypeVariableDefinition, configureTypeVariableReference, fillParameterNames, getInvokeSpecialHandle, getPluginDefaultGroovyMethods, getPluginStaticGroovyMethods, getValue, getVersion, invalidateCallSites, invokeHandle, makeClassNode, makeRecordComponents, newLookup, of, setAdditionalClassInformation, toAnnotationNode, transformMetaMethod, transformMetaMethod, trySetAccessible`

- - ### Method Detail

    - #### public boolean checkAccessible(Class<?> accessingClass, Class<?> declaringClass, int memberModifiers, boolean allowIllegalAccess)

      * check whether the member can be accessed or not *

      Parameters:
        `callerClass` - callerClass the callerClass to invoke `setAccessible` *
        `declaringClass` - the type of member owner *
        `memberModifiers` - modifiers of member *
        `allowIllegalAccess` - whether to allow illegal access *
      Returns:
        the result of checking

    - #### public boolean checkCanSetAccessible(AccessibleObject accessibleObject, Class<?> callerClass)

      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` - the accessible object to check
        `callerClass` - the class wishing to invoke `setAccessible`
      Returns:
        the check result

    - #### public Map<String, Set<String>> getDefaultImportClasses(String[] packageNames)

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

      Parameters:
        `packageNames` - the default import package names, e.g. java.lang. *
      Returns:
        the default import classes *
      Since:
        3.0.2

    - #### public Class<?>[] getPluginDefaultGroovyMethods()

      * Returns plugin-specific default Groovy methods. * *

      Returns:
        the default Groovy method classes contributed by this plugin

    - #### public int getVersion()

      * Gives the version the plugin is made for *

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

    - #### protected Lookup newLookup(Class<?> targetClass)

      * Creates a lookup capable of accessing members declared by the target class. * *

      Parameters:
        `targetClass` - the lookup target *
      Returns:
        a lookup for the target class

    - #### public MetaMethod transformMetaMethod(MetaClass metaClass, MetaMethod metaMethod, Class<?> caller)

      * transform meta method * *

      Parameters:
        `metaClass` - metaclass *
        `metaMethod` - the original meta method *
        `caller` - caller class, whose method sets accessible for methods *
      Returns:
        the transformed meta method

    - #### public boolean trySetAccessible(AccessibleObject ao)

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

      throws:
        SecurityException if the request is denied by the security manager (legacy comment)
      Parameters:
        `ao` - the accessible object *
      Returns:
        `true` if the `accessible` flag is set to `true`; * `false` if access cannot be enabled. *