From d549a67b2cc0d8b5038ffdf3613a8296df1d44b6 Mon Sep 17 00:00:00 2001 From: Marcono1234 Date: Fri, 29 Jul 2022 04:05:44 +0200 Subject: [PATCH] Remove unused package-private FieldAttributes methods --- .../java/com/google/gson/FieldAttributes.java | 25 +++---------------- .../com/google/gson/FieldAttributesTest.java | 8 +----- 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/gson/src/main/java/com/google/gson/FieldAttributes.java b/gson/src/main/java/com/google/gson/FieldAttributes.java index 4ee906a60a..9fb93f7bec 100644 --- a/gson/src/main/java/com/google/gson/FieldAttributes.java +++ b/gson/src/main/java/com/google/gson/FieldAttributes.java @@ -135,27 +135,8 @@ public boolean hasModifier(int modifier) { return (field.getModifiers() & modifier) != 0; } - /** - * Returns the value of the field represented by this {@code Field}, on - * the specified object. The value is automatically wrapped in an - * object if it has a primitive type. - * - * @return the value of the represented field in object - * {@code obj}; primitive values are wrapped in an appropriate - * object before being returned - * @throws IllegalAccessException - * @throws IllegalArgumentException - */ - Object get(Object instance) throws IllegalAccessException { - return field.get(instance); - } - - /** - * This is exposed internally only for the removing synthetic fields from the JSON output. - * - * @return true if the field is synthetic; otherwise false - */ - boolean isSynthetic() { - return field.isSynthetic(); + @Override + public String toString() { + return field.toString(); } } diff --git a/gson/src/test/java/com/google/gson/FieldAttributesTest.java b/gson/src/test/java/com/google/gson/FieldAttributesTest.java index a032266bbf..31be3e286b 100644 --- a/gson/src/test/java/com/google/gson/FieldAttributesTest.java +++ b/gson/src/test/java/com/google/gson/FieldAttributesTest.java @@ -17,12 +17,10 @@ package com.google.gson; import com.google.gson.reflect.TypeToken; - -import junit.framework.TestCase; - import java.lang.reflect.Modifier; import java.lang.reflect.Type; import java.util.List; +import junit.framework.TestCase; /** * Unit tests for the {@link FieldAttributes} class. @@ -62,10 +60,6 @@ public void testModifiers() throws Exception { assertTrue(fieldAttributes.hasModifier(Modifier.TRANSIENT)); } - public void testIsSynthetic() throws Exception { - assertFalse(fieldAttributes.isSynthetic()); - } - public void testName() throws Exception { assertEquals("bar", fieldAttributes.getName()); }