Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow up wrt #191 by using NativeImageUtil.isRunningInNativeImage() in databind #217

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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