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

Validate the default JAXBContext at build time only if it is really u… #31666

Merged
merged 1 commit into from
Mar 8, 2023

Conversation

ppalaga
Copy link
Contributor

@ppalaga ppalaga commented Mar 7, 2023

…sed in the application; do not validate if user provides his own JAXBContext bean or if there is no JAXBContext injection point

Fix #31646

@quarkus-bot
Copy link

quarkus-bot bot commented Mar 7, 2023

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 ellipsis (make sure the title is complete)

This message is automatically generated by a bot.

@quarkus-bot

This comment has been minimized.

Copy link
Contributor

@Sgitario Sgitario left a comment

Choose a reason for hiding this comment

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

Apart from the comments, these changes cause a build cycle exception in the RESTEasy Reactive Jaxb tests.

in the application; do not validate if user provides his own JAXBContext
bean or if there is no JAXBContext injection point quarkusio#31646
@ppalaga
Copy link
Contributor Author

ppalaga commented Mar 8, 2023

5e39264:

  • Addressed the feedback by @Sgitario (thanks!)
  • Solved the BuildStep methods cycle by not producing a ValidationErrorBuildItem and rather throwing a DeploymentException direcly plus consuming a JaxbContextConfigRecorder to force the container to call validateDefaultJaxbContext().

@Sgitario please feel free to re-review

Copy link
Contributor

@Sgitario Sgitario left a comment

Choose a reason for hiding this comment

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

lgtm! thanks @ppalaga !

btw, I still think #31651 is something we could incorporate. Let me know if you want to add this change as part of your pull request or I should add it after yours is merged.

@quarkus-bot
Copy link

quarkus-bot bot commented Mar 8, 2023

✔️ 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.

@Sgitario
Copy link
Contributor

Sgitario commented Mar 8, 2023

Let's merge this as it is.

@Sgitario Sgitario merged commit d213830 into quarkusio:main Mar 8, 2023
@quarkus-bot quarkus-bot bot added this to the 3.0 - main milestone Mar 8, 2023
@ppalaga
Copy link
Contributor Author

ppalaga commented Mar 9, 2023

I still think #31651 is something we could incorporate.

On one hand, it looks like a nice general improvement.
OTOH, I wonder how transparent can we make it for the users to understand that in spite they have a dependency bringing org.acme.Foo class, that class might still not be available in the default JAXBContext because some extension "Bar" that the user also happens to have in his classpath chose to exclude org.acme.Foo? However well we document that behavior in extension "Bar", it can still be very surprising to the users.

Having a catch-all default JAXBContext is definitely intuitive and user friendly, but it is very hard to say who should be responsible for solving the namespace conflicts. I do not feel like it should (always) be extension devs, because they might not know what the users want. Maybe sometimes the choice is clear, e.g. when one half of the conflicting classes is deprecated or outdated. Maybe in such situations ExcludeJaxbClassesToBeBoundBuildItem would be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow third party extensions to avoid validating the default JAXB context
2 participants