Blob Blame History Raw
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

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

--- ./gson/src/main/java/com/google/gson/internal/reflect/ReflectionHelper.java.orig	2023-03-27 12:12:11.824878326 +0100
+++ ./gson/src/main/java/com/google/gson/internal/reflect/ReflectionHelper.java	2023-03-27 12:14:36.157362353 +0100
@@ -1,7 +1,6 @@
 package com.google.gson.internal.reflect;
 
 import com.google.gson.JsonIOException;
-import com.google.gson.internal.GsonBuildConfig;
 import java.lang.reflect.AccessibleObject;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
@@ -150,7 +149,7 @@ public class ReflectionHelper {
 
   public static RuntimeException createExceptionForUnexpectedIllegalAccess(
       IllegalAccessException exception) {
-    throw new RuntimeException("Unexpected IllegalAccessException occurred (Gson " + GsonBuildConfig.VERSION + ")."
+    throw new RuntimeException("Unexpected IllegalAccessException occurred (Gson). "
         + " Certain ReflectionAccessFilter features require Java >= 9 to work correctly. If you are not using"
         + " ReflectionAccessFilter, report this to the Gson maintainers.",
         exception);
@@ -160,7 +159,6 @@ public class ReflectionHelper {
   private static RuntimeException createExceptionForRecordReflectionException(
           ReflectiveOperationException exception) {
     throw new RuntimeException("Unexpected ReflectiveOperationException occurred"
-            + " (Gson " + GsonBuildConfig.VERSION + ")."
             + " To support Java records, reflection is utilized to read out information"
             + " about records. All these invocations happens after it is established"
             + " that records exist in the JVM. This exception is unexpected behavior.",
--- ./gson/src/main/java/com/google/gson/Gson.java.orig	2023-03-27 12:09:35.155438649 +0100
+++ ./gson/src/main/java/com/google/gson/Gson.java	2023-03-27 12:11:25.244044921 +0100
@@ -18,7 +18,6 @@ package com.google.gson;
 
 import com.google.gson.internal.ConstructorConstructor;
 import com.google.gson.internal.Excluder;
-import com.google.gson.internal.GsonBuildConfig;
 import com.google.gson.internal.LazilyParsedNumber;
 import com.google.gson.internal.Primitives;
 import com.google.gson.internal.Streams;
@@ -568,7 +567,7 @@ public final class Gson {
     }
 
     if (candidate == null) {
-      throw new IllegalArgumentException("GSON (" + GsonBuildConfig.VERSION + ") cannot handle " + type);
+      throw new IllegalArgumentException("GSON cannot handle " + type);
     }
 
     if (isInitialAdapterRequest) {
@@ -842,8 +841,6 @@ public final class Gson {
       adapter.write(writer, src);
     } catch (IOException e) {
       throw new JsonIOException(e);
-    } catch (AssertionError e) {
-      throw new AssertionError("AssertionError (GSON " + GsonBuildConfig.VERSION + "): " + e.getMessage(), e);
     } finally {
       writer.setLenient(oldLenient);
       writer.setHtmlSafe(oldHtmlSafe);
@@ -945,8 +942,6 @@ public final class Gson {
       Streams.write(jsonElement, writer);
     } catch (IOException e) {
       throw new JsonIOException(e);
-    } catch (AssertionError e) {
-      throw new AssertionError("AssertionError (GSON " + GsonBuildConfig.VERSION + "): " + e.getMessage(), e);
     } finally {
       writer.setLenient(oldLenient);
       writer.setHtmlSafe(oldHtmlSafe);
@@ -1239,8 +1234,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) {
-      throw new AssertionError("AssertionError (GSON " + GsonBuildConfig.VERSION + "): " + e.getMessage(), e);
     } finally {
       reader.setLenient(oldLenient);
     }