[ 
https://issues.apache.org/jira/browse/GEODE-8882?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17273965#comment-17273965
 ] 

ASF GitHub Bot commented on GEODE-8882:
---------------------------------------

Bill commented on a change in pull request #5967:
URL: https://github.com/apache/geode/pull/5967#discussion_r566366660



##########
File path: geode-common/build.gradle
##########
@@ -26,6 +26,7 @@ dependencies {
   implementation(platform(project(':boms:geode-all-bom')))
   implementation('com.fasterxml.jackson.core:jackson-databind')
 
+  api('org.jetbrains:annotations')

Review comment:
       I want to introduce a compile-time dependency on `annotation`, in any 
subproject that depends on `geode-common`, because I want to save my colleagues 
from having to add an explicit dependency on `annotation` to the `build.gradle` 
for each subproject, as they desire to add a `@NotNull` annotation in some new 
place.
   
   I tried changing this to `compileOnly('org.jetbrains:annotations')` but now 
the compiler/IDE says  `java: package org.jetbrains.annotations does not exist` 
where I'm trying to import it over in `SocketMessageWriter.java` in 
`geode-core`.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


> 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
>            Assignee: Bill Burcham
>            Priority: Major
>              Labels: pull-request-available
>
> 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)

Reply via email to