From c45fa9038a0b7fb578ee1025bed50e55c5ccedc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Wed, 18 Sep 2024 14:52:00 -0700 Subject: [PATCH 1/2] Build for Java 8 rather than Java 7. Part of #2743. --- .../test/java/com/google/gson/integration/OSGiManifestIT.java | 3 +-- pom.xml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) 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/pom.xml b/pom.xml index 4b1d0220ca..d66e6aee60 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,7 @@ UTF-8 - 7 + 8 11 From f3a27cd9e7bd599ab067ebe830b31aae5184b2f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Wed, 18 Sep 2024 15:00:16 -0700 Subject: [PATCH 2/2] Further adjustments to remove traces of Java 7. --- README.md | 3 ++- .../com/google/gson/internal/JavaVersionTest.java | 4 ++-- pom.xml | 14 -------------- 3 files changed, 4 insertions(+), 17 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/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 d66e6aee60..a5b279aa01 100644 --- a/pom.xml +++ b/pom.xml @@ -556,20 +556,6 @@ - - - jdk21+ - - [21,) - - - - 8 - - - release