Closed mhalbritter closed 1 month ago
Unfortunately, this can't be done robustly using Checkstyle. Its AST is created from parsing the source. As such, it doesn't contain enough information to be certain that it's java.lang.Objects.requireNonNull()
that's being called and not requireNonNull()
on some other class named Objects
. We'll check it instead in Boot's own build using ArchUnit. ArchUnit works with bytecode so it knows exactly what's being called.
We should add a rule preventing calls to
Objects.requireNonNull()
, instead we should useAssert.notNull()
from Spring Framework.Objects.requireNonNull()
throws aNullPointerException
, whileAssert.notNull()
throws aIllegalArgumentException
.