Skip to content

Commit 32d9de2

Browse files
committed
Migrate from ASM to Class-File API
https://openjdk.org/jeps/484
1 parent 5e559b6 commit 32d9de2

File tree

4 files changed

+545
-41
lines changed

4 files changed

+545
-41
lines changed

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[versions]
2-
jdkRelease = "17"
2+
jdkRelease = "24"
33
minGradle = "9.0.0"
44
kotlin = "2.3.20-RC3"
55
moshi = "1.15.2"

src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/RelocationTest.kt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,45 @@ class RelocationTest : BasePluginTest() {
533533
}
534534
}
535535

536+
@Test
537+
fun relocateAnnotationStringConstants() {
538+
writeClass {
539+
"""
540+
package my;
541+
import java.lang.annotation.Retention;
542+
import java.lang.annotation.RetentionPolicy;
543+
@Retention(RetentionPolicy.RUNTIME)
544+
@interface MyAnnotation {
545+
String value();
546+
}
547+
@MyAnnotation("foo.Bar")
548+
public class Main {
549+
public static void main(String[] args) {
550+
MyAnnotation ann = Main.class.getAnnotation(MyAnnotation.class);
551+
System.out.println(ann.value());
552+
}
553+
}
554+
"""
555+
.trimIndent()
556+
}
557+
projectScript.appendText(
558+
"""
559+
$shadowJarTask {
560+
manifest {
561+
attributes '$mainClassAttributeKey': 'my.Main'
562+
}
563+
relocate('foo', 'shadow.foo')
564+
}
565+
"""
566+
.trimIndent()
567+
)
568+
569+
runWithSuccess(shadowJarPath)
570+
val result = runProcess("java", "-jar", outputShadowedJar.use { it.toString() })
571+
572+
assertThat(result).contains("shadow.foo.Bar")
573+
}
574+
536575
@Issue("https://github.com/GradleUp/shadow/issues/1403")
537576
@Test
538577
fun relocateMultiClassSignatureStringConstants() {

0 commit comments

Comments
 (0)