Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed Sep 10, 2023
1 parent 9728b8c commit b082f54
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ private static Method[] getDeclaredMethods(Class<?> clazz, boolean defensive) {
if (result == null) {
try {
Method[] declaredMethods = clazz.getDeclaredMethods();
List<Method> defaultMethods = findConcreteMethodsOnInterfaces(clazz);
List<Method> defaultMethods = findDefaultMethodsOnInterfaces(clazz);
if (defaultMethods != null) {
result = new Method[declaredMethods.length + defaultMethods.size()];
System.arraycopy(declaredMethods, 0, result, 0, declaredMethods.length);
Expand All @@ -487,15 +487,15 @@ private static Method[] getDeclaredMethods(Class<?> clazz, boolean defensive) {
}

@Nullable
private static List<Method> findConcreteMethodsOnInterfaces(Class<?> clazz) {
private static List<Method> findDefaultMethodsOnInterfaces(Class<?> clazz) {
List<Method> result = null;
for (Class<?> ifc : clazz.getInterfaces()) {
for (Method ifcMethod : ifc.getMethods()) {
if (ifcMethod.isDefault()) {
for (Method method : ifc.getMethods()) {
if (method.isDefault()) {
if (result == null) {
result = new ArrayList<>();
}
result.add(ifcMethod);
result.add(method);
}
}
}
Expand Down

0 comments on commit b082f54

Please sign in to comment.