mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-20 11:09:35 +00:00
Fix handling of multi-dimensional array elements in the AP
This commit is contained in:
1 parent
d8c4f6f0a7
commit
2f63e40255
3 files changed
+18
-76
No files matched your search
@@ -458,7 +458,7 @@ public final class MemberInfo {
|
||||
}
|
||||
|
||||
if (this.desc != null) {
|
||||
if (!this.desc.matches("^(\\([\\w\\p{Sc}\\[/;]*\\))?\\[?[\\w\\p{Sc}/;]+$")) {
|
||||
if (!this.desc.matches("^(\\([\\w\\p{Sc}\\[/;]*\\))?\\[*[\\w\\p{Sc}/;]+$")) {
|
||||
throw new InvalidMemberDescriptorException("Invalid descriptor: " + this.desc);
|
||||
}
|
||||
if (this.isField()) {
|
||||
|
||||
@@ -229,7 +229,7 @@ public class SignaturePrinter {
|
||||
private StringBuilder appendType(StringBuilder sb, Type type, String name) {
|
||||
switch (type.getSort()) {
|
||||
case Type.ARRAY:
|
||||
return this.appendType(sb, type.getElementType(), name).append("[]");
|
||||
return SignaturePrinter.appendArraySuffix(this.appendType(sb, type.getElementType(), name), type);
|
||||
case Type.OBJECT:
|
||||
return this.appendType(sb, type.getClassName(), name);
|
||||
default:
|
||||
@@ -287,7 +287,7 @@ public class SignaturePrinter {
|
||||
case Type.FLOAT: return box ? "Float" : "float";
|
||||
case Type.LONG: return box ? "Long" : "long";
|
||||
case Type.DOUBLE: return box ? "Double" : "double";
|
||||
case Type.ARRAY: return SignaturePrinter.getTypeName(type.getElementType(), box, fullyQualified) + "[]";
|
||||
case Type.ARRAY: return SignaturePrinter.getTypeName(type.getElementType(), box, fullyQualified) + SignaturePrinter.arraySuffix(type);
|
||||
case Type.OBJECT:
|
||||
String typeName = type.getClassName();
|
||||
if (!fullyQualified) {
|
||||
@@ -298,4 +298,16 @@ public class SignaturePrinter {
|
||||
return "Object";
|
||||
}
|
||||
}
|
||||
|
||||
private static String arraySuffix(Type type) {
|
||||
return Strings.repeat("[]", type.getDimensions());
|
||||
}
|
||||
|
||||
|
||||
private static StringBuilder appendArraySuffix(StringBuilder sb, Type type) {
|
||||
for (int i = 0; i < type.getDimensions(); i++) {
|
||||
sb.append("[]");
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user