Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused package-private FieldAttributes methods #2162

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 3 additions & 22 deletions gson/src/main/java/com/google/gson/FieldAttributes.java
Expand Up @@ -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();
}
}
8 changes: 1 addition & 7 deletions gson/src/test/java/com/google/gson/FieldAttributesTest.java
Expand Up @@ -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.
Expand Down Expand Up @@ -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());
}
Expand Down