diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-09-18 01:40:32 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-09-18 01:40:32 +0200 |
commit | aee4e76d864e01b5d453409e703ad54852fa57bb (patch) | |
tree | 98e00ec3d53c03a492d0c8b3d3af678167cbbddc /website/templates/features | |
parent | 9198551defb7dd71d872c7b86af0a3f0bf0ec545 (diff) | |
download | lombok-aee4e76d864e01b5d453409e703ad54852fa57bb.tar.gz lombok-aee4e76d864e01b5d453409e703ad54852fa57bb.tar.bz2 lombok-aee4e76d864e01b5d453409e703ad54852fa57bb.zip |
updated docs to reflect change to copyable annotations
Diffstat (limited to 'website/templates/features')
-rw-r--r-- | website/templates/features/Builder.html | 2 | ||||
-rw-r--r-- | website/templates/features/Data.html | 2 | ||||
-rw-r--r-- | website/templates/features/GetterSetter.html | 4 | ||||
-rw-r--r-- | website/templates/features/Value.html | 2 | ||||
-rw-r--r-- | website/templates/features/constructor.html | 2 | ||||
-rw-r--r-- | website/templates/features/experimental/SuperBuilder.html | 2 | ||||
-rw-r--r-- | website/templates/features/experimental/Wither.html | 2 |
7 files changed, 13 insertions, 3 deletions
diff --git a/website/templates/features/Builder.html b/website/templates/features/Builder.html index bc03749e..793c7b54 100644 --- a/website/templates/features/Builder.html +++ b/website/templates/features/Builder.html @@ -181,6 +181,8 @@ public class JacksonExample { With <code>toBuilder = true</code> applied to methods, any type parameter of the annotated method itself must also show up in the return type. </p><p> The initializer on a <code>@Builder.Default</code> field is removed and stored in a static method, in order to guarantee that this initializer won't be executed at all if a value is specified in the build. This does mean the initializer cannot refer to <code>this</code>, <code>super</code> or any non-static member. If lombok generates a constructor for you, it'll also initialize this field with the initializer. + </p><p> + Various well known annotations about nullity cause null checks to be inserted and will be copied to parameter of the builder's 'setter' method. See <a href="/features/GetterSetter">Getter/Setter</a> documentation's small print for more information. </p> </@f.smallPrint> </@f.scaffold> diff --git a/website/templates/features/Data.html b/website/templates/features/Data.html index 59370cc8..36278819 100644 --- a/website/templates/features/Data.html +++ b/website/templates/features/Data.html @@ -33,7 +33,7 @@ <p> See the small print of <a href="/features/ToString"><code>@ToString</code></a>, <a href="/features/EqualsAndHashCode"><code>@EqualsAndHashCode</code></a>, <a href="/features/GetterSetter"><code>@Getter / @Setter</code></a> and <a href="/features/constructor">@RequiredArgsConstructor</a>. </p><p> - Any annotations named <code>@NonNull</code> (case insensitive) on a field are interpreted as: This field must not ever hold <em>null</em>. Therefore, these annotations result in an explicit null check in the generated constructor for the provided field. Also, these annotations (as well as any annotation named <code>@Nullable</code>) are copied to the constructor parameter, in both the true constructor and any static constructor. The same principle applies to generated getters and setters (see the documentation for <a href="/features/GetterSetter">@Getter / @Setter</a>) + Various well known annotations about nullity cause null checks to be inserted and will be copied to the relevant places (such as the method for getters, and the parameter for the constructor and setters). See <a href="/features/GetterSetter">Getter/Setter</a> documentation's small print for more information. </p><p> By default, any variables that start with a $ symbol are excluded automatically. You can include them by specifying an explicit annotation (<code>@Getter</code> or <code>@ToString</code>, for example) and using the 'of' parameter. </p> diff --git a/website/templates/features/GetterSetter.html b/website/templates/features/GetterSetter.html index 1baa5bd0..04cd1ec7 100644 --- a/website/templates/features/GetterSetter.html +++ b/website/templates/features/GetterSetter.html @@ -58,7 +58,9 @@ </p><p> Any variation on <code>boolean</code> will <em>not</em> result in using the <code>is</code> prefix instead of the <code>get</code> prefix; for example, returning <code>java.lang.Boolean</code> results in a <code>get</code> prefix, not an <code>is</code> prefix. </p><p> - Any annotations named <code>@NonNull</code> (case insensitive) on the field are interpreted as: This field must not ever hold <em>null</em>. Therefore, these annotations result in an explicit null check in the generated setter. Also, these annotations (as well as any annotation named <code>@Nullable</code> or <code>@CheckForNull</code>) are copied to setter parameter and getter method. + A number of annotations from popular libraries that indicate non-nullness, such as <code>javax.annotation.Nonnull</code>, if present on the field, result in an explicit null check in the generated setter. + </p><p> + Various well-known annotations about nullability, such as <code>org.eclipse.jdt.annotation.NonNull</code>, are automatically copied over to the right place (method for getters, parameter for setters). You can specify additional annotations that should always be copied via lombok <a href="/features/configuration">configuration key</a> <code>lombok.copyableAnnotations</code>. </p><p> You can annotate a class with a <code>@Getter</code> or <code>@Setter</code> annotation. Doing so is equivalent to annotating all non-static fields in that class with that annotation. <code>@Getter</code>/<code>@Setter</code> annotations on fields take precedence over the ones on classes. </p><p> diff --git a/website/templates/features/Value.html b/website/templates/features/Value.html index fdad0e12..5fe188b3 100644 --- a/website/templates/features/Value.html +++ b/website/templates/features/Value.html @@ -42,6 +42,8 @@ </p><p> For classes with generics, it's useful to have a static method which serves as a constructor, because inference of generic parameters via static methods works in java6 and avoids having to use the diamond operator. While you can force this by applying an explicit <code>@AllArgsConstructor(staticConstructor="of")</code> annotation, there's also the <code>@Value(staticConstructor="of")</code> feature, which will make the generated all-arguments constructor private, and generates a public static method named <code>of</code> which is a wrapper around this private constructor. </p><p> + Various well known annotations about nullity cause null checks to be inserted and will be copied to the relevant places (such as the method for getters, and the parameter for the constructor and setters). See <a href="/features/GetterSetter">Getter/Setter</a> documentation's small print for more information. + </p><p> <code>@Value</code> was an experimental feature from v0.11.4 to v0.11.9 (as <code>@lombok.experimental.Value</code>). It has since been moved into the core package. The old annotation is still around (and is an alias). It will eventually be removed in a future version, though. </p><p> It is not possible to use <code>@FieldDefaults</code> to 'undo' the private-by-default and final-by-default aspect of fields in the annotated class. Use <code>@NonFinal</code> and <code>@PackagePrivate</code> on the fields in the class to override this behaviour. diff --git a/website/templates/features/constructor.html b/website/templates/features/constructor.html index 716efe5a..fc0be1c6 100644 --- a/website/templates/features/constructor.html +++ b/website/templates/features/constructor.html @@ -51,6 +51,8 @@ </p><p> While <code>suppressConstructorProperties</code> has been marked deprecated in anticipation of a world where all java environments have the <code>@ConstructorProperties</code> annotation available, first GWT 2.2 and Android 2.3.3, which do not (yet) have this annotation, will have to be ancient history before this annotation parameter will be removed. </p><p> + Various well known annotations about nullity cause null checks to be inserted and will be copied to the parameter. See <a href="/features/GetterSetter">Getter/Setter</a> documentation's small print for more information. + </p><p> The <code>flagUsage</code> configuration keys do not trigger when a constructor is generated by <code>@Data</code>, <code>@Value</code> or any other lombok annotation. </p> </@f.smallPrint> diff --git a/website/templates/features/experimental/SuperBuilder.html b/website/templates/features/experimental/SuperBuilder.html index 9b49bc83..8189a254 100644 --- a/website/templates/features/experimental/SuperBuilder.html +++ b/website/templates/features/experimental/SuperBuilder.html @@ -63,6 +63,8 @@ An <code>ArrayList</code> is used to store added elements as call methods of a <code>@Singular</code> marked field, if the target collection is from the <code>java.util</code> package, <em>even if the collection is a set or map</em>. Because lombok ensures that generated collections are compacted, a new backing instance of a set or map must be constructed anyway, and storing the data as an <code>ArrayList</code> during the build process is more efficient that storing it as a map or set. This behaviour is not externally visible, an implementation detail of the current implementation of the <code>java.util</code> recipes for <code>@Singular</code>. </p><p> The generated builder code heavily relies on generics to avoid class casting when using the builder. + </p><p> + Various well known annotations about nullity cause null checks to be inserted and will be copied to parameter of the builder's 'setter' method. See <a href="/features/GetterSetter">Getter/Setter</a> documentation's small print for more information. </p> </@f.smallPrint> </@f.scaffold> diff --git a/website/templates/features/experimental/Wither.html b/website/templates/features/experimental/Wither.html index 9642458b..00dc10b1 100644 --- a/website/templates/features/experimental/Wither.html +++ b/website/templates/features/experimental/Wither.html @@ -60,7 +60,7 @@ </p><p> For <code>boolean</code> fields that start with <code>is</code> immediately followed by a title-case letter, nothing is prefixed to generate the wither name. </p><p> - Any annotations named <code>@NonNull</code> (case insensitive) on the field are interpreted as: This field must not ever hold <em>null</em>. Therefore, these annotations result in an explicit null check in the generated wither. Also, these annotations (as well as any annotation named <code>@Nullable</code> or <code>@CheckForNull</code>) are copied to wither parameter. + Various well known annotations about nullity cause null checks to be inserted and will be copied to the parameter. See <a href="/features/GetterSetter">Getter/Setter</a> documentation's small print for more information. </p> </@f.smallPrint> </@f.scaffold> |