Skip to content

Commit

Permalink
make sure it works with the graalvm jdk8 native image
Browse files Browse the repository at this point in the history
  • Loading branch information
zhfeng committed Jul 17, 2020
1 parent b2a29c0 commit b370708
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
4 changes: 4 additions & 0 deletions extensions/mybatis/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<artifactId>svm</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
}

}

0 comments on commit b370708

Please sign in to comment.