Skip to content
Merged
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 @@ -41,8 +41,11 @@ public static void premain(@Nullable String agentArgs, @NonNull Instrumentation
// init and registers the unsafe transformer very early in the process. this is done here
// as we usually don't allow transformers to be registered so early as they're intended to
// transform classes brought in by the wrapped application, not by the jdk
UnsafeTransformer.init(inst);
Premain.transformerRegistry.registerTransformer(new UnsafeTransformer());
var unsafeTransformerDisabled = Boolean.getBoolean("cloudnet.wrapper.unsafe-transform-disabled");
if (!unsafeTransformerDisabled) {
UnsafeTransformer.init(inst);
Premain.transformerRegistry.registerTransformer(new UnsafeTransformer());
}
}

public static void preloadClasses(@NonNull Path file, @NonNull ClassLoader loader) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,9 @@ public final class UnsafeTransformer implements ClassTransformer {
MethodTypeDesc.of(ConstantDescs.CD_void, ConstantDescs.CD_String, ConstantDescs.CD_String);

/**
* Constructs a new instance of this transformer, usually done via SPI.
* Constructs a new instance of this transformer, only public for internal use.
*/
public UnsafeTransformer() {
var transformerDisabled = Boolean.getBoolean("cloudnet.wrapper.unsafe-transform-disabled");
if (transformerDisabled) {
throw new UnsupportedOperationException("transformer disabled via system property");
}
}

/**
Expand Down
Loading