From 2f4cc7c66c41defc04641f0ad0a056e5baf9f618 Mon Sep 17 00:00:00 2001 From: Kostya Date: Wed, 22 Jul 2026 21:54:28 +0000 Subject: whoops --- ex1/src/main/java/reflection/api/ReflectionInvestigator.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'ex1/src') diff --git a/ex1/src/main/java/reflection/api/ReflectionInvestigator.java b/ex1/src/main/java/reflection/api/ReflectionInvestigator.java index e16d3d5..16fafc1 100644 --- a/ex1/src/main/java/reflection/api/ReflectionInvestigator.java +++ b/ex1/src/main/java/reflection/api/ReflectionInvestigator.java @@ -78,9 +78,7 @@ public class ReflectionInvestigator implements Investigator { var cursor = classInfo; while (cursor != null) { fields.addAll( - Stream.of(classInfo.getDeclaredFields()) - .map(f -> f.getName()) - .collect(Collectors.toSet())); + Stream.of(cursor.getDeclaredFields()).map(f -> f.getName()).collect(Collectors.toSet())); cursor = cursor.getSuperclass(); } return fields; @@ -127,12 +125,12 @@ public class ReflectionInvestigator implements Investigator { @Override public String getInheritanceChain(String delimiter) { var nameStack = new HashSet(); - nameStack.add(classInfo.getSimpleName()); var cursor = classInfo; - while (cursor != null) { + do { nameStack.add(cursor.getSimpleName()); cursor = cursor.getSuperclass(); - } + } while (cursor != null); + return String.join(" >> ", nameStack); } } -- cgit v1.2.3