Skip to content

Commit

Permalink
Merge branch 'master' into marcono1234/inaccessible-object-exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcono1234 committed Nov 8, 2021
2 parents 41ff3e3 + ca2ed74 commit 0696e12
Show file tree
Hide file tree
Showing 16 changed files with 198 additions and 447 deletions.
172 changes: 39 additions & 133 deletions codegen/pom.xml
Original file line number Diff line number Diff line change
@@ -1,170 +1,76 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.code.gson</groupId>
<parent>
<groupId>com.google.code.gson</groupId>
<artifactId>gson-parent</artifactId>
<version>2.9.0-SNAPSHOT</version>
</parent>

<artifactId>gson-codegen</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<inceptionYear>2008</inceptionYear>
<name>Gson Code Gen</name>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<url>http://code.google.com/p/google-gson/</url>
<description>Google Gson grab bag of utilities, type adapters, etc.</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
<name>Apache-2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<scm>
<connection>scm:svn:http://google-gson.googlecode.com/svn/trunk/extras</connection>
<developerConnection>scm:svn:https://google-gson.googlecode.com/svn/trunk/extras</developerConnection>
<url>http://google-gson.codegoogle.com/svn/trunk/extras</url>
</scm>
<issueManagement>
<system>Google Code Issue Tracking</system>
<url>http://code.google.com/p/google-gson/issues/list</url>
</issueManagement>

<organization>
<name>Google, Inc.</name>
<url>http://www.google.com</url>
<url>https://www.google.com</url>
</organization>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<!-- Activate PGP signing only when performing a release -->
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<defaultGoal>package</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-proc:none</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<executions>
<!-- First compile without without annotation processing, then
compile again, see https://stackoverflow.com/a/36250332 -->
<execution>
<phase>package</phase>
<id>default-compile</id>
<configuration>
<compilerArgument>-proc:none</compilerArgument>
</configuration>
</execution>
<execution>
<id>compile-project</id>
<phase>compile</phase>
<goals>
<goal>jar</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<links>
<link>http://download.oracle.com/javase/1.5.0/docs/api/</link>
</links>
<version>true</version>
<show>public</show>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<workspace>
../eclipse-ws/
</workspace>
<workspaceCodeStylesURL>
file:///${basedir}/../lib/gson-formatting-styles.xml
</workspaceCodeStylesURL>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<!-- version>2.3.2</version -->
<configuration>
<arguments>-DenableCiProfile=true</arguments>
<tagBase>https://google-gson.googlecode.com/svn/tags/</tagBase>
</configuration>
</plugin>
</plugins>

<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<!-- Not deployed -->
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

<developers>
<developer>
<name>Inderjeet Singh</name>
Expand Down
2 changes: 0 additions & 2 deletions extras/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
</parent>

<artifactId>gson-extras</artifactId>
<packaging>jar</packaging>
<version>2.9.0-SNAPSHOT</version>
<inceptionYear>2008</inceptionYear>
<name>Gson Extras</name>
<description>Google Gson grab bag of utilities, type adapters, etc.</description>
Expand Down
38 changes: 36 additions & 2 deletions gson/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down Expand Up @@ -31,6 +33,39 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<jdkToolchain>
<version>9</version>
</jdkToolchain>
<release>9</release>
</configuration>
</execution>
<execution>
<id>base-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<excludes>
<exclude>module-info.java</exclude>
</excludes>
</configuration>
</execution>
</executions>
<configuration>
<jdkToolchain>
<version>[1.5,9)</version>
</jdkToolchain>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand All @@ -50,7 +85,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<includePackageNames>com.google.gson</includePackageNames>
<excludePackageNames>com.google.gson.internal:com.google.gson.internal.bind</excludePackageNames>
<links>
<link>https://docs.oracle.com/javase/6/docs/api/</link>
Expand Down
5 changes: 4 additions & 1 deletion gson/src/main/java/com/google/gson/JsonArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,10 @@ public byte getAsByte() {
@Override
public char getAsCharacter() {
if (elements.size() == 1) {
return elements.get(0).getAsCharacter();
JsonElement element = elements.get(0);
@SuppressWarnings("deprecation")
char result = element.getAsCharacter();
return result;
}
throw new IllegalStateException();
}
Expand Down
5 changes: 4 additions & 1 deletion gson/src/test/java/com/google/gson/JsonObjectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ public void testAddingCharacterProperties() throws Exception {
JsonElement jsonElement = jsonObj.get(propertyName);
assertNotNull(jsonElement);
assertEquals(String.valueOf(value), jsonElement.getAsString());
assertEquals(value, jsonElement.getAsCharacter());

@SuppressWarnings("deprecation")
char character = jsonElement.getAsCharacter();
assertEquals(value, character);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import java.net.InetAddress;
import java.net.URI;
import java.net.URL;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

import org.junit.Test;

import com.google.gson.internal.JavaVersion;

/**
* Unit and functional tests for {@link JavaVersion}
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.internal.JavaVersion;
import com.google.gson.internal.bind.DefaultDateTypeAdapter;
import com.google.gson.internal.bind.DefaultDateTypeAdapter.DateType;
import com.google.gson.reflect.TypeToken;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
package com.google.gson.internal.bind.util;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import org.junit.function.ThrowingRunnable;
import java.text.ParseException;
import java.text.ParsePosition;
import java.util.*;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;

public class ISO8601UtilsTest {

@Rule
public final ExpectedException exception = ExpectedException.none();

private static TimeZone utcTimeZone() {
return TimeZone.getTimeZone("UTC");
}
Expand Down Expand Up @@ -87,8 +83,12 @@ public void testDateParseSpecialTimezone() throws ParseException {

@Test
public void testDateParseInvalidTime() throws ParseException {
String dateStr = "2018-06-25T61:60:62-03:00";
exception.expect(ParseException.class);
ISO8601Utils.parse(dateStr, new ParsePosition(0));
final String dateStr = "2018-06-25T61:60:62-03:00";
assertThrows(ParseException.class, new ThrowingRunnable() {
@Override
public void run() throws Throwable {
ISO8601Utils.parse(dateStr, new ParsePosition(0));
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public static List<Object[]> parameters() {
assertEquals("$", reader.getPath());
}

enum Factory {
public enum Factory {
STRING_READER {
@Override public JsonReader create(String data) {
return new JsonReader(new StringReader(data));
Expand Down

0 comments on commit 0696e12

Please sign in to comment.