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 @@ -36,17 +36,8 @@
final class ApplicationBootstrap {

private static final List<String> DEFAULT_PROCESS_ARGUMENTS = Arrays.asList(
// libraries that use unsafe with flags to disable it
"-Djoml.nounsafe=true",
"-Dio.netty.noUnsafe=true",
// no need to use unsafe in netty5, usees memory segments instead
"-Dio.netty5.noUnsafe=true",
// platform specific settings to disable unsafe usages
"-Dvelocity.natives-disabled=true",
"-Dnet.md_5.bungee.native.disable=true",
// enable method handle support in guice (since 7.1) and use child class loaders for
// fast class generation (all other options require unsafe to access internals)
"-Dguice_use_method_handles=YES",
"-Dguice_custom_class_loading=CHILD",
// Enables the usage of native access for all unnamed modules, which allows us to use the JLine FFM terminal.
// While enabling native access for modules is not a strict requirement yet (see JEP 472 for initial work),
// JLine has a check that specifically ensures that native access is enabled before allowing to use the impl.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@

public abstract class AbstractServiceLogCache implements ServiceConsoleLogCache {

private static final String VM_BOOTSTRAP_NO_SHARE_WARNING = "Sharing is only supported for boot loader classes";

protected static final Logger LOGGER = LoggerFactory.getLogger(AbstractServiceLogCache.class);
protected static final Pattern ANSI_SEQUENCE_PATTERN = Pattern.compile("\u001b\\[[0-9;]*[A-Za-z]");

Expand Down Expand Up @@ -120,7 +122,9 @@ protected void handleItem(@NonNull String entry, boolean comesFromErrorStream) {
}

if (this.alwaysPrintErrorStreamToConsole && comesFromErrorStream) {
LOGGER.warn("[{}/WARN]: {}", this.associatedServiceId.name(), entry);
if (!entry.contains(VM_BOOTSTRAP_NO_SHARE_WARNING)) {
LOGGER.warn("[{}/WARN]: {}", this.associatedServiceId.name(), entry);
}
}

if (!this.handlers.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package eu.cloudnetservice.wrapper.impl;

import eu.cloudnetservice.wrapper.impl.transform.DefaultClassTransformerRegistry;
import eu.cloudnetservice.wrapper.impl.transform.unsafe.UnsafeTransformer;
import eu.cloudnetservice.wrapper.transform.ClassTransformerRegistry;
import java.io.IOException;
import java.lang.instrument.Instrumentation;
Expand All @@ -36,6 +37,12 @@ final class Premain {
public static void premain(@Nullable String agentArgs, @NonNull Instrumentation inst) {
Premain.instrumentation = inst;
Premain.transformerRegistry = new DefaultClassTransformerRegistry(inst);

// 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());
}

public static void preloadClasses(@NonNull Path file, @NonNull ClassLoader loader) {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading