From 0b26602420978a4b541ca060bcb785a43fc16b0e Mon Sep 17 00:00:00 2001 From: "Jan S." Date: Sun, 26 May 2024 19:16:24 +0200 Subject: [PATCH] bugfix: invocation of a static/class method wasn't possible --- .../sf/feeling/decompiler/util/ReflectionUtils.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/ReflectionUtils.java b/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/ReflectionUtils.java index 31254962..ad1b5858 100644 --- a/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/ReflectionUtils.java +++ b/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/ReflectionUtils.java @@ -35,12 +35,19 @@ public static Method getDeclaredMethod(Object object, String methodName, Class[] return null; } - for (Class clazz = object.getClass(); clazz != Object.class; clazz = clazz.getSuperclass()) { + Class clazz; + if ((object instanceof Class)) { + clazz = (Class) object; + } else { + clazz = object.getClass(); + } + do { try { return clazz.getDeclaredMethod(methodName, parameterTypes); } catch (Exception e) { } - } + clazz = clazz.getSuperclass(); + } while (clazz != Object.class); return null; }