Class TracingBootstrap

java.lang.Object
com.aembot.lib.tracing.TracingBootstrap

public final class TracingBootstrap extends Object
Bootstraps the @Traced annotation system using ByteBuddy. Call install() early in Main.main() before any @Traced classes are loaded.

This uses ByteBuddy's self-attach capability to instrument classes at load time. If self-attach fails (e.g., on restricted JVMs), tracing via annotations won't work but manual Tracer.trace() calls will still function.

Usage in Main.java:


 public static void main(String... args) {
     TracingBootstrap.install();
     RobotBase.startRobot(Robot::new);
 }
 
  • Method Details

    • install

      public static boolean install()
      Install the ByteBuddy agent and register the @Traced transformer. Must be called before any @Traced classes are loaded (ideally first thing in main()).
      Returns:
      true if installation succeeded, false if it failed
    • isInstalled

      public static boolean isInstalled()
      Check if the tracing instrumentation was successfully installed
    • installCommandTracing

      public static boolean installCommandTracing()
      Install automatic tracing for WPILib Command lifecycle methods. Traces initialize(), execute(), isFinished(), and end() on all Command subclasses.

      Must be called after install() and before Command classes are loaded.

      Usage:

      
       public static void main(String... args) {
           TracingBootstrap.install();
           TracingBootstrap.installCommandTracing();
           RobotBase.startRobot(Robot::new);
       }
       
      Returns:
      true if installation succeeded, false if it failed
    • isCommandTracingInstalled

      public static boolean isCommandTracingInstalled()
      Check if Command tracing was successfully installed