From 4fd150441d5075c2ed46c0f452d96c31acaf1a8a Mon Sep 17 00:00:00 2001 From: Claudio Maggioni Date: Mon, 9 Jan 2023 18:42:06 +0100 Subject: [PATCH] fix typo on ex10 --- DiSLProject2022/src-profiler/ex10/Instrumentation.java | 8 +++----- DiSLProject2022/src-profiler/ex10/Profiler.java | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/DiSLProject2022/src-profiler/ex10/Instrumentation.java b/DiSLProject2022/src-profiler/ex10/Instrumentation.java index 58592d1..e01af2e 100644 --- a/DiSLProject2022/src-profiler/ex10/Instrumentation.java +++ b/DiSLProject2022/src-profiler/ex10/Instrumentation.java @@ -33,14 +33,12 @@ public class Instrumentation { try { final Class clazz = cls.loadClass(clazzName); final Set declaredMethods = Set.of(clazz.getDeclaredMethods()); - for (final Method m : declaredMethods) { - Profiler.registerDeclare(clazzName, m.toString()); - } for (final Method m : clazz.getMethods()) { if (declaredMethods.contains(m)) { - continue; + Profiler.registerDeclared(clazzName, m.toString()); + } else { + Profiler.registerInherited(clazzName, m.toString()); } - Profiler.registerInherited(clazzName, m.toString()); } } catch (final ClassNotFoundException e) { throw new RuntimeException(e); diff --git a/DiSLProject2022/src-profiler/ex10/Profiler.java b/DiSLProject2022/src-profiler/ex10/Profiler.java index d6d0675..a2c6d2f 100644 --- a/DiSLProject2022/src-profiler/ex10/Profiler.java +++ b/DiSLProject2022/src-profiler/ex10/Profiler.java @@ -41,7 +41,7 @@ public class Profiler { register(className, methodName, methodInvocations); } - public static void registerDeclare(final String className, final String methodName) { + public static void registerDeclared(final String className, final String methodName) { register(className, methodName, methodDeclarations); }