diff --git a/.mvn/jvm.config b/.mvn/jvm.config index 0e7dabeff..761912e40 100644 --- a/.mvn/jvm.config +++ b/.mvn/jvm.config @@ -1 +1,11 @@ --Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom \ No newline at end of file +-Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom +--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED +--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED +--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED \ No newline at end of file diff --git a/pom.xml b/pom.xml index bfd95a961..3a3b1b9ba 100644 --- a/pom.xml +++ b/pom.xml @@ -87,6 +87,7 @@ commons 1.0.0 1.81 + true diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/ServiceInstance.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/ServiceInstance.java index c603f8454..b15d9ac12 100644 --- a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/ServiceInstance.java +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/ServiceInstance.java @@ -19,6 +19,8 @@ import java.net.URI; import java.util.Map; +import org.jspecify.annotations.Nullable; + /** * Represents an instance of a service in a discovery system. * @@ -30,7 +32,7 @@ public interface ServiceInstance { /** * @return The unique instance ID as registered. */ - default String getInstanceId() { + default @Nullable String getInstanceId() { return null; } @@ -67,7 +69,7 @@ default String getInstanceId() { /** * @return The scheme of the service instance. */ - default String getScheme() { + default @Nullable String getScheme() { return null; } diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/ManagementServerPortUtils.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/ManagementServerPortUtils.java index d422f0cb6..722b4fcb1 100644 --- a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/ManagementServerPortUtils.java +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/ManagementServerPortUtils.java @@ -16,6 +16,8 @@ package org.springframework.cloud.client.discovery; +import org.jspecify.annotations.Nullable; + import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties; @@ -71,7 +73,7 @@ public static boolean isSame(BeanFactory beanFactory) { return get(beanFactory) == ManagementServerPort.SAME; } - public static Integer getPort(BeanFactory beanFactory) { + public static @Nullable Integer getPort(BeanFactory beanFactory) { if (!hasActuator) { return null; } diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/package-info.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/package-info.java new file mode 100644 index 000000000..d3fb5f71c --- /dev/null +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright 2013-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Spring Cloud service discovery abstractions. + */ +@org.jspecify.annotations.NullMarked +package org.springframework.cloud.client.discovery; diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancedRetryFactory.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancedRetryFactory.java index 75937751a..f1904a4a4 100644 --- a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancedRetryFactory.java +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancedRetryFactory.java @@ -16,6 +16,8 @@ package org.springframework.cloud.client.loadbalancer; +import org.jspecify.annotations.Nullable; + import org.springframework.retry.RetryListener; import org.springframework.retry.backoff.BackOffPolicy; import org.springframework.retry.backoff.NoBackOffPolicy; @@ -33,7 +35,8 @@ public interface LoadBalancedRetryFactory { * @param serviceInstanceChooser Used to get the next server from a load balancer. * @return A retry policy for the service. */ - default LoadBalancedRetryPolicy createRetryPolicy(String service, ServiceInstanceChooser serviceInstanceChooser) { + default @Nullable LoadBalancedRetryPolicy createRetryPolicy(String service, + ServiceInstanceChooser serviceInstanceChooser) { return null; } diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/package-info.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/package-info.java new file mode 100644 index 000000000..139a095fa --- /dev/null +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright 2013-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Spring Cloud load balancer abstractions. + */ +@org.jspecify.annotations.NullMarked +package org.springframework.cloud.client.loadbalancer; diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/reactive/ReactiveLoadBalancer.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/reactive/ReactiveLoadBalancer.java index 098bb99f4..17a36f4c6 100644 --- a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/reactive/ReactiveLoadBalancer.java +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/reactive/ReactiveLoadBalancer.java @@ -18,6 +18,7 @@ import java.util.Map; +import org.jspecify.annotations.Nullable; import org.reactivestreams.Publisher; import org.springframework.cloud.client.loadbalancer.DefaultRequest; @@ -54,7 +55,7 @@ default Publisher> choose() { // conflicting name interface Factory { - default LoadBalancerProperties getProperties(String serviceId) { + default @Nullable LoadBalancerProperties getProperties(String serviceId) { return null; } diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/package-info.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/package-info.java new file mode 100644 index 000000000..2b6896ff4 --- /dev/null +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright 2013-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Spring Cloud client abstractions. + */ +@org.jspecify.annotations.NullMarked +package org.springframework.cloud.client; diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/serviceregistry/package-info.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/serviceregistry/package-info.java new file mode 100644 index 000000000..07065a97a --- /dev/null +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/serviceregistry/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright 2013-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Spring Cloud service registry abstractions. + */ +@org.jspecify.annotations.NullMarked +package org.springframework.cloud.client.serviceregistry; diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/commons/config/CommonsConfigAutoConfiguration.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/commons/config/CommonsConfigAutoConfiguration.java index 7338d1989..a8337e9b1 100644 --- a/spring-cloud-commons/src/main/java/org/springframework/cloud/commons/config/CommonsConfigAutoConfiguration.java +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/commons/config/CommonsConfigAutoConfiguration.java @@ -19,10 +19,11 @@ import java.util.HashMap; import java.util.Map; +import org.jspecify.annotations.Nullable; + import org.springframework.boot.context.properties.source.ConfigurationPropertyName; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.lang.Nullable; import org.springframework.util.ObjectUtils; /** @@ -34,7 +35,7 @@ public class CommonsConfigAutoConfiguration { @Bean public DefaultsBindHandlerAdvisor defaultsBindHandlerAdvisor( - @Nullable DefaultsBindHandlerAdvisor.MappingsProvider[] providers) { + DefaultsBindHandlerAdvisor.@Nullable MappingsProvider @Nullable [] providers) { Map additionalMappings = new HashMap<>(); if (!ObjectUtils.isEmpty(providers)) { for (DefaultsBindHandlerAdvisor.MappingsProvider mappingsProvider : providers) { diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/commons/package-info.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/commons/package-info.java new file mode 100644 index 000000000..021e2e596 --- /dev/null +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/commons/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright 2013-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Spring Cloud commons utilities and abstractions. + */ +@org.jspecify.annotations.NullMarked +package org.springframework.cloud.commons; diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/commons/util/InetUtils.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/commons/util/InetUtils.java index c154f951e..66a64b766 100644 --- a/spring-cloud-commons/src/main/java/org/springframework/cloud/commons/util/InetUtils.java +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/commons/util/InetUtils.java @@ -32,6 +32,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.jspecify.annotations.Nullable; /** * @author Spencer Gibb @@ -71,7 +72,7 @@ public HostInfo findFirstNonLoopbackHostInfo() { return hostInfo; } - public InetAddress findFirstNonLoopbackAddress() { + public @Nullable InetAddress findFirstNonLoopbackAddress() { InetAddress result = null; try { int lowest = Integer.MAX_VALUE; diff --git a/spring-cloud-context/src/main/java/org/springframework/cloud/autoconfigure/package-info.java b/spring-cloud-context/src/main/java/org/springframework/cloud/autoconfigure/package-info.java new file mode 100644 index 000000000..146b1e73c --- /dev/null +++ b/spring-cloud-context/src/main/java/org/springframework/cloud/autoconfigure/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright 2013-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Spring Cloud auto-configuration classes. + */ +@org.jspecify.annotations.NullMarked +package org.springframework.cloud.autoconfigure; diff --git a/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/package-info.java b/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/package-info.java new file mode 100644 index 000000000..cf0e60744 --- /dev/null +++ b/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright 2013-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Spring Cloud bootstrap abstractions. + */ +@org.jspecify.annotations.NullMarked +package org.springframework.cloud.bootstrap; diff --git a/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/support/OriginTrackedCompositePropertySource.java b/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/support/OriginTrackedCompositePropertySource.java index 21a2e796a..fd52bddc1 100644 --- a/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/support/OriginTrackedCompositePropertySource.java +++ b/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/support/OriginTrackedCompositePropertySource.java @@ -16,6 +16,8 @@ package org.springframework.cloud.bootstrap.support; +import org.jspecify.annotations.Nullable; + import org.springframework.boot.origin.Origin; import org.springframework.boot.origin.OriginLookup; import org.springframework.core.env.CompositePropertySource; @@ -33,7 +35,7 @@ public OriginTrackedCompositePropertySource(String name) { @Override @SuppressWarnings("unchecked") - public Origin getOrigin(String name) { + public @Nullable Origin getOrigin(String name) { for (PropertySource propertySource : getPropertySources()) { if (propertySource instanceof OriginLookup lookup) { Origin origin = lookup.getOrigin(name); diff --git a/spring-cloud-context/src/main/java/org/springframework/cloud/context/named/ClientFactoryObjectProvider.java b/spring-cloud-context/src/main/java/org/springframework/cloud/context/named/ClientFactoryObjectProvider.java index d581d602b..12f941ee5 100644 --- a/spring-cloud-context/src/main/java/org/springframework/cloud/context/named/ClientFactoryObjectProvider.java +++ b/spring-cloud-context/src/main/java/org/springframework/cloud/context/named/ClientFactoryObjectProvider.java @@ -22,9 +22,10 @@ import java.util.function.Supplier; import java.util.stream.Stream; +import org.jspecify.annotations.Nullable; + import org.springframework.beans.BeansException; import org.springframework.beans.factory.ObjectProvider; -import org.springframework.lang.Nullable; /** * Special ObjectProvider that allows the actual ObjectProvider to be resolved later @@ -54,8 +55,7 @@ public T getObject(Object... args) throws BeansException { } @Override - @Nullable - public T getIfAvailable() throws BeansException { + public @Nullable T getIfAvailable() throws BeansException { return delegate().getIfAvailable(); } @@ -70,8 +70,7 @@ public void ifAvailable(Consumer dependencyConsumer) throws BeansException { } @Override - @Nullable - public T getIfUnique() throws BeansException { + public @Nullable T getIfUnique() throws BeansException { return delegate().getIfUnique(); } diff --git a/spring-cloud-context/src/main/java/org/springframework/cloud/context/package-info.java b/spring-cloud-context/src/main/java/org/springframework/cloud/context/package-info.java new file mode 100644 index 000000000..7d541fc52 --- /dev/null +++ b/spring-cloud-context/src/main/java/org/springframework/cloud/context/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright 2013-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Spring Cloud context abstractions. + */ +@org.jspecify.annotations.NullMarked +package org.springframework.cloud.context; diff --git a/spring-cloud-context/src/main/java/org/springframework/cloud/context/restart/RestartEndpoint.java b/spring-cloud-context/src/main/java/org/springframework/cloud/context/restart/RestartEndpoint.java index dd33ed05e..661f3eb69 100644 --- a/spring-cloud-context/src/main/java/org/springframework/cloud/context/restart/RestartEndpoint.java +++ b/spring-cloud-context/src/main/java/org/springframework/cloud/context/restart/RestartEndpoint.java @@ -24,7 +24,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -// + import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.boot.SpringApplication; diff --git a/spring-cloud-context/src/main/java/org/springframework/cloud/util/random/CachedRandomPropertySource.java b/spring-cloud-context/src/main/java/org/springframework/cloud/util/random/CachedRandomPropertySource.java index 17714553e..8b984e8e5 100644 --- a/spring-cloud-context/src/main/java/org/springframework/cloud/util/random/CachedRandomPropertySource.java +++ b/spring-cloud-context/src/main/java/org/springframework/cloud/util/random/CachedRandomPropertySource.java @@ -19,6 +19,8 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import org.jspecify.annotations.Nullable; + import org.springframework.core.env.PropertySource; import org.springframework.util.StringUtils; @@ -44,7 +46,7 @@ public CachedRandomPropertySource(PropertySource randomValuePropertySource) { } @Override - public Object getProperty(String name) { + public @Nullable Object getProperty(String name) { if (!name.startsWith(PREFIX) || name.length() == PREFIX.length()) { return null; } diff --git a/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/cache/DefaultLoadBalancerCache.java b/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/cache/DefaultLoadBalancerCache.java index 966621810..66de05ce1 100644 --- a/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/cache/DefaultLoadBalancerCache.java +++ b/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/cache/DefaultLoadBalancerCache.java @@ -22,11 +22,11 @@ import com.stoyanr.evictor.ConcurrentMapWithTimedEviction; import com.stoyanr.evictor.map.ConcurrentHashMapWithTimedEviction; import com.stoyanr.evictor.scheduler.DelayedTaskEvictionScheduler; +import org.jspecify.annotations.Nullable; import org.springframework.cache.Cache; import org.springframework.cache.concurrent.ConcurrentMapCache; import org.springframework.cache.support.AbstractValueAdaptingCache; -import org.springframework.lang.Nullable; import org.springframework.util.Assert; /** @@ -107,8 +107,7 @@ public ConcurrentMap getNativeCache() { @SuppressWarnings("unchecked") @Override - @Nullable - public T get(Object key, Callable valueLoader) { + public @Nullable T get(Object key, Callable valueLoader) { return (T) fromStoreValue(cache.computeIfAbsent(key, k -> { try { return toStoreValue(valueLoader.call()); @@ -124,14 +123,12 @@ public void put(Object key, @Nullable Object value, long evictMs) { } @Override - @Nullable - public ValueWrapper putIfAbsent(Object key, @Nullable Object value) { + public @Nullable ValueWrapper putIfAbsent(Object key, @Nullable Object value) { Object existing = cache.putIfAbsent(key, toStoreValue(value), evictMs); return toValueWrapper(existing); } - @Nullable - public ValueWrapper putIfAbsent(Object key, @Nullable Object value, long evictMs) { + public @Nullable ValueWrapper putIfAbsent(Object key, @Nullable Object value, long evictMs) { Object existing = cache.putIfAbsent(key, toStoreValue(value), evictMs); return toValueWrapper(existing); } diff --git a/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/cache/DefaultLoadBalancerCacheManager.java b/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/cache/DefaultLoadBalancerCacheManager.java index c3f72198d..5d397557e 100644 --- a/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/cache/DefaultLoadBalancerCacheManager.java +++ b/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/cache/DefaultLoadBalancerCacheManager.java @@ -28,9 +28,9 @@ import com.stoyanr.evictor.map.ConcurrentHashMapWithTimedEviction; import com.stoyanr.evictor.scheduler.DelayedTaskEvictionScheduler; +import org.jspecify.annotations.Nullable; import org.springframework.cache.Cache; -import org.springframework.lang.Nullable; import static org.springframework.cloud.loadbalancer.core.CachingServiceInstanceListSupplier.SERVICE_INSTANCE_CACHE_NAME; @@ -81,8 +81,7 @@ private ScheduledExecutorService aScheduledDaemonThreadExecutor() { } @Override - @Nullable - public Cache getCache(String name) { + public @Nullable Cache getCache(String name) { return cacheMap.get(name); } diff --git a/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/ServiceInstanceListSupplierBuilder.java b/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/ServiceInstanceListSupplierBuilder.java index 96515705c..c143dc7dc 100644 --- a/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/ServiceInstanceListSupplierBuilder.java +++ b/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/ServiceInstanceListSupplierBuilder.java @@ -24,6 +24,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.jspecify.annotations.Nullable; import reactor.core.publisher.Mono; import org.springframework.beans.factory.ObjectProvider; @@ -367,7 +368,7 @@ public ServiceInstanceListSupplierBuilder withBlockingApiVersioning() { * @param delegateCreator a {@link DelegateCreator} object * @return the {@link ServiceInstanceListSupplierBuilder} object */ - public ServiceInstanceListSupplierBuilder with(DelegateCreator delegateCreator) { + public ServiceInstanceListSupplierBuilder with(@Nullable DelegateCreator delegateCreator) { if (delegateCreator != null) { creators.add(delegateCreator); } diff --git a/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/package-info.java b/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/package-info.java new file mode 100644 index 000000000..d54cb6012 --- /dev/null +++ b/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright 2013-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Spring Cloud load balancer core abstractions. + */ +@org.jspecify.annotations.NullMarked +package org.springframework.cloud.loadbalancer.core; diff --git a/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/package-info.java b/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/package-info.java new file mode 100644 index 000000000..d512dcc8a --- /dev/null +++ b/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright 2013-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Spring Cloud load balancer implementation. + */ +@org.jspecify.annotations.NullMarked +package org.springframework.cloud.loadbalancer;