[
https://issues.redhat.com/browse/WFCORE-5285?page=com.atlassian.jira.plug...
]
Boris Unckel commented on WFCORE-5285:
--------------------------------------
[~jmesnil] The first part - improve existing usage - is ready:
[
https://github.com/boris-unckel/wildfly-core/commit/b6282ebb7cc379266cd49...]
What is you're oppionion to the approach? Does it conform to the overall strategy to
deal with null / null checks? If you like the approach - what is your preferred way to get
changes which affect classes all over the codebase? Single PR, one PR per module?
Improve Fail-Fast with Objects.requireNonNull
---------------------------------------------
Key: WFCORE-5285
URL:
https://issues.redhat.com/browse/WFCORE-5285
Project: WildFly Core
Issue Type: Enhancement
Affects Versions: 14.0.1.Final
Reporter: Boris Unckel
Assignee: Jeff Mesnil
Priority: Minor
In the current WildFly-Core code are very few cases where Objects.requireNonNull is in
use, 61 occurrences. Some of them can be improved with a message ("Parameter xyz
cannot be null").
The idea is to add Objects.requireNonNull in more cases. The check shall not pollute at
any place and shall occur only once (i.e. at the top of a class hierarchy for a specific
attribute).
Candidates would be:
a) Constructors with object parameters without setter (single check at point of
assignment to instance variable). NullPointer would raise at instantiation, not at usage.
b) Factory methods which creates objects in terms of a)
c) Public methods with two or more object parameters where null pointer would occur in
the direct method code.
--
This message was sent by Atlassian Jira
(v8.13.1#813001)