void (String options, Instrumentation inst) { // Handle duplicate agents if (initialized) { return; } initialized = true; inst.addTransformer(new ClassFileTransformer() { public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException { try { if (className == null || className.indexOf('$') >= 0) { // non-toplevel Groovy classes don't have timestamp fields, so don't Java classes and lambdas // let's not care about presumably rare dollar-named Groovy classes return null; } if (classBeingRedefined != null) { Field callSiteArrayField = classBeingRedefined.getDeclaredField("$callSiteArray"); callSiteArrayField.setAccessible(true); callSiteArrayField.set(null, null); } return removeTimestampField(classfileBuffer); } catch (Throwable ignored) { return null; } } }); }