lombok 1.18.0, intellij 2018.1.5 with latest plugin, java 8


According to the docs, @Value generates an AllArgsConstructor, and in case of conflicts, a compile error rather than silently dropping the constructor... But that doesn't seem to be the case here. This was also an issue on 1.16.20.
config.stopBubbling=true
lombok.accessors.chain=true
lombok.addLombokGeneratedAnnotation=true
lombok.experimental.flagUsage=error
lombok.extern.findbugs.addSuppressFBWarnings=true
lombok.getter.noIsPrefix=true
lombok.log.fieldName=LOGGER
lombok.nonNull.exceptionType=IllegalArgumentException
lombok.singular.auto=false
My bad, sorry!
@TheRealMarnes I'm not sure if you remember this, but perhaps you could explain what was the error, which apparently you've found and closed the issue because of it?
It seems that I've got a similar issue with the @Value annotation - the All Args Constructor doesn't get generated in case when a custom constructor is present in the class.
Oh yeah, so now I've also read the documentation of @Value a little bit further: https://projectlombok.org/features/Value
For anyone facing this problem as well - the documentation states:
In practice,
@Valueis shorthand for:final @ToString @EqualsAndHashCode @AllArgsConstructor @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @Getter, except that explicitly including an implementation of any of the relevant methods simply means that part won't be generated and no warning will be emitted. For example, if you write your own toString, no error occurs, and lombok will not generate a toString. Also, any explicit constructor, no matter the arguments list, implies lombok will not generate a constructor.
So basically, IMO the Javadoc is a little bit misleading, as it states:
Equivalent to {@code @Getter @FieldDefaults(makeFinal=true, level=AccessLevel.PRIVATE) @AllArgsConstructor @ToString @EqualsAndHashCode}.
In the next line, a URL to the complete documentation is provided, nevertheless a small notice, that there're some exceptions, would be nice.
Yeah I just researched this again and found the same "small print":
Also, _any_ explicit constructor, no matter the arguments list, implies lombok will not generate a constructor. If you do want lombok to generate the all-args constructor, add
@AllArgsConstructorto the class.
I agree the documentation is misleading when it says that an annotation is equivalent to a combination of other annotations. Constructors in particular often give me different behavior between using the individual annotations and the composed ones.
My experience using lombok on 2 projects has led me to use @Data and @Value only on absolutely "dumb" pojos that do not and should not contain any logic whatsoever. As soon as a class gets any more "smart" than just a DTO bean, I use the individual annotations to avoid confusing behavior and to improve clarity (reading a list like @Getter @EqualsAndHashCode @ToString is easier than remembering what exactly the composed annotations add up to).
I used @Value with @NoArgsConstructor(force = true, access = AccessLevel.PRIVATE) so AllArgsConstructor was not made at all. Finally I found the reason on this issue. I think that lines should be inserted to lombok docs.
Belows are the documentation when i hover mouse over @Value. It said nothing about those exception cases.
Generates a lot of code which fits with a class that is a representation of an immutable entity.
Equivalent to @Getter @FieldDefaults(makeFinal=true, level=AccessLevel.PRIVATE) @AllArgsConstructor @ToString @EqualsAndHashCode.
Complete documentation is found at the project lombok features page for @Value.
Most helpful comment
Oh yeah, so now I've also read the documentation of
@Valuea little bit further: https://projectlombok.org/features/ValueFor anyone facing this problem as well - the documentation states:
So basically, IMO the Javadoc is a little bit misleading, as it states:
In the next line, a URL to the complete documentation is provided, nevertheless a small notice, that there're some exceptions, would be nice.