From c3d7165ec38695babac12b6bc2608a4864f98e18 Mon Sep 17 00:00:00 2001 From: Jerry Lee Date: Tue, 19 Dec 2023 15:56:50 +0800 Subject: [PATCH] =?UTF-8?q?style:=20improve=20code=20format=20of=20`Utils.?= =?UTF-8?q?getLoadedClasses`=20=F0=9F=92=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/foldright/study/agent/utils/Utils.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/utils/src/main/java/io/foldright/study/agent/utils/Utils.java b/utils/src/main/java/io/foldright/study/agent/utils/Utils.java index 7418c1b..df54b51 100644 --- a/utils/src/main/java/io/foldright/study/agent/utils/Utils.java +++ b/utils/src/main/java/io/foldright/study/agent/utils/Utils.java @@ -30,11 +30,18 @@ public static boolean isClassLoadedByClassLoader(@NonNull final Instrumentation @NonNull private static Map>>> getLoadedClasses(@NonNull Instrumentation inst) { - return Arrays.stream((Class[]) inst.getAllLoadedClasses()) - .collect(groupingBy(Class::getName, groupingBy(clazz -> { - ClassLoader classLoader = clazz.getClassLoader(); - return classLoader == null ? NULL_CLASS_LOADER : classLoader; - }, toSet()))); + return Arrays.stream((Class[]) inst.getAllLoadedClasses()).collect( + groupingBy( + Class::getName, + groupingBy( + clazz -> { + ClassLoader classLoader = clazz.getClassLoader(); + return classLoader == null ? NULL_CLASS_LOADER : classLoader; + }, + toSet() + ) + ) + ); } @SuppressWarnings("removal")