Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/main/java/org/json/JSONObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -1865,6 +1865,10 @@ private static <A extends Annotation> A getAnnotation(final Method m, final Clas
}
}

//If the superclass is Object, no annotations will be found any more
if (c.getSuperclass().equals(Object.class))
return null;

try {
return getAnnotation(
c.getSuperclass().getMethod(m.getName(), m.getParameterTypes()),
Expand Down Expand Up @@ -1919,6 +1923,10 @@ private static int getAnnotationDepth(final Method m, final Class<? extends Anno
}
}

//If the superclass is Object, no annotations will be found any more
if (c.getSuperclass().equals(Object.class))
return -1;

try {
int d = getAnnotationDepth(
c.getSuperclass().getMethod(m.getName(), m.getParameterTypes()),
Expand Down