All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.undefinedlabs.scope.ScopeAgentBuilderCreator Maven / Gradle / Ivy

package com.undefinedlabs.scope;

import static com.undefinedlabs.scope.agent.ScopeClassLoaderMatcher.skipClassLoader;
import static net.bytebuddy.matcher.ElementMatchers.any;
import static net.bytebuddy.matcher.ElementMatchers.nameStartsWith;

import net.bytebuddy.ByteBuddy;
import net.bytebuddy.agent.builder.AgentBuilder;
import net.bytebuddy.dynamic.scaffold.TypeValidation;

public enum ScopeAgentBuilderCreator implements AgentBuilderCreator {
  INSTANCE;

  private static final AgentBuilder AGENT_BUILDER =
      new AgentBuilder.Default(new ByteBuddy().with(TypeValidation.DISABLED))
          .disableClassFormatChanges()
          .with(AgentBuilder.InitializationStrategy.NoOp.INSTANCE)
          .with(AgentBuilder.TypeStrategy.Default.REDEFINE)
          .with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION)
          .ignore(any(), skipClassLoader())
          .or(nameStartsWith("com.sun.proxy"))
          .or(nameStartsWith("ch.qos.logback"))
          .or(nameStartsWith("net.bytebuddy"))
          .or(nameStartsWith("io.opentracing"))
          .or(nameStartsWith("com.undefinedlabs.scope"));

  @Override
  public AgentBuilder getInstance() {
    return AGENT_BUILDER;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy