Blame SOURCES/no-templating-maven-plugin.patch

9cbf5f
diff --git a/gson/pom.xml b/gson/pom.xml
9cbf5f
index ffe41ac..5ce5d96 100644
9cbf5f
--- a/gson/pom.xml
9cbf5f
+++ b/gson/pom.xml
9cbf5f
@@ -56,23 +56,6 @@
9cbf5f
         <groupId>org.apache.felix</groupId>
9cbf5f
         <artifactId>maven-bundle-plugin</artifactId>
9cbf5f
       </plugin>
9cbf5f
-      <plugin>
9cbf5f
-        <groupId>org.codehaus.mojo</groupId>
9cbf5f
-        <artifactId>templating-maven-plugin</artifactId>
9cbf5f
-        <version>1.0.0</version>
9cbf5f
-        <executions>
9cbf5f
-          <execution>
9cbf5f
-            <id>filtering-java-templates</id>
9cbf5f
-            <goals>
9cbf5f
-              <goal>filter-sources</goal>
9cbf5f
-            </goals>
9cbf5f
-            <configuration>
9cbf5f
-              <sourceDirectory>${basedir}/src/main/java-templates</sourceDirectory>
9cbf5f
-              <outputDirectory>${project.build.directory}/generated-sources/java-templates</outputDirectory>
9cbf5f
-            </configuration>
9cbf5f
-          </execution>
9cbf5f
-        </executions>
9cbf5f
-      </plugin>
9cbf5f
     </plugins>
9cbf5f
   </build>
9cbf5f
 </project>
9cbf5f
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
9cbf5f
deleted file mode 100644
9cbf5f
index a94c96b..0000000
9cbf5f
--- a/gson/src/main/java-templates/com/google/gson/internal/GsonBuildConfig.java
9cbf5f
+++ /dev/null
9cbf5f
@@ -1,32 +0,0 @@
9cbf5f
-/*
9cbf5f
- * Copyright (C) 2018 The Gson authors
9cbf5f
- *
9cbf5f
- * Licensed under the Apache License, Version 2.0 (the "License");
9cbf5f
- * you may not use this file except in compliance with the License.
9cbf5f
- * You may obtain a copy of the License at
9cbf5f
- *
9cbf5f
- * http://www.apache.org/licenses/LICENSE-2.0
9cbf5f
- *
9cbf5f
- * Unless required by applicable law or agreed to in writing, software
9cbf5f
- * distributed under the License is distributed on an "AS IS" BASIS,
9cbf5f
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9cbf5f
- * See the License for the specific language governing permissions and
9cbf5f
- * limitations under the License.
9cbf5f
- */
9cbf5f
-
9cbf5f
-package com.google.gson.internal;
9cbf5f
-
9cbf5f
-/**
9cbf5f
- * Build configuration for Gson. This file is automatically populated by
9cbf5f
- * templating-maven-plugin and .java/.class files are generated for use in Gson.
9cbf5f
- *
9cbf5f
- * @author Inderjeet Singh
9cbf5f
- */
9cbf5f
-public final class GsonBuildConfig {
9cbf5f
-  // Based on https://stackoverflow.com/questions/2469922/generate-a-version-java-file-in-maven
9cbf5f
-
9cbf5f
-  /** This field is automatically populated by Maven when a build is triggered */
9cbf5f
-  public static final String VERSION = "${project.version}";
9cbf5f
-
9cbf5f
-  private GsonBuildConfig() { }
9cbf5f
-}
9cbf5f
diff --git a/gson/src/main/java/com/google/gson/Gson.java b/gson/src/main/java/com/google/gson/Gson.java
9cbf5f
index 27f3ee9..d584ece 100644
9cbf5f
--- a/gson/src/main/java/com/google/gson/Gson.java
9cbf5f
+++ b/gson/src/main/java/com/google/gson/Gson.java
9cbf5f
@@ -37,7 +37,6 @@ import java.util.concurrent.atomic.AtomicLongArray;
9cbf5f
 
9cbf5f
 import com.google.gson.internal.ConstructorConstructor;
9cbf5f
 import com.google.gson.internal.Excluder;
9cbf5f
-import com.google.gson.internal.GsonBuildConfig;
9cbf5f
 import com.google.gson.internal.Primitives;
9cbf5f
 import com.google.gson.internal.Streams;
9cbf5f
 import com.google.gson.internal.bind.ArrayTypeAdapter;
9cbf5f
@@ -462,7 +461,7 @@ public final class Gson {
9cbf5f
           return candidate;
9cbf5f
         }
9cbf5f
       }
9cbf5f
-      throw new IllegalArgumentException("GSON (" + GsonBuildConfig.VERSION + ") cannot handle " + type);
9cbf5f
+      throw new IllegalArgumentException("GSON cannot handle " + type);
9cbf5f
     } finally {
9cbf5f
       threadCalls.remove(type);
9cbf5f
 
9cbf5f
@@ -704,10 +703,6 @@ public final class Gson {
9cbf5f
       ((TypeAdapter<Object>) adapter).write(writer, src);
9cbf5f
     } catch (IOException e) {
9cbf5f
       throw new JsonIOException(e);
9cbf5f
-    } catch (AssertionError e) {
9cbf5f
-      AssertionError error = new AssertionError("AssertionError (GSON " + GsonBuildConfig.VERSION + "): " + e.getMessage());
9cbf5f
-      error.initCause(e);
9cbf5f
-      throw error;
9cbf5f
     } finally {
9cbf5f
       writer.setLenient(oldLenient);
9cbf5f
       writer.setHtmlSafe(oldHtmlSafe);
9cbf5f
@@ -784,10 +779,6 @@ public final class Gson {
9cbf5f
       Streams.write(jsonElement, writer);
9cbf5f
     } catch (IOException e) {
9cbf5f
       throw new JsonIOException(e);
9cbf5f
-    } catch (AssertionError e) {
9cbf5f
-      AssertionError error = new AssertionError("AssertionError (GSON " + GsonBuildConfig.VERSION + "): " + e.getMessage());
9cbf5f
-      error.initCause(e);
9cbf5f
-      throw error;
9cbf5f
     } finally {
9cbf5f
       writer.setLenient(oldLenient);
9cbf5f
       writer.setHtmlSafe(oldHtmlSafe);
9cbf5f
@@ -945,10 +936,6 @@ public final class Gson {
9cbf5f
     } catch (IOException e) {
9cbf5f
       // TODO(inder): Figure out whether it is indeed right to rethrow this as JsonSyntaxException
9cbf5f
       throw new JsonSyntaxException(e);
9cbf5f
-    } catch (AssertionError e) {
9cbf5f
-      AssertionError error = new AssertionError("AssertionError (GSON " + GsonBuildConfig.VERSION + "): " + e.getMessage());
9cbf5f
-      error.initCause(e);
9cbf5f
-      throw error;
9cbf5f
     } finally {
9cbf5f
       reader.setLenient(oldLenient);
9cbf5f
     }
9cbf5f
diff --git a/gson/src/test/java/com/google/gson/functional/GsonVersionDiagnosticsTest.java b/gson/src/test/java/com/google/gson/functional/GsonVersionDiagnosticsTest.java
9cbf5f
deleted file mode 100644
9cbf5f
index 36eff8e..0000000
9cbf5f
--- a/gson/src/test/java/com/google/gson/functional/GsonVersionDiagnosticsTest.java
9cbf5f
+++ /dev/null
9cbf5f
@@ -1,96 +0,0 @@
9cbf5f
-/*
9cbf5f
- * Copyright (C) 2018 Gson Authors
9cbf5f
- *
9cbf5f
- * Licensed under the Apache License, Version 2.0 (the "License");
9cbf5f
- * you may not use this file except in compliance with the License.
9cbf5f
- * You may obtain a copy of the License at
9cbf5f
- *
9cbf5f
- * http://www.apache.org/licenses/LICENSE-2.0
9cbf5f
- *
9cbf5f
- * Unless required by applicable law or agreed to in writing, software
9cbf5f
- * distributed under the License is distributed on an "AS IS" BASIS,
9cbf5f
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9cbf5f
- * See the License for the specific language governing permissions and
9cbf5f
- * limitations under the License.
9cbf5f
- */
9cbf5f
-package com.google.gson.functional;
9cbf5f
-
9cbf5f
-import java.io.IOException;
9cbf5f
-import java.util.regex.Pattern;
9cbf5f
-
9cbf5f
-import org.junit.Before;
9cbf5f
-import org.junit.Test;
9cbf5f
-
9cbf5f
-import com.google.gson.Gson;
9cbf5f
-import com.google.gson.GsonBuilder;
9cbf5f
-import com.google.gson.TypeAdapter;
9cbf5f
-import com.google.gson.stream.JsonReader;
9cbf5f
-import com.google.gson.stream.JsonWriter;
9cbf5f
-
9cbf5f
-import junit.framework.TestCase;
9cbf5f
-
9cbf5f
-/**
9cbf5f
- * Functional tests to validate printing of Gson version on AssertionErrors
9cbf5f
- *
9cbf5f
- * @author Inderjeet Singh
9cbf5f
- */
9cbf5f
-public class GsonVersionDiagnosticsTest extends TestCase {
9cbf5f
-  private static final Pattern GSON_VERSION_PATTERN = Pattern.compile("(\\(GSON \\d\\.\\d\\.\\d)(?:[-.][A-Z]+)?\\)$");
9cbf5f
-
9cbf5f
-  private Gson gson;
9cbf5f
-
9cbf5f
-  @Before
9cbf5f
-  public void setUp() {
9cbf5f
-    gson = new GsonBuilder().registerTypeAdapter(TestType.class, new TypeAdapter<TestType>() {
9cbf5f
-      @Override public void write(JsonWriter out, TestType value) {
9cbf5f
-        throw new AssertionError("Expected during serialization");
9cbf5f
-      }
9cbf5f
-      @Override public TestType read(JsonReader in) throws IOException {
9cbf5f
-        throw new AssertionError("Expected during deserialization");
9cbf5f
-      }
9cbf5f
-    }).create();
9cbf5f
-  }
9cbf5f
-
9cbf5f
-  @Test
9cbf5f
-  public void testVersionPattern() {
9cbf5f
-    assertTrue(GSON_VERSION_PATTERN.matcher("(GSON 2.8.5)").matches());
9cbf5f
-    assertTrue(GSON_VERSION_PATTERN.matcher("(GSON 2.8.5-SNAPSHOT)").matches());
9cbf5f
-  }
9cbf5f
-
9cbf5f
-  @Test
9cbf5f
-  public void testAssertionErrorInSerializationPrintsVersion() {
9cbf5f
-    try {
9cbf5f
-      gson.toJson(new TestType());
9cbf5f
-      fail();
9cbf5f
-    } catch (AssertionError expected) {
9cbf5f
-      ensureAssertionErrorPrintsGsonVersion(expected);
9cbf5f
-    }
9cbf5f
-  }
9cbf5f
-
9cbf5f
-  @Test
9cbf5f
-  public void testAssertionErrorInDeserializationPrintsVersion() {
9cbf5f
-    try {
9cbf5f
-      gson.fromJson("{'a':'abc'}", TestType.class);
9cbf5f
-      fail();
9cbf5f
-    } catch (AssertionError expected) {
9cbf5f
-      ensureAssertionErrorPrintsGsonVersion(expected);
9cbf5f
-    }
9cbf5f
-  }
9cbf5f
-
9cbf5f
-  private void ensureAssertionErrorPrintsGsonVersion(AssertionError expected) {
9cbf5f
-    String msg = expected.getMessage();
9cbf5f
-    // System.err.println(msg);
9cbf5f
-    int start = msg.indexOf("(GSON");
9cbf5f
-    assertTrue(start > 0);
9cbf5f
-    int end = msg.indexOf("):") + 1;
9cbf5f
-    assertTrue(end > 0 && end > start + 6);
9cbf5f
-    String version = msg.substring(start, end);
9cbf5f
-    // System.err.println(version);
9cbf5f
-    assertTrue(GSON_VERSION_PATTERN.matcher(version).matches());
9cbf5f
-  }
9cbf5f
-
9cbf5f
-  private static final class TestType {
9cbf5f
-    @SuppressWarnings("unused")
9cbf5f
-    String a;
9cbf5f
-  }
9cbf5f
-}
9cbf5f
diff --git a/gson/src/test/java/com/google/gson/internal/GsonBuildConfigTest.java b/gson/src/test/java/com/google/gson/internal/GsonBuildConfigTest.java
9cbf5f
deleted file mode 100644
9cbf5f
index dc39bc0..0000000
9cbf5f
--- a/gson/src/test/java/com/google/gson/internal/GsonBuildConfigTest.java
9cbf5f
+++ /dev/null
9cbf5f
@@ -1,33 +0,0 @@
9cbf5f
-/*
9cbf5f
- * Copyright (C) 2018 The Gson authors
9cbf5f
- *
9cbf5f
- * Licensed under the Apache License, Version 2.0 (the "License");
9cbf5f
- * you may not use this file except in compliance with the License.
9cbf5f
- * You may obtain a copy of the License at
9cbf5f
- *
9cbf5f
- * http://www.apache.org/licenses/LICENSE-2.0
9cbf5f
- *
9cbf5f
- * Unless required by applicable law or agreed to in writing, software
9cbf5f
- * distributed under the License is distributed on an "AS IS" BASIS,
9cbf5f
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9cbf5f
- * See the License for the specific language governing permissions and
9cbf5f
- * limitations under the License.
9cbf5f
- */
9cbf5f
-package com.google.gson.internal;
9cbf5f
-
9cbf5f
-import static org.junit.Assert.assertFalse;
9cbf5f
-
9cbf5f
-import org.junit.Test;
9cbf5f
-
9cbf5f
-/**
9cbf5f
- * Unit tests for {@code GsonBuildConfig}
9cbf5f
- *
9cbf5f
- * @author Inderjeet Singh
9cbf5f
- */
9cbf5f
-public class GsonBuildConfigTest {
9cbf5f
-
9cbf5f
-  @Test
9cbf5f
-  public void testEnsureGsonBuildConfigGetsUpdatedToMavenVersion() {
9cbf5f
-    assertFalse("${project.version}".equals(GsonBuildConfig.VERSION));
9cbf5f
-  }
9cbf5f
-}