Quarkus Shim is a Quarkus extension that lets you patch Java classes from third-party libraries at build time without Java agents or runtime instrumentation. Using annotations like @Shim, @ShimReplace, @ShimAround, @ShimBefore, and @ShimAfter, you can replace method bodies, wrap existing behavior, or inject code before/after method execution. The transformation uses ASM during Quarkus augmentation, works across JVM, dev, and native modes, and validates signatures at build time. It also supports accessing private fields and methods via ShimFields and ShimMethods helpers, and handles overloaded methods via paramTypes. Limitations include inability to patch JDK classes or abstract/native methods.
1.3K Impressions