Skip to content

nonapi.io.github.classgraph.utils.FileUtils invokes terminally deprecated method sun.misc.Unsafe::invokeCleaner #899

@zakkak

Description

@zakkak

Using ClassGraph with JDK >=24 (see https://openjdk.org/jeps/498) results in the following warning:

WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::invokeCleaner has been called by nonapi.io.github.classgraph.utils.FileUtils (file:/home/zakkak/.m2/repository/io/github/classgraph/classgraph/4.8.179/classgraph-4.8.179.jar)
WARNING: Please consider reporting this to the maintainers of class nonapi.io.github.classgraph.utils.FileUtils
WARNING: sun.misc.Unsafe::invokeCleaner will be removed in a future release

The invocation happens in:

cleanerCleanMethod = unsafeClass.getMethod("invokeCleaner", ByteBuffer.class);

Reproducer

///usr/bin/env jbang "$0" "$@" ; exit $?

//DEPS io.github.classgraph:classgraph:4.8.179

import static java.lang.System.*;
import io.github.classgraph.ClassGraph;
import io.github.classgraph.ScanResult;

public class ClassgraphRepro {

    public static void main(String... args) {
        try (ScanResult scanResult = new ClassGraph().enableAllInfo().scan()) {
            scanResult.getAllClasses().forEach(classInfo -> {
                out.println(classInfo.getName());
            });
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions