Skip to content
Open
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
12 changes: 11 additions & 1 deletion .mvn/jvm.config
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
-Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom
-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
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
</maven-checkstyle-plugin.failsOnViolation>
<maven-checkstyle-plugin.includeTestSourceDirectory>true
</maven-checkstyle-plugin.includeTestSourceDirectory>
<jspecify.enabled>true</jspecify.enabled>
</properties>

<modules>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import io.kubernetes.client.util.Config;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jspecify.annotations.Nullable;

import org.springframework.cloud.kubernetes.commons.EnvReader;
import org.springframework.cloud.kubernetes.commons.LazilyInstantiate;
Expand Down Expand Up @@ -75,7 +76,7 @@ public boolean isInsideKubernetes() {
return currentPod().get() != null;
}

private V1Pod internalGetPod() {
private @Nullable V1Pod internalGetPod() {
try {
if (isServiceHostEnvVarPresent() && isHostNameEnvVarPresent() && isServiceAccountFound()) {
LOG.debug("reading pod in namespace : " + namespace);
Expand Down
Original file line number Diff line number Diff line change
@@ -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 Kubernetes client config implementations.
*/
@org.jspecify.annotations.NullMarked
package org.springframework.cloud.kubernetes.client.config;
Original file line number Diff line number Diff line change
@@ -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 Kubernetes client discovery implementations.
*/
@org.jspecify.annotations.NullMarked
package org.springframework.cloud.kubernetes.client.discovery;
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import io.kubernetes.client.openapi.models.V1ServicePort;
import io.kubernetes.client.openapi.models.V1ServiceSpec;
import org.apache.commons.logging.LogFactory;
import org.jspecify.annotations.Nullable;

import org.springframework.cloud.kubernetes.commons.discovery.DefaultKubernetesServiceInstance;
import org.springframework.cloud.kubernetes.commons.discovery.DiscoveryClientUtils;
Expand Down Expand Up @@ -71,7 +72,7 @@ public KubernetesClientServiceInstanceMapper(KubernetesLoadBalancerProperties pr
}

@Override
public KubernetesServiceInstance map(V1Service service) {
public @Nullable KubernetesServiceInstance map(V1Service service) {
V1ObjectMeta metadata = service.getMetadata();

List<V1ServicePort> ports = ofNullable(service.getSpec()).map(V1ServiceSpec::getPorts).orElse(List.of());
Expand Down
Original file line number Diff line number Diff line change
@@ -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 Kubernetes client load balancer implementations.
*/
@org.jspecify.annotations.NullMarked
package org.springframework.cloud.kubernetes.client.loadbalancer;
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import java.nio.file.Path;
import java.nio.file.Paths;

import org.jspecify.annotations.Nullable;

import org.springframework.boot.context.properties.bind.BindHandler;
import org.springframework.boot.context.properties.bind.Bindable;
import org.springframework.boot.context.properties.bind.Binder;
Expand Down Expand Up @@ -71,7 +73,7 @@ public KubernetesNamespaceProvider(String namespacePropertyValue) {
this.namespacePropertyValue = namespacePropertyValue;
}

public static String getNamespaceFromServiceAccountFile(String path) {
public static @Nullable String getNamespaceFromServiceAccountFile(String path) {
String namespace = null;
LOG.debug("Looking for service account namespace at: [" + path + "].");
Path serviceAccountNamespacePath = Paths.get(path);
Expand All @@ -91,7 +93,7 @@ public static String getNamespaceFromServiceAccountFile(String path) {
return namespace;
}

public String getNamespace() {
public @Nullable String getNamespace() {
// If they provided the namespace in the constructor just return that
if (!ObjectUtils.isEmpty(namespacePropertyValue)) {
return namespacePropertyValue;
Expand All @@ -107,7 +109,7 @@ public String getNamespace() {
return namespace != null ? namespace : getServiceAccountNamespace();
}

private String getServiceAccountNamespace() {
private @Nullable String getServiceAccountNamespace() {
String serviceAccountNamespacePathString = null;
if (environment != null) {
serviceAccountNamespacePathString = environment.getProperty(NAMESPACE_PATH_PROPERTY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.Set;

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

import org.springframework.cloud.bootstrap.config.PropertySourceLocator;
import org.springframework.core.env.CompositePropertySource;
Expand Down Expand Up @@ -52,7 +53,7 @@ protected abstract MapPropertySource getPropertySource(ConfigurableEnvironment e
NormalizedSource normalizedSource, ReadType readType);

@Override
public PropertySource<?> locate(Environment environment) {
public @Nullable PropertySource<?> locate(Environment environment) {

if (environment instanceof ConfigurableEnvironment env) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import java.util.Properties;
import java.util.stream.Collectors;

import jakarta.annotation.Nullable;
import org.apache.commons.logging.LogFactory;
import org.jspecify.annotations.Nullable;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.reader.UnicodeReader;

Expand Down
Original file line number Diff line number Diff line change
@@ -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 Kubernetes configuration abstractions.
*/
@org.jspecify.annotations.NullMarked
package org.springframework.cloud.kubernetes.commons.config;
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import java.util.function.Supplier;
import java.util.stream.Collectors;

import jakarta.annotation.Nullable;
import org.apache.commons.logging.LogFactory;
import org.jspecify.annotations.Nullable;

import org.springframework.cloud.client.ServiceInstance;
import org.springframework.core.log.LogAccessor;
Expand Down Expand Up @@ -173,7 +173,7 @@ public static ServiceInstance externalNameServiceInstance(ServiceMetadata servic
* take primary-port-name from service label "PRIMARY_PORT_NAME_LABEL_KEY" if it
* exists, otherwise from KubernetesDiscoveryProperties if it exists, otherwise null.
*/
static String primaryPortName(KubernetesDiscoveryProperties properties, Map<String, String> serviceLabels,
static @Nullable String primaryPortName(KubernetesDiscoveryProperties properties, Map<String, String> serviceLabels,
String serviceId) {
String primaryPortNameFromProperties = properties.primaryPortName();

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

package org.springframework.cloud.kubernetes.commons.discovery;

import jakarta.annotation.Nullable;
import org.jspecify.annotations.Nullable;

/**
* @author wind57
Expand Down
Original file line number Diff line number Diff line change
@@ -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 Kubernetes discovery abstractions.
*/
@org.jspecify.annotations.NullMarked
package org.springframework.cloud.kubernetes.commons.discovery;
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import java.util.Objects;
import java.util.Optional;

import org.jspecify.annotations.Nullable;

import org.springframework.core.log.LogAccessor;
import org.springframework.integration.leader.Candidate;
import org.springframework.integration.leader.Context;
Expand Down Expand Up @@ -76,7 +78,7 @@ protected Map<String, String> getLeaderData(Candidate candidate) {
return Collections.singletonMap(leaderKey, candidate.getId());
}

protected Leader extractLeader(Map<String, String> data) {
protected @Nullable Leader extractLeader(@Nullable Map<String, String> data) {
if (data == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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 Kubernetes load balancer abstractions.
*/
@org.jspecify.annotations.NullMarked
package org.springframework.cloud.kubernetes.commons.loadbalancer;
Original file line number Diff line number Diff line change
@@ -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 Kubernetes commons utilities and abstractions.
*/
@org.jspecify.annotations.NullMarked
package org.springframework.cloud.kubernetes.commons;
Original file line number Diff line number Diff line change
@@ -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 Kubernetes abstractions.
*/
@org.jspecify.annotations.NullMarked
package org.springframework.cloud.kubernetes;
Original file line number Diff line number Diff line change
@@ -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 Kubernetes discovery client abstractions.
*/
@org.jspecify.annotations.NullMarked
package org.springframework.cloud.kubernetes.discovery;
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.fabric8.kubernetes.client.KubernetesClient;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jspecify.annotations.Nullable;

import org.springframework.cloud.kubernetes.commons.EnvReader;
import org.springframework.cloud.kubernetes.commons.LazilyInstantiate;
Expand Down Expand Up @@ -68,7 +69,7 @@ public boolean isInsideKubernetes() {
return currentPod().get() != null;
}

private Pod internalGetPod() {
private @Nullable Pod internalGetPod() {
try {
if (isServiceHostEnvVarPresent() && isHostNameEnvVarPresent() && isServiceAccountFound()) {
return this.client.pods().withName(this.hostName).get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import io.fabric8.kubernetes.api.model.Service;
import io.fabric8.kubernetes.api.model.ServiceSpec;
import io.fabric8.kubernetes.client.KubernetesClient;
import jakarta.annotation.Nullable;
import org.apache.commons.logging.LogFactory;
import org.jspecify.annotations.Nullable;

import org.springframework.cloud.kubernetes.commons.KubernetesNamespaceProvider;
import org.springframework.cloud.kubernetes.commons.config.NamespaceResolutionFailedException;
Expand Down
Loading
Loading