Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default behavior of RegisterForReflection ignoreNested attribute to false #38534

Merged
merged 1 commit into from
Feb 9, 2024

Conversation

humcqc
Copy link
Contributor

@humcqc humcqc commented Feb 1, 2024

Copy link

quarkus-bot bot commented Feb 1, 2024

Thanks for your pull request!

The title of your pull request does not follow our editorial rules. Could you have a look?

  • title should not end up with dot

This message is automatically generated by a bot.

@humcqc humcqc changed the title Change default behavior of RegisterForReflection ignoreNested attribute to false. Change default behavior of RegisterForReflection ignoreNested attribute to false Feb 1, 2024
@humcqc humcqc force-pushed the main branch 4 times, most recently from 637210f to 3a29c75 Compare February 3, 2024 14:36
@zakkak
Copy link
Contributor

zakkak commented Feb 6, 2024

Thank you @humcqc , please see my two comments.

@quarkus-bot quarkus-bot bot added the area/jackson Issues related to Jackson (JSON library) label Feb 6, 2024
@humcqc
Copy link
Contributor Author

humcqc commented Feb 6, 2024

Thank you @humcqc , please see my two comments.

Done, do you know why the CI Sanity Check Expected — Waiting for status to be reported is always pending ?

@zakkak
Copy link
Contributor

zakkak commented Feb 7, 2024

Done, do you know why the CI Sanity Check Expected — Waiting for status to be reported is always pending ?

Yes, that's a safety guard to prevent first time contributors from running workflows. I approved the run :)

@zakkak
Copy link
Contributor

zakkak commented Feb 7, 2024

CI fails with:

Error:  Failed to execute goal net.revelc.code.formatter:formatter-maven-plugin:2.23.0:validate (default) on project quarkus-core: File '/home/runner/work/quarkus/quarkus/core/runtime/src/main/java/io/quarkus/runtime/annotations/RegisterForReflection.java' has not been previously formatted. Please format file (for example by invoking `mvn -f core/runtime net.revelc.code.formatter:formatter-maven-plugin:2.23.0:format`) and commit before running validation! -> [Help 1]

@humcqc please run ./mvnw process-sources and amend your commit with the formatting changes.

This comment has been minimized.

@humcqc
Copy link
Contributor Author

humcqc commented Feb 7, 2024

Hi @zakkak , any idea for this : Error: Failed to execute goal net.revelc.code.formatter:formatter-maven-plugin:2.23.0:validate (default) on project quarkus-core: File '/home/runner/work/quarkus/quarkus/core/runtime/src/main/java/io/quarkus/runtime/annotations/RegisterForReflection.java' has not been previously formatted. Please format file (for example by invoking mvn -f core/runtime net.revelc.code.formatter:formatter-maven-plugin:2.23.0:format) and commit before running validation! -> [Help 1]

Seems link to the javadoc changes ?
--> The direct commit though github interface introduce some spaces not ok with quarkus code style. I fixed it.

@quarkus-bot quarkus-bot bot added area/cli Related to quarkus cli (not maven/gradle/etc.) area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins labels Feb 7, 2024
Copy link
Contributor

@zakkak zakkak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @humcqc . Let's see if the CI is OK with it and merge it :)

@zakkak zakkak added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Feb 7, 2024
@humcqc
Copy link
Contributor Author

humcqc commented Feb 7, 2024

Thanks @humcqc . Let's see if the CI is OK with it and merge it :)

I can squash the commits before merge if you want ?

@zakkak
Copy link
Contributor

zakkak commented Feb 7, 2024

I can squash the commits before merge if you want ?

Yes, please do so.

@humcqc
Copy link
Contributor Author

humcqc commented Feb 7, 2024

Seems the last change on class with targets make some test failing:
https://github.com/quarkusio/quarkus/actions/runs/7815481419/job/21322155888?pr=38534

@zakkak, what do you think ?

This comment has been minimized.

@zakkak
Copy link
Contributor

zakkak commented Feb 8, 2024

Main IT

Fails with:

Response body doesn't match expectation.
Expected: is "OtherInaccessibleClassOfC"
  Actual: FAILED

and

Response body doesn't match expectation.
Expected: is "InnerClassOfB"
  Actual: FAILED

Which indicates that the nested InnerClassOfB class was not properly registered, despite ResourceB being annotated without setting ignoreNested to true. So in that case it looks like the default is either altered by somehow, or that the default doesn't actually work.

Data3 IT tests - Hibernate ORM with Panache

Fails with:

ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-1) HTTP Request to /test/projection-nested failed, error id: d2d25807-7c24-4361-843f-487351bc4049-1: org.jboss.resteasy.spi.UnhandledException: java.lang.IllegalStateException: Cannot instantiate class 'io.quarkus.it.panache.PersonDTO$AddressDTO' (it has no constructor with signature [java.lang.String], and not every argument has an alias)

Which indicates that the nested AddressDTO class was not properly registered, despite PersonDTO being annotated without setting ignoreNested to true. So in that case it looks like the default is either altered by somehow, or that the default doesn't actually work.

Data 7 IT - Hibernate Reactive with Panache

Fails with:

ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (vert.x-eventloop-thread-1) HTTP Request to /test/projection-nested failed, error id: fe3bdc55-d68d-41d6-9b16-9afe5812889e-1: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0

Which is not clear why is happening but I suspect is related to the PersonDTO registration above.

In all cases I see that the classes were originally annotated with @RegisterForReflection(ignoreNested = false) and you now removed the ignoreNested = false part as it's supposed to be the new default, but Quarkus is still treating them like it did before.

@humcqc
Copy link
Contributor Author

humcqc commented Feb 8, 2024

ok certainly the current condition test does not handle the reverse one, I will check.

@humcqc humcqc force-pushed the main branch 2 times, most recently from b22f9f5 to d2022c2 Compare February 9, 2024 07:55
@@ -50,7 +50,7 @@ public void build(CombinedIndexBuildItem combinedIndexBuildItem, Capabilities ca

boolean methods = getBooleanValue(i, "methods");
boolean fields = getBooleanValue(i, "fields");
boolean ignoreNested = getBooleanValue(i, "ignoreNested");
boolean ignoreNested = i.value("ignoreNested") != null && i.value("ignoreNested").asBoolean();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original definition of getBooleanValue is:

private static boolean getBooleanValue(AnnotationInstance i, String name) {
        return i.value(name) == null || i.value(name).asBoolean();
    }

which means that it returns true if the value is not explicitly set, no matter what the default value is set to in the corresponding annotation, which seems wrong to me.

With the change you propose you revert this and set the default value to false, but it again doesn't seem right to me because:

  1. If we change the ignoreNested default sometime in the future it will fail again.
  2. If we change any other default from true to false it will fail again.

I will prepare a PR to fix this independently.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I was looking to a more robust change, to handle properly the default value of the annotation. This commit was to trigger the CI , I have some limitation to test the native version locally. We can do this in a second PR if you prefer ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, let's keep them separate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing if we want to do this properly we need to change the getBooleanValue method and it will impact a lot of more test as it will impact the other annotation attributes. Not sure I have sufficient knowledge on the impact of those attributes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@humcqc no worries, I will try to fix this (I already have a WIP branch but hit some issue I am not sure how to resolve yet).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

quarkus-bot bot commented Feb 9, 2024

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit beec214.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.


Flaky tests - Develocity

⚙️ JVM Tests - JDK 17

📦 extensions/smallrye-reactive-messaging-kafka/deployment

io.quarkus.smallrye.reactivemessaging.kafka.deployment.dev.KafkaDevServicesDevModeTestCase.sseStream - History

  • Assertion condition defined as a io.quarkus.smallrye.reactivemessaging.kafka.deployment.dev.KafkaDevServicesDevModeTestCase Expecting size of: [] to be greater than or equal to 2 but was 0 within 10 seconds. - org.awaitility.core.ConditionTimeoutException
org.awaitility.core.ConditionTimeoutException: 
Assertion condition defined as a io.quarkus.smallrye.reactivemessaging.kafka.deployment.dev.KafkaDevServicesDevModeTestCase 
Expecting size of:
  []
to be greater than or equal to 2 but was 0 within 10 seconds.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
	at org.awaitility.core.AssertionCondition.await(AssertionCondition.java:119)
	at org.awaitility.core.AssertionCondition.await(AssertionCondition.java:31)
  • Assertion condition defined as a io.quarkus.smallrye.reactivemessaging.kafka.deployment.dev.KafkaDevServicesDevModeTestCase Expecting size of: [] to be greater than or equal to 2 but was 0 within 10 seconds. - org.awaitility.core.ConditionTimeoutException
org.awaitility.core.ConditionTimeoutException: 
Assertion condition defined as a io.quarkus.smallrye.reactivemessaging.kafka.deployment.dev.KafkaDevServicesDevModeTestCase 
Expecting size of:
  []
to be greater than or equal to 2 but was 0 within 10 seconds.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
	at org.awaitility.core.AssertionCondition.await(AssertionCondition.java:119)
	at org.awaitility.core.AssertionCondition.await(AssertionCondition.java:31)

⚙️ JVM Tests - JDK 21

📦 extensions/smallrye-reactive-messaging-kafka/deployment

io.quarkus.smallrye.reactivemessaging.kafka.deployment.dev.KafkaDevServicesDevModeTestCase.sseStream - History

  • Assertion condition Expecting size of: [] to be greater than or equal to 2 but was 0 within 10 seconds. - org.awaitility.core.ConditionTimeoutException
org.awaitility.core.ConditionTimeoutException: 
Assertion condition 
Expecting size of:
  []
to be greater than or equal to 2 but was 0 within 10 seconds.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
	at org.awaitility.core.AssertionCondition.await(AssertionCondition.java:119)
	at org.awaitility.core.AssertionCondition.await(AssertionCondition.java:31)

@zakkak
Copy link
Contributor

zakkak commented Feb 9, 2024

The CI failures look unrelated to me.

@humcqc
Copy link
Contributor Author

humcqc commented Feb 9, 2024

The CI failures look unrelated to me.

I think so. Do you think it could be merged ?

@zakkak
Copy link
Contributor

zakkak commented Feb 9, 2024

Yes, the failures show up in other PRs as well:

@zakkak zakkak merged commit 48ddf16 into quarkusio:main Feb 9, 2024
49 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.9 - main milestone Feb 9, 2024
@quarkus-bot quarkus-bot bot removed the triage/waiting-for-ci Ready to merge when CI successfully finishes label Feb 9, 2024
@humcqc
Copy link
Contributor Author

humcqc commented Feb 9, 2024

Thanks for your help, do you know when the 3.9 release is planed ?

@geoand
Copy link
Contributor

geoand commented Feb 9, 2024

It has not been planned yet.

@humcqc
Copy link
Contributor Author

humcqc commented Feb 9, 2024

It has not been planned yet.

@geoand Could we backport this one and #24474 in 3.7.x ?

@geoand
Copy link
Contributor

geoand commented Feb 9, 2024

We are trying to be super conservative for 3.7/3.8, so I would prefer not

@humcqc
Copy link
Contributor Author

humcqc commented Feb 9, 2024

We are trying to be super conservative for 3.7/3.8, so I would prefer not

:-( ok, i still have few issues to contribute. Any estimate for 3.9 ?

@geoand
Copy link
Contributor

geoand commented Feb 9, 2024

Not yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli Related to quarkus cli (not maven/gradle/etc.) area/core area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/jackson Issues related to Jackson (JSON library) area/panache triage/flaky-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants