Add @ConstructorProperties to generated constructor #195

lombokissues opened this Issue Jul 14, 2015 · 6 comments


None yet

2 participants


Migrated from Google Code (issue 122)


๐Ÿ‘ค ย  ๐Ÿ•— May 19, 2010 at 14:46 UTC

@ ConstructorProperties is a new annotation in Java 6.

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; }


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


๐Ÿ‘ค 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.


๐Ÿ‘ค r.spilker ย  ๐Ÿ•— May 20, 2010 at 08:48 UTC


๐Ÿ‘ค 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

๐Ÿ‘ค reinierz ย  ๐Ÿ•— Jul 20, 2010 at 05:43 UTC

Docs have been updated in aaf8547

@lombokissues lombokissues removed the accepted label Jul 14, 2015

End of migration

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