summaryrefslogtreecommitdiffstats
path: root/ex1/src/main/java/reflection
diff options
context:
space:
mode:
Diffstat (limited to 'ex1/src/main/java/reflection')
-rw-r--r--ex1/src/main/java/reflection/api/ReflectionInvestigator.java6
1 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 {
74 74
75 @Override 75 @Override
76 public Set<String> getNamesOfAllFieldsIncludingInheritanceChain() { 76 public Set<String> getNamesOfAllFieldsIncludingInheritanceChain() {
77 return Stream.of(classInfo.getFields()).map(f -> f.getName()).collect(Collectors.toSet()); 77 return Stream.of(classInfo.getDeclaredFields())
78 .map(f -> f.getName())
79 .collect(Collectors.toSet());
78 } 80 }
79 81
80 @Override 82 @Override
@@ -107,7 +109,7 @@ public class ReflectionInvestigator implements Investigator {
107 @Override 109 @Override
108 public Object elevateMethodAndInvoke(String name, Class<?>[] parametersTypes, Object... args) { 110 public Object elevateMethodAndInvoke(String name, Class<?>[] parametersTypes, Object... args) {
109 try { 111 try {
110 var method = classInfo.getMethod(name); 112 var method = classInfo.getMethod(name, parametersTypes);
111 method.setAccessible(true); 113 method.setAccessible(true);
112 return method.invoke(subjectInstance, args); 114 return method.invoke(subjectInstance, args);
113 } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { 115 } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {