mirror of
https://github.com/tiennm99/lombok.git
synced 2026-09-08 02:20:00 +00:00
Fixes #1197, add Objects.requireNonNull and Preconditions.checkkNotNull to supported null-check styles
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
//version 7:
|
||||
//CONF: lombok.nonNull.exceptionType = Jdk
|
||||
import static java.util.Objects.*;
|
||||
public class NonNullWithJdk {
|
||||
@lombok.NonNull @lombok.Setter private String test;
|
||||
|
||||
public void testMethod(@lombok.NonNull String arg) {
|
||||
System.out.println(arg);
|
||||
}
|
||||
|
||||
public void testMethodWithCheck1(@lombok.NonNull String arg) {
|
||||
requireNonNull(arg);
|
||||
}
|
||||
|
||||
public void testMethodWithCheckAssign(@lombok.NonNull String arg) {
|
||||
test = requireNonNull(arg);
|
||||
}
|
||||
|
||||
public void testMethodWithCheck2(@lombok.NonNull String arg) {
|
||||
java.util.Objects.requireNonNull(arg);
|
||||
}
|
||||
|
||||
public void testMethodWithFakeCheck1(@lombok.NonNull String arg) {
|
||||
requireNonNull("");
|
||||
}
|
||||
|
||||
public void testMethodWithFakeCheck2(@lombok.NonNull String arg) {
|
||||
java.util.Objects.requireNonNull(test);
|
||||
}
|
||||
|
||||
public void testMethodWithFakeCheckAssign(@lombok.NonNull String arg) {
|
||||
test = requireNonNull(test);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user