diff --git a/build.gradle.kts b/build.gradle.kts index 3d80ead..e4ea3b9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -69,6 +69,11 @@ subprojects { options.encoding = "UTF-8" options.compilerArgs.add("-parameters") + // Source code: A category that an Error Prone check already owns is deliberately absent + options.compilerArgs.add("-Xlint:deprecation,removal,unchecked,cast,rawtypes,divzero,this-escape,identity,text-blocks,dangling-doc-comments,restricted") + // The build itself: command-line options, path entries, output file collisions + options.compilerArgs.add("-Xlint:options,path,output-file-clash") + options.errorprone { // The checks live in errorprone.args, see https://github.com/tbroyer/gradle-errorprone-plugin#argument-files argumentFiles.from(rootProject.layout.projectDirectory.file("errorprone.args")) diff --git a/operator/src/test/java/it/aboutbits/postgresql/crd/clusterconnection/ClusterConnectionReconcilerErrorTest.java b/operator/src/test/java/it/aboutbits/postgresql/crd/clusterconnection/ClusterConnectionReconcilerErrorTest.java index e45799a..e2a8ba8 100644 --- a/operator/src/test/java/it/aboutbits/postgresql/crd/clusterconnection/ClusterConnectionReconcilerErrorTest.java +++ b/operator/src/test/java/it/aboutbits/postgresql/crd/clusterconnection/ClusterConnectionReconcilerErrorTest.java @@ -52,8 +52,7 @@ void setUp() { resource.setSpec(spec); resource.setMetadata(metadata); - //noinspection unchecked - context = mock(Context.class); + context = mock(); } @Test diff --git a/operator/src/test/java/it/aboutbits/postgresql/crd/grant/GrantReconcilerTest.java b/operator/src/test/java/it/aboutbits/postgresql/crd/grant/GrantReconcilerTest.java index 80bcfe7..36b017f 100644 --- a/operator/src/test/java/it/aboutbits/postgresql/crd/grant/GrantReconcilerTest.java +++ b/operator/src/test/java/it/aboutbits/postgresql/crd/grant/GrantReconcilerTest.java @@ -1294,7 +1294,7 @@ private void createTableWithSerial( ) { try (var dsl = postgreSQLContextFactory.getDSLContext(clusterConnection, databaseName)) { dsl.createTable(quotedName(schemaName, tableName)) - .column("id", SQLDataType.BIGINT.identity(true)) + .column("id", SQLDataType.BIGINT.generatedByDefaultAsIdentity()) .execute(); } } diff --git a/operator/src/test/java/it/aboutbits/postgresql/helm/HelmTest.java b/operator/src/test/java/it/aboutbits/postgresql/helm/HelmTest.java index dac3efb..740a0eb 100644 --- a/operator/src/test/java/it/aboutbits/postgresql/helm/HelmTest.java +++ b/operator/src/test/java/it/aboutbits/postgresql/helm/HelmTest.java @@ -1,5 +1,7 @@ package it.aboutbits.postgresql.helm; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; import io.fabric8.kubernetes.api.model.ConfigBuilder; import io.fabric8.kubernetes.api.model.LocalObjectReference; import io.fabric8.kubernetes.api.model.Volume; @@ -83,22 +85,20 @@ void helmInstall_createsDeployment() throws IOException { // 1. Verify files exist and contain expected data // ./Chart.yaml - @SuppressWarnings("unchecked") - Map chartMetadata = Serialization.yamlMapper() - .readValue( - chartPath.resolve("Chart.yaml").toFile(), - Map.class - ); + Map chartMetadata = Serialization.unmarshal( + Files.newInputStream(chartPath.resolve("Chart.yaml")), + new TypeReference>() { + } + ); assertThat(chartMetadata.get("name")).isEqualTo(chartName); // ./values.yaml - @SuppressWarnings("unchecked") - Map values = Serialization.yamlMapper() - .readValue( - chartPath.resolve("values.yaml").toFile(), - Map.class - ); + Map values = Serialization.unmarshal( + Files.newInputStream(chartPath.resolve("values.yaml")), + new TypeReference>() { + } + ); assertThat(values).containsKey(rootValuesAlias); @@ -123,8 +123,10 @@ void helmInstall_createsDeployment() throws IOException { // ./values.schema.json // The type must be declared for every list value, otherwise the generated schema // falls back to `string` and `helm install` rejects a list. - var valuesSchema = Serialization.jsonMapper() - .readTree(chartPath.resolve("values.schema.json").toFile()); + var valuesSchema = Serialization.unmarshal( + Files.newInputStream(chartPath.resolve("values.schema.json")), + JsonNode.class + ); for (var listValue : LIST_VALUES) { var schemaProperty = valuesSchema.at("/properties/%s/properties/%s".formatted(