Skip to content

Commit

Permalink
style: improve code format of Utils.getLoadedClasses πŸ’…
Browse files Browse the repository at this point in the history
  • Loading branch information
oldratlee committed Dec 19, 2023
1 parent 8c403ba commit c3d7165
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions utils/src/main/java/io/foldright/study/agent/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,18 @@ public static boolean isClassLoadedByClassLoader(@NonNull final Instrumentation

@NonNull
private static Map<String, Map<ClassLoader, Set<Class<?>>>> 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")
Expand Down

0 comments on commit c3d7165

Please sign in to comment.