blob: 318d85b93ca8c5e660cf1e8b664a357d6be4481c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
//version 8:
public class NonNullWithAssertion {
@lombok.NonNull
private String test;
public void testMethod(@lombok.NonNull String arg) {
assert arg != null : "arg is marked non-null but is null";
System.out.println(arg);
}
public void testMethodWithIf(@lombok.NonNull String arg) {
if (arg == null) throw new NullPointerException("Oops");
}
@java.lang.SuppressWarnings("all")
public void setTest(@lombok.NonNull final String test) {
assert test != null : "test is marked non-null but is null";
this.test = test;
}
}
|