From 58eaac338786f449335e389a7f3c73ed40252ea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Sun, 22 Sep 2024 21:00:58 -0700 Subject: [PATCH] Build for Java 8 rather than Java 7. (#2744) * Build for Java 8 rather than Java 7. Part of #2743. * Further adjustments to remove traces of Java 7. --- README.md | 3 ++- .../google/gson/integration/OSGiManifestIT.java | 3 +-- .../google/gson/internal/JavaVersionTest.java | 4 ++-- pom.xml | 16 +--------------- 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 29275d6268..acd145b504 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,8 @@ Maven: ### Requirements #### Minimum Java version -- Gson 2.9.0 and newer: Java 7 +- Gson 2.12.0 and newer: Java 8 +- Gson 2.9.0 to 2.11.0: Java 7 - Gson 2.8.9 and older: Java 6 Despite supporting older Java versions, Gson also provides a JPMS module descriptor (module name `com.google.gson`) for users of Java 9 or newer. diff --git a/gson/src/test/java/com/google/gson/integration/OSGiManifestIT.java b/gson/src/test/java/com/google/gson/integration/OSGiManifestIT.java index 4b3eea3256..151b333d48 100644 --- a/gson/src/test/java/com/google/gson/integration/OSGiManifestIT.java +++ b/gson/src/test/java/com/google/gson/integration/OSGiManifestIT.java @@ -144,8 +144,7 @@ public void testExports() { @Test public void testRequireCapability() { - // When building with JDK >= 21, the minimum target version is Java 8 - String expectedJavaVersion = Runtime.version().feature() < 21 ? "1.7" : "1.8"; + String expectedJavaVersion = "1.8"; // Defines the minimum required Java version assertThat(getAttribute("Require-Capability")) diff --git a/gson/src/test/java/com/google/gson/internal/JavaVersionTest.java b/gson/src/test/java/com/google/gson/internal/JavaVersionTest.java index 28369ffe54..a07155a4f3 100644 --- a/gson/src/test/java/com/google/gson/internal/JavaVersionTest.java +++ b/gson/src/test/java/com/google/gson/internal/JavaVersionTest.java @@ -30,8 +30,8 @@ public class JavaVersionTest { @Test public void testGetMajorJavaVersion() { - // Gson currently requires at least Java 7 - assertThat(JavaVersion.getMajorJavaVersion()).isAtLeast(7); + // Gson currently requires at least Java 8 + assertThat(JavaVersion.getMajorJavaVersion()).isAtLeast(8); } @Test diff --git a/pom.xml b/pom.xml index 4b1d0220ca..a5b279aa01 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,7 @@ UTF-8 - 7 + 8 11 @@ -556,20 +556,6 @@ - - - jdk21+ - - [21,) - - - - 8 - - - release