Skip to content

Illegal reflective access warning on Classpath.getClasspathURIs() with Adopt JDK 11 #605

@UlrichLohrmann

Description

@UlrichLohrmann

I use AdopJDK on Windows with the following version:

Eclipse OpenJ9 VM AdoptOpenJDK (build openj9-0.24.0, JRE 11 Windows 10 amd64-64-Bit Compressed References 20210120_899 (JIT enabled, AOT enabled)
OpenJ9   - 345e1b09e
OMR      - 741e94ea8
JCL      - 0a86953833 based on jdk-11.0.10+9)

With ClassGraph 4.8.135 I have a JEE application running in Open Liberty that does the following ClassGraph call:

List<URI>       classpathEntries = new ClassGraph().getClasspathURIs();

With this I get the following warning from the JDK:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by nonapi.io.github.classgraph.reflection.ReflectionDriver (file:/D:/Programme/openLiberty/openLiberty-SAMV/wlp/usr/servers/SAMV-Liberty/apps/expanded/Gradle___de_dsv_samv___SamvEAR_ear.ear/lib/classgraph-4.8.135.jar) to method com.ibm.java.lang.management.internal.RuntimeMXBeanImpl.getInputArguments()
WARNING: Please consider reporting this to the maintainers of nonapi.io.github.classgraph.reflection.ReflectionDriver
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

As the warning mentions that illegal reflective access might be denied in future releases of the JDK it would be interesting how to handle this situation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions