Skip to content

Commit 6d2557d

Browse files
authored
Remove unused package-private FieldAttributes methods (#2162)
1 parent 2deb209 commit 6d2557d

File tree

2 files changed

+4
-29
lines changed

2 files changed

+4
-29
lines changed

gson/src/main/java/com/google/gson/FieldAttributes.java

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -135,27 +135,8 @@ public boolean hasModifier(int modifier) {
135135
return (field.getModifiers() & modifier) != 0;
136136
}
137137

138-
/**
139-
* Returns the value of the field represented by this {@code Field}, on
140-
* the specified object. The value is automatically wrapped in an
141-
* object if it has a primitive type.
142-
*
143-
* @return the value of the represented field in object
144-
* {@code obj}; primitive values are wrapped in an appropriate
145-
* object before being returned
146-
* @throws IllegalAccessException
147-
* @throws IllegalArgumentException
148-
*/
149-
Object get(Object instance) throws IllegalAccessException {
150-
return field.get(instance);
151-
}
152-
153-
/**
154-
* This is exposed internally only for the removing synthetic fields from the JSON output.
155-
*
156-
* @return true if the field is synthetic; otherwise false
157-
*/
158-
boolean isSynthetic() {
159-
return field.isSynthetic();
138+
@Override
139+
public String toString() {
140+
return field.toString();
160141
}
161142
}

gson/src/test/java/com/google/gson/FieldAttributesTest.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@
1717
package com.google.gson;
1818

1919
import com.google.gson.reflect.TypeToken;
20-
21-
import junit.framework.TestCase;
22-
2320
import java.lang.reflect.Modifier;
2421
import java.lang.reflect.Type;
2522
import java.util.List;
23+
import junit.framework.TestCase;
2624

2725
/**
2826
* Unit tests for the {@link FieldAttributes} class.
@@ -62,10 +60,6 @@ public void testModifiers() throws Exception {
6260
assertTrue(fieldAttributes.hasModifier(Modifier.TRANSIENT));
6361
}
6462

65-
public void testIsSynthetic() throws Exception {
66-
assertFalse(fieldAttributes.isSynthetic());
67-
}
68-
6963
public void testName() throws Exception {
7064
assertEquals("bar", fieldAttributes.getName());
7165
}

0 commit comments

Comments
 (0)