Remove dependency on javaagent-bootstrap from javaagent-extension-api
MODIFY
instrumentation/internal/internal-url-class-loader/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/internal/urlclassloader/UrlClassLoaderInstrumentation.java
instrumentation/internal/internal-url-class-loader/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/internal/urlclassloader/UrlClassLoaderInstrumentation.java
@@ -13,9 +13,9 @@ import static net.bytebuddy.matcher.ElementMatchers.not;
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
-import io.opentelemetry.javaagent.bootstrap.ClassLoaderMatcherCacheHolder;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
+import io.opentelemetry.javaagent.instrumentation.api.internal.ClassLoaderMatcherCacheHolder;
import java.net.URL;
import java.net.URLClassLoader;
import net.bytebuddy.asm.Advice;

RENAME
javaagent-bootstrap/src/main/java/io/opentelemetry/javaagent/bootstrap/ClassLoaderMatcherCacheHolder.java
javaagent-api/src/main/java/io/opentelemetry/javaagent/instrumentation/api/internal/ClassLoaderMatcherCacheHolder.java
* SPDX-License-Identifier: Apache-2.0
*/
-package io.opentelemetry.javaagent.bootstrap;
+package io.opentelemetry.javaagent.instrumentation.api.internal;
import io.opentelemetry.instrumentation.api.caching.Cache;
import java.net.URL;
@@ -16,7 +16,7 @@ import org.checkerframework.checker.lock.qual.GuardedBy;
* instrumentation can invalidate the ClassLoaderMatcher for a particular ClassLoader, e.g. when
* {@link java.net.URLClassLoader#addURL(URL)} is called.
*/
-public class ClassLoaderMatcherCacheHolder {
+public final class ClassLoaderMatcherCacheHolder {
@GuardedBy("allCaches")
private static final List<Cache<ClassLoader, Boolean>> allCaches = new ArrayList<>();

MODIFY
javaagent-extension-api/build.gradle.kts
javaagent-extension-api/build.gradle.kts
@@ -21,8 +21,6 @@ dependencies {
implementation(project(":instrumentation-api"))
implementation(project(":javaagent-api"))
- // TODO: ideally this module should not depend on bootstrap, bootstrap should be an internal component
- implementation(project(":javaagent-bootstrap"))
// metrics are unstable, do not expose as api
implementation("io.opentelemetry:opentelemetry-sdk-metrics")

MODIFY
javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/extension/matcher/ClassLoaderMatcher.java
javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/extension/matcher/ClassLoaderMatcher.java
package io.opentelemetry.javaagent.extension.matcher;
import io.opentelemetry.instrumentation.api.caching.Cache;
-import io.opentelemetry.javaagent.bootstrap.ClassLoaderMatcherCacheHolder;
+import io.opentelemetry.javaagent.instrumentation.api.internal.ClassLoaderMatcherCacheHolder;
import io.opentelemetry.javaagent.instrumentation.api.internal.InClassLoaderMatcher;
import net.bytebuddy.matcher.ElementMatcher;
import org.checkerframework.checker.nullness.qual.Nullable;

Remove dependency on javaagent-bootstrap from javaagent-extension-api (#3477)