public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/google-gson] epel10: Add patch to prevent hard OSGi dep on 'sun.misc' package
@ 2026-08-17 12:38 Mat Booth
0 siblings, 0 replies; only message in thread
From: Mat Booth @ 2026-08-17 12:38 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/google-gson
Branch : epel10
Commit : 77732a348d3a6eaedaf7b5c9b62045888451d850
Author : Mat Booth <mat.booth@redhat.com>
Date : 2020-08-27T11:45:51+01:00
Stats : +431/-297 in 8 file(s)
URL : https://src.fedoraproject.org/rpms/google-gson/c/77732a348d3a6eaedaf7b5c9b62045888451d850?branch=epel10
Log:
Add patch to prevent hard OSGi dep on 'sun.misc' package
Fix bogus date in changelog
---
diff --git a/0001-Update-to-latest-version-of-bnd-maven-plugin.patch b/0001-Update-to-latest-version-of-bnd-maven-plugin.patch
new file mode 100644
index 0000000..bfabd7a
--- /dev/null
+++ b/0001-Update-to-latest-version-of-bnd-maven-plugin.patch
@@ -0,0 +1,77 @@
+From c2fd092f97e4ec6ee700f134bc1b52b62b8630a2 Mon Sep 17 00:00:00 2001
+From: Mat Booth <mat.booth@redhat.com>
+Date: Thu, 27 Aug 2020 10:27:01 +0100
+Subject: [PATCH 1/4] Update to latest version of bnd-maven-plugin
+
+This version has a couple of advantages:
+
+1) It is aware of module-info.class files, which means we don't
+need to manually override the "Require-Capability" header.
+
+2) External packages used by reflection are now detected, i.e.
+the "sun.misc" package is now added to the "Import-Package"
+header. This is manually given optional resolution since it
+is obviously not present on all JVMs.
+
+3) It also introduces some new useful OSGi headers:
+ - Bundle-DocURL (overriden with correct URL for manual)
+ - Bundle-License
+ - Bundle-SCM
+
+This change also removes unnecessary mention of the felix
+bundle-plugin in the pluginManagement section of the parent pom.
+
+Signed-off-by: Mat Booth <mat.booth@redhat.com>
+---
+ gson/bnd.bnd | 2 ++
+ gson/pom.xml | 2 +-
+ pom.xml | 6 ------
+ 3 files changed, 3 insertions(+), 7 deletions(-)
+
+diff --git a/gson/bnd.bnd b/gson/bnd.bnd
+index c98fcfd..7706d8a 100644
+--- a/gson/bnd.bnd
++++ b/gson/bnd.bnd
+@@ -3,7 +3,9 @@ Bundle-Name: ${project.name}
+ Bundle-Description: ${project.description}
+ Bundle-Vendor: Google Gson Project
+ Bundle-ContactAddress: ${project.parent.url}
++Bundle-DocURL: ${project.parent.url}/blob/master/UserGuide.md
+ Bundle-RequiredExecutionEnvironment: J2SE-1.5, JavaSE-1.6, JavaSE-1.7, JavaSE-1.8
++Import-Package: sun.misc;resolution:=optional,*
+
+ -removeheaders: Private-Package
+
+diff --git a/gson/pom.xml b/gson/pom.xml
+index ffe41ac..909a91a 100644
+--- a/gson/pom.xml
++++ b/gson/pom.xml
+@@ -34,7 +34,7 @@
+ <plugin>
+ <groupId>biz.aQute.bnd</groupId>
+ <artifactId>bnd-maven-plugin</artifactId>
+- <version>4.0.0</version>
++ <version>5.1.2</version>
+ <executions>
+ <execution>
+ <goals>
+diff --git a/pom.xml b/pom.xml
+index 4774e70..8716014 100644
+--- a/pom.xml
++++ b/pom.xml
+@@ -103,12 +103,6 @@
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ </plugin>
+- <plugin>
+- <groupId>org.apache.felix</groupId>
+- <artifactId>maven-bundle-plugin</artifactId>
+- <version>3.3.0</version>
+- <inherited>true</inherited>
+- </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+--
+2.26.2
+
diff --git a/0002-Also-export-internal-packages-in-OSGi-metadata.patch b/0002-Also-export-internal-packages-in-OSGi-metadata.patch
new file mode 100644
index 0000000..d6dab1e
--- /dev/null
+++ b/0002-Also-export-internal-packages-in-OSGi-metadata.patch
@@ -0,0 +1,25 @@
+From ad012fa6acc53560a07d05676aa22d1afc66bf22 Mon Sep 17 00:00:00 2001
+From: Mat Booth <mat.booth@redhat.com>
+Date: Thu, 27 Aug 2020 10:52:58 +0100
+Subject: [PATCH 2/4] Also export internal packages in OSGi metadata
+
+---
+ gson/bnd.bnd | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/gson/bnd.bnd b/gson/bnd.bnd
+index 7706d8a..8469930 100644
+--- a/gson/bnd.bnd
++++ b/gson/bnd.bnd
+@@ -13,4 +13,7 @@ Import-Package: sun.misc;resolution:=optional,*
+ com.google.gson,\
+ com.google.gson.annotations,\
+ com.google.gson.reflect,\
+- com.google.gson.stream
++ com.google.gson.stream,\
++ com.google.gson.internal;x-internal:=true,\
++ com.google.gson.internal.bind;x-internal:=true,\
++ com.google.gson.internal.bind.util;x-internal:=true
+--
+2.26.2
+
diff --git a/0003-Allow-building-on-Java-8.patch b/0003-Allow-building-on-Java-8.patch
new file mode 100644
index 0000000..8e402d8
--- /dev/null
+++ b/0003-Allow-building-on-Java-8.patch
@@ -0,0 +1,27 @@
+From 55ba74d967df953b4a5b646be4305877d6bb267c Mon Sep 17 00:00:00 2001
+From: Mat Booth <mat.booth@redhat.com>
+Date: Thu, 27 Aug 2020 11:08:44 +0100
+Subject: [PATCH 3/4] Allow building on Java 8
+
+---
+ pom.xml | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/pom.xml b/pom.xml
+index 8716014..3ce8a3d 100644
+--- a/pom.xml
++++ b/pom.xml
+@@ -69,9 +69,8 @@
+ <id>default-compile</id>
+ <configuration>
+ <jdkToolchain>
+- <version>9</version>
++ <version>8</version>
+ </jdkToolchain>
+- <release>9</release>
+ </configuration>
+ </execution>
+ <execution>
+--
+2.26.2
+
diff --git a/0004-This-commit-added-a-dependency-on-templating-maven-p.patch b/0004-This-commit-added-a-dependency-on-templating-maven-p.patch
new file mode 100644
index 0000000..fc297c3
--- /dev/null
+++ b/0004-This-commit-added-a-dependency-on-templating-maven-p.patch
@@ -0,0 +1,282 @@
+From 7bc6b3dae1b948a40f81223acd8eb41e52240307 Mon Sep 17 00:00:00 2001
+From: Mat Booth <mat.booth@redhat.com>
+Date: Thu, 27 Aug 2020 11:31:46 +0100
+Subject: [PATCH 4/4] This commit added a dependency on
+ templating-maven-plugin, we don't want it nor need it, so we revert it
+ https://github.com/google/gson/commit/d84e26d
+
+---
+ gson/pom.xml | 17 ----
+ .../google/gson/internal/GsonBuildConfig.java | 32 -------
+ gson/src/main/java/com/google/gson/Gson.java | 15 +--
+ .../GsonVersionDiagnosticsTest.java | 96 -------------------
+ .../gson/internal/GsonBuildConfigTest.java | 33 -------
+ 5 files changed, 1 insertion(+), 192 deletions(-)
+ delete mode 100644 gson/src/main/java-templates/com/google/gson/internal/GsonBuildConfig.java
+ delete mode 100644 gson/src/test/java/com/google/gson/functional/GsonVersionDiagnosticsTest.java
+ delete mode 100644 gson/src/test/java/com/google/gson/internal/GsonBuildConfigTest.java
+
+diff --git a/gson/pom.xml b/gson/pom.xml
+index 909a91a..b8984cc 100644
+--- a/gson/pom.xml
++++ b/gson/pom.xml
+@@ -56,23 +56,6 @@
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+- <plugin>
+- <groupId>org.codehaus.mojo</groupId>
+- <artifactId>templating-maven-plugin</artifactId>
+- <version>1.0.0</version>
+- <executions>
+- <execution>
+- <id>filtering-java-templates</id>
+- <goals>
+- <goal>filter-sources</goal>
+- </goals>
+- <configuration>
+- <sourceDirectory>${basedir}/src/main/java-templates</sourceDirectory>
+- <outputDirectory>${project.build.directory}/generated-sources/java-templates</outputDirectory>
+- </configuration>
+- </execution>
+- </executions>
+- </plugin>
+ </plugins>
+ </build>
+ </project>
+diff --git a/gson/src/main/java-templates/com/google/gson/internal/GsonBuildConfig.java b/gson/src/main/java-templates/com/google/gson/internal/GsonBuildConfig.java
+deleted file mode 100644
+index a94c96b..0000000
+--- a/gson/src/main/java-templates/com/google/gson/internal/GsonBuildConfig.java
++++ /dev/null
+@@ -1,32 +0,0 @@
+-/*
+- * Copyright (C) 2018 The Gson authors
+- *
+- * Licensed under the Apache License, Version 2.0 (the "License");
+- * you may not use this file except in compliance with the License.
+- * You may obtain a copy of the License at
+- *
+- * http://www.apache.org/licenses/LICENSE-2.0
+- *
+- * Unless required by applicable law or agreed to in writing, software
+- * distributed under the License is distributed on an "AS IS" BASIS,
+- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+- * See the License for the specific language governing permissions and
+- * limitations under the License.
+- */
+-
+-package com.google.gson.internal;
+-
+-/**
+- * Build configuration for Gson. This file is automatically populated by
+- * templating-maven-plugin and .java/.class files are generated for use in Gson.
+- *
+- * @author Inderjeet Singh
+- */
+-public final class GsonBuildConfig {
+- // Based on https://stackoverflow.com/questions/2469922/generate-a-version-java-file-in-maven
+-
+- /** This field is automatically populated by Maven when a build is triggered */
+- public static final String VERSION = "${project.version}";
+-
+- private GsonBuildConfig() { }
+-}
+diff --git a/gson/src/main/java/com/google/gson/Gson.java b/gson/src/main/java/com/google/gson/Gson.java
+index 27f3ee9..d584ece 100644
+--- a/gson/src/main/java/com/google/gson/Gson.java
++++ b/gson/src/main/java/com/google/gson/Gson.java
+@@ -37,7 +37,6 @@ import java.util.concurrent.atomic.AtomicLongArray;
+
+ import com.google.gson.internal.ConstructorConstructor;
+ import com.google.gson.internal.Excluder;
+-import com.google.gson.internal.GsonBuildConfig;
+ import com.google.gson.internal.Primitives;
+ import com.google.gson.internal.Streams;
+ import com.google.gson.internal.bind.ArrayTypeAdapter;
+@@ -462,7 +461,7 @@ public final class Gson {
+ return candidate;
+ }
+ }
+- throw new IllegalArgumentException("GSON (" + GsonBuildConfig.VERSION + ") cannot handle " + type);
++ throw new IllegalArgumentException("GSON cannot handle " + type);
+ } finally {
+ threadCalls.remove(type);
+
+@@ -704,10 +703,6 @@ public final class Gson {
+ ((TypeAdapter<Object>) adapter).write(writer, src);
+ } catch (IOException e) {
+ throw new JsonIOException(e);
+- } catch (AssertionError e) {
+- AssertionError error = new AssertionError("AssertionError (GSON " + GsonBuildConfig.VERSION + "): " + e.getMessage());
+- error.initCause(e);
+- throw error;
+ } finally {
+ writer.setLenient(oldLenient);
+ writer.setHtmlSafe(oldHtmlSafe);
+@@ -784,10 +779,6 @@ public final class Gson {
+ Streams.write(jsonElement, writer);
+ } catch (IOException e) {
+ throw new JsonIOException(e);
+- } catch (AssertionError e) {
+- AssertionError error = new AssertionError("AssertionError (GSON " + GsonBuildConfig.VERSION + "): " + e.getMessage());
+- error.initCause(e);
+- throw error;
+ } finally {
+ writer.setLenient(oldLenient);
+ writer.setHtmlSafe(oldHtmlSafe);
+@@ -945,10 +936,6 @@ public final class Gson {
+ } catch (IOException e) {
+ // TODO(inder): Figure out whether it is indeed right to rethrow this as JsonSyntaxException
+ throw new JsonSyntaxException(e);
+- } catch (AssertionError e) {
+- AssertionError error = new AssertionError("AssertionError (GSON " + GsonBuildConfig.VERSION + "): " + e.getMessage());
+- error.initCause(e);
+- throw error;
+ } finally {
+ reader.setLenient(oldLenient);
+ }
+diff --git a/gson/src/test/java/com/google/gson/functional/GsonVersionDiagnosticsTest.java b/gson/src/test/java/com/google/gson/functional/GsonVersionDiagnosticsTest.java
+deleted file mode 100644
+index 36eff8e..0000000
+--- a/gson/src/test/java/com/google/gson/functional/GsonVersionDiagnosticsTest.java
++++ /dev/null
+@@ -1,96 +0,0 @@
+-/*
+- * Copyright (C) 2018 Gson Authors
+- *
+- * Licensed under the Apache License, Version 2.0 (the "License");
+- * you may not use this file except in compliance with the License.
+- * You may obtain a copy of the License at
+- *
+- * http://www.apache.org/licenses/LICENSE-2.0
+- *
+- * Unless required by applicable law or agreed to in writing, software
+- * distributed under the License is distributed on an "AS IS" BASIS,
+- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+- * See the License for the specific language governing permissions and
+- * limitations under the License.
+- */
+-package com.google.gson.functional;
+-
+-import java.io.IOException;
+-import java.util.regex.Pattern;
+-
+-import org.junit.Before;
+-import org.junit.Test;
+-
+-import com.google.gson.Gson;
+-import com.google.gson.GsonBuilder;
+-import com.google.gson.TypeAdapter;
+-import com.google.gson.stream.JsonReader;
+-import com.google.gson.stream.JsonWriter;
+-
+-import junit.framework.TestCase;
+-
+-/**
+- * Functional tests to validate printing of Gson version on AssertionErrors
+- *
+- * @author Inderjeet Singh
+- */
+-public class GsonVersionDiagnosticsTest extends TestCase {
+- private static final Pattern GSON_VERSION_PATTERN = Pattern.compile("(\\(GSON \\d\\.\\d\\.\\d)(?:[-.][A-Z]+)?\\)$");
+-
+- private Gson gson;
+-
+- @Before
+- public void setUp() {
+- gson = new GsonBuilder().registerTypeAdapter(TestType.class, new TypeAdapter<TestType>() {
+- @Override public void write(JsonWriter out, TestType value) {
+- throw new AssertionError("Expected during serialization");
+- }
+- @Override public TestType read(JsonReader in) throws IOException {
+- throw new AssertionError("Expected during deserialization");
+- }
+- }).create();
+- }
+-
+- @Test
+- public void testVersionPattern() {
+- assertTrue(GSON_VERSION_PATTERN.matcher("(GSON 2.8.5)").matches());
+- assertTrue(GSON_VERSION_PATTERN.matcher("(GSON 2.8.5-SNAPSHOT)").matches());
+- }
+-
+- @Test
+- public void testAssertionErrorInSerializationPrintsVersion() {
+- try {
+- gson.toJson(new TestType());
+- fail();
+- } catch (AssertionError expected) {
+- ensureAssertionErrorPrintsGsonVersion(expected);
+- }
+- }
+-
+- @Test
+- public void testAssertionErrorInDeserializationPrintsVersion() {
+- try {
+- gson.fromJson("{'a':'abc'}", TestType.class);
+- fail();
+- } catch (AssertionError expected) {
+- ensureAssertionErrorPrintsGsonVersion(expected);
+- }
+- }
+-
+- private void ensureAssertionErrorPrintsGsonVersion(AssertionError expected) {
+- String msg = expected.getMessage();
+- // System.err.println(msg);
+- int start = msg.indexOf("(GSON");
+- assertTrue(start > 0);
+- int end = msg.indexOf("):") + 1;
+- assertTrue(end > 0 && end > start + 6);
+- String version = msg.substring(start, end);
+- // System.err.println(version);
+- assertTrue(GSON_VERSION_PATTERN.matcher(version).matches());
+- }
+-
+- private static final class TestType {
+- @SuppressWarnings("unused")
+- String a;
+- }
+-}
+diff --git a/gson/src/test/java/com/google/gson/internal/GsonBuildConfigTest.java b/gson/src/test/java/com/google/gson/internal/GsonBuildConfigTest.java
+deleted file mode 100644
+index dc39bc0..0000000
+--- a/gson/src/test/java/com/google/gson/internal/GsonBuildConfigTest.java
++++ /dev/null
+@@ -1,33 +0,0 @@
+-/*
+- * Copyright (C) 2018 The Gson authors
+- *
+- * Licensed under the Apache License, Version 2.0 (the "License");
+- * you may not use this file except in compliance with the License.
+- * You may obtain a copy of the License at
+- *
+- * http://www.apache.org/licenses/LICENSE-2.0
+- *
+- * Unless required by applicable law or agreed to in writing, software
+- * distributed under the License is distributed on an "AS IS" BASIS,
+- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+- * See the License for the specific language governing permissions and
+- * limitations under the License.
+- */
+-package com.google.gson.internal;
+-
+-import static org.junit.Assert.assertFalse;
+-
+-import org.junit.Test;
+-
+-/**
+- * Unit tests for {@code GsonBuildConfig}
+- *
+- * @author Inderjeet Singh
+- */
+-public class GsonBuildConfigTest {
+-
+- @Test
+- public void testEnsureGsonBuildConfigGetsUpdatedToMavenVersion() {
+- assertFalse("${project.version}".equals(GsonBuildConfig.VERSION));
+- }
+-}
+--
+2.26.2
+
diff --git a/google-gson.spec b/google-gson.spec
index 6a0d09a..78a7b26 100644
--- a/google-gson.spec
+++ b/google-gson.spec
@@ -1,17 +1,22 @@
Name: google-gson
Version: 2.8.6
-Release: 6%{?dist}
+Release: 7%{?dist}
Summary: Java lib for conversion of Java objects into JSON representation
License: ASL 2.0
URL: https://github.com/google/gson
Source0: https://github.com/google/gson/archive/gson-parent-%{version}.tar.gz
-Patch0: osgi-export-internal.patch
-Patch1: java-eight-build.patch
-# This commit added a dependency on templating-maven-plugin,
-# we don't want it nor need it, so we revert it
-# https://github.com/google/gson/commit/d84e26d
-Patch2: no-templating-maven-plugin.patch
+# PR sent upstream: https://github.com/google/gson/pull/1770
+Patch0: 0001-Update-to-latest-version-of-bnd-maven-plugin.patch
+
+# Internal packages are naughtily used by other packages in Fedora
+Patch1: 0002-Also-export-internal-packages-in-OSGi-metadata.patch
+
+Patch2: 0003-Allow-building-on-Java-8.patch
+
+# Remove dependency on unavailable templating-maven-plugin
+# Reverts upstream commit https://github.com/google/gson/commit/d84e26d
+Patch3: 0004-This-commit-added-a-dependency-on-templating-maven-p.patch
BuildArch: noarch
@@ -36,11 +41,12 @@ This package contains the API documentation for %{name}.
%patch0 -p1
%patch1 -p1
%patch2 -p1
+%patch3 -p1
# remove unnecessary dependency on parent POM
%pom_remove_parent
-# presence of these files breaks builds with Java 8
+# presence of these files breaks builds with Java 8, see also Patch2: 0003-Allow-building-on-Java-8.patch
find -name "module-info.java" -print -delete
# Use felix maven-bundle-plugin only for OSGi metadata
@@ -59,7 +65,7 @@ find -name "module-info.java" -print -delete
</executions>" gson
%build
-%mvn_build --xmvn-javadoc
+%mvn_build
%install
%mvn_install
@@ -72,13 +78,17 @@ find -name "module-info.java" -print -delete
%license LICENSE
%changelog
+* Thu Aug 27 2020 Mat Booth <mat.booth@redhat.com> - 2.8.6-7
+- Add patch to prevent hard OSGi dep on 'sun.misc' package
+- Fix bogus date in changelog
+
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.6-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Jul 10 2020 Jiri Vanek <jvanek@redhat.com> - 2.8.6-5
- Rebuilt for JDK-11, see https://fedoraproject.org/wiki/Changes/Java11
-* Mon Jun 06 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.6-4
+* Sat Jun 06 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.6-4
- fixed javadoc to build on jdk11
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.6-3
diff --git a/java-eight-build.patch b/java-eight-build.patch
deleted file mode 100644
index f2c701e..0000000
--- a/java-eight-build.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/pom.xml b/pom.xml
-index 4774e70..c7941b2 100644
---- a/pom.xml
-+++ b/pom.xml
-@@ -69,9 +69,8 @@
- <id>default-compile</id>
- <configuration>
- <jdkToolchain>
-- <version>9</version>
-+ <version>8</version>
- </jdkToolchain>
-- <release>9</release>
- </configuration>
- </execution>
- <execution>
diff --git a/no-templating-maven-plugin.patch b/no-templating-maven-plugin.patch
deleted file mode 100644
index f58e07f..0000000
--- a/no-templating-maven-plugin.patch
+++ /dev/null
@@ -1,261 +0,0 @@
-diff --git a/gson/pom.xml b/gson/pom.xml
-index ffe41ac..5ce5d96 100644
---- a/gson/pom.xml
-+++ b/gson/pom.xml
-@@ -56,23 +56,6 @@
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- </plugin>
-- <plugin>
-- <groupId>org.codehaus.mojo</groupId>
-- <artifactId>templating-maven-plugin</artifactId>
-- <version>1.0.0</version>
-- <executions>
-- <execution>
-- <id>filtering-java-templates</id>
-- <goals>
-- <goal>filter-sources</goal>
-- </goals>
-- <configuration>
-- <sourceDirectory>${basedir}/src/main/java-templates</sourceDirectory>
-- <outputDirectory>${project.build.directory}/generated-sources/java-templates</outputDirectory>
-- </configuration>
-- </execution>
-- </executions>
-- </plugin>
- </plugins>
- </build>
- </project>
-diff --git a/gson/src/main/java-templates/com/google/gson/internal/GsonBuildConfig.java b/gson/src/main/java-templates/com/google/gson/internal/GsonBuildConfig.java
-deleted file mode 100644
-index a94c96b..0000000
---- a/gson/src/main/java-templates/com/google/gson/internal/GsonBuildConfig.java
-+++ /dev/null
-@@ -1,32 +0,0 @@
--/*
-- * Copyright (C) 2018 The Gson authors
-- *
-- * Licensed under the Apache License, Version 2.0 (the "License");
-- * you may not use this file except in compliance with the License.
-- * You may obtain a copy of the License at
-- *
-- * http://www.apache.org/licenses/LICENSE-2.0
-- *
-- * Unless required by applicable law or agreed to in writing, software
-- * distributed under the License is distributed on an "AS IS" BASIS,
-- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- * See the License for the specific language governing permissions and
-- * limitations under the License.
-- */
--
--package com.google.gson.internal;
--
--/**
-- * Build configuration for Gson. This file is automatically populated by
-- * templating-maven-plugin and .java/.class files are generated for use in Gson.
-- *
-- * @author Inderjeet Singh
-- */
--public final class GsonBuildConfig {
-- // Based on https://stackoverflow.com/questions/2469922/generate-a-version-java-file-in-maven
--
-- /** This field is automatically populated by Maven when a build is triggered */
-- public static final String VERSION = "${project.version}";
--
-- private GsonBuildConfig() { }
--}
-diff --git a/gson/src/main/java/com/google/gson/Gson.java b/gson/src/main/java/com/google/gson/Gson.java
-index 27f3ee9..d584ece 100644
---- a/gson/src/main/java/com/google/gson/Gson.java
-+++ b/gson/src/main/java/com/google/gson/Gson.java
-@@ -37,7 +37,6 @@ import java.util.concurrent.atomic.AtomicLongArray;
-
- import com.google.gson.internal.ConstructorConstructor;
- import com.google.gson.internal.Excluder;
--import com.google.gson.internal.GsonBuildConfig;
- import com.google.gson.internal.Primitives;
- import com.google.gson.internal.Streams;
- import com.google.gson.internal.bind.ArrayTypeAdapter;
-@@ -462,7 +461,7 @@ public final class Gson {
- return candidate;
- }
- }
-- throw new IllegalArgumentException("GSON (" + GsonBuildConfig.VERSION + ") cannot handle " + type);
-+ throw new IllegalArgumentException("GSON cannot handle " + type);
- } finally {
- threadCalls.remove(type);
-
-@@ -704,10 +703,6 @@ public final class Gson {
- ((TypeAdapter<Object>) adapter).write(writer, src);
- } catch (IOException e) {
- throw new JsonIOException(e);
-- } catch (AssertionError e) {
-- AssertionError error = new AssertionError("AssertionError (GSON " + GsonBuildConfig.VERSION + "): " + e.getMessage());
-- error.initCause(e);
-- throw error;
- } finally {
- writer.setLenient(oldLenient);
- writer.setHtmlSafe(oldHtmlSafe);
-@@ -784,10 +779,6 @@ public final class Gson {
- Streams.write(jsonElement, writer);
- } catch (IOException e) {
- throw new JsonIOException(e);
-- } catch (AssertionError e) {
-- AssertionError error = new AssertionError("AssertionError (GSON " + GsonBuildConfig.VERSION + "): " + e.getMessage());
-- error.initCause(e);
-- throw error;
- } finally {
- writer.setLenient(oldLenient);
- writer.setHtmlSafe(oldHtmlSafe);
-@@ -945,10 +936,6 @@ public final class Gson {
- } catch (IOException e) {
- // TODO(inder): Figure out whether it is indeed right to rethrow this as JsonSyntaxException
- throw new JsonSyntaxException(e);
-- } catch (AssertionError e) {
-- AssertionError error = new AssertionError("AssertionError (GSON " + GsonBuildConfig.VERSION + "): " + e.getMessage());
-- error.initCause(e);
-- throw error;
- } finally {
- reader.setLenient(oldLenient);
- }
-diff --git a/gson/src/test/java/com/google/gson/functional/GsonVersionDiagnosticsTest.java b/gson/src/test/java/com/google/gson/functional/GsonVersionDiagnosticsTest.java
-deleted file mode 100644
-index 36eff8e..0000000
---- a/gson/src/test/java/com/google/gson/functional/GsonVersionDiagnosticsTest.java
-+++ /dev/null
-@@ -1,96 +0,0 @@
--/*
-- * Copyright (C) 2018 Gson Authors
-- *
-- * Licensed under the Apache License, Version 2.0 (the "License");
-- * you may not use this file except in compliance with the License.
-- * You may obtain a copy of the License at
-- *
-- * http://www.apache.org/licenses/LICENSE-2.0
-- *
-- * Unless required by applicable law or agreed to in writing, software
-- * distributed under the License is distributed on an "AS IS" BASIS,
-- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- * See the License for the specific language governing permissions and
-- * limitations under the License.
-- */
--package com.google.gson.functional;
--
--import java.io.IOException;
--import java.util.regex.Pattern;
--
--import org.junit.Before;
--import org.junit.Test;
--
--import com.google.gson.Gson;
--import com.google.gson.GsonBuilder;
--import com.google.gson.TypeAdapter;
--import com.google.gson.stream.JsonReader;
--import com.google.gson.stream.JsonWriter;
--
--import junit.framework.TestCase;
--
--/**
-- * Functional tests to validate printing of Gson version on AssertionErrors
-- *
-- * @author Inderjeet Singh
-- */
--public class GsonVersionDiagnosticsTest extends TestCase {
-- private static final Pattern GSON_VERSION_PATTERN = Pattern.compile("(\\(GSON \\d\\.\\d\\.\\d)(?:[-.][A-Z]+)?\\)$");
--
-- private Gson gson;
--
-- @Before
-- public void setUp() {
-- gson = new GsonBuilder().registerTypeAdapter(TestType.class, new TypeAdapter<TestType>() {
-- @Override public void write(JsonWriter out, TestType value) {
-- throw new AssertionError("Expected during serialization");
-- }
-- @Override public TestType read(JsonReader in) throws IOException {
-- throw new AssertionError("Expected during deserialization");
-- }
-- }).create();
-- }
--
-- @Test
-- public void testVersionPattern() {
-- assertTrue(GSON_VERSION_PATTERN.matcher("(GSON 2.8.5)").matches());
-- assertTrue(GSON_VERSION_PATTERN.matcher("(GSON 2.8.5-SNAPSHOT)").matches());
-- }
--
-- @Test
-- public void testAssertionErrorInSerializationPrintsVersion() {
-- try {
-- gson.toJson(new TestType());
-- fail();
-- } catch (AssertionError expected) {
-- ensureAssertionErrorPrintsGsonVersion(expected);
-- }
-- }
--
-- @Test
-- public void testAssertionErrorInDeserializationPrintsVersion() {
-- try {
-- gson.fromJson("{'a':'abc'}", TestType.class);
-- fail();
-- } catch (AssertionError expected) {
-- ensureAssertionErrorPrintsGsonVersion(expected);
-- }
-- }
--
-- private void ensureAssertionErrorPrintsGsonVersion(AssertionError expected) {
-- String msg = expected.getMessage();
-- // System.err.println(msg);
-- int start = msg.indexOf("(GSON");
-- assertTrue(start > 0);
-- int end = msg.indexOf("):") + 1;
-- assertTrue(end > 0 && end > start + 6);
-- String version = msg.substring(start, end);
-- // System.err.println(version);
-- assertTrue(GSON_VERSION_PATTERN.matcher(version).matches());
-- }
--
-- private static final class TestType {
-- @SuppressWarnings("unused")
-- String a;
-- }
--}
-diff --git a/gson/src/test/java/com/google/gson/internal/GsonBuildConfigTest.java b/gson/src/test/java/com/google/gson/internal/GsonBuildConfigTest.java
-deleted file mode 100644
-index dc39bc0..0000000
---- a/gson/src/test/java/com/google/gson/internal/GsonBuildConfigTest.java
-+++ /dev/null
-@@ -1,33 +0,0 @@
--/*
-- * Copyright (C) 2018 The Gson authors
-- *
-- * Licensed under the Apache License, Version 2.0 (the "License");
-- * you may not use this file except in compliance with the License.
-- * You may obtain a copy of the License at
-- *
-- * http://www.apache.org/licenses/LICENSE-2.0
-- *
-- * Unless required by applicable law or agreed to in writing, software
-- * distributed under the License is distributed on an "AS IS" BASIS,
-- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- * See the License for the specific language governing permissions and
-- * limitations under the License.
-- */
--package com.google.gson.internal;
--
--import static org.junit.Assert.assertFalse;
--
--import org.junit.Test;
--
--/**
-- * Unit tests for {@code GsonBuildConfig}
-- *
-- * @author Inderjeet Singh
-- */
--public class GsonBuildConfigTest {
--
-- @Test
-- public void testEnsureGsonBuildConfigGetsUpdatedToMavenVersion() {
-- assertFalse("${project.version}".equals(GsonBuildConfig.VERSION));
-- }
--}
diff --git a/osgi-export-internal.patch b/osgi-export-internal.patch
deleted file mode 100644
index 9f2875d..0000000
--- a/osgi-export-internal.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- gson-gson-parent-2.8.1/gson/bnd.bnd.orig 2017-08-29 11:07:29.630655005 +0100
-+++ gson-gson-parent-2.8.1/gson/bnd.bnd 2017-08-29 11:08:29.592075069 +0100
-@@ -11,4 +11,7 @@
- com.google.gson,\
- com.google.gson.annotations,\
- com.google.gson.reflect,\
-- com.google.gson.stream
-+ com.google.gson.stream,\
-+ com.google.gson.internal;x-internal:=true,\
-+ com.google.gson.internal.bind;x-internal:=true,\
-+ com.google.gson.internal.bind.util;x-internal:=true
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-17 12:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-17 12:38 [rpms/google-gson] epel10: Add patch to prevent hard OSGi dep on 'sun.misc' package Mat Booth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox