Skip to content

Commit

Permalink
Merge pull request #217 from JooHyukKim/Follow-up-with-TODOs-in-#216
Browse files Browse the repository at this point in the history
Follow up wrt #191 by using `NativeImageUtil.isRunningInNativeImage()` in `databind`
  • Loading branch information
cowtowncoder authored Aug 3, 2023
2 parents d750d6e + b047518 commit 758b700
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

import com.fasterxml.jackson.core.Version;
import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.databind.util.NativeImageUtil;
import com.fasterxml.jackson.module.afterburner.ser.SerializerModifier;
import com.fasterxml.jackson.module.afterburner.deser.DeserializerModifier;

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 @@ -51,7 +50,8 @@ public AfterburnerModule() { }
@Override
public void setupModule(SetupContext context)
{
if (RUNNING_IN_SVM)
// [modules-base#191] Since 2.16, Native image detection
if (NativeImageUtil.isInNativeImage())
{
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.fasterxml.jackson.module.blackbird;

import com.fasterxml.jackson.databind.util.NativeImageUtil;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodHandles.Lookup;
import java.util.function.Function;
Expand All @@ -12,8 +13,6 @@

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 @@ -37,7 +36,8 @@ public BlackbirdModule(Supplier<MethodHandles.Lookup> lookup) {
@Override
public void setupModule(SetupContext context)
{
if (RUNNING_IN_SVM)
// [modules-base#191] Since 2.16, Native image detection
if (NativeImageUtil.isInNativeImage())
{
return;
}
Expand Down

0 comments on commit 758b700

Please sign in to comment.