Resolve field obfuscations in superclass mappings

This commit is contained in:
Mumfrey committed 2015-12-16 17:33:54 +00:00
1 parent 068f64be00
commit e2275d15e2
6 files changed
+115 -7

No files matched your search

@@ -190,6 +190,19 @@ public class MemberInfo {
this.matchAll = remapped.matchAll;
}
/**
* Initialise a remapped MemberInfo with a new name
*
* @param original Original MemberInfo
* @param owner new owner
*/
private MemberInfo(MemberInfo original, String owner) {
this.owner = owner;
this.name = original.name;
this.desc = original.desc;
this.matchAll = original.matchAll;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@@ -210,7 +223,7 @@ public class MemberInfo {
*/
public String toSrg() {
if (!this.isFullyQualified()) {
throw new RuntimeException("Cannot convert unqalified reference to SRG mapping");
throw new RuntimeException("Cannot convert unqualified reference to SRG mapping");
}
if (this.desc.startsWith("(")) {
@@ -230,7 +243,7 @@ public class MemberInfo {
public MethodData asMethodData() {
if (!this.isFullyQualified()) {
throw new RuntimeException("Cannot convert unqalified reference to MethodData");
throw new RuntimeException("Cannot convert unqualified reference to MethodData");
}
if (this.isField()) {
@@ -377,6 +390,20 @@ public class MemberInfo {
&& (ordinal == 0 || this.matchAll);
}
/**
* Create a new version of this member with a different owner
*
* @param methodData Method data to use
* @param setOwner True to set the owner as well as the name
* @return New MethodInfo with remapped values
*/
public MemberInfo move(String newOwner) {
if (newOwner.equals(this.owner)) {
return this;
}
return new MemberInfo(this, newOwner);
}
/**
* Create a remapped version of this member using the supplied method data
*