This is an automated email from the ASF dual-hosted git repository. rmannibucau pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/johnzon.git
The following commit(s) were added to refs/heads/master by this push: new 920af22 no functional change, just extracting the JohnzonJsonb instantiation (+cdi tracking) in a dedicated method to be able to easily drop it with graalvm like tools (or asm rewriting code) 920af22 is described below commit 920af228fe9ea2b76a8f81197299286239b5e5e3 Author: Romain Manni-Bucau <rmannibu...@gmail.com> AuthorDate: Fri Oct 25 14:01:39 2019 +0200 no functional change, just extracting the JohnzonJsonb instantiation (+cdi tracking) in a dedicated method to be able to easily drop it with graalvm like tools (or asm rewriting code) --- .../src/main/java/org/apache/johnzon/jsonb/JohnzonBuilder.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JohnzonBuilder.java b/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JohnzonBuilder.java index 427e493..26f380b 100644 --- a/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JohnzonBuilder.java +++ b/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JohnzonBuilder.java @@ -142,7 +142,7 @@ public class JohnzonBuilder implements JsonbBuilder { config = new JsonbConfig(); } - final Boolean skipCdi = shouldSkipCdi(); + final boolean skipCdi = shouldSkipCdi(); // todo: global spec toggle to disable all these ones at once? builder.setUseBigDecimalForObjectNumbers( @@ -357,13 +357,15 @@ public class JohnzonBuilder implements JsonbBuilder { }); }); - final boolean useCdi = cdiIntegration != null && cdiIntegration.isCanWrite() && !skipCdi; if (Closeable.class.isInstance(accessMode)) { builder.addCloseable(Closeable.class.cast(accessMode)); } - final Mapper mapper = builder.build(); + return doCreateJsonb(skipCdi, ijson, builder.build()); + } - if (useCdi) { + // note: this method must stay as small as possible to enable graalvm to replace it by "false" when needed + private Jsonb doCreateJsonb(final boolean skipCdi, final boolean ijson, final Mapper mapper) { + if (!skipCdi && cdiIntegration != null && cdiIntegration.isCanWrite()) { final JohnzonJsonb jsonb = new JohnzonJsonb(mapper, ijson, i -> { if (cdiIntegration.isCanWrite()) { cdiIntegration.untrack(i);