Bill Burcham created GEODE-8882:
-----------------------------------
Summary: Introduce JetBrains @NotNull Annotation Support
Key: GEODE-8882
URL: https://issues.apache.org/jira/browse/GEODE-8882
Project: Geode
Issue Type: Task
Components: build, tools
Reporter: Bill Burcham
In [2017 a couple committers
discussed|https://markmail.org/search/?q=list%3Aorg.apache.geode.dev+order%3Adate-backward+notnull#query:list%3Aorg.apache.geode.dev%20order%3Adate-backward%20notnull+page:1+mid:daov733nyw5xbhps+state:results]
using the JetBrains {{@NotNull}} annotation in Geode.
More recently, in [PR #5947|https://github.com/apache/geode/pull/5947/files#]
there was agreement that the {{@NotNull}} annotation would improve the
documentation and development-time (IDE) static analysis of the
{{{SocketMessageWriter.writeHandshakeMessage()}} method signature.
Specifically, there was a question whether it was ok to remove a null-check on
the {{clientVersion}} parameter.
When this task is complete, {{geode-common}} will have a new {{api()}}
dependency on [JetBrains Java
Annotations|https://github.com/JetBrains/java-annotations]. As a result, Gradle
subprojects that depend on {{geode-common}} will also be able to reference the
annotations.
Also the method just mentioned will have this signature (as a demonstration
that the new annotation works):
{code}
public void writeHandshakeMessage(DataOutputStream dos, byte type, String
p_msg,
@NotNull final KnownVersion clientVersion, byte endpointType, int
queueSize)
throws IOException {
{code}
The benefit will be that IntelliJ code inspections will flag (some) situations
where we are passing nullable references where they aren't expected. This will
entail adding more annotations. This PR merely enables that work, and the
attendant static analysis.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)