Skip to content

Commit

Permalink
Fix warning about setting VirtualField supplier twice (#12584)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurit authored Nov 8, 2024
1 parent 0c2d504 commit 51b4051
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
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

0 comments on commit 51b4051

Please sign in to comment.