Skip to content

Commit f409a1c

Browse files
authored
Initial support for JSpecify (#1594)
1 parent d8c4895 commit f409a1c

File tree

25 files changed

+259
-28
lines changed

25 files changed

+259
-28
lines changed

.mvn/jvm.config

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
-Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom
1+
-Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom
2+
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
3+
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
4+
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
5+
--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
6+
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
7+
--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
8+
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
9+
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
10+
--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
11+
--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
<bintray.package>commons</bintray.package>
8888
<evictor.version>1.0.0</evictor.version>
8989
<bouncycastle-bcprov-jdk18on.version>1.81</bouncycastle-bcprov-jdk18on.version>
90+
<jspecify.enabled>true</jspecify.enabled>
9091
</properties>
9192
<build>
9293
<plugins>

spring-cloud-commons/src/main/java/org/springframework/cloud/client/ServiceInstance.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import java.net.URI;
2020
import java.util.Map;
2121

22+
import org.jspecify.annotations.Nullable;
23+
2224
/**
2325
* Represents an instance of a service in a discovery system.
2426
*
@@ -30,7 +32,7 @@ public interface ServiceInstance {
3032
/**
3133
* @return The unique instance ID as registered.
3234
*/
33-
default String getInstanceId() {
35+
default @Nullable String getInstanceId() {
3436
return null;
3537
}
3638

@@ -67,7 +69,7 @@ default String getInstanceId() {
6769
/**
6870
* @return The scheme of the service instance.
6971
*/
70-
default String getScheme() {
72+
default @Nullable String getScheme() {
7173
return null;
7274
}
7375

spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/ManagementServerPortUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package org.springframework.cloud.client.discovery;
1818

19+
import org.jspecify.annotations.Nullable;
20+
1921
import org.springframework.beans.factory.BeanFactory;
2022
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
2123
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties;
@@ -71,7 +73,7 @@ public static boolean isSame(BeanFactory beanFactory) {
7173
return get(beanFactory) == ManagementServerPort.SAME;
7274
}
7375

74-
public static Integer getPort(BeanFactory beanFactory) {
76+
public static @Nullable Integer getPort(BeanFactory beanFactory) {
7577
if (!hasActuator) {
7678
return null;
7779
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright 2013-present the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/**
18+
* Spring Cloud service discovery abstractions.
19+
*/
20+
@org.jspecify.annotations.NullMarked
21+
package org.springframework.cloud.client.discovery;

spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancedRetryFactory.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package org.springframework.cloud.client.loadbalancer;
1818

19+
import org.jspecify.annotations.Nullable;
20+
1921
import org.springframework.retry.RetryListener;
2022
import org.springframework.retry.backoff.BackOffPolicy;
2123
import org.springframework.retry.backoff.NoBackOffPolicy;
@@ -33,7 +35,8 @@ public interface LoadBalancedRetryFactory {
3335
* @param serviceInstanceChooser Used to get the next server from a load balancer.
3436
* @return A retry policy for the service.
3537
*/
36-
default LoadBalancedRetryPolicy createRetryPolicy(String service, ServiceInstanceChooser serviceInstanceChooser) {
38+
default @Nullable LoadBalancedRetryPolicy createRetryPolicy(String service,
39+
ServiceInstanceChooser serviceInstanceChooser) {
3740
return null;
3841
}
3942

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright 2013-present the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/**
18+
* Spring Cloud load balancer abstractions.
19+
*/
20+
@org.jspecify.annotations.NullMarked
21+
package org.springframework.cloud.client.loadbalancer;

spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/reactive/ReactiveLoadBalancer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.util.Map;
2020

21+
import org.jspecify.annotations.Nullable;
2122
import org.reactivestreams.Publisher;
2223

2324
import org.springframework.cloud.client.loadbalancer.DefaultRequest;
@@ -54,7 +55,7 @@ default Publisher<Response<T>> choose() { // conflicting name
5455

5556
interface Factory<T> {
5657

57-
default LoadBalancerProperties getProperties(String serviceId) {
58+
default @Nullable LoadBalancerProperties getProperties(String serviceId) {
5859
return null;
5960
}
6061

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright 2013-present the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/**
18+
* Spring Cloud client abstractions.
19+
*/
20+
@org.jspecify.annotations.NullMarked
21+
package org.springframework.cloud.client;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright 2013-present the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/**
18+
* Spring Cloud service registry abstractions.
19+
*/
20+
@org.jspecify.annotations.NullMarked
21+
package org.springframework.cloud.client.serviceregistry;

0 commit comments

Comments
 (0)