Skip to content

Commit

Permalink
Introspect interface-declared methods in case of proxy (for varargs)
Browse files Browse the repository at this point in the history
Issue: SPR-16122
  • Loading branch information
jhoeller committed Oct 27, 2017
1 parent 2611aa0 commit 419b444
Show file tree
Hide file tree
Showing 2 changed files with 492 additions and 465 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
Expand Down Expand Up @@ -230,6 +231,14 @@ private Collection<Method> getMethods(Class<?> type, Object targetObject) {
result.addAll(Arrays.asList(getMethods(Class.class)));
return result;
}
else if (Proxy.isProxyClass(type)) {
Set<Method> result = new LinkedHashSet<>();
// Expose interface methods (not proxy-declared overrides) for proper vararg introspection
for (Class<?> ifc : type.getInterfaces()) {
result.addAll(Arrays.asList(getMethods(ifc)));
}
return result;
}
else {
return Arrays.asList(getMethods(type));
}
Expand Down
Loading

0 comments on commit 419b444

Please sign in to comment.