Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Enhance fluent-api to generate single-argument withXYZ() for collection properties #18

Open
glassfishrobot opened this issue Mar 6, 2009 · 3 comments

Comments

@glassfishrobot
Copy link
Contributor

The fluent-api plugin already generates vararg-based withXYZ() methods for
collection properties. This works fine in most cases, but when XJC generates
properties of type JAXBElement, you end up with a lot of compiler warning when
using the vararg method.

This is because JAXBElement is a generic type, and when you pass an object of a
generic type to a method with a vararg parameter, the compiler complains:

"a generic array is created for a varargs parameter"

It's a pointless and harmless warning, but you get a lot of them.

I suggest that the fluent-api plugin also generates a with...() method that
takes a single, non-vararg parameter, as a special case for the vararg version.
This would remove the warnings in cases where we only have a single object to
add to the collection.

If this wasn't auto-generated code, I wouldn't see it as worth the bother, but
it would many of my bindings less frustrating.

Environment

Operating System: All
Platform: All

Affected Versions

[current]

@glassfishrobot
Copy link
Contributor Author

Reported by skaffman

@glassfishrobot
Copy link
Contributor Author

Was assigned to hchar

@glassfishrobot
Copy link
Contributor Author

This issue was imported from java.net JIRA JAXB2_COMMONS-18

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

No branches or pull requests

1 participant