From c1ad41584e68bcc1f3d5c48fd947e12dfcf20166 Mon Sep 17 00:00:00 2001 From: Kostya Date: Wed, 22 Jul 2026 21:39:03 +0000 Subject: find method invocation --- .../java/reflection/api/ReflectionInvestigator.java | 6 ++++-- .../reflection/api/ReflectionInvestigator.class | Bin 6827 -> 6814 bytes 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ex1/src/main/java/reflection/api/ReflectionInvestigator.java b/ex1/src/main/java/reflection/api/ReflectionInvestigator.java index 054691b..f5d43f0 100644 --- a/ex1/src/main/java/reflection/api/ReflectionInvestigator.java +++ b/ex1/src/main/java/reflection/api/ReflectionInvestigator.java @@ -74,7 +74,9 @@ public class ReflectionInvestigator implements Investigator { @Override public Set getNamesOfAllFieldsIncludingInheritanceChain() { - return Stream.of(classInfo.getFields()).map(f -> f.getName()).collect(Collectors.toSet()); + return Stream.of(classInfo.getDeclaredFields()) + .map(f -> f.getName()) + .collect(Collectors.toSet()); } @Override @@ -107,7 +109,7 @@ public class ReflectionInvestigator implements Investigator { @Override public Object elevateMethodAndInvoke(String name, Class[] parametersTypes, Object... args) { try { - var method = classInfo.getMethod(name); + var method = classInfo.getMethod(name, parametersTypes); method.setAccessible(true); return method.invoke(subjectInstance, args); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { diff --git a/ex1/target/classes/reflection/api/ReflectionInvestigator.class b/ex1/target/classes/reflection/api/ReflectionInvestigator.class index 8becea9..f5127db 100644 Binary files a/ex1/target/classes/reflection/api/ReflectionInvestigator.class and b/ex1/target/classes/reflection/api/ReflectionInvestigator.class differ -- cgit v1.2.3