byte-buddy icon indicating copy to clipboard operation
byte-buddy copied to clipboard

An unexpected issue for JDK 9 #697

Open HackerRookie opened this issue 2 years ago • 5 comments

This problem occurs again when using AgentBuilder with(TransformerDecoratorTransformerDecorator) #697. The following is the implementation code for TransformerDecorator

public ResettableClassFileTransformer decorate(ResettableClassFileTransformer classFileTransformer) { return new ResettableClassFileTransformer.WithDelegation(classFileTransformer) {

        @Override
        public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {
            // load from cache
            byte[] classCache = cacheResolver.getClassCache(loader, className);
            if (classCache != null) {
                return classCache;
            }

            //transform class
            classfileBuffer = classFileTransformer.transform(loader, className, classBeingRedefined, protectionDomain, classfileBuffer);

            // save to cache
            if (classfileBuffer != null) {
                cacheResolver.putClassCache(loader, className, classfileBuffer);
            }

            return classfileBuffer;
        }
    };
}

HackerRookie avatar Apr 14 '23 07:04 HackerRookie

What is the issue?

raphw avatar Apr 14 '23 08:04 raphw

The current version in use is 1.12.19. How can I fix this. Or do you have to wait for the 1.14.4 new version to come out? @raphw

HackerRookie avatar Apr 17 '23 01:04 HackerRookie

Try updating first.

raphw avatar Apr 17 '23 10:04 raphw

Upgrading to a new version([1.14.4]), where do I need to change my code?

HackerRookie avatar Apr 17 '23 10:04 HackerRookie

To update? I assume in your build setup somewhere.

raphw avatar Apr 17 '23 17:04 raphw