Fix Kotlin warnings and code quality hints from IntelliJ
For example, with the current master, I'm getting the following logs when compiling:
> Task :compileKotlin
w: .../theodolite/src/main/kotlin/theodolite/benchmark/ResourceSets.kt: (24, 20): Condition '::configMap != null' is always 'true'
w: .../theodolite/src/main/kotlin/theodolite/benchmark/ResourceSets.kt: (26, 24): Condition '::fileSystem != null' is always 'true'
w: .../theodolite/src/main/kotlin/theodolite/evaluation/SloConfigHandler.kt: (14, 38): 'toLowerCase(): String' is deprecated. Use lowercase() instead.
w: .../theodolite/src/main/kotlin/theodolite/execution/TheodoliteStandalone.kt: (6, 24): 'YamlParserFromFile' is deprecated. Use Jackson ObjectMapper instead
w: .../theodolite/src/main/kotlin/theodolite/execution/TheodoliteStandalone.kt: (31, 26): 'YamlParserFromFile' is deprecated. Use Jackson ObjectMapper instead
w: .../theodolite/src/main/kotlin/theodolite/execution/operator/BenchmarkStateChecker.kt: (179, 27): 'loadKubernetesResources(List<ResourceSets>): Collection<Pair<String, HasMetadata>>' is deprecated. Use `loadResourceSet` from `ResourceSets`
w: .../theodolite/src/main/kotlin/theodolite/execution/operator/BenchmarkStateChecker.kt: (181, 27): 'loadKubernetesResources(List<ResourceSets>): Collection<Pair<String, HasMetadata>>' is deprecated. Use `loadResourceSet` from `ResourceSets`
w: .../theodolite/src/main/kotlin/theodolite/execution/operator/BenchmarkStateChecker.kt: (195, 37): Unchecked cast: V to K
w: .../theodolite/src/main/kotlin/theodolite/execution/operator/ClusterSetup.kt: (7, 23): 'K8sContextFactory' is deprecated. Use `CustomResourceDefinitionContext.Builder` instead.
w: .../theodolite/src/main/kotlin/theodolite/execution/operator/ClusterSetup.kt: (17, 41): 'K8sContextFactory' is deprecated. Use `CustomResourceDefinitionContext.Builder` instead.
w: .../theodolite/src/main/kotlin/theodolite/execution/operator/ExecutionEventHandler.kt: (36, 9): Non exhaustive 'when' statements on enum will be prohibited in 1.7, add 'PENDING', 'FAILURE', 'FINISHED', 'RESTART', 'INTERRUPTED' branches or 'else' branch instead
w: .../theodolite/src/main/kotlin/theodolite/execution/operator/TheodoliteController.kt: (72, 35): 'loadKubernetesResources(List<ResourceSets>): Collection<Pair<String, HasMetadata>>' is deprecated. Use `loadResourceSet` from `ResourceSets`
w: .../theodolite/src/main/kotlin/theodolite/execution/operator/TheodoliteController.kt: (73, 33): 'loadKubernetesResources(List<ResourceSets>): Collection<Pair<String, HasMetadata>>' is deprecated. Use `loadResourceSet` from `ResourceSets`
w: .../theodolite/src/main/kotlin/theodolite/execution/operator/TheodoliteOperator.kt: (88, 14): 'inNamespace(String!): SharedInformerFactory!' is deprecated. Deprecated in Java
w: .../theodolite/src/main/kotlin/theodolite/execution/operator/TheodoliteOperator.kt: (90, 17): 'sharedIndexInformerForCustomResource(Class<T!>!, Long): SharedIndexInformer<T!>!' is deprecated. Deprecated in Java
w: .../theodolite/src/main/kotlin/theodolite/execution/operator/TheodoliteOperator.kt: (147, 23): 'customResources(Class<T!>!, Class<L!>!): MixedOperation<T!, L!, Resource<T!>!>!' is deprecated. Deprecated in Java
w: .../theodolite/src/main/kotlin/theodolite/execution/operator/TheodoliteOperator.kt: (157, 23): 'customResources(Class<T!>!, Class<L!>!): MixedOperation<T!, L!, Resource<T!>!>!' is deprecated. Deprecated in Java
w: .../theodolite/src/main/kotlin/theodolite/k8s/ResourceByLabelHandler.kt: (86, 25): 'customResource(CustomResourceDefinitionContext!): RawCustomResourceOperationsImpl!' is deprecated. Deprecated in Java
w: .../theodolite/src/main/kotlin/theodolite/k8s/ResourceByLabelHandler.kt: (93, 36): 'customResource(CustomResourceDefinitionContext!): RawCustomResourceOperationsImpl!' is deprecated. Deprecated in Java
w: .../theodolite/src/main/kotlin/theodolite/k8s/ResourceByLabelHandler.kt: (93, 60): 'delete(String!, String!): Boolean' is deprecated. Deprecated in Java
w: .../theodolite/src/main/kotlin/theodolite/k8s/TopicManager.kt: (91, 32): 'values(): (Mutable)Map<String!, KafkaFuture<Void!>!>!' is deprecated. Deprecated in Java
w: .../theodolite/src/main/kotlin/theodolite/patcher/AbstractPatcher.kt: (23, 5): Parameter 'k8sResource' is never used
w: .../theodolite/src/main/kotlin/theodolite/patcher/EnvVarPatcher.kt: (25, 51): Unchecked cast: Map<kotlin.String, String#1 (type parameter of theodolite.patcher.EnvVarPatcher.patch)> to Map<kotlin.String, kotlin.String>
w: .../theodolite/src/main/kotlin/theodolite/patcher/ImagePatcher.kt: (16, 33): The corresponding parameter in the supertype 'AbstractPatcher' is named 'value'. This may cause problems when calling this function with named arguments.
w: .../theodolite/src/main/kotlin/theodolite/patcher/LabelPatcher.kt: (13, 33): The corresponding parameter in the supertype 'AbstractPatcher' is named 'value'. This may cause problems when calling this function with named arguments.
w: .../theodolite/src/main/kotlin/theodolite/patcher/MatchLabelPatcher.kt: (16, 33): The corresponding parameter in the supertype 'AbstractPatcher' is named 'value'. This may cause problems when calling this function with named arguments.
w: .../theodolite/src/main/kotlin/theodolite/patcher/TemplateLabelPatcher.kt: (16, 33): The corresponding parameter in the supertype 'AbstractPatcher' is named 'value'. This may cause problems when calling this function with named arguments.
w: .../theodolite/src/main/kotlin/theodolite/util/PrometheusResponse.kt: (34, 21): Name shadowed: value
w: .../theodolite/src/main/kotlin/theodolite/util/YamlParserFromString.kt: (11, 28): The corresponding parameter in the supertype 'Parser' is named 'path'. This may cause problems when calling this function with named arguments.
Unable to properly register the hierarchy of the following classes for reflection as they are not in the Jandex index:
- kotlin.properties.ReadWriteProperty (sources: JacksonProcessor > theodolite.util.KafkaConfig$TopicWrapper, KubernetesClientProcessor > theodolite.model.crd.ExecutionCRD)
Consider adding them to the index either by creating a Jandex index for your dependency via the Maven plugin, an empty META-INF/beans.xml or quarkus.index-dependency properties.
> Task :compileTestKotlin
w: .../theodolite/src/test/kotlin/theodolite/execution/operator/ControllerTest.kt: (118, 48): Unchecked cast: Any! to List<BenchmarkCRD>
w: .../theodolite/src/test/kotlin/theodolite/strategies/restriction/LowerBoundRestrictionTest.kt: (82, 45): Unnecessary non-null assertion (!!) on a non-null receiver of type Resource
w: .../theodolite/src/test/kotlin/theodolite/strategies/restriction/LowerBoundRestrictionTest.kt: (98, 45): Unnecessary non-null assertion (!!) on a non-null receiver of type Resource
w: .../theodolite/src/test/kotlin/theodolite/util/ResultsTest.kt: (23, 45): Unnecessary non-null assertion (!!) on a non-null receiver of type Resource
w: .../theodolite/src/test/kotlin/theodolite/util/ResultsTest.kt: (39, 45): Unnecessary non-null assertion (!!) on a non-null receiver of type Resource
Edited by Sören Henning