@@ -19,6 +19,7 @@ import java.lang.classfile.Signature
1919import java.lang.classfile.Superclass
2020import java.lang.classfile.TypeAnnotation
2121import java.lang.classfile.attribute.AnnotationDefaultAttribute
22+ import java.lang.classfile.attribute.ConstantValueAttribute
2223import java.lang.classfile.attribute.EnclosingMethodAttribute
2324import java.lang.classfile.attribute.ExceptionsAttribute
2425import java.lang.classfile.attribute.InnerClassInfo
@@ -39,6 +40,7 @@ import java.lang.classfile.attribute.RuntimeVisibleAnnotationsAttribute
3940import java.lang.classfile.attribute.RuntimeVisibleParameterAnnotationsAttribute
4041import java.lang.classfile.attribute.RuntimeVisibleTypeAnnotationsAttribute
4142import java.lang.classfile.attribute.SignatureAttribute
43+ import java.lang.classfile.constantpool.StringEntry
4244import java.lang.classfile.instruction.ConstantInstruction
4345import java.lang.classfile.instruction.ExceptionCatch
4446import java.lang.classfile.instruction.FieldInstruction
@@ -183,6 +185,15 @@ internal class RelocatorRemapper(
183185
184186 private fun asFieldTransform (): FieldTransform = FieldTransform { fb, fe ->
185187 when (fe) {
188+ is ConstantValueAttribute -> {
189+ val constant = fe.constant()
190+ if (constant is StringEntry ) {
191+ val remapped = map(constant.stringValue(), true )
192+ fb.with (ConstantValueAttribute .of(fb.constantPool().stringEntry(remapped)))
193+ } else {
194+ fb.with (fe)
195+ }
196+ }
186197 is SignatureAttribute -> fb.with (SignatureAttribute .of(mapSignature(fe.asTypeSignature())))
187198 is RuntimeVisibleAnnotationsAttribute ->
188199 fb.with (RuntimeVisibleAnnotationsAttribute .of(mapAnnotations(fe.annotations())))
@@ -518,7 +529,7 @@ internal class RelocatorRemapper(
518529
519530 for (relocator in relocators) {
520531 if (mapLiterals && relocator.skipStringConstants) {
521- return name
532+ continue
522533 } else if (relocator.canRelocateClass(newName)) {
523534 return prefix + relocator.relocateClass(newName) + suffix
524535 } else if (relocator.canRelocatePath(newName)) {
0 commit comments