diff --git a/src/main/java/net/fabricmc/mappingio/tree/MemoryMappingTree.java b/src/main/java/net/fabricmc/mappingio/tree/MemoryMappingTree.java index 8624d1d4..78004662 100644 --- a/src/main/java/net/fabricmc/mappingio/tree/MemoryMappingTree.java +++ b/src/main/java/net/fabricmc/mappingio/tree/MemoryMappingTree.java @@ -574,7 +574,9 @@ private void addPendingMember(MemberEntry member) { return; } - ClassEntry owner = member.getOwner(); + // Make sure the owner reference is pointing to an in-tree entry + ClassEntry owner = classesBySrcName.get(member.getOwner().getSrcName()); + member.setOwner(owner); boolean isField = member.getKind() == MappedElementKind.FIELD; // tree-side src String srcName = member.getSrcName(); @@ -1278,6 +1280,11 @@ public final ClassEntry getOwner() { return owner; } + void setOwner(ClassEntry owner) { + assert this.owner.getSrcName().equals(owner.getSrcName()); + this.owner = owner; + } + @Override void setSrcName(String name) { super.setSrcName(name); @@ -1316,7 +1323,7 @@ protected final boolean acceptMember(MappingVisitor visitor, boolean supplyDstDe return acceptElement(visitor, dstDescs); } - protected final ClassEntry owner; + protected ClassEntry owner; protected String srcDesc; private MemberKey key; }