Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<spring-asciidoctor-backends.version>0.0.6</spring-asciidoctor-backends.version>

<!-- plugin versions -->
<maven-compiler-plugin.version>3.14.0</maven-compiler-plugin.version>
<maven-compiler-plugin.version>3.14.1</maven-compiler-plugin.version>
<maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
<maven-failsafe-plugin.version>3.1.2</maven-failsafe-plugin.version>
<maven-flatten-plugin.version>1.6.0</maven-flatten-plugin.version>
Expand All @@ -111,6 +111,9 @@
<maven-site-plugin.version>4.0.0-M13</maven-site-plugin.version>
<maven-project-info-reports-plugin.version>3.4.5</maven-project-info-reports-plugin.version>
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
<!-- Nullability plugins -->
<error-prone.version>2.44.0</error-prone.version>
<nullaway.version>0.12.12</nullaway.version>
<!-- BEGIN format + checkstyle properties -->
<spring-javaformat-maven-plugin.version>0.0.43</spring-javaformat-maven-plugin.version>
<maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
Expand Down Expand Up @@ -193,9 +196,39 @@
<version>${maven-compiler-plugin.version}</version>
<configuration>
<release>${java.version}</release>
<showWarnings>true</showWarnings>
<compilerArgs>
<compilerArg>-parameters</compilerArg>
<compilerArg>-Xdoclint:none</compilerArg>
<compilerArg>-Werror</compilerArg>
<compilerArg>-XDcompilePolicy=simple</compilerArg>
<compilerArg>--should-stop=ifError=FLOW</compilerArg>
<compilerArg>
-Xplugin:ErrorProne
<!-- Disable all built-in error prone checks -->
-XepDisableAllChecks
<!-- JSpecify mode https://github.com/uber/NullAway/wiki/JSpecify-Support -->
-XepOpt:NullAway:JSpecifyMode=true
<!-- Check JSpecify annotations -->
-Xep:NullAway:ERROR
-XepOpt:NullAway:OnlyNullMarked
-XepOpt:NullAway:TreatGeneratedAsUnannotated=true
<!-- https://github.com/uber/NullAway/issues/162 -->
-XepExcludedPaths:.*/src/test/java/.*
</compilerArg>
</compilerArgs>
<annotationProcessorPaths>
<path>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>${error-prone.version}</version>
</path>
<path>
<groupId>com.uber.nullaway</groupId>
<artifactId>nullaway</artifactId>
<version>${nullaway.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
Expand Down
6 changes: 6 additions & 0 deletions spring-grpc-build-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
</licenses>

<properties>
<jspecify.version>1.0.0</jspecify.version>
<spring-framework.version>7.0.1</spring-framework.version>
<spring-security.version>7.0.0</spring-security.version>
<micrometer.version>1.16.0</micrometer.version>
Expand Down Expand Up @@ -94,6 +95,11 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jspecify</groupId>
<artifactId>jspecify</artifactId>
<version>${jspecify.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
4 changes: 4 additions & 0 deletions spring-grpc-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
<artifactId>spring-security-web</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jspecify</groupId>
<artifactId>jspecify</artifactId>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
import java.util.List;
import java.util.concurrent.TimeUnit;

import org.jspecify.annotations.Nullable;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.core.log.LogAccessor;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;

import io.grpc.ChannelCredentials;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import java.util.HashSet;
import java.util.Set;

import org.jspecify.annotations.Nullable;

import org.springframework.aot.generate.GenerationContext;
import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.ReflectionHints;
Expand All @@ -36,7 +38,6 @@
import org.springframework.beans.factory.support.RegisteredBean;
import org.springframework.core.MethodParameter;
import org.springframework.grpc.client.GrpcClientFactory;
import org.springframework.lang.Nullable;
import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@
* limitations under the License.
*/

/**
* Core module for Spring gRPC.
*/
@NullMarked
package org.springframework.grpc;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @onobc I believe that actually every package needs to be annotated, right? Not only the top-level one, due to the limitations of how NullAway+JSpecify do things, its not inherited from the root to all sub packages.

For example, searching inside Spring Framework we have 356 mathces for files package-info.java with NullMarked inside:

repo:spring-projects/spring-framework "@NullMarked" path:package-info.java

https://github.com/search?q=repo%3Aspring-projects%2Fspring-framework+%22%40NullMarked%22+path%3Apackage-info.java&type=code

So to truly benefit from JSpecify I believe Spring gRPC still has some package-info to add, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋🏻 @lobaorn-bitso - great catch! Absolutely have to put a package-info.java in each package directory. I will get this fixed shortly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @onobc. If you don't mind or are unavailable, I can do PR for this myself.


import org.jspecify.annotations.NullMarked;
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jspecify.annotations.Nullable;

import org.springframework.grpc.internal.GrpcUtils;
import org.springframework.grpc.server.service.ServerInterceptorFilter;
import org.springframework.lang.Nullable;

import io.grpc.Grpc;
import io.grpc.InsecureServerCredentials;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

import javax.net.ssl.SSLSession;

import org.springframework.lang.Nullable;
import org.jspecify.annotations.Nullable;

import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken;
import org.springframework.security.web.authentication.preauth.x509.SubjectDnX509PrincipalExtractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
import java.util.Arrays;
import java.util.List;

import org.jspecify.annotations.Nullable;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.grpc.internal.ApplicationContextBeanLookupUtils;
import org.springframework.grpc.server.GlobalServerInterceptor;
import org.springframework.grpc.server.GrpcServerFactory;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;

import io.grpc.BindableService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@

import java.util.List;

import org.jspecify.annotations.Nullable;

import org.springframework.context.ApplicationContext;
import org.springframework.grpc.internal.ApplicationContextBeanLookupUtils;
import org.springframework.lang.Nullable;

import io.grpc.BindableService;
import io.grpc.ServerServiceDefinition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@

package org.springframework.grpc.server.service;

import org.jspecify.annotations.Nullable;

import org.springframework.grpc.server.GrpcServerFactory;
import org.springframework.lang.Nullable;

import io.grpc.ServerServiceDefinition;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

import java.util.List;

import org.springframework.lang.Nullable;
import org.jspecify.annotations.Nullable;

import org.springframework.util.Assert;

import io.grpc.ServerInterceptor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

package org.springframework.grpc.server.service;

import org.springframework.lang.Nullable;
import org.jspecify.annotations.Nullable;

import org.springframework.util.Assert;

import io.grpc.BindableService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.function.Consumer;

import org.assertj.core.api.InstanceOfAssertFactories;
import org.jspecify.annotations.Nullable;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.mockito.MockedStatic;
Expand All @@ -44,7 +45,6 @@
import org.springframework.core.annotation.Order;
import org.springframework.grpc.server.GlobalServerInterceptor;
import org.springframework.grpc.server.lifecycle.GrpcServerLifecycle;
import org.springframework.lang.Nullable;

import io.grpc.BindableService;
import io.grpc.ServerInterceptor;
Expand Down
Loading