From d36b4bf97ece9920e14aa2a470bff18c464cadb7 Mon Sep 17 00:00:00 2001 From: Chris Laprun Date: Wed, 18 Oct 2023 15:27:49 +0200 Subject: [PATCH] chore: add test to show type inference issue --- .../kubernetes/client/TypeInferenceTest.java | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/TypeInferenceTest.java diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/TypeInferenceTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/TypeInferenceTest.java new file mode 100644 index 00000000000..387859477e0 --- /dev/null +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/TypeInferenceTest.java @@ -0,0 +1,56 @@ +package io.fabric8.kubernetes.client; + +import io.fabric8.kubernetes.api.model.ConfigMap; +import io.fabric8.kubernetes.api.model.HasMetadata; +import io.fabric8.kubernetes.api.model.Service; +import io.fabric8.kubernetes.api.model.apps.Deployment; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.Optional; + +class TypeInferenceTest { + + @Test + void test() { + final ConfigMapDependentResource cdr = new ConfigMapDependentResource(); + final DeploymentDependentResource ddr = new DeploymentDependentResource(); + Arrays.asList(cdr, ddr).forEach(dr -> dr.reconcile()); + } + + static abstract class KubernetesDependentResource + implements DependentResourceConfigurator> { + void reconcile() { + // NOOP + } + + @Override + public void configureWith(KubernetesDependentConfig config) { + + } + + @Override + public Optional> configuration() { + return Optional.empty(); + } + } + + static class KubernetesDependentConfig { + + } + + interface DependentResourceConfigurator { + void configureWith(C config); + + Optional configuration(); + } + + static final class ConfigMapDependentResource extends KubernetesDependentResource { + + } + + static final class DeploymentDependentResource extends KubernetesDependentResource { + + } + +}