From c0ac9bdba4abe66847fc947667b5eec2ac105c7e Mon Sep 17 00:00:00 2001 From: Lai Jiang Date: Thu, 25 Jan 2024 18:29:07 -0500 Subject: [PATCH] Compile to Java 17 bytecode (#2304) Also fix a linter warning. --- .github/workflows/codeql.yml | 2 +- build.gradle | 12 ++---------- config/presubmits.py | 2 +- .../bsa/UploadBsaUnavailableDomainsActionTest.java | 6 ++++-- .../google/registry/processors/VKeyProcessor.java | 2 +- 5 files changed, 9 insertions(+), 15 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index cae39b798..b5b79a97b 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -33,7 +33,7 @@ jobs: uses: actions/setup-java@v3 with: distribution: 'temurin' - java-version: '11' + java-version: '17' # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/build.gradle b/build.gradle index 0af7084f9..8bf638459 100644 --- a/build.gradle +++ b/build.gradle @@ -382,16 +382,8 @@ subprojects { apply from: "${rootDir.path}/java_common.gradle" - if (!rootProject.enableCrossReferencing.toBoolean()) { - compileJava { - // TODO: Remove this once we migrate off of AppEngine. - options.release = 8 - } - compileTestJava { - // TODO: Remove this once we migrate off of AppEngine. - options.release = 8 - } - } + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 project.tasks.test.dependsOn runPresubmits diff --git a/config/presubmits.py b/config/presubmits.py index 829c93b43..3c74d0519 100644 --- a/config/presubmits.py +++ b/config/presubmits.py @@ -87,7 +87,7 @@ PRESUBMITS = { PresubmitCheck( r".*Copyright 20\d{2} The Nomulus Authors\. All Rights Reserved\.", ("java", "js", "soy", "sql", "py", "sh", "gradle", "ts"), { - ".git", "/build/", "/generated/", "/generated_tests/", + ".git", "/build/", "/bin/generated-sources/", "/bin/generated-test-sources/", "node_modules/", "LoggerConfig.java", "registrar_bin.", "registrar_dbg.", "google-java-format-diff.py", "nomulus.golden.sql", "soyutils_usegoog.js", "javascript/checks.js" diff --git a/core/src/test/java/google/registry/bsa/UploadBsaUnavailableDomainsActionTest.java b/core/src/test/java/google/registry/bsa/UploadBsaUnavailableDomainsActionTest.java index 2fe068fcf..00aa702ad 100644 --- a/core/src/test/java/google/registry/bsa/UploadBsaUnavailableDomainsActionTest.java +++ b/core/src/test/java/google/registry/bsa/UploadBsaUnavailableDomainsActionTest.java @@ -48,6 +48,10 @@ import org.mockito.junit.jupiter.MockitoExtension; @ExtendWith(MockitoExtension.class) public class UploadBsaUnavailableDomainsActionTest { + private static final String BUCKET = "domain-registry-bsa"; + + private static final String API_URL = "https://upload.test/bsa"; + private final FakeClock clock = new FakeClock(DateTime.parse("2024-02-02T02:02:02Z")); @RegisterExtension @@ -62,9 +66,7 @@ public class UploadBsaUnavailableDomainsActionTest { private final GcsUtils gcsUtils = new GcsUtils(LocalStorageHelper.getOptions()); - private final String BUCKET = "domain-registry-bsa"; - private final String API_URL = "https://upload.test/bsa"; private final FakeResponse response = new FakeResponse(); diff --git a/processor/src/main/java/google/registry/processors/VKeyProcessor.java b/processor/src/main/java/google/registry/processors/VKeyProcessor.java index 8b9da6d03..d49ee3884 100644 --- a/processor/src/main/java/google/registry/processors/VKeyProcessor.java +++ b/processor/src/main/java/google/registry/processors/VKeyProcessor.java @@ -50,7 +50,7 @@ import javax.persistence.Converter; /** Processor to generate {@link AttributeConverter} for {@code VKey} type. */ @SupportedAnnotationTypes("google.registry.persistence.WithVKey") -@SupportedSourceVersion(SourceVersion.RELEASE_8) +@SupportedSourceVersion(SourceVersion.RELEASE_17) public class VKeyProcessor extends AbstractProcessor { private static final String CONVERTER_CLASS_NAME_TEMP = "VKeyConverter_%s";