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

Comments

Projects
None yet
2 participants
@lombokissues
Collaborator

lombokissues commented Jul 14, 2015

Migrated from Google Code (issue 122)

@lombokissues

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

Collaborator

👤 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) {
...
}

Collaborator

lombokissues commented Jul 14, 2015

👤 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

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

Collaborator

👤 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.

Collaborator

lombokissues commented Jul 14, 2015

👤 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

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

Collaborator

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

Collaborator

lombokissues commented Jul 14, 2015

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

@lombokissues

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

Collaborator

👤 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

Collaborator

lombokissues commented Jul 14, 2015

👤 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

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

Collaborator

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

Docs have been updated in aaf8547

Collaborator

lombokissues commented Jul 14, 2015

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

Docs have been updated in aaf8547

@lombokissues

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

Collaborator

End of migration

Collaborator

lombokissues commented Jul 14, 2015

End of migration

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