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

Add @ConstructorProperties to generated constructor #195

Closed
lombokissues opened this issue Jul 14, 2015 · 6 comments
Closed

Add @ConstructorProperties to generated constructor #195

lombokissues opened this issue Jul 14, 2015 · 6 comments
Assignees
Milestone

Comments

@lombokissues
Copy link

Migrated from Google Code (issue 122)

@lombokissues
Copy link
Author

👤 jonathancrosmer@hotmail.com   🕗 May 19, 2010 at 14:46 UTC

@ ConstructorProperties is a new annotation in Java 6.
http://java.sun.com/javase/6/docs/api/java/beans/ConstructorProperties.html

The most obvious use of this annotation is that it enables XmlEncoder
to automatically encode immutable POJOs as XML (normally, XmlEncoder
can't encode immutable objects without special handling).

The constructor generated by @ Data should automatically add this
annotation. For example,

@ Data
class Point { private final int x, y; }

...becomes...

class Point {
@ ConstructorProperties({"x", "y"})
public Point(int x, int y) {
...
}

@lombokissues
Copy link
Author

👤 r.spilker   🕗 May 20, 2010 at 08:47 UTC

Thanks, Jonathan, for submitting this feature request. Looks like a great addition to
Lombok to me.

@lombokissues
Copy link
Author

👤 r.spilker   🕗 May 20, 2010 at 08:48 UTC

@lombokissues lombokissues added accepted The issue/enhancement is valid, sensible, and explained in sufficient detail enhancement labels Jul 14, 2015
@lombokissues
Copy link
Author

👤 reinierz   🕗 Jul 19, 2010 at 21:50 UTC

We've added this feature to 0.9.3 (Burrowing Whale)!

There's still the issue that such a file won't compile on java 1.5, as @ ConstructorProperties is new in java 1.6. It can be suppressed with @ RequiredArgsConstructor(suppressConstructorProperties=true), though we've already deprecated that feature as we intend to remove it once 1.5 fades into the limelight.

Done in commit 5c6fe62

Leaving this issue open until we update the web docs

@lombokissues lombokissues added this to the 0.9.3 milestone Jul 14, 2015
@lombokissues
Copy link
Author

👤 reinierz   🕗 Jul 20, 2010 at 05:43 UTC

Docs have been updated in aaf8547

@lombokissues lombokissues removed the accepted The issue/enhancement is valid, sensible, and explained in sufficient detail label Jul 14, 2015
@lombokissues
Copy link
Author

End of migration

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

No branches or pull requests

2 participants