Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import java.lang.classfile.Signature
import java.lang.classfile.Superclass
import java.lang.classfile.TypeAnnotation
import java.lang.classfile.attribute.AnnotationDefaultAttribute
import java.lang.classfile.attribute.ConstantValueAttribute
import java.lang.classfile.attribute.EnclosingMethodAttribute
import java.lang.classfile.attribute.ExceptionsAttribute
import java.lang.classfile.attribute.InnerClassInfo
Expand All @@ -39,6 +40,7 @@ import java.lang.classfile.attribute.RuntimeVisibleAnnotationsAttribute
import java.lang.classfile.attribute.RuntimeVisibleParameterAnnotationsAttribute
import java.lang.classfile.attribute.RuntimeVisibleTypeAnnotationsAttribute
import java.lang.classfile.attribute.SignatureAttribute
import java.lang.classfile.constantpool.StringEntry
import java.lang.classfile.instruction.ConstantInstruction
import java.lang.classfile.instruction.ExceptionCatch
import java.lang.classfile.instruction.FieldInstruction
Expand Down Expand Up @@ -183,6 +185,15 @@ internal class RelocatorRemapper(

private fun asFieldTransform(): FieldTransform = FieldTransform { fb, fe ->
when (fe) {
is ConstantValueAttribute -> {
val constant = fe.constant()
if (constant is StringEntry) {
val remapped = map(constant.stringValue(), true)
fb.with(ConstantValueAttribute.of(fb.constantPool().stringEntry(remapped)))
} else {
fb.with(fe)
}
}
is SignatureAttribute -> fb.with(SignatureAttribute.of(mapSignature(fe.asTypeSignature())))
is RuntimeVisibleAnnotationsAttribute ->
fb.with(RuntimeVisibleAnnotationsAttribute.of(mapAnnotations(fe.annotations())))
Expand Down Expand Up @@ -518,7 +529,7 @@ internal class RelocatorRemapper(

for (relocator in relocators) {
if (mapLiterals && relocator.skipStringConstants) {
return name
continue
} else if (relocator.canRelocateClass(newName)) {
return prefix + relocator.relocateClass(newName) + suffix
} else if (relocator.canRelocatePath(newName)) {
Expand Down