-
Feature Request
-
Resolution: Won't Do
-
Major
-
None
-
None
-
None
Use an @NotNull or @RequiresNonNull annotation on a method to generate a null check and throw, by default, an IllegalArgumentException if null. Also clean the stack trace.
Example Interface
@Message(id = 123, value = "Name cannot be null") @NotNull(IllegalArgumentException.class) void requireNotNull(String name);
Example Generated Code
@Override public void requireNotNull(final String name) { if (name == null) { final IllegalArgumentException result = new IllegalArgumentException(String.format(invalidUser$str(), name)); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); } }
The @Param annotation could be used along with @Pos for formatting possibly.
- duplicates
-
WFLY-5265 Use WildFly Common for null param checks
- Open