summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya <mail@sartin.in>2026-07-22 21:31:18 +0000
committerKostya <mail@sartin.in>2026-07-22 21:31:18 +0000
commit568e9790298a8dd1381c9b01673cce3ad53ef899 (patch)
tree1b703aa323d87f6630fd11a8449d0a575894814b
parent440fc53f86e4f01e25581190a64a4f3bed665595 (diff)
downloadjava-course-568e9790298a8dd1381c9b01673cce3ad53ef899.tar.gz
java-course-568e9790298a8dd1381c9b01673cce3ad53ef899.tar.xz
java-course-568e9790298a8dd1381c9b01673cce3ad53ef899.zip
fix names
-rw-r--r--ex1/src/main/java/reflection/api/ReflectionInvestigator.java11
-rw-r--r--ex1/target/classes/reflection/api/ReflectionInvestigator.classbin6978 -> 6797 bytes
2 files changed, 6 insertions, 5 deletions
diff --git a/ex1/src/main/java/reflection/api/ReflectionInvestigator.java b/ex1/src/main/java/reflection/api/ReflectionInvestigator.java
index 160102a..03e6dab 100644
--- a/ex1/src/main/java/reflection/api/ReflectionInvestigator.java
+++ b/ex1/src/main/java/reflection/api/ReflectionInvestigator.java
@@ -2,6 +2,7 @@ package reflection.api;
2 2
3import java.lang.reflect.InvocationTargetException; 3import java.lang.reflect.InvocationTargetException;
4import java.lang.reflect.Modifier; 4import java.lang.reflect.Modifier;
5import java.util.HashSet;
5import java.util.Set; 6import java.util.Set;
6import java.util.stream.Collectors; 7import java.util.stream.Collectors;
7import java.util.stream.Stream; 8import java.util.stream.Stream;
@@ -36,7 +37,7 @@ public class ReflectionInvestigator implements Investigator {
36 @Override 37 @Override
37 public Set<String> getAllImplementedInterfaces() { 38 public Set<String> getAllImplementedInterfaces() {
38 return Stream.of(classInfo.getInterfaces()) 39 return Stream.of(classInfo.getInterfaces())
39 .map(info -> info.getName()) 40 .map(info -> info.getSimpleName())
40 .collect(Collectors.toSet()); 41 .collect(Collectors.toSet());
41 } 42 }
42 43
@@ -116,13 +117,13 @@ public class ReflectionInvestigator implements Investigator {
116 117
117 @Override 118 @Override
118 public String getInheritanceChain(String delimiter) { 119 public String getInheritanceChain(String delimiter) {
119 var sb = new StringBuilder(); 120 var nameStack = new HashSet<String>();
120 sb.append(classInfo.getName()); 121 nameStack.add(classInfo.getSimpleName());
121 var cursor = classInfo; 122 var cursor = classInfo;
122 while (cursor != null) { 123 while (cursor != null) {
123 sb.append(cursor.getName() + " -> "); 124 nameStack.add(cursor.getSimpleName());
124 cursor = cursor.getSuperclass(); 125 cursor = cursor.getSuperclass();
125 } 126 }
126 return sb.toString(); 127 return String.join(" >> ", nameStack);
127 } 128 }
128} 129}
diff --git a/ex1/target/classes/reflection/api/ReflectionInvestigator.class b/ex1/target/classes/reflection/api/ReflectionInvestigator.class
index 382f4a2..b14f268 100644
--- a/ex1/target/classes/reflection/api/ReflectionInvestigator.class
+++ b/ex1/target/classes/reflection/api/ReflectionInvestigator.class
Binary files differ