Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-8882

Introduce JetBrains @NotNull Annotation Support

    XMLWordPrintableJSON

    Details

      Description

      This ticket affects only product development. It does not change product behavior.

      In 2017 a couple committers discussed using the JetBrains @NotNull annotation in Geode.

      More recently, in PR #5947 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. 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):

        public void writeHandshakeMessage(DataOutputStream dos, byte type, String p_msg,
            @Nullable final KnownVersion clientVersion, byte endpointType, int queueSize)
            throws IOException {
      

      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.

      Documented this on the Geode wiki: https://cwiki.apache.org/confluence/display/GEODE/@NotNull+Annotation

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                burcham Bill Burcham
                Reporter:
                burcham Bill Burcham
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: