From d27266bc0dca0816b4e2505839536a370228ab3f Mon Sep 17 00:00:00 2001 From: "tom.johnson" Date: Wed, 4 Dec 2024 16:42:24 +0000 Subject: [PATCH] [Java] Suppress "this-escape" warnings from generated encoders and decoders, required for them to compile without warnings in JDK21 --- .../artio/dictionary/generation/DecoderGenerator.java | 1 + .../artio/dictionary/generation/EncoderGenerator.java | 2 ++ .../real_logic/artio/dictionary/generation/GenerationUtil.java | 1 + 3 files changed, 4 insertions(+) diff --git a/artio-codecs/src/main/java/uk/co/real_logic/artio/dictionary/generation/DecoderGenerator.java b/artio-codecs/src/main/java/uk/co/real_logic/artio/dictionary/generation/DecoderGenerator.java index 54fc32a812..8dacf79ed2 100644 --- a/artio-codecs/src/main/java/uk/co/real_logic/artio/dictionary/generation/DecoderGenerator.java +++ b/artio-codecs/src/main/java/uk/co/real_logic/artio/dictionary/generation/DecoderGenerator.java @@ -311,6 +311,7 @@ private String classDeclaration( return String.format( "\n" + GENERATED_ANNOTATION + + SUPPRESS_THIS_ESCAPE_ANNOTATION + "public %3$s%4$sclass %1$s extends %5$s%2$s\n" + "{\n", className, diff --git a/artio-codecs/src/main/java/uk/co/real_logic/artio/dictionary/generation/EncoderGenerator.java b/artio-codecs/src/main/java/uk/co/real_logic/artio/dictionary/generation/EncoderGenerator.java index e4cbefa608..28b8befb66 100644 --- a/artio-codecs/src/main/java/uk/co/real_logic/artio/dictionary/generation/EncoderGenerator.java +++ b/artio-codecs/src/main/java/uk/co/real_logic/artio/dictionary/generation/EncoderGenerator.java @@ -42,6 +42,7 @@ import static uk.co.real_logic.artio.dictionary.generation.AggregateType.HEADER; import static uk.co.real_logic.artio.dictionary.generation.EnumGenerator.enumName; import static uk.co.real_logic.artio.dictionary.generation.GenerationUtil.GENERATED_ANNOTATION; +import static uk.co.real_logic.artio.dictionary.generation.GenerationUtil.SUPPRESS_THIS_ESCAPE_ANNOTATION; import static uk.co.real_logic.artio.dictionary.generation.GenerationUtil.fileHeader; import static uk.co.real_logic.artio.dictionary.generation.GenerationUtil.importFor; import static uk.co.real_logic.artio.dictionary.generation.OptionalSessionFields.ENCODER_OPTIONAL_SESSION_FIELDS; @@ -347,6 +348,7 @@ private String classDeclaration( return String.format( "\n" + GENERATED_ANNOTATION + + SUPPRESS_THIS_ESCAPE_ANNOTATION + "public %3$s%4$sclass %1$s%5$s%2$s\n" + "{\n", className, diff --git a/artio-codecs/src/main/java/uk/co/real_logic/artio/dictionary/generation/GenerationUtil.java b/artio-codecs/src/main/java/uk/co/real_logic/artio/dictionary/generation/GenerationUtil.java index ad653ef334..006c9fe445 100644 --- a/artio-codecs/src/main/java/uk/co/real_logic/artio/dictionary/generation/GenerationUtil.java +++ b/artio-codecs/src/main/java/uk/co/real_logic/artio/dictionary/generation/GenerationUtil.java @@ -30,6 +30,7 @@ public final class GenerationUtil public static final String INDENT = " "; public static final String GENERATED_ANNOTATION = "@Generated(\"uk.co.real_logic.artio\")\n"; + public static final String SUPPRESS_THIS_ESCAPE_ANNOTATION = "@SuppressWarnings(\"this-escape\")\n"; private GenerationUtil() {