From c5c128033deee4fe152b550d062007c3411915cc Mon Sep 17 00:00:00 2001 From: root Date: Tue, 14 Jul 2020 18:59:16 +0000 Subject: [PATCH] Code Review BAEL-4302 --- .../com/baeldung/loadedclasslisting/ClassLoaderType.java | 6 ------ .../main/java/com/baeldung/loadedclasslisting/Launcher.java | 5 +---- .../baeldung/loadedclasslisting/ListLoadedClassesAgent.java | 4 ++++ .../loadedclasslisting/customLoader/ClassLoaderInfo.java | 1 - 4 files changed, 5 insertions(+), 11 deletions(-) delete mode 100644 core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ClassLoaderType.java diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ClassLoaderType.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ClassLoaderType.java deleted file mode 100644 index 1111fc21fe..0000000000 --- a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ClassLoaderType.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.baeldung.loadedclasslisting; - -public enum ClassLoaderType { - - SYSTEM, EXTENSION, BOOTSTRAP, CUSTOM -} diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java index 19c42dfd8d..e1851275c9 100644 --- a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java +++ b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java @@ -3,6 +3,7 @@ package com.baeldung.loadedclasslisting; import java.lang.reflect.Method; import java.util.Arrays; +import com.baeldung.loadedclasslisting.ListLoadedClassesAgent.ClassLoaderType; import com.baeldung.loadedclasslisting.customLoader.ClassLoaderInfo; import com.baeldung.loadedclasslisting.customLoader.CustomClassLoader; @@ -11,13 +12,9 @@ public class Launcher { private static ClassLoader customClassLoader; public static void main(String[] args) { - printClassesLoadedBy(ClassLoaderType.BOOTSTRAP); - printClassesLoadedBy(ClassLoaderType.SYSTEM); - printClassesLoadedBy(ClassLoaderType.EXTENSION); - printClassesLoadedBy(ClassLoaderType.CUSTOM); } diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ListLoadedClassesAgent.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ListLoadedClassesAgent.java index 03907f8b04..8f4b8ebd41 100644 --- a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ListLoadedClassesAgent.java +++ b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ListLoadedClassesAgent.java @@ -4,6 +4,10 @@ import java.lang.instrument.Instrumentation; public class ListLoadedClassesAgent { + public enum ClassLoaderType { + SYSTEM, EXTENSION, BOOTSTRAP, CUSTOM , PLATFORM + } + private static Instrumentation instrumentation; public static void premain(String agentArgs, Instrumentation instrumentation) { diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/ClassLoaderInfo.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/ClassLoaderInfo.java index a787b062d5..2574394c13 100644 --- a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/ClassLoaderInfo.java +++ b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/ClassLoaderInfo.java @@ -5,7 +5,6 @@ import java.util.ArrayList; public class ClassLoaderInfo { public void printClassLoaders() throws ClassNotFoundException { - System.out.println("Classloader of this class:" + ClassLoaderInfo.class.getClassLoader()); System.out.println("Classloader of ArrayList:" + ArrayList.class.getClassLoader()); }