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

SimpleToString plugin exists, but cannot be activated/used? #432

Closed
soc opened this issue Oct 7, 2023 · 10 comments
Closed

SimpleToString plugin exists, but cannot be activated/used? #432

soc opened this issue Oct 7, 2023 · 10 comments
Labels
question xjc-plugins Issue concerns basics plugins

Comments

@soc
Copy link
Contributor

soc commented Oct 7, 2023

It seems the code is here, but specifying <arg>-XsimpleToString</arg> reports:

unrecognized parameter -XsimpleToString

Is this intentional?

@laurentschoelens
Copy link
Collaborator

Hi @soc

Did you add jaxb2-basics (or the new name, depending which version of the plugin you use) in jaxb-maven-plugin configuration ?

The jar containing the XJC plugins is splitted from the one containing the maven-plugin itself.

Laurent

@soc
Copy link
Contributor Author

soc commented Oct 8, 2023

@laurentschoelens Yes. All other plugins work fine, even the related ones like simpleEquals and simpleHashCode.

I had a short look at the code if there was a hint it was disabled, but didn't see anything, therefore my question.

Here is the list of plugins I'm using, adding <arg>-XsimpleToString</arg> fails the build.

@laurentschoelens
Copy link
Collaborator

From what I've seen the plugin had never been declared in the https://github.com/highsource/jaxb-tools/blob/master/jaxb-plugins-parent/jaxb-plugins/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin file where it is clearly missing, and from initial repo too 🤔

I'd suggest not using it for the moment and if this plugin is viable, we'll add it to the list

@laurentschoelens
Copy link
Collaborator

Alexey was adding the 3 "simple" / reflection free plugins (equals / hashCode / toString) but he ended up removing Simpletostring from the file mentionned above.
The plugin wasnt even mentionned in previous repo...

So I would say, yes it's intentionnal not to be activated.
The other question is : can we add it as new plugin in it's actual state ? I don't know... Let us see first what it does 😀

@laurentschoelens laurentschoelens added question xjc-plugins Issue concerns basics plugins labels Oct 8, 2023
@soc
Copy link
Contributor Author

soc commented Oct 8, 2023

@laurentschoelens Thanks for digging into this!

I was interested in the equals/hashCode/toString situation anyway, wondering if it might make sense to use more "modern Java" to reduce the amount of generated code and make those methods basically behave like equals/hashCode/toString on records. (Though inheritance will be a problem.)

@mattrpav
Copy link
Collaborator

mattrpav commented Oct 8, 2023

@laurentschoelens we take an approach of copying the locator along side the generated classes to give a runtime dependency-free solution for the boiler plate toString.

I think we could copy in the locator strategy class just like ObjectFactory and package-info.

I think runtime Dependency-free approach should be the default at some point as well.

@laurentschoelens
Copy link
Collaborator

@laurentschoelens we take an approach of copying the locator along side the generated classes to give a runtime dependency-free solution for the boiler plate toString.

I think we could copy in the locator strategy class just like ObjectFactory and package-info.

I think runtime Dependency-free approach should be the default at some point as well.

My guess is we first need to look at existing but not active plugin to see what had been done by Alexey and then make it works or start from something new for this simpleToString xjc plugin.

@soc
Copy link
Contributor Author

soc commented Oct 8, 2023

Ok, thanks that answers my questions!

@soc soc closed this as completed Oct 8, 2023
@laurentschoelens
Copy link
Collaborator

From what I've seen, the SimpleToString plugin is just a copy of the ToString plugin, so it depend on jaxb-plugins-runtime...
Not very useful for the moment

@laurentschoelens
Copy link
Collaborator

@soc new issue follow up of yours #433

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question xjc-plugins Issue concerns basics plugins
Projects
None yet
Development

No branches or pull requests

3 participants