diff --git a/agent-module/bootstraps/bootstrap-java15/pom.xml b/agent-module/bootstraps/bootstrap-java15/pom.xml
index 5ad5b36c6e6b..6bdc27d888c9 100644
--- a/agent-module/bootstraps/bootstrap-java15/pom.xml
+++ b/agent-module/bootstraps/bootstrap-java15/pom.xml
@@ -39,10 +39,6 @@
com.navercorp.pinpoint
pinpoint-bootstrap-core
-
- com.navercorp.pinpoint
- pinpoint-commons
-
diff --git a/agent-module/bootstraps/bootstrap-java16/pom.xml b/agent-module/bootstraps/bootstrap-java16/pom.xml
index 48f95c0d6e79..4c53f0a22cb3 100644
--- a/agent-module/bootstraps/bootstrap-java16/pom.xml
+++ b/agent-module/bootstraps/bootstrap-java16/pom.xml
@@ -38,10 +38,6 @@
com.navercorp.pinpoint
pinpoint-bootstrap-core
-
- com.navercorp.pinpoint
- pinpoint-commons
-
diff --git a/agent-module/bootstraps/bootstrap-java9-internal/pom.xml b/agent-module/bootstraps/bootstrap-java9-internal/pom.xml
index 3131b47d766c..2bd5d660dab5 100644
--- a/agent-module/bootstraps/bootstrap-java9-internal/pom.xml
+++ b/agent-module/bootstraps/bootstrap-java9-internal/pom.xml
@@ -39,10 +39,6 @@
com.navercorp.pinpoint
pinpoint-bootstrap-core
-
- com.navercorp.pinpoint
- pinpoint-commons
-
diff --git a/agent-module/bootstraps/bootstrap-java9/pom.xml b/agent-module/bootstraps/bootstrap-java9/pom.xml
index 46ac392bacdb..c4a7259df004 100644
--- a/agent-module/bootstraps/bootstrap-java9/pom.xml
+++ b/agent-module/bootstraps/bootstrap-java9/pom.xml
@@ -35,14 +35,6 @@
jar
-
- com.navercorp.pinpoint
- pinpoint-bootstrap-core
-
-
- com.navercorp.pinpoint
- pinpoint-commons
-
com.navercorp.pinpoint
pinpoint-bootstrap-java9-internal
diff --git a/agent-module/bootstraps/bootstrap-java9/src/main/java/com/navercorp/pinpoint/bootstrap/java9/module/JarFileAnalyzer.java b/agent-module/bootstraps/bootstrap-java9/src/main/java/com/navercorp/pinpoint/bootstrap/java9/module/JarFileAnalyzer.java
index aae724b01327..612259d376a3 100644
--- a/agent-module/bootstraps/bootstrap-java9/src/main/java/com/navercorp/pinpoint/bootstrap/java9/module/JarFileAnalyzer.java
+++ b/agent-module/bootstraps/bootstrap-java9/src/main/java/com/navercorp/pinpoint/bootstrap/java9/module/JarFileAnalyzer.java
@@ -17,7 +17,6 @@
package com.navercorp.pinpoint.bootstrap.java9.module;
import com.navercorp.pinpoint.bootstrap.module.Providers;
-import com.navercorp.pinpoint.common.util.ClassUtils;
import java.io.IOException;
import java.io.InputStream;
@@ -124,28 +123,20 @@ public String filter(JarEntry jarEntry) {
}
final String fileName = jarEntry.getName();
- if (!checkFIleExtension(fileName, CLASS_EXTENSION)) {
+ if (!checkFileExtension(fileName, CLASS_EXTENSION)) {
// skip non-class file
return null;
}
- final String packageName = ClassUtils.getPackageName(fileName, '/', null);
+ final String packageName = ModuleUtils.getPackageName(fileName, '/');
if (packageName == null) {
return null;
}
- return toPackageName(packageName);
+ return ModuleUtils.toPackageName(packageName);
}
- private boolean checkFIleExtension(String fileName, String extension) {
+ private boolean checkFileExtension(String fileName, String extension) {
return fileName.endsWith(extension);
}
-
-
- private String toPackageName(String dirFormat) {
- if (dirFormat == null) {
- return null;
- }
- return dirFormat.replace('/', '.');
- }
}
}
diff --git a/agent-module/bootstraps/bootstrap-java9/src/main/java/com/navercorp/pinpoint/bootstrap/java9/module/ModuleSupport.java b/agent-module/bootstraps/bootstrap-java9/src/main/java/com/navercorp/pinpoint/bootstrap/java9/module/ModuleSupport.java
index a25692c0ecfe..354bf20d4d41 100644
--- a/agent-module/bootstraps/bootstrap-java9/src/main/java/com/navercorp/pinpoint/bootstrap/java9/module/ModuleSupport.java
+++ b/agent-module/bootstraps/bootstrap-java9/src/main/java/com/navercorp/pinpoint/bootstrap/java9/module/ModuleSupport.java
@@ -18,8 +18,6 @@
import com.navercorp.pinpoint.bootstrap.module.JavaModule;
-import com.navercorp.pinpoint.common.util.JvmUtils;
-import com.navercorp.pinpoint.common.util.JvmVersion;
import java.lang.instrument.Instrumentation;
import java.net.URL;
@@ -161,8 +159,7 @@ private void prepareAgentModule(final ClassLoader classLoader, JavaModule agentM
// for Java9DefineClass
baseModule.addExports("jdk.internal.misc", agentModule);
- final JvmVersion version = JvmUtils.getVersion();
- if (version.onOrAfter(JvmVersion.JAVA_11)) {
+ if (ModuleUtils.jvmVersionUpper(11)) {
final String internalAccessModule = "jdk.internal.access";
if (baseModule.getPackages().contains(internalAccessModule)) {
baseModule.addExports(internalAccessModule, agentModule);
diff --git a/agent-module/bootstraps/bootstrap-java9/src/main/java/com/navercorp/pinpoint/bootstrap/java9/module/ModuleUtils.java b/agent-module/bootstraps/bootstrap-java9/src/main/java/com/navercorp/pinpoint/bootstrap/java9/module/ModuleUtils.java
new file mode 100644
index 000000000000..04bf10cf63b2
--- /dev/null
+++ b/agent-module/bootstraps/bootstrap-java9/src/main/java/com/navercorp/pinpoint/bootstrap/java9/module/ModuleUtils.java
@@ -0,0 +1,37 @@
+package com.navercorp.pinpoint.bootstrap.java9.module;
+
+import java.util.Objects;
+
+public final class ModuleUtils {
+ private static final int CLASS_BASE_VERSION = 44;
+ private static final int JAVA_VERSION = readJavaVersion();
+
+ public static String getPackageName(String fqcn, char packageSeparator) {
+ Objects.requireNonNull(fqcn, "fqcn");
+
+ final int lastPackageSeparatorIndex = fqcn.lastIndexOf(packageSeparator);
+ if (lastPackageSeparatorIndex == -1) {
+ return null;
+ }
+ return fqcn.substring(0, lastPackageSeparatorIndex);
+ }
+
+ public static String toPackageName(String dirFormat) {
+ if (dirFormat == null) {
+ return null;
+ }
+ return dirFormat.replace('/', '.');
+ }
+
+ public static int getJavaVersion() {
+ return JAVA_VERSION;
+ }
+
+ private static int readJavaVersion() {
+ return (int) Float.parseFloat(System.getProperty("java.class.version")) - CLASS_BASE_VERSION;
+ }
+
+ public static boolean jvmVersionUpper(int version) {
+ return getJavaVersion() <= version;
+ }
+}
diff --git a/agent-module/bootstraps/bootstrap-java9/src/test/java/com/navercorp/pinpoint/bootstrap/java9/module/ModuleUtilsTest.java b/agent-module/bootstraps/bootstrap-java9/src/test/java/com/navercorp/pinpoint/bootstrap/java9/module/ModuleUtilsTest.java
new file mode 100644
index 000000000000..d1cebe72e861
--- /dev/null
+++ b/agent-module/bootstraps/bootstrap-java9/src/test/java/com/navercorp/pinpoint/bootstrap/java9/module/ModuleUtilsTest.java
@@ -0,0 +1,18 @@
+package com.navercorp.pinpoint.bootstrap.java9.module;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class ModuleUtilsTest {
+
+ @Test
+ void isJava11JvmVersionUpper() {
+ assertFalse(ModuleUtils.jvmVersionUpper(7));
+ assertFalse(ModuleUtils.jvmVersionUpper(8));
+
+ assertTrue(ModuleUtils.jvmVersionUpper(11));
+ assertTrue(ModuleUtils.jvmVersionUpper(17));
+ }
+}
\ No newline at end of file