From a69985f5a22ab6759a6b326bda01d402535e4ae6 Mon Sep 17 00:00:00 2001 From: humberto Date: Tue, 6 Feb 2024 22:41:09 +0100 Subject: [PATCH] Change default behavior of RegisterForReflection ignoreNested attribute to false. --- .../runtime/annotations/RegisterForReflection.java | 8 ++++---- .../model/ModelWithSerializerAndDeserializerOnField.java | 2 +- .../jsonb/ModelWithSerializerAndDeserializerOnField.java | 2 +- .../main/src/main/java/io/quarkus/it/rest/ResourceA.java | 2 +- .../main/src/main/java/io/quarkus/it/rest/ResourceC.java | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/runtime/src/main/java/io/quarkus/runtime/annotations/RegisterForReflection.java b/core/runtime/src/main/java/io/quarkus/runtime/annotations/RegisterForReflection.java index 80f0884eaa8fc7..9d697983ba294e 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/annotations/RegisterForReflection.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/annotations/RegisterForReflection.java @@ -7,10 +7,10 @@ /** * Annotation that can be used to force a class to be registered for reflection in native image mode. - * Note that by default nested classes and interfaces are registered too. - * If you have performance concerns, you can use {@link #ignoreNested()} = true. - * Similarly, by default only the class itself is registered, not the full class hierarchy. This can be changed by setting - * {@link #registerFullHierarchy()} to true. + * Note that by default the class itself is registered including nested classes and interfaces, + * but not the full class hierarchy. This can be changed by setting: + * {@link #ignoreNested()} to true, to ignore nested classes. + * {@link #registerFullHierarchy()} to true, to register the full hierarchy. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) diff --git a/integration-tests/jackson/src/main/java/io/quarkus/it/jackson/model/ModelWithSerializerAndDeserializerOnField.java b/integration-tests/jackson/src/main/java/io/quarkus/it/jackson/model/ModelWithSerializerAndDeserializerOnField.java index 8cb4ff7f6963d4..a5dca13f503d5d 100644 --- a/integration-tests/jackson/src/main/java/io/quarkus/it/jackson/model/ModelWithSerializerAndDeserializerOnField.java +++ b/integration-tests/jackson/src/main/java/io/quarkus/it/jackson/model/ModelWithSerializerAndDeserializerOnField.java @@ -15,7 +15,7 @@ import io.quarkus.runtime.annotations.RegisterForReflection; -@RegisterForReflection +@RegisterForReflection(ignoreNested = true) @JsonIgnoreProperties(ignoreUnknown = true) public class ModelWithSerializerAndDeserializerOnField { diff --git a/integration-tests/jsonb/src/main/java/io/quarkus/it/jsonb/ModelWithSerializerAndDeserializerOnField.java b/integration-tests/jsonb/src/main/java/io/quarkus/it/jsonb/ModelWithSerializerAndDeserializerOnField.java index ca13e2f3de83e8..f3a5b1ce549a35 100644 --- a/integration-tests/jsonb/src/main/java/io/quarkus/it/jsonb/ModelWithSerializerAndDeserializerOnField.java +++ b/integration-tests/jsonb/src/main/java/io/quarkus/it/jsonb/ModelWithSerializerAndDeserializerOnField.java @@ -13,7 +13,7 @@ import io.quarkus.runtime.annotations.RegisterForReflection; -@RegisterForReflection +@RegisterForReflection(ignoreNested = true) public class ModelWithSerializerAndDeserializerOnField { private String name; diff --git a/integration-tests/main/src/main/java/io/quarkus/it/rest/ResourceA.java b/integration-tests/main/src/main/java/io/quarkus/it/rest/ResourceA.java index c5cdb5debb026a..2d6fd6b205a6f4 100644 --- a/integration-tests/main/src/main/java/io/quarkus/it/rest/ResourceA.java +++ b/integration-tests/main/src/main/java/io/quarkus/it/rest/ResourceA.java @@ -5,7 +5,7 @@ /** * Only Parent Class will be registered and none of the inner classes will be registered for reflection. */ -@RegisterForReflection +@RegisterForReflection(ignoreNested = true) class ResourceA { private class InnerClassOfA { diff --git a/integration-tests/main/src/main/java/io/quarkus/it/rest/ResourceC.java b/integration-tests/main/src/main/java/io/quarkus/it/rest/ResourceC.java index 3441c74b478057..6a4e4db08b6737 100644 --- a/integration-tests/main/src/main/java/io/quarkus/it/rest/ResourceC.java +++ b/integration-tests/main/src/main/java/io/quarkus/it/rest/ResourceC.java @@ -6,7 +6,7 @@ * This class is registering targets = ResourceD.StaticClassOfD * The class itself won't be registered by this, only target will be registered without registering nested classes */ -@RegisterForReflection(targets = ResourceD.StaticClassOfD.class) +@RegisterForReflection(targets = ResourceD.StaticClassOfD.class, ignoreNested = true) public class ResourceC { private class InaccessibleClassOfC {