Do not convert ModFileScanData annotation values to immutable lists

Related: #627
This commit is contained in:
embeddedt 2026-01-23 20:17:19 -05:00
parent f26d35070e
commit 4dcdf09a01
No known key found for this signature in database
GPG Key ID: A69433EC199B5613

View File

@ -8,7 +8,7 @@ import org.embeddedt.modernfix.ModernFix;
import org.objectweb.asm.Type;
import java.lang.reflect.Field;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.stream.Collectors;
@ -65,8 +65,8 @@ public class ModFileScanDataCompactor {
memberNames.addOrGet(a.memberName()),
a.annotationData().entrySet().stream().collect(Collectors.toUnmodifiableMap(Map.Entry::getKey, e -> {
Object annValue = e.getValue();
if (annValue instanceof List<?> list) {
annValue = List.copyOf(list);
if (annValue instanceof ArrayList<?> list) {
list.trimToSize();
}
return annValue;
}))