Remove unused package-private FieldAttributes methods (#2162)
This commit is contained in:
parent
2deb2099d3
commit
6d2557d5d1
|
@ -135,27 +135,8 @@ public final class FieldAttributes {
|
||||||
return (field.getModifiers() & modifier) != 0;
|
return (field.getModifiers() & modifier) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Returns the value of the field represented by this {@code Field}, on
|
public String toString() {
|
||||||
* the specified object. The value is automatically wrapped in an
|
return field.toString();
|
||||||
* 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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,12 +17,10 @@
|
||||||
package com.google.gson;
|
package com.google.gson;
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for the {@link FieldAttributes} class.
|
* Unit tests for the {@link FieldAttributes} class.
|
||||||
|
@ -62,10 +60,6 @@ public class FieldAttributesTest extends TestCase {
|
||||||
assertTrue(fieldAttributes.hasModifier(Modifier.TRANSIENT));
|
assertTrue(fieldAttributes.hasModifier(Modifier.TRANSIENT));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIsSynthetic() throws Exception {
|
|
||||||
assertFalse(fieldAttributes.isSynthetic());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testName() throws Exception {
|
public void testName() throws Exception {
|
||||||
assertEquals("bar", fieldAttributes.getName());
|
assertEquals("bar", fieldAttributes.getName());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user