Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit 798c29b

Browse files
committed
Fix increment and type signature merging
1 parent be310b5 commit 798c29b

File tree

1 file changed

+23
-7
lines changed
  • src/main/java/org/spongepowered/obfuscation/merge/operation

1 file changed

+23
-7
lines changed

src/main/java/org/spongepowered/obfuscation/merge/operation/MergeUtil.java

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,18 @@ public static boolean merge(MergeEngine set, TypeSignature o, TypeSignature n) {
129129
if (o instanceof ClassTypeSignature && n instanceof ClassTypeSignature) {
130130
ClassTypeSignature c = (ClassTypeSignature) o;
131131
ClassTypeSignature cn = (ClassTypeSignature) n;
132-
TypeEntry old_type = set.getOldSourceSet().get(c.getName());
133-
TypeEntry new_type = set.getNewSourceSet().get(cn.getName());
132+
String cname = c.getDescriptor();
133+
while (cname.startsWith("[")) {
134+
cname = cname.substring(1);
135+
}
136+
TypeEntry old_type = set.getOldSourceSet().get(TypeHelper.descToType(cname));
137+
String cnname = cn.getDescriptor();
138+
while (cnname.startsWith("[")) {
139+
cnname = cnname.substring(1);
140+
}
141+
TypeEntry new_type = set.getNewSourceSet().get(TypeHelper.descToType(cnname));
134142
if (old_type == null || new_type == null) {
135-
return c.getDescriptor() == cn.getDescriptor();
143+
return c.getDescriptor().equals(cn.getDescriptor());
136144
}
137145
return set.vote(old_type, new_type);
138146
} else if (o instanceof GenericClassTypeSignature && n instanceof GenericClassTypeSignature) {
@@ -141,10 +149,18 @@ public static boolean merge(MergeEngine set, TypeSignature o, TypeSignature n) {
141149
if (c.getArguments().size() != cn.getArguments().size()) {
142150
return false;
143151
}
144-
TypeEntry old_type = set.getOldSourceSet().get(c.getName());
145-
TypeEntry new_type = set.getNewSourceSet().get(cn.getName());
152+
String cname = c.getDescriptor();
153+
while (cname.startsWith("[")) {
154+
cname = cname.substring(1);
155+
}
156+
TypeEntry old_type = set.getOldSourceSet().get(TypeHelper.descToType(cname));
157+
String cnname = cn.getDescriptor();
158+
while (cnname.startsWith("[")) {
159+
cnname = cnname.substring(1);
160+
}
161+
TypeEntry new_type = set.getNewSourceSet().get(TypeHelper.descToType(cnname));
146162
if ((old_type == null || new_type == null)) {
147-
if (c.getDescriptor() != cn.getDescriptor()) {
163+
if (!c.getDescriptor().equals(cn.getDescriptor())) {
148164
return false;
149165
}
150166
} else if (!set.vote(old_type, new_type)) {
@@ -819,7 +835,7 @@ private static <S extends Condition> void create(Class<S> type, ConditionMerger<
819835
if (!merge(set, a.getLocal().getType(), b.getLocal().getType())) {
820836
return false;
821837
}
822-
return false;
838+
return true;
823839
});
824840
create(Return.class, (set, a, b) -> {
825841
if (!a.getValue().isPresent()) {

0 commit comments

Comments
 (0)