Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use mapping file for fallback #96

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions src/main/java/net/fabricmc/tinyremapper/AsmRemapper.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2016, 2018, Player, asie
* Copyright (c) 2018, 2021, FabricMC
* Copyright (c) 2018, 2022, FabricMC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -46,7 +46,16 @@ public String map(String typeName) {
@Override
public String mapFieldName(String owner, String name, String desc) {
ClassInstance cls = getClass(owner);
if (cls == null) return name;

if (cls == null) {
System.out.println(String.format("Warning: actual class missing: %1$s", owner));

if (!tr.ignoreFieldDesc) {
return tr.fieldMap.getOrDefault(owner + "/" + name + ";;" + desc, name);
} else {
return tr.fieldMap.getOrDefault(owner + "/" + name, name);
}
}

return mapFieldName(cls, name, desc);
}
Expand Down Expand Up @@ -76,7 +85,11 @@ public String mapMethodName(String owner, String name, String desc) {
}

ClassInstance cls = getClass(owner);
if (cls == null) return name; // TODO: try to map these from just the mappings?, warn if actual class is missing

if (cls == null) {
System.out.println(String.format("Warning: actual class missing: %1$s", owner));
return tr.methodMap.getOrDefault(owner + "/" + name + desc, name);
}

return mapMethodName(cls, name, desc);
}
Expand Down