diff --git a/.github/workflows/[A] build and test, release if requested.yml b/.github/workflows/[A] build and test, release if requested.yml index b7ad31c4..cbff9ee9 100644 --- a/.github/workflows/[A] build and test, release if requested.yml +++ b/.github/workflows/[A] build and test, release if requested.yml @@ -89,7 +89,7 @@ jobs: architecture: [x64] distribution: [zulu] os: [ubuntu-latest, macOS-latest, windows-latest] - java: [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24] + java: [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26] exclude: - architecture: x64 java: 10 diff --git a/java/src/main/java/io/github/toolfactory/jvm/Info.java b/java/src/main/java/io/github/toolfactory/jvm/Info.java index c8eb739d..9db9ac3b 100644 --- a/java/src/main/java/io/github/toolfactory/jvm/Info.java +++ b/java/src/main/java/io/github/toolfactory/jvm/Info.java @@ -31,7 +31,7 @@ package io.github.toolfactory.jvm; public interface Info { - public final static int[] CRITICAL_VERSIONS = {7, 9, 14, 17, 20, 21, 22, 24, 25}; + public final static int[] CRITICAL_VERSIONS = {7, 9, 14, 17, 20, 21, 22, 24, 25, 26}; public boolean isCompressedOopsOffOn64BitHotspot(); diff --git a/java/src/main/java/io/github/toolfactory/jvm/function/catalog/GetClassByNameFunction.java b/java/src/main/java/io/github/toolfactory/jvm/function/catalog/GetClassByNameFunction.java index a46b94eb..8fb23359 100644 --- a/java/src/main/java/io/github/toolfactory/jvm/function/catalog/GetClassByNameFunction.java +++ b/java/src/main/java/io/github/toolfactory/jvm/function/catalog/GetClassByNameFunction.java @@ -95,4 +95,29 @@ public Class apply(String className, Boolean initialize, ClassLoader classLoa } + + public static class ForJava26 extends Abst { + + public ForJava26(Map context) throws Throwable { + super(context); + } + + @Override + protected MethodHandle retrieveClassFinder(Map context) throws Throwable { + ObjectProvider functionProvider = ObjectProvider.get(context); + MethodHandles.Lookup consulter = functionProvider.getOrBuildObject(DeepConsulterSupplyFunction.class, context).apply(Class.class); + // In Java 26 the caller parameter was removed from Class.forName0 + return consulter.findStatic( + Class.class, "forName0", + MethodType.methodType(Class.class, String.class, boolean.class, ClassLoader.class) + ); + } + + @Override + public Class apply(String className, Boolean initialize, ClassLoader classLoader, Class caller) throws Throwable { + return (Class)classFinder.invokeWithArguments(className, initialize.booleanValue(), classLoader); + } + + } + }