Skip to content

Commit

Permalink
Change default behavior of RegisterForReflection ignoreNested attribu…
Browse files Browse the repository at this point in the history
…te to false.
  • Loading branch information
humcqc committed Feb 3, 2024
1 parent ddcb144 commit 3a29c75
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

/**
* 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 not registered, unless {@link #ignoreNested()} is set to false.
* 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.
*/
Expand All @@ -26,11 +27,10 @@
boolean fields() default true;

/**
* If nested classes/interfaces should be ignored/registered
*
* This is useful when it's necessary to register inner (especially private) classes for Reflection.
* If nested classes/interfaces should be ignored.
* By default, nested classes are registered. To ignore them set it to true.
*/
boolean ignoreNested() default true;
boolean ignoreNested() default false;

/**
* Alternative classes that should actually be registered for reflection instead of the current class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import io.quarkus.hibernate.orm.panache.common.NestedProjectedClass;
import io.quarkus.runtime.annotations.RegisterForReflection;

@RegisterForReflection(ignoreNested = false)
@RegisterForReflection
public class DogDto2 {
public String name;
public PersonDto2 owner;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import io.quarkus.hibernate.orm.panache.common.ProjectedFieldName;
import io.quarkus.runtime.annotations.RegisterForReflection;

@RegisterForReflection(ignoreNested = false)
@RegisterForReflection
public class PersonDTO extends PersonName {

public final AddressDTO address;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import io.quarkus.hibernate.reactive.panache.common.NestedProjectedClass;
import io.quarkus.runtime.annotations.RegisterForReflection;

@RegisterForReflection(ignoreNested = false)
@RegisterForReflection
public class DogDto {
public String name;
public PersonDto owner;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import io.quarkus.hibernate.reactive.panache.common.ProjectedFieldName;
import io.quarkus.runtime.annotations.RegisterForReflection;

@RegisterForReflection(ignoreNested = false)
@RegisterForReflection
public class PersonDTO extends PersonName {
public final AddressDTO address;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* Both Parent Class and all nested classed will be registered for reflection
*/
@RegisterForReflection(ignoreNested = false)
@RegisterForReflection
public class ResourceB {

private class InnerClassOfB {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* This class is registering targets = ResourceC$InaccessibleClassOfC
* The class itself won't be registered by this, only target will be registered including target's nested classes
*/
@RegisterForReflection(classNames = "io.quarkus.it.rest.ResourceC$InaccessibleClassOfC", ignoreNested = false)
@RegisterForReflection(classNames = "io.quarkus.it.rest.ResourceC$InaccessibleClassOfC")
public class ResourceD {

// Parent class won't be registered, only the below private class will be registered without nested classes
Expand Down

0 comments on commit 3a29c75

Please sign in to comment.