ACC_SYNTHETIC attribute is lost for < Java 1.5 if the constant pool is copied
I observe that a Java agent is failing a retransformation when the constant pool is copied where the JVM indicates that a method modifier has changed. I pinned it down to a class file (< Java 1.5) that is generated by ASM where a method looses its synthetic modifier. If I do not copy the constant pool (by using new ClassWriter(0)
rather then new ClassWriter(reader, 0)
, the problem does not occur. The method in question is not transformed in any way.
Unfortunately, I struggle to create a reproduction. I assume that it is related to the short cut being taken in MethodWriter::putMethodInfo
where the modifier seems to be stripped without that the attribute is added for class files before 1.5.
The issue seems to be similar to #317822 (closed)