Skip to content

Commit 14833da

Browse files
shawkinsmanusa
authored andcommitted
fix #4662: adding a changelog and additional deprecations
1 parent 3633ea6 commit 14833da

File tree

4 files changed

+23
-28
lines changed

4 files changed

+23
-28
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ Fix #5145: [java-generator] handle `additionalProperties: true` emitting a field
1717
* Fix #4911: Config/RequestConfig.scaleTimeout has been deprecated along with Scalable.scale(count, wait) and DeployableScalableResource.deployLatest(wait). withTimeout may be called before the operation to control the timeout.
1818
* Fix #4911: Config/RequestConfig.websocketTimeout has been removed. Config/RequestConfig.requestTimeout will be used for websocket connection timeouts.
1919
* Fix #4911: HttpClient api/building changes - writeTimeout has been removed, readTimeout has moved to the HttpRequest
20+
* Fix #4662: removed deprecated classes/methods: ReflectUtils, ReplaceValueStream, ParameterNamespaceListVisitFromServerGetDeleteRecreateWaitApplicable, ResourceCompare, and Serialization methods taking parameters
21+
* Fix #4662: deprecated serialization static logic: several IOHelpers methods, Serialization methods, such as access to the static jsonMapper. Please use KubernetesSerialization methods instead.
22+
* Fix #4662: deprecated Helper.getAnnotationValue, use HasMetadata methods instead.
2023

2124
### 6.6.2 (2023-05-15)
2225

kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/informers/cache/Cache.java

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717

1818
import io.fabric8.kubernetes.api.model.HasMetadata;
1919
import io.fabric8.kubernetes.api.model.ObjectMeta;
20-
import io.fabric8.kubernetes.client.utils.ReflectUtils;
2120
import io.fabric8.kubernetes.client.utils.Utils;
2221

2322
import java.util.Collections;
2423
import java.util.List;
24+
import java.util.Optional;
2525

2626
/**
2727
* It basically saves and indexes all the entries.
@@ -41,27 +41,16 @@ public interface Cache<T> extends Indexer<T> {
4141
* @param obj specific object
4242
* @return the key
4343
*/
44-
public static String metaNamespaceKeyFunc(Object obj) {
45-
try {
46-
if (obj == null) {
47-
return "";
48-
}
49-
ObjectMeta metadata;
50-
if (obj instanceof String) {
51-
return (String) obj;
52-
} else if (obj instanceof ObjectMeta) {
53-
metadata = (ObjectMeta) obj;
54-
} else {
55-
metadata = ReflectUtils.objectMetadata(obj);
56-
if (metadata == null) {
57-
throw new RuntimeException("Object is bad :" + obj);
58-
}
59-
}
60-
61-
return namespaceKeyFunc(metadata.getNamespace(), metadata.getName());
62-
} catch (ReflectiveOperationException e) {
63-
throw new RuntimeException(e);
44+
public static String metaNamespaceKeyFunc(HasMetadata obj) {
45+
if (obj == null) {
46+
return "";
47+
}
48+
ObjectMeta metadata = obj.getMetadata();
49+
if (metadata == null) {
50+
throw new RuntimeException("Object is bad :" + obj);
6451
}
52+
53+
return namespaceKeyFunc(metadata.getNamespace(), metadata.getName());
6554
}
6655

6756
public static String metaUidKeyFunc(HasMetadata obj) {
@@ -90,12 +79,8 @@ public static String namespaceKeyFunc(String objectNamespace, String objectName)
9079
* @param obj the specific object
9180
* @return the indexed value
9281
*/
93-
public static List<String> metaNamespaceIndexFunc(Object obj) {
94-
try {
95-
ObjectMeta metadata = ReflectUtils.objectMetadata(obj);
96-
return metadata == null ? Collections.emptyList() : Collections.singletonList(metadata.getNamespace());
97-
} catch (ReflectiveOperationException e) {
98-
throw new RuntimeException(e);
99-
}
82+
public static List<String> metaNamespaceIndexFunc(HasMetadata obj) {
83+
return Optional.ofNullable(obj).map(HasMetadata::getMetadata)
84+
.map(metadata -> Collections.singletonList(metadata.getNamespace())).orElse(Collections.emptyList());
10085
}
10186
}

kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ReflectUtils.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
import java.lang.reflect.Method;
2525
import java.util.List;
2626

27+
/**
28+
* @deprecated use {@link HasMetadata} methods instead
29+
*/
30+
@Deprecated
2731
public class ReflectUtils {
2832
private ReflectUtils() {
2933
throw new IllegalStateException("Utility class");

kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ReplaceValueStream.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@
2626
/**
2727
* Replaces template parameter values in the stream to avoid
2828
* parsing issues of templates with numeric expressions
29+
*
30+
* @deprecated to be removed in future versions
2931
*/
32+
@Deprecated
3033
public class ReplaceValueStream {
3134
private final Map<String, String> valuesMap;
3235

0 commit comments

Comments
 (0)