Skip to content

Commit

Permalink
[JDK21] suppress this-escape warning: allows compilation without erro…
Browse files Browse the repository at this point in the history
…rs under JDK21. There are ways of solving this without the suppression, but they require more discussion and work: this is a good starting point for what's likely to be over-eager analysis for most use cases.
  • Loading branch information
writeoncereadmany committed Nov 30, 2023
1 parent c78d936 commit bd3a107
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,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;
Expand Down Expand Up @@ -346,6 +347,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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down

0 comments on commit bd3a107

Please sign in to comment.