fix typo on ex10

This commit is contained in:
Claudio Maggioni 2023-01-09 18:42:06 +01:00
parent 14b3fad321
commit 4fd150441d
2 changed files with 4 additions and 6 deletions

View file

@ -33,14 +33,12 @@ public class Instrumentation {
try {
final Class<?> clazz = cls.loadClass(clazzName);
final Set<Method> 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);

View file

@ -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);
}