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

generateIsSetMethod generates dangerous boolean code #253

Open
Tomas-Kraus opened this issue Aug 17, 2009 · 9 comments
Open

generateIsSetMethod generates dangerous boolean code #253

Tomas-Kraus opened this issue Aug 17, 2009 · 9 comments
Assignees
Labels
bug Something isn't working Major Priority

Comments

@Tomas-Kraus
Copy link
Contributor

xjc generates code that does not properly autobox when 'generateIsSetMethod' is
used. I reported this for integers as issue 667, but that could be worked around
with an isSet method. However, booleans do not get an isSet method!

Generated code:

@XmlAttribute(name = "includeChildren")
protected Boolean includeChildren;

With generateIsSetMethod:
public boolean isIncludeChildren()

{ return includeChildren; }

Without:
public Boolean isIncludeChildren() { return includeChildren; }

Environment

Operating System: All
Platform: All

Affected Versions

[2.1.12]

@Tomas-Kraus
Copy link
Contributor Author

@glassfishrobot Commented
Reported by lucasmo

@Tomas-Kraus
Copy link
Contributor Author

@glassfishrobot Commented
Was assigned to snajper

@Tomas-Kraus
Copy link
Contributor Author

@glassfishrobot Commented
snajper said:
Please see 131. We cannot fix this as we have to maintain backward compatibility.

      • This issue has been marked as a duplicate of 131 ***

@Tomas-Kraus
Copy link
Contributor Author

@glassfishrobot Commented
lucasmo said:
I do not believe this is a duplicate of issue 131. Issue 131 reports as a bug
that isIncludeChildren returs a Boolean. I am reporting the opposite: that it's
a bug for it to return boolean. This Boolean return is the default behavior,
which should be used.

The bug here is when the extension 'generateIsSetMethod' is used, it turns on
some rather undocumented side effects; for instance, the signature turns to
boolean, not Boolean. If this was a resolution for 131, it was undocumented.

The problem with this is - when generateIsSetMethod is used - is that there is
NO POSSIBLE WAY to look at your xml boolean values without using
introspection. Calling object.isIncludeChildren() should not throw a NPE under
any circumstances.

@Tomas-Kraus
Copy link
Contributor Author

@glassfishrobot Commented
snajper said:
Ah, I see what you mean. The trouble is the spec specifies the method signature
to be specifically "boolean", and we can't change the signature because there
might be code out there which relies on it.

Fixing this requires update to the spec itself. I'll mark 667 as a duplicate of
this one, as both should be fixed at once.

@Tomas-Kraus
Copy link
Contributor Author

@glassfishrobot Commented
snajper said:

      • Issue 667 has been marked as a duplicate of this issue. ***

@Tomas-Kraus
Copy link
Contributor Author

@glassfishrobot Commented
This issue was imported from java.net JIRA JAXB-679

@Tomas-Kraus
Copy link
Contributor Author

@lukasj lukasj transferred this issue from eclipse-ee4j/jaxb-ri May 19, 2022
@lukasj lukasj added bug Something isn't working and removed Component: spec labels May 19, 2022
@antoniosanct
Copy link
Contributor

@lukasj
I don't see any references about 'generateIsSetMethod' in the API, only in spec documentation. Is it correct to maintain this issue here instead of eclipse-ee4j/jaxb-ri?

Regards,
Antonio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Major Priority
Projects
None yet
Development

No branches or pull requests

4 participants