diff --git a/extensions/mybatis/runtime/pom.xml b/extensions/mybatis/runtime/pom.xml index d38c3c8250f0e3..ee55066abf1e3a 100644 --- a/extensions/mybatis/runtime/pom.xml +++ b/extensions/mybatis/runtime/pom.xml @@ -27,6 +27,10 @@ org.mybatis mybatis + + org.graalvm.nativeimage + svm + diff --git a/extensions/mybatis/runtime/src/main/java/io/quarkus/mybatis/runtime/graal/DefineClassHelperSubstitution.java b/extensions/mybatis/runtime/src/main/java/io/quarkus/mybatis/runtime/graal/DefineClassHelperSubstitution.java new file mode 100644 index 00000000000000..382444d04850d8 --- /dev/null +++ b/extensions/mybatis/runtime/src/main/java/io/quarkus/mybatis/runtime/graal/DefineClassHelperSubstitution.java @@ -0,0 +1,25 @@ +package io.quarkus.mybatis.runtime.graal; + +import java.lang.invoke.MethodHandles; + +import org.apache.ibatis.javassist.CannotCompileException; +import org.apache.ibatis.javassist.util.proxy.DefineClassHelper; + +import com.oracle.svm.core.annotate.Substitute; +import com.oracle.svm.core.annotate.TargetClass; +import com.oracle.svm.core.jdk.JDK8OrEarlier; + +@TargetClass(value = DefineClassHelper.class, onlyWith = JDK8OrEarlier.class) +final public class DefineClassHelperSubstitution { + + @Substitute + public static Class toClass(MethodHandles.Lookup lookup, byte[] bcode) throws CannotCompileException { + throw new CannotCompileException("Not support"); + } + + @Substitute + static Class toPublicClass(String className, byte[] bcode) throws CannotCompileException { + throw new CannotCompileException("Not support"); + } + +}