io.opentelemetry.javaagent.tooling.instrumentation.indy.LookupExposer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of opentelemetry-javaagent-tooling Show documentation
Show all versions of opentelemetry-javaagent-tooling Show documentation
Instrumentation of Java libraries using OpenTelemetry.
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.javaagent.tooling.instrumentation.indy;
import java.lang.invoke.MethodHandles;
/**
* This class is injected into every {@link InstrumentationModuleClassLoader} so that the bootstrap
* can use a {@link MethodHandles.Lookup} with a lookup class from within the {@link
* InstrumentationModuleClassLoader}, instead of calling {@link MethodHandles#lookup()} which uses
* the caller class as the lookup class.
*
* This circumvents a nasty JVM bug that's described here. The error is reproduced in
* {@code InstrumentationModuleClassLoaderTest}
*/
public class LookupExposer {
private LookupExposer() {}
public static MethodHandles.Lookup getLookup() {
return MethodHandles.lookup();
}
}