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 b66cdbba..162864ab 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}; + public final static int[] CRITICAL_VERSIONS = {7, 9, 14, 17, 20, 21, 22}; public boolean isCompressedOopsOffOn64BitHotspot(); diff --git a/java/src/main/java/io/github/toolfactory/jvm/function/catalog/ConstructorInvokeFunction.java b/java/src/main/java/io/github/toolfactory/jvm/function/catalog/ConstructorInvokeFunction.java index 6837002c..b4b195c6 100644 --- a/java/src/main/java/io/github/toolfactory/jvm/function/catalog/ConstructorInvokeFunction.java +++ b/java/src/main/java/io/github/toolfactory/jvm/function/catalog/ConstructorInvokeFunction.java @@ -76,4 +76,17 @@ public ForJava9(Map context) throws Throwable { } + public static class ForJava22 extends Abst { + + public ForJava22(Map context) throws Throwable { + ObjectProvider functionProvider = ObjectProvider.get(context); + Class constructorAccessorImplClass = Class.forName("jdk.internal.reflect.DirectConstructorHandleAccessor$NativeAccessor"); + Method method = constructorAccessorImplClass.getDeclaredMethod("newInstance0", Constructor.class, Object[].class); + ConsulterSupplyFunction getConsulterFunction = functionProvider.getOrBuildObject(ConsulterSupplyFunction.class, context); + MethodHandles.Lookup consulter = getConsulterFunction.apply(constructorAccessorImplClass); + methodHandle = consulter.unreflect(method); + } + + } + } \ No newline at end of file diff --git a/java/src/main/java/io/github/toolfactory/jvm/function/catalog/MethodInvokeFunction.java b/java/src/main/java/io/github/toolfactory/jvm/function/catalog/MethodInvokeFunction.java index 249a1953..9b6995a5 100644 --- a/java/src/main/java/io/github/toolfactory/jvm/function/catalog/MethodInvokeFunction.java +++ b/java/src/main/java/io/github/toolfactory/jvm/function/catalog/MethodInvokeFunction.java @@ -76,4 +76,18 @@ public ForJava9(Map context) throws Throwable { } + public static class ForJava22 extends Abst { + + public ForJava22(Map context) throws Throwable { + Class nativeMethodAccessorImplClass = Class.forName("jdk.internal.reflect.DirectMethodHandleAccessor$NativeAccessor"); + Method invoker = nativeMethodAccessorImplClass.getDeclaredMethod("invoke0", Method.class, Object.class, Object[].class); + ObjectProvider functionProvider = ObjectProvider.get(context); + ConsulterSupplyFunction consulterSupplyFunction = functionProvider.getOrBuildObject(ConsulterSupplyFunction.class, context); + MethodHandles.Lookup consulter = consulterSupplyFunction.apply(nativeMethodAccessorImplClass); + functionProvider.getOrBuildObject(SetAccessibleFunction.class, context).accept(invoker, true); + methodHandle = consulter.unreflect(invoker); + } + + } + }