8304148: Remapping a class with Invokedynamic constant loses static bootstrap arguments

Reviewed-by: asotona
This commit is contained in:
Thiago Henrique Hüpner 2023-05-09 17:33:27 +00:00 committed by Adam Sotona
parent 82bcee76ea
commit dde557e312
2 changed files with 3 additions and 1 deletions

View File

@ -317,7 +317,8 @@ public sealed interface ClassRemapper extends ClassTransform {
case InvokeDynamicInstruction idi -> case InvokeDynamicInstruction idi ->
cob.invokeDynamicInstruction(DynamicCallSiteDesc.of( cob.invokeDynamicInstruction(DynamicCallSiteDesc.of(
idi.bootstrapMethod(), idi.name().stringValue(), idi.bootstrapMethod(), idi.name().stringValue(),
mapMethodDesc(idi.typeSymbol()))); mapMethodDesc(idi.typeSymbol()),
idi.bootstrapArgs().stream().map(this::mapConstantValue).toArray(ConstantDesc[]::new)));
case NewObjectInstruction c -> case NewObjectInstruction c ->
cob.newObjectInstruction(map(c.className().asSymbol())); cob.newObjectInstruction(map(c.className().asSymbol()));
case NewReferenceArrayInstruction c -> case NewReferenceArrayInstruction c ->

View File

@ -211,6 +211,7 @@ class AdvancedTransformationsTest {
"INVOKESTATIC, owner: AdvancedTransformationsTest$Bar, method name: fooMethod, method type: (LAdvancedTransformationsTest$Bar;)LAdvancedTransformationsTest$Bar", "INVOKESTATIC, owner: AdvancedTransformationsTest$Bar, method name: fooMethod, method type: (LAdvancedTransformationsTest$Bar;)LAdvancedTransformationsTest$Bar",
"method type: ()LAdvancedTransformationsTest$Bar;", "method type: ()LAdvancedTransformationsTest$Bar;",
"GETFIELD, owner: AdvancedTransformationsTest$Rec, field name: foo, field type: LAdvancedTransformationsTest$Bar;"); "GETFIELD, owner: AdvancedTransformationsTest$Rec, field name: foo, field type: LAdvancedTransformationsTest$Bar;");
assertFalse(out.contains("bootstrap method arguments indexes: []"), "bootstrap arguments lost");
} }
private static void assertContains(String actual, String... expected) { private static void assertContains(String actual, String... expected) {