Skip to content

Commit

Permalink
Fix a stack overflow in IndexEntryResolver
Browse files Browse the repository at this point in the history
  • Loading branch information
IotaBread committed Feb 25, 2025
1 parent 61af4f0 commit 115ab98
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.quiltmc.enigma.api.translation.representation.entry.ClassEntry;
import org.quiltmc.enigma.api.translation.representation.entry.Entry;
import org.quiltmc.enigma.api.translation.representation.entry.MethodEntry;
import org.tinylog.Logger;

import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -125,11 +126,16 @@ private Set<Entry<ClassEntry>> resolveEntryInAncestry(Entry<ClassEntry> entry, R
if (entry instanceof MethodEntry methodEntry) {
MethodEntry bridgeMethod = this.bridgeMethodIndex.getBridgeFromSpecialized(methodEntry);
if (bridgeMethod != null && ownerClass.equals(bridgeMethod.getParent())) {
Set<Entry<ClassEntry>> resolvedBridge = this.resolveEntryInAncestry(bridgeMethod, strategy, skipStatic);
if (!resolvedBridge.isEmpty()) {
return resolvedBridge;
if (bridgeMethod != methodEntry) {
Set<Entry<ClassEntry>> resolvedBridge = this.resolveEntryInAncestry(bridgeMethod, strategy, skipStatic);
if (!resolvedBridge.isEmpty()) {
return resolvedBridge;
} else {
return Collections.singleton(bridgeMethod);
}
} else {
return Collections.singleton(bridgeMethod);
// TODO: Find out cause?
Logger.warn("Bridge method for {} is itself!", methodEntry);
}
}
}
Expand Down

0 comments on commit 115ab98

Please sign in to comment.