Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warning about setting VirtualField supplier twice #12584

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private static void installEarlyInstrumentation(
(builder, typeDescription, classLoader, module, protectionDomain) -> builder);

VirtualFieldImplementationInstallerFactory virtualFieldInstallerFactory =
new VirtualFieldImplementationInstallerFactory();
VirtualFieldImplementationInstallerFactory.getInstance();
for (EarlyInstrumentationModule earlyInstrumentationModule :
loadOrdered(EarlyInstrumentationModule.class, Utils.getExtensionsClassLoader())) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ public final class VirtualFieldImplementationInstallerFactory {

private static final TransformSafeLogger logger =
TransformSafeLogger.getLogger(VirtualFieldImplementationInstallerFactory.class);
private static final VirtualFieldImplementationInstallerFactory INSTANCE =
new VirtualFieldImplementationInstallerFactory();

public VirtualFieldImplementationInstallerFactory() {
private VirtualFieldImplementationInstallerFactory() {
RuntimeVirtualFieldSupplier.set(new RuntimeFieldBasedImplementationSupplier());
}

public static VirtualFieldImplementationInstallerFactory getInstance() {
return INSTANCE;
}

public VirtualFieldImplementationInstaller create(InstrumentationModule instrumentationModule) {
VirtualFieldMappingsBuilderImpl builder = new VirtualFieldMappingsBuilderImpl();
if (instrumentationModule instanceof InstrumentationModuleMuzzle) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public final class InstrumentationModuleInstaller {

private final Instrumentation instrumentation;
private final VirtualFieldImplementationInstallerFactory virtualFieldInstallerFactory =
new VirtualFieldImplementationInstallerFactory();
VirtualFieldImplementationInstallerFactory.getInstance();

public InstrumentationModuleInstaller(Instrumentation instrumentation) {
this.instrumentation = instrumentation;
Expand Down
Loading