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

Make private methods static where possible #475

Merged
merged 1 commit into from Aug 4, 2019
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
4 changes: 2 additions & 2 deletions JSONObject.java
Expand Up @@ -1496,11 +1496,11 @@ && isValidMethodName(method.getName())) {
}
}

private boolean isValidMethodName(String name) {
private static boolean isValidMethodName(String name) {
return !"getClass".equals(name) && !"getDeclaringClass".equals(name);
}

private String getKeyNameFromMethod(Method method) {
private static String getKeyNameFromMethod(Method method) {
final int ignoreDepth = getAnnotationDepth(method, JSONPropertyIgnore.class);
if (ignoreDepth > 0) {
final int forcedNameDepth = getAnnotationDepth(method, JSONPropertyName.class);
Expand Down
6 changes: 3 additions & 3 deletions JSONPointer.java
Expand Up @@ -186,7 +186,7 @@ public JSONPointer(List<String> refTokens) {
this.refTokens = new ArrayList<String>(refTokens);
}

private String unescape(String token) {
private static String unescape(String token) {
return token.replace("~1", "/").replace("~0", "~")
.replace("\\\"", "\"")
.replace("\\\\", "\\");
Expand Down Expand Up @@ -228,7 +228,7 @@ public Object queryFrom(Object document) throws JSONPointerException {
* @return the matched object. If no matching item is found a
* @throws JSONPointerException is thrown if the index is out of bounds
*/
private Object readByIndexToken(Object current, String indexToken) throws JSONPointerException {
private static Object readByIndexToken(Object current, String indexToken) throws JSONPointerException {
try {
int index = Integer.parseInt(indexToken);
JSONArray currentArr = (JSONArray) current;
Expand Down Expand Up @@ -267,7 +267,7 @@ public String toString() {
* @param token the JSONPointer segment value to be escaped
* @return the escaped value for the token
*/
private String escape(String token) {
private static String escape(String token) {
return token.replace("~", "~0")
.replace("/", "~1")
.replace("\\", "\\\\")
Expand Down