mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-26 01:04:29 +00:00
Rename MethodData to more meaningful SrgMethod
This commit is contained in:
1 parent
5afccbd4dd
commit
204a10c64d
10 files changed
+69
-69
No files matched your search
@@ -35,7 +35,7 @@ import javax.tools.Diagnostic.Kind;
|
||||
|
||||
import org.spongepowered.asm.mixin.injection.struct.InvalidMemberDescriptorException;
|
||||
import org.spongepowered.asm.mixin.injection.struct.MemberInfo;
|
||||
import org.spongepowered.asm.obfuscation.MethodData;
|
||||
import org.spongepowered.asm.obfuscation.SrgMethod;
|
||||
import org.spongepowered.asm.util.ConstraintParser;
|
||||
import org.spongepowered.asm.util.ConstraintParser.Constraint;
|
||||
import org.spongepowered.asm.util.ConstraintViolationException;
|
||||
@@ -244,7 +244,7 @@ abstract class AnnotatedMixinElementHandler {
|
||||
}
|
||||
this.obf.addFieldMapping(this.classRef, target, targetMember, obfFieldData);
|
||||
} else {
|
||||
ObfuscationData<MethodData> obfMethodData = this.obf.getObfMethodRecursive(targetMember);
|
||||
ObfuscationData<SrgMethod> obfMethodData = this.obf.getObfMethodRecursive(targetMember);
|
||||
if (obfMethodData.isEmpty()) {
|
||||
if (targetMember.owner == null || !targetMember.owner.startsWith("java/lang/")) {
|
||||
this.ap.printMessage(Kind.WARNING, "Cannot find method mapping for @At(" + key + ") '" + target + "'", element, inject);
|
||||
|
||||
@@ -36,7 +36,7 @@ import javax.tools.Diagnostic.Kind;
|
||||
|
||||
import org.spongepowered.asm.mixin.injection.struct.InvalidMemberDescriptorException;
|
||||
import org.spongepowered.asm.mixin.injection.struct.MemberInfo;
|
||||
import org.spongepowered.asm.obfuscation.MethodData;
|
||||
import org.spongepowered.asm.obfuscation.SrgMethod;
|
||||
import org.spongepowered.asm.util.Constants;
|
||||
import org.spongepowered.tools.MirrorUtils;
|
||||
import org.spongepowered.tools.obfuscation.interfaces.IMixinAnnotationProcessor;
|
||||
@@ -93,7 +93,7 @@ class AnnotatedMixinInjectorHandler extends AnnotatedMixinElementHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
ObfuscationData<MethodData> obfData = this.obf.getObfMethod(new MethodData(this.mixin.getPrimaryTargetRef() + "/" + targetMember.name, desc));
|
||||
ObfuscationData<SrgMethod> obfData = this.obf.getObfMethod(new SrgMethod(this.mixin.getPrimaryTargetRef() + "/" + targetMember.name, desc));
|
||||
if (obfData.isEmpty()) {
|
||||
Kind error = Constants.INIT.equals(targetMember.name) ? Kind.WARNING : Kind.ERROR;
|
||||
return new Message(error, "No obfuscation mapping for " + type + " target " + targetMember.name, method, inject);
|
||||
|
||||
@@ -30,7 +30,7 @@ import javax.lang.model.element.AnnotationMirror;
|
||||
import javax.lang.model.element.ExecutableElement;
|
||||
import javax.tools.Diagnostic.Kind;
|
||||
|
||||
import org.spongepowered.asm.obfuscation.MethodData;
|
||||
import org.spongepowered.asm.obfuscation.SrgMethod;
|
||||
import org.spongepowered.tools.MirrorUtils;
|
||||
import org.spongepowered.tools.obfuscation.interfaces.IMixinAnnotationProcessor;
|
||||
|
||||
@@ -51,7 +51,7 @@ class AnnotatedMixinOverwriteHandler extends AnnotatedMixinElementHandler {
|
||||
|
||||
String mcpName = method.getSimpleName().toString();
|
||||
String mcpSignature = MirrorUtils.generateSignature(method);
|
||||
ObfuscationData<MethodData> obfData = this.obf.getObfMethod(new MethodData(this.mixin.getPrimaryTargetRef() + "/" + mcpName, mcpSignature));
|
||||
ObfuscationData<SrgMethod> obfData = this.obf.getObfMethod(new SrgMethod(this.mixin.getPrimaryTargetRef() + "/" + mcpName, mcpSignature));
|
||||
|
||||
if (obfData.isEmpty()) {
|
||||
Kind error = Kind.ERROR;
|
||||
@@ -71,7 +71,7 @@ class AnnotatedMixinOverwriteHandler extends AnnotatedMixinElementHandler {
|
||||
}
|
||||
|
||||
for (ObfuscationType type : obfData) {
|
||||
MethodData obfMethod = obfData.get(type);
|
||||
SrgMethod obfMethod = obfData.get(type);
|
||||
this.addMethodMapping(type, mcpName, obfMethod.getSimpleName(), mcpSignature, obfMethod.getDesc());
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import javax.lang.model.element.ExecutableElement;
|
||||
import javax.lang.model.element.VariableElement;
|
||||
import javax.tools.Diagnostic.Kind;
|
||||
|
||||
import org.spongepowered.asm.obfuscation.MethodData;
|
||||
import org.spongepowered.asm.obfuscation.SrgMethod;
|
||||
import org.spongepowered.tools.MirrorUtils;
|
||||
import org.spongepowered.tools.obfuscation.interfaces.IMixinAnnotationProcessor;
|
||||
|
||||
@@ -75,7 +75,7 @@ class AnnotatedMixinShadowHandler extends AnnotatedMixinElementHandler {
|
||||
}
|
||||
|
||||
String mcpSignature = MirrorUtils.generateSignature(method);
|
||||
ObfuscationData<MethodData> obfData = this.obf.getObfMethod(new MethodData(this.mixin.getPrimaryTargetRef() + "/" + name, mcpSignature));
|
||||
ObfuscationData<SrgMethod> obfData = this.obf.getObfMethod(new SrgMethod(this.mixin.getPrimaryTargetRef() + "/" + name, mcpSignature));
|
||||
|
||||
if (obfData.isEmpty()) {
|
||||
this.ap.printMessage(Kind.WARNING, "Unable to locate obfuscation mapping for @Shadow method", method, shadow);
|
||||
@@ -83,7 +83,7 @@ class AnnotatedMixinShadowHandler extends AnnotatedMixinElementHandler {
|
||||
}
|
||||
|
||||
for (ObfuscationType type : obfData) {
|
||||
MethodData obfMethod = obfData.get(type);
|
||||
SrgMethod obfMethod = obfData.get(type);
|
||||
this.addMethodMapping(type, name.setObfuscatedName(obfMethod.getName()), mcpSignature, obfMethod.getDesc());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ import javax.tools.StandardLocation;
|
||||
|
||||
import org.spongepowered.asm.mixin.injection.struct.MemberInfo;
|
||||
import org.spongepowered.asm.mixin.injection.struct.ReferenceMapper;
|
||||
import org.spongepowered.asm.obfuscation.MethodData;
|
||||
import org.spongepowered.asm.obfuscation.SrgMethod;
|
||||
import org.spongepowered.asm.util.Constants;
|
||||
import org.spongepowered.tools.obfuscation.interfaces.IMixinAnnotationProcessor;
|
||||
import org.spongepowered.tools.obfuscation.interfaces.IObfuscationManager;
|
||||
@@ -164,7 +164,7 @@ public class ObfuscationManager implements IObfuscationManager {
|
||||
if (currentTarget.isField()) {
|
||||
obfData.add(type, (T)MemberInfo.fromSrgField(obfMember.toString(), "").move(obfClass).toSrg());
|
||||
} else {
|
||||
obfData.add(type, (T)MemberInfo.fromSrgMethod((MethodData)obfMember).move(obfClass).asMethodData());
|
||||
obfData.add(type, (T)MemberInfo.fromSrgMethod((SrgMethod)obfMember).move(obfClass).asSrgMethod());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -186,7 +186,7 @@ public class ObfuscationManager implements IObfuscationManager {
|
||||
if (targetMember.isField()) {
|
||||
return (ObfuscationData<T>)this.getObfField(targetMember.toSrg());
|
||||
}
|
||||
return (ObfuscationData<T>)this.getObfMethod(targetMember.asMethodData());
|
||||
return (ObfuscationData<T>)this.getObfMethod(targetMember.asSrgMethod());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -195,8 +195,8 @@ public class ObfuscationManager implements IObfuscationManager {
|
||||
* org.spongepowered.asm.mixin.injection.struct.MemberInfo)
|
||||
*/
|
||||
@Override
|
||||
public ObfuscationData<MethodData> getObfMethodRecursive(MemberInfo targetMember) {
|
||||
return this.<MethodData>getObfEntryRecursive(targetMember);
|
||||
public ObfuscationData<SrgMethod> getObfMethodRecursive(MemberInfo targetMember) {
|
||||
return this.<SrgMethod>getObfEntryRecursive(targetMember);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -205,11 +205,11 @@ public class ObfuscationManager implements IObfuscationManager {
|
||||
* org.spongepowered.asm.mixin.injection.struct.MemberInfo)
|
||||
*/
|
||||
@Override
|
||||
public ObfuscationData<MethodData> getObfMethod(MemberInfo method) {
|
||||
ObfuscationData<MethodData> data = new ObfuscationData<MethodData>();
|
||||
public ObfuscationData<SrgMethod> getObfMethod(MemberInfo method) {
|
||||
ObfuscationData<SrgMethod> data = new ObfuscationData<SrgMethod>();
|
||||
|
||||
for (TargetObfuscationEnvironment targetEnv : this.targetEnvironments) {
|
||||
MethodData obfMethod = targetEnv.getObfMethod(method);
|
||||
SrgMethod obfMethod = targetEnv.getObfMethod(method);
|
||||
if (obfMethod != null) {
|
||||
data.add(targetEnv.getType(), obfMethod);
|
||||
}
|
||||
@@ -223,15 +223,15 @@ public class ObfuscationManager implements IObfuscationManager {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.spongepowered.tools.obfuscation.IObfuscationManager
|
||||
* #getObfMethod(net.minecraftforge.srg2source.rangeapplier.MethodData)
|
||||
* @see org.spongepowered.tools.obfuscation.interfaces.IObfuscationManager
|
||||
* #getObfMethod(org.spongepowered.asm.obfuscation.SrgMethod)
|
||||
*/
|
||||
@Override
|
||||
public ObfuscationData<MethodData> getObfMethod(MethodData method) {
|
||||
ObfuscationData<MethodData> data = new ObfuscationData<MethodData>();
|
||||
public ObfuscationData<SrgMethod> getObfMethod(SrgMethod method) {
|
||||
ObfuscationData<SrgMethod> data = new ObfuscationData<SrgMethod>();
|
||||
|
||||
for (TargetObfuscationEnvironment targetEnv : this.targetEnvironments) {
|
||||
MethodData obfMethod = targetEnv.getObfMethod(method);
|
||||
SrgMethod obfMethod = targetEnv.getObfMethod(method);
|
||||
if (obfMethod != null) {
|
||||
data.add(targetEnv.getType(), obfMethod);
|
||||
}
|
||||
@@ -251,11 +251,11 @@ public class ObfuscationManager implements IObfuscationManager {
|
||||
* @param method Method to remap
|
||||
* @return data
|
||||
*/
|
||||
public ObfuscationData<MethodData> remapDescriptor(ObfuscationData<MethodData> data, MemberInfo method) {
|
||||
public ObfuscationData<SrgMethod> remapDescriptor(ObfuscationData<SrgMethod> data, MemberInfo method) {
|
||||
for (TargetObfuscationEnvironment targetEnv : this.targetEnvironments) {
|
||||
MemberInfo obfMethod = targetEnv.remapDescriptor(method);
|
||||
if (obfMethod != null) {
|
||||
data.add(targetEnv.getType(), obfMethod.asMethodData());
|
||||
data.add(targetEnv.getType(), obfMethod.asSrgMethod());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,9 +323,9 @@ public class ObfuscationManager implements IObfuscationManager {
|
||||
* org.spongepowered.tools.obfuscation.ObfuscationData)
|
||||
*/
|
||||
@Override
|
||||
public void addMethodMapping(String className, String reference, ObfuscationData<MethodData> obfMethodData) {
|
||||
public void addMethodMapping(String className, String reference, ObfuscationData<SrgMethod> obfMethodData) {
|
||||
for (TargetObfuscationEnvironment targetEnv : this.targetEnvironments) {
|
||||
MethodData obfMethod = obfMethodData.get(targetEnv.getType());
|
||||
SrgMethod obfMethod = obfMethodData.get(targetEnv.getType());
|
||||
if (obfMethod != null) {
|
||||
MemberInfo remappedReference = new MemberInfo(obfMethod);
|
||||
targetEnv.addMapping(className, reference, remappedReference.toString());
|
||||
@@ -340,9 +340,9 @@ public class ObfuscationManager implements IObfuscationManager {
|
||||
* org.spongepowered.tools.obfuscation.ObfuscationData)
|
||||
*/
|
||||
@Override
|
||||
public void addMethodMapping(String className, String reference, MemberInfo context, ObfuscationData<MethodData> obfMethodData) {
|
||||
public void addMethodMapping(String className, String reference, MemberInfo context, ObfuscationData<SrgMethod> obfMethodData) {
|
||||
for (TargetObfuscationEnvironment targetEnv : this.targetEnvironments) {
|
||||
MethodData obfMethod = obfMethodData.get(targetEnv.getType());
|
||||
SrgMethod obfMethod = obfMethodData.get(targetEnv.getType());
|
||||
if (obfMethod != null) {
|
||||
MemberInfo remappedReference = context.remapUsing(obfMethod, true);
|
||||
targetEnv.addMapping(className, reference, remappedReference.toString());
|
||||
|
||||
@@ -43,7 +43,7 @@ import javax.tools.StandardLocation;
|
||||
|
||||
import org.spongepowered.asm.mixin.injection.struct.MemberInfo;
|
||||
import org.spongepowered.asm.mixin.injection.struct.ReferenceMapper;
|
||||
import org.spongepowered.asm.obfuscation.MethodData;
|
||||
import org.spongepowered.asm.obfuscation.SrgMethod;
|
||||
import org.spongepowered.asm.obfuscation.SrgContainer;
|
||||
import org.spongepowered.asm.util.ObfuscationUtil;
|
||||
import org.spongepowered.asm.util.ObfuscationUtil.IClassRemapper;
|
||||
@@ -170,8 +170,8 @@ class TargetObfuscationEnvironment {
|
||||
/**
|
||||
* Get an obfuscation mapping for a method
|
||||
*/
|
||||
public MethodData getObfMethod(MemberInfo method) {
|
||||
MethodData obfd = this.getObfMethod(method.asMethodData());
|
||||
public SrgMethod getObfMethod(MemberInfo method) {
|
||||
SrgMethod obfd = this.getObfMethod(method.asSrgMethod());
|
||||
if (obfd != null || !method.isFullyQualified()) {
|
||||
return obfd;
|
||||
}
|
||||
@@ -196,7 +196,7 @@ class TargetObfuscationEnvironment {
|
||||
/**
|
||||
* Get an obfuscation mapping for a method
|
||||
*/
|
||||
public MethodData getObfMethod(MethodData method) {
|
||||
public SrgMethod getObfMethod(SrgMethod method) {
|
||||
if (this.initSrgs()) {
|
||||
return this.srgs.getMethodMapping(method);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ package org.spongepowered.tools.obfuscation.interfaces;
|
||||
|
||||
import org.spongepowered.asm.mixin.injection.struct.MemberInfo;
|
||||
import org.spongepowered.asm.mixin.injection.struct.ReferenceMapper;
|
||||
import org.spongepowered.asm.obfuscation.MethodData;
|
||||
import org.spongepowered.asm.obfuscation.SrgMethod;
|
||||
import org.spongepowered.tools.obfuscation.ObfuscationData;
|
||||
import org.spongepowered.tools.obfuscation.TypeHandle;
|
||||
|
||||
@@ -70,17 +70,17 @@ public interface IObfuscationManager {
|
||||
* @return ObfuscationData with remapped owner class corresponding to the
|
||||
* original owner class
|
||||
*/
|
||||
public abstract ObfuscationData<MethodData> getObfMethodRecursive(MemberInfo method);
|
||||
public abstract ObfuscationData<SrgMethod> getObfMethodRecursive(MemberInfo method);
|
||||
|
||||
/**
|
||||
* Get an obfuscation mapping for a method
|
||||
*/
|
||||
public abstract ObfuscationData<MethodData> getObfMethod(MemberInfo method);
|
||||
public abstract ObfuscationData<SrgMethod> getObfMethod(MemberInfo method);
|
||||
|
||||
/**
|
||||
* Get an obfuscation mapping for a method
|
||||
*/
|
||||
public abstract ObfuscationData<MethodData> getObfMethod(MethodData method);
|
||||
public abstract ObfuscationData<SrgMethod> getObfMethod(SrgMethod method);
|
||||
|
||||
/**
|
||||
* Attempts to resolve an obfuscated field by recursively enumerating
|
||||
@@ -116,7 +116,7 @@ public interface IObfuscationManager {
|
||||
* @param reference Original reference, as it appears in the annotation
|
||||
* @param obfMethodData Method data to add for this mapping
|
||||
*/
|
||||
public abstract void addMethodMapping(String className, String reference, ObfuscationData<MethodData> obfMethodData);
|
||||
public abstract void addMethodMapping(String className, String reference, ObfuscationData<SrgMethod> obfMethodData);
|
||||
|
||||
/**
|
||||
* Adds a method mapping to the internal refmap, generates refmap entries
|
||||
@@ -128,7 +128,7 @@ public interface IObfuscationManager {
|
||||
* supplied obfuscation data
|
||||
* @param obfMethodData Method data to add for this mapping
|
||||
*/
|
||||
public abstract void addMethodMapping(String className, String reference, MemberInfo context, ObfuscationData<MethodData> obfMethodData);
|
||||
public abstract void addMethodMapping(String className, String reference, MemberInfo context, ObfuscationData<SrgMethod> obfMethodData);
|
||||
|
||||
/**
|
||||
* Adds a field mapping to the internal refmap, generates refmap entries
|
||||
|
||||
Reference in new issue
Block a user