From 4e7414038ad9df25fb6d2ee76dd22421e1ff7005 Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Mon, 25 Mar 2019 23:36:16 +0100 Subject: [i2078] Add possibility to generate assert on `@NonNull` --- website/templates/features/NonNull.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'website') diff --git a/website/templates/features/NonNull.html b/website/templates/features/NonNull.html index 66ab2fc2..b09f0cda 100644 --- a/website/templates/features/NonNull.html +++ b/website/templates/features/NonNull.html @@ -21,9 +21,9 @@ <@f.confKeys>
- lombok.nonNull.exceptionType = [NullPointerException | IllegalArgumentException] (default: NullPointerException). + lombok.nonNull.exceptionType = [NullPointerException | IllegalArgumentException | Assertion] (default: NullPointerException).
- When lombok generates a null-check if statement, by default, a java.lang.NullPointerException will be thrown with 'field name is marked @NonNull but is null' as the exception message. However, you can use IllegalArgumentException in this configuration key to have lombok throw that exception with this message instead. + When lombok generates a null-check if statement, by default, a java.lang.NullPointerException will be thrown with 'field name is marked @non-null but is null' as the exception message. However, you can use IllegalArgumentException in this configuration key to have lombok throw that exception with this message instead. By using Assertion, an assert statement with the same message will be generated.
lombok.nonNull.flagUsage = [warning | error] (default: not set)
@@ -33,7 +33,7 @@ <@f.smallPrint>

- Lombok's detection scheme for already existing null-checks consists of scanning for if statements that look just like lombok's own. Any 'throws' statement as the 'then' part of the if statement, whether in braces or not, counts. The conditional of the if statement must look exactly like PARAMNAME == null. The first statement in your method that is not such a null-check stops the process of inspecting for null-checks. + Lombok's detection scheme for already existing null-checks consists of scanning for if statements or assert statements that look just like lombok's own. Any 'throws' statement as the 'then' part of the if statement, whether in braces or not, counts. The conditional of the if statement must look exactly like PARAMNAME == null; the assert statement must look exactly like PARAMNAME != null. The first statement in your method that is not such a null-check stops the process of inspecting for null-checks.

While @Data and other method-generating lombok annotations will trigger on various well-known annotations that signify the field must never be @NonNull, this feature only triggers on lombok's own @NonNull annotation from the lombok package.

-- cgit