project(injector): Remove edge case checks and let the injector handle it

This commit is contained in:
Owain van Brakel
2022-05-11 22:28:48 +02:00
parent dfddf153b1
commit 8ed22caad4
2 changed files with 13 additions and 13 deletions

View File

@@ -457,17 +457,22 @@ public class MixinInjector extends AbstractInjector
}
}*/
Method copy = new Method(targetClass, mixinMethod.getName(), mixinMethod.getDescriptor());
moveCode(copy, mixinMethod.getCode());
copy.setAccessFlags(mixinMethod.getAccessFlags());
copy.setPublic();
Method method = targetClass.findMethod(mixinMethod.getName(), mixinMethod.getDescriptor());
if (method == null)
{
method = new Method(targetClass, mixinMethod.getName(), mixinMethod.getDescriptor());
targetClass.addMethod(method);
}
moveCode(method, mixinMethod.getCode());
method.setAccessFlags(mixinMethod.getAccessFlags());
method.setPublic();
assert mixinMethod.getExceptions().getExceptions().isEmpty();
setOwnersToTargetClass(mixinClass, targetClass, copy, copiedMethods);
setOwnersToTargetClass(mixinClass, targetClass, method, copiedMethods);
targetClass.addMethod(copy);
log.debug("[DEBUG] Injected mixin method {} to {}", copy, targetClass);
log.debug("[DEBUG] Injected mixin method {} to {}", method, targetClass);
++injected;
}
else if (mixinMethod.findAnnotation(REPLACE) != null)

View File

@@ -93,11 +93,6 @@ public class CopyRuneLiteClasses extends AbstractInjector
for (Method method : runeLiteDeob.getMethods())
{
if (className.equals("RuneLiteMenuEntry") && (method.getName().equals("getItemId") || method.getName().equals("getWidget") || method.getName().equals("getItemOp")))
{
continue;
}
transformMethod(method);
runeliteObjectVanilla.addMethod(method);
}