-
Enhancement
-
Resolution: Done
-
Major
-
None
-
None
The java.lang.instrument.ClassFileTransformer interface is hostile to JBoss Modules for two reasons. Firstly, it accepts and returns a byte[], which means that resource loaders which utilize memory mapping must copy class data an extra time even if no transformation takes place. Secondly, that interface exists in the java.instrument module which may be excluded from the run time image starting in Java 9, causing unexpected run-time errors.
Introduce a new transformer which is a BiFunction<String, ByteBuffer, ByteBuffer> which accepts the class name and bytes (as a buffer) and returns the same buffer or a new buffer containing the transformed bytes. Deprecate the transformation properties which use java.lang.instrument.ClassFileTransformer for removal in a future version.