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

CXFXJC-47: XJC DefaultValue plugin uses JAXBElement that does not have a default constructor #129

Merged
merged 2 commits into from
Jun 7, 2024
Merged

CXFXJC-47: XJC DefaultValue plugin uses JAXBElement that does not have a default constructor #129

merged 2 commits into from
Jun 7, 2024

Conversation

marcelhdl
Copy link
Contributor

We've found a minor bug when using extensions and substitiongroups.
The defaultvalue-plugin generates a new JAXBElement expression, which isn't valid java code, as JAXBElement does not have a default constructor.
I've added a fix and a xsd-file for the corresponding test, to reproduce this bug.

@reta
Copy link
Member

reta commented Apr 11, 2024

@marcelhdl thank you bringing this issue, we probably should step further and detect such cases in the plugin by verifying if the default constructor exists. Would you be willing to make this change? Thank you!

@marcelhdl
Copy link
Contributor Author

marcelhdl commented Apr 15, 2024

@reta I just gave it a try, but while trying it out - i got stuck. I guess we don't know if there are default-constructors for each class because we aren't having all of them in the classpath at runtime.
We need a JType which extends JDefinedClass to check for the available constructors, but we got a simple JClass (JNarrowedClass) here.

@reta
Copy link
Member

reta commented Apr 16, 2024

@reta I just gave it a try, but while trying it out - i got stuck. I guess we don't know if there are default-constructors for each class because we aren't having all of them in the classpath at runtime.

I see, thank you @marcelhdl , may be whitelisting could be better here (for JAXB classes at least): it seems like no matter what, for JAXBElement we could not generate the default value (configuration looks a bit redundant in this case). Thank you.

@marcelhdl
Copy link
Contributor Author

@reta sorry for my late response, i am runnning out of time atm.
Is it possible that you implement the whitelisting here? Otherwise this bug must wait.

@reta
Copy link
Member

reta commented May 21, 2024

@reta sorry for my late response, i am runnning out of time atm.

Not a problem @marcelhdl , thank you a lot for spending your time on that, I will pick it up shortly, looks like an issue worth fixing.

@marcelhdl
Copy link
Contributor Author

marcelhdl commented Jun 6, 2024

Hi @reta, how is it going.
Did you have the time already to check that issue. we are now starting with jakarta and do also have issues here.
So we would need the fix for 3.3.3 und 4.0.1.

@reta
Copy link
Member

reta commented Jun 6, 2024

Hi @reta, how is it going.

Hey @marcelhdl , slipped through my list, will wrapping it up shortly, sorry about that

@reta reta changed the title Added new Parameter to exclude specific classes from default value generation CXFXJC-47: XJC DefaultValue plugin uses JAXBElement that does not have a default constructor Jun 7, 2024
@marcelhdl
Copy link
Contributor Author

marcelhdl commented Jun 7, 2024

@reta Looks good to me :)
How are the changes going into 3.x also?
Another Pull Request?

@reta
Copy link
Member

reta commented Jun 7, 2024

@reta Looks good to me :)

Thank you @marcelhdl , I will backport that to all maintenance branches once merged (a bit later today I hope)

@reta reta merged commit aad624b into apache:main Jun 7, 2024
3 checks passed
reta added a commit that referenced this pull request Jun 7, 2024
…e a default constructor (#129)

* Added new Parameter to exclude specific classes from default value generation

* CXFXJC-47: XJC DefaultValue plugin uses JAXBElement that does not have a default constructor

---------

Co-authored-by: Marcel Hödl <marcel.hoedl@ofdka.bwl.de>
Co-authored-by: Andriy Redko <drreta@gmail.com>
reta added a commit that referenced this pull request Jun 7, 2024
…e a default constructor (#129)

* Added new Parameter to exclude specific classes from default value generation

* CXFXJC-47: XJC DefaultValue plugin uses JAXBElement that does not have a default constructor

---------

Co-authored-by: Marcel Hödl <marcel.hoedl@ofdka.bwl.de>
Co-authored-by: Andriy Redko <drreta@gmail.com>
@marcelhdl marcelhdl deleted the feature/exclude-list branch June 8, 2024 07:36
@marcelhdl
Copy link
Contributor Author

@reta this would be awesome!!

@marcelhdl
Copy link
Contributor Author

@reta do you already know when the two new versions are released?

@reta
Copy link
Member

reta commented Jun 10, 2024

@reta do you already know when the two new versions are released?

@marcelhdl there is no ETA as of today, but hopefully soon enough

@marcelhdl
Copy link
Contributor Author

@reta thanks for the quick response.
I hope so too. Do you need some support with backporting the fix?

@reta
Copy link
Member

reta commented Jun 12, 2024

I hope so too. Do you need some support with backporting the

No, thank you @marcelhdl , it is already in 4.0.x and 3.3.x branches

@marcelhdl
Copy link
Contributor Author

Hi @reta, any news on the ETA?

@reta
Copy link
Member

reta commented Jul 22, 2024

Hi @reta, any news on the ETA?

Hi @marcelhdl , we have just cut Apache CXF releases, I think we should be able to make one for cxf-xjc-utils shortly, thank you

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

Successfully merging this pull request may close these issues.

2 participants