mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 08:18:29 +00:00
Fixes #1197, add Objects.requireNonNull and Preconditions.checkkNotNull to supported null-check styles
This commit is contained in:
1 parent
e1d1415d6e
commit
aa80e1baf9
12 files changed
+356
-34
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
public class NonNullWithGuava {
|
||||
private @lombok.NonNull @lombok.Setter String test;
|
||||
public NonNullWithGuava() {
|
||||
super();
|
||||
}
|
||||
public void testMethod(@lombok.NonNull String arg) {
|
||||
com.google.common.base.Preconditions.checkNotNull(arg, "arg is marked non-null but is null");
|
||||
System.out.println(arg);
|
||||
}
|
||||
public void testMethodWithCheck1(@lombok.NonNull String arg) {
|
||||
checkNotNull(arg);
|
||||
}
|
||||
public void testMethodWithCheckAssign(@lombok.NonNull String arg) {
|
||||
test = checkNotNull(arg);
|
||||
}
|
||||
public void testMethodWithCheck2(@lombok.NonNull String arg) {
|
||||
com.google.common.base.Preconditions.checkNotNull(arg);
|
||||
}
|
||||
public void testMethodWithFakeCheck1(@lombok.NonNull String arg) {
|
||||
com.google.common.base.Preconditions.checkNotNull(arg, "arg is marked non-null but is null");
|
||||
checkNotNull("");
|
||||
}
|
||||
public void testMethodWithFakeCheck2(@lombok.NonNull String arg) {
|
||||
com.google.common.base.Preconditions.checkNotNull(arg, "arg is marked non-null but is null");
|
||||
com.google.common.base.Preconditions.checkNotNull(test);
|
||||
}
|
||||
public void testMethodWithFakeCheckAssign(@lombok.NonNull String arg) {
|
||||
com.google.common.base.Preconditions.checkNotNull(arg, "arg is marked non-null but is null");
|
||||
test = checkNotNull(test);
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") void setTest(final @lombok.NonNull String test) {
|
||||
com.google.common.base.Preconditions.checkNotNull(test, "test is marked non-null but is null");
|
||||
this.test = test;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user