From 9aa7a069ee65efa030f1289e381e50d1062cb70b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Mar 2026 11:06:40 +0000 Subject: [PATCH 1/2] Initial plan From 134ea29de3990a153fde934a6d084eb4fd11b3db Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Mar 2026 11:14:09 +0000 Subject: [PATCH 2/2] Fix ConstantValueAttribute remapping and skipStringConstants logic in RelocatorRemapper Co-authored-by: Goooler <10363352+Goooler@users.noreply.github.com> --- .../plugins/shadow/internal/RelocatorRemapper.kt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/RelocatorRemapper.kt b/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/RelocatorRemapper.kt index ae00eb4bd..d1f17106b 100644 --- a/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/RelocatorRemapper.kt +++ b/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/RelocatorRemapper.kt @@ -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 @@ -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 @@ -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()))) @@ -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)) {