Skip to content

Commit

Permalink
Merge pull request #216 from stevenschlansker/scs-bb-ab-svm
Browse files Browse the repository at this point in the history
Blackbird, Afterburner: disable in native-image
  • Loading branch information
cowtowncoder authored Jul 29, 2023
2 parents 0e16583 + c3bbe3e commit 9cb2d4a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
public class AfterburnerModule extends Module
implements java.io.Serializable // is this necessary?
{
// TODO: replace with jackson-databind/NativeImageUtil.RUNNING_IN_SVM
private static final boolean RUNNING_IN_SVM = System.getProperty("org.graalvm.nativeimage.imagecode") != null;
private static final long serialVersionUID = 1L;

/*
Expand Down Expand Up @@ -49,6 +51,10 @@ public AfterburnerModule() { }
@Override
public void setupModule(SetupContext context)
{
if (RUNNING_IN_SVM)
{
return;
}
ClassLoader cl = _cfgUseValueClassLoader ? null : getClass().getClassLoader();
context.addBeanDeserializerModifier(new DeserializerModifier(cl,
_cfgUseOptimizedBeanDeserializer));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

public class BlackbirdModule extends Module
{
// TODO: replace with jackson-databind/NativeImageUtil.RUNNING_IN_SVM
private static final boolean RUNNING_IN_SVM = System.getProperty("org.graalvm.nativeimage.imagecode") != null;
private Function<Class<?>, Lookup> _lookups;

public BlackbirdModule() {
Expand All @@ -35,6 +37,10 @@ public BlackbirdModule(Supplier<MethodHandles.Lookup> lookup) {
@Override
public void setupModule(SetupContext context)
{
if (RUNNING_IN_SVM)
{
return;
}
CrossLoaderAccess openSesame = new CrossLoaderAccess();
context.addBeanDeserializerModifier(new BBDeserializerModifier(_lookups, openSesame));
context.addBeanSerializerModifier(new BBSerializerModifier(_lookups, openSesame));
Expand Down

0 comments on commit 9cb2d4a

Please sign in to comment.