From 568e9790298a8dd1381c9b01673cce3ad53ef899 Mon Sep 17 00:00:00 2001 From: Kostya Date: Wed, 22 Jul 2026 21:31:18 +0000 Subject: fix names --- .../java/reflection/api/ReflectionInvestigator.java | 11 ++++++----- .../reflection/api/ReflectionInvestigator.class | Bin 6978 -> 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; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Modifier; +import java.util.HashSet; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -36,7 +37,7 @@ public class ReflectionInvestigator implements Investigator { @Override public Set getAllImplementedInterfaces() { return Stream.of(classInfo.getInterfaces()) - .map(info -> info.getName()) + .map(info -> info.getSimpleName()) .collect(Collectors.toSet()); } @@ -116,13 +117,13 @@ public class ReflectionInvestigator implements Investigator { @Override public String getInheritanceChain(String delimiter) { - var sb = new StringBuilder(); - sb.append(classInfo.getName()); + var nameStack = new HashSet(); + nameStack.add(classInfo.getSimpleName()); var cursor = classInfo; while (cursor != null) { - sb.append(cursor.getName() + " -> "); + nameStack.add(cursor.getSimpleName()); cursor = cursor.getSuperclass(); } - return sb.toString(); + return String.join(" >> ", nameStack); } } diff --git a/ex1/target/classes/reflection/api/ReflectionInvestigator.class b/ex1/target/classes/reflection/api/ReflectionInvestigator.class index 382f4a2..b14f268 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