Address review comments from @Marcono1234. (#2372)

This commit is contained in:
Éamonn McManus 2023-04-10 13:33:47 -07:00 committed by GitHub
parent c1da2d7070
commit 37ed0fcbd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 6 deletions

View File

@ -129,6 +129,7 @@ public final class GraphAdapterBuilderTest {
@Test
public void testSerializationWithMultipleTypes() {
Company google = new Company("Google");
// Employee constructor adds `this` to the given Company object
Employee unused1 = new Employee("Jesse", google);
Employee unused2 = new Employee("Joel", google);

View File

@ -144,7 +144,7 @@ public abstract class JsonElement {
* @throws IllegalStateException if this element is of another type.
* @since 1.2
*/
@CanIgnoreReturnValue
@CanIgnoreReturnValue // When this method is used only to verify that the value is JsonNull
public JsonNull getAsJsonNull() {
if (isJsonNull()) {
return (JsonNull) this;

View File

@ -15,7 +15,6 @@
*/
package com.google.gson;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.gson.internal.Streams;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;

View File

@ -124,11 +124,11 @@ public class DefaultTypeAdaptersTest {
public void testUrlDeserialization() {
String urlValue = "http://google.com/";
String json = "'http:\\/\\/google.com\\/'";
URL target = gson.fromJson(json, URL.class);
assertThat(target.toExternalForm()).isEqualTo(urlValue);
URL target1 = gson.fromJson(json, URL.class);
assertThat(target1.toExternalForm()).isEqualTo(urlValue);
URL unused = gson.fromJson('"' + urlValue + '"', URL.class);
assertThat(target.toExternalForm()).isEqualTo(urlValue);
URL target2 = gson.fromJson('"' + urlValue + '"', URL.class);
assertThat(target2.toExternalForm()).isEqualTo(urlValue);
}
@Test