checkstyle - mixin processor
This commit is contained in:
@@ -33,11 +33,11 @@ public class MethodGarbageValue
|
|||||||
|
|
||||||
public MethodGarbageValue(int value)
|
public MethodGarbageValue(int value)
|
||||||
{
|
{
|
||||||
if(value <= Byte.MAX_VALUE && value >= Byte.MIN_VALUE)
|
if (value <= Byte.MAX_VALUE && value >= Byte.MIN_VALUE)
|
||||||
{
|
{
|
||||||
type = "B";
|
type = "B";
|
||||||
}
|
}
|
||||||
else if(value <= Short.MAX_VALUE && value >= Short.MIN_VALUE)
|
else if (value <= Short.MAX_VALUE && value >= Short.MIN_VALUE)
|
||||||
{
|
{
|
||||||
type = "S";
|
type = "S";
|
||||||
}
|
}
|
||||||
@@ -60,6 +60,6 @@ public class MethodGarbageValue
|
|||||||
|
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return "MethodGarbageValue[type="+getType()+",value="+getValue()+"]";
|
return "MethodGarbageValue[type=" + getType() + ",value=" + getValue() + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,10 +33,6 @@ import io.sigpipe.jbsdiff.Patch;
|
|||||||
import javassist.ClassPool;
|
import javassist.ClassPool;
|
||||||
import javassist.CtClass;
|
import javassist.CtClass;
|
||||||
import javassist.LoaderClassPath;
|
import javassist.LoaderClassPath;
|
||||||
import org.objectweb.asm.AnnotationVisitor;
|
|
||||||
import org.objectweb.asm.ClassWriter;
|
|
||||||
import org.objectweb.asm.FieldVisitor;
|
|
||||||
import org.objectweb.asm.MethodVisitor;
|
|
||||||
import org.objectweb.asm.Opcodes;
|
import org.objectweb.asm.Opcodes;
|
||||||
import us.runelitepl.mixinprocessor.generators.AnnotationProcessor;
|
import us.runelitepl.mixinprocessor.generators.AnnotationProcessor;
|
||||||
import us.runelitepl.mixinprocessor.generators.PatchGenerator;
|
import us.runelitepl.mixinprocessor.generators.PatchGenerator;
|
||||||
@@ -50,14 +46,11 @@ import us.runelitepl.mixinprocessor.util.JavassistUtils;
|
|||||||
import us.runelitepl.mixinprocessor.util.RefUtils;
|
import us.runelitepl.mixinprocessor.util.RefUtils;
|
||||||
import org.apache.maven.plugin.AbstractMojo;
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
|
|
||||||
import org.apache.maven.plugin.MojoFailureException;
|
|
||||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||||
import org.apache.maven.plugins.annotations.Mojo;
|
import org.apache.maven.plugins.annotations.Mojo;
|
||||||
import org.apache.maven.plugins.annotations.Parameter;
|
import org.apache.maven.plugins.annotations.Parameter;
|
||||||
import org.apache.maven.plugins.annotations.ResolutionScope;
|
import org.apache.maven.plugins.annotations.ResolutionScope;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -111,9 +104,9 @@ public class MixinProcessorMojo
|
|||||||
|
|
||||||
public static HashMap<String, MethodGarbageValue> methodGarbageValues = new HashMap<>();
|
public static HashMap<String, MethodGarbageValue> methodGarbageValues = new HashMap<>();
|
||||||
|
|
||||||
public static HashMap<String, byte[]> gamepack = new HashMap<>();
|
private static HashMap<String, byte[]> gamepack = new HashMap<>();
|
||||||
|
|
||||||
public static final int BUFFER_SIZE = 1024 * 1024 * 4;
|
private static final int BUFFER_SIZE = 1024 * 1024 * 4;
|
||||||
|
|
||||||
public void execute()
|
public void execute()
|
||||||
throws MojoExecutionException
|
throws MojoExecutionException
|
||||||
@@ -257,7 +250,7 @@ public class MixinProcessorMojo
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stderr(String s, Object... format)
|
private void stderr(String s, Object... format)
|
||||||
{
|
{
|
||||||
getLog().info(String.format(s, format));
|
getLog().info(String.format(s, format));
|
||||||
}
|
}
|
||||||
@@ -267,7 +260,7 @@ public class MixinProcessorMojo
|
|||||||
INST.stderr(s, format);
|
INST.stderr(s, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deleteDir(File file) throws IOException
|
private static void deleteDir(File file) throws IOException
|
||||||
{
|
{
|
||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,5 +31,5 @@ public enum InjectionType
|
|||||||
APPEND,
|
APPEND,
|
||||||
OVERWRITE,
|
OVERWRITE,
|
||||||
PREPEND,
|
PREPEND,
|
||||||
PROVIDED;
|
PROVIDED
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,6 @@
|
|||||||
package us.runelitepl.mixinprocessor.generators;
|
package us.runelitepl.mixinprocessor.generators;
|
||||||
|
|
||||||
import us.runelitepl.mixinprocessor.transformers.AnnotationRemoverTransformer;
|
import us.runelitepl.mixinprocessor.transformers.AnnotationRemoverTransformer;
|
||||||
import us.runelitepl.mixinprocessor.transformers.AsmMethodGarbageTransformer;
|
|
||||||
import us.runelitepl.mixinprocessor.transformers.AsmMethodSignatureTransformer;
|
|
||||||
import us.runelitepl.mixinprocessor.transformers.AsmNameTransformer;
|
import us.runelitepl.mixinprocessor.transformers.AsmNameTransformer;
|
||||||
import us.runelitepl.mixinprocessor.transformers.AsmStaticUsageTransformer;
|
import us.runelitepl.mixinprocessor.transformers.AsmStaticUsageTransformer;
|
||||||
import us.runelitepl.mixinprocessor.transformers.DoNothingTransformer;
|
import us.runelitepl.mixinprocessor.transformers.DoNothingTransformer;
|
||||||
|
|||||||
@@ -25,18 +25,12 @@
|
|||||||
|
|
||||||
package us.runelitepl.mixinprocessor.generators;
|
package us.runelitepl.mixinprocessor.generators;
|
||||||
|
|
||||||
import javassist.CannotCompileException;
|
|
||||||
import javassist.CtClass;
|
|
||||||
import javassist.NotFoundException;
|
|
||||||
import us.runelitepl.mixinprocessor.MixinProcessorMojo;
|
import us.runelitepl.mixinprocessor.MixinProcessorMojo;
|
||||||
import us.runelitepl.mixinprocessor.util.JavassistUtils;
|
|
||||||
import us.runelitepl.mixinprocessor.util.RefUtils;
|
import us.runelitepl.mixinprocessor.util.RefUtils;
|
||||||
import org.objectweb.asm.ClassReader;
|
import org.objectweb.asm.ClassReader;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import org.objectweb.asm.tree.FieldNode;
|
import org.objectweb.asm.tree.FieldNode;
|
||||||
import org.objectweb.asm.tree.MethodNode;
|
import org.objectweb.asm.tree.MethodNode;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -45,11 +39,11 @@ import java.util.Set;
|
|||||||
public class StaticGenerator
|
public class StaticGenerator
|
||||||
{
|
{
|
||||||
|
|
||||||
public static HashMap<String, ArrayList<MethodNode>> staticMethods = new HashMap<>();
|
static HashMap<String, ArrayList<MethodNode>> staticMethods = new HashMap<>();
|
||||||
public static HashMap<String, ArrayList<FieldNode>> staticFields = new HashMap<>();
|
static HashMap<String, ArrayList<FieldNode>> staticFields = new HashMap<>();
|
||||||
public static Set<String> modifiedClasses = new HashSet<>();
|
static Set<String> modifiedClasses = new HashSet<>();
|
||||||
|
|
||||||
public void run(byte[] bytecode) throws NotFoundException, IOException, CannotCompileException
|
public void run(byte[] bytecode)
|
||||||
{
|
{
|
||||||
ClassReader cr = new ClassReader(bytecode);
|
ClassReader cr = new ClassReader(bytecode);
|
||||||
|
|
||||||
@@ -68,7 +62,7 @@ public class StaticGenerator
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String reobbed = RefUtils.reobMethodName(RefUtils.STATICS_STRING, methodName, method.desc);
|
String reobbed = RefUtils.reobMethodName(RefUtils.STATICS_STRING, methodName, method.desc);
|
||||||
if(reobbed == null)
|
if (reobbed == null)
|
||||||
{
|
{
|
||||||
MixinProcessorMojo.log("Failed to reob static method: %s %s", methodName, method.desc);
|
MixinProcessorMojo.log("Failed to reob static method: %s %s", methodName, method.desc);
|
||||||
throw new RuntimeException();
|
throw new RuntimeException();
|
||||||
@@ -93,7 +87,7 @@ public class StaticGenerator
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String reobbed = RefUtils.reobFieldName(RefUtils.STATICS_STRING, fieldName, field.desc);
|
String reobbed = RefUtils.reobFieldName(RefUtils.STATICS_STRING, fieldName, field.desc);
|
||||||
if(reobbed == null)
|
if (reobbed == null)
|
||||||
{
|
{
|
||||||
MixinProcessorMojo.log("Failed to reob static field: %s %s", fieldName, field.desc);
|
MixinProcessorMojo.log("Failed to reob static field: %s %s", fieldName, field.desc);
|
||||||
throw new RuntimeException();
|
throw new RuntimeException();
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ import org.objectweb.asm.tree.AnnotationNode;
|
|||||||
import org.objectweb.asm.tree.FieldNode;
|
import org.objectweb.asm.tree.FieldNode;
|
||||||
import org.objectweb.asm.tree.MethodNode;
|
import org.objectweb.asm.tree.MethodNode;
|
||||||
import org.objectweb.asm.tree.TypeAnnotationNode;
|
import org.objectweb.asm.tree.TypeAnnotationNode;
|
||||||
import us.runelitepl.mixinprocessor.MixinProcessorMojo;
|
|
||||||
import us.runelitepl.mixinprocessor.parsers.MethodReflector;
|
import us.runelitepl.mixinprocessor.parsers.MethodReflector;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class GamepackDownloader
|
|||||||
ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(gamepackJarAry));
|
ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(gamepackJarAry));
|
||||||
byte[] buffer = new byte[2048];
|
byte[] buffer = new byte[2048];
|
||||||
ZipEntry entry;
|
ZipEntry entry;
|
||||||
ByteArrayOutputStream fileContent = new ByteArrayOutputStream(1024*1024*4);
|
ByteArrayOutputStream fileContent = new ByteArrayOutputStream(1024 * 1024 * 4);
|
||||||
while ((entry = zipInputStream.getNextEntry()) != null)
|
while ((entry = zipInputStream.getNextEntry()) != null)
|
||||||
{
|
{
|
||||||
if (entry.getName().startsWith("META-INF"))
|
if (entry.getName().startsWith("META-INF"))
|
||||||
@@ -56,8 +56,8 @@ public class GamepackDownloader
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String key = entry.getName().replace(".class", "");
|
String key = entry.getName().replace(".class", "");
|
||||||
int len = 0;
|
int len;
|
||||||
while((len = zipInputStream.read(buffer)) > 0)
|
while ((len = zipInputStream.read(buffer)) > 0)
|
||||||
{
|
{
|
||||||
fileContent.write(buffer, 0, len);
|
fileContent.write(buffer, 0, len);
|
||||||
}
|
}
|
||||||
@@ -83,7 +83,7 @@ public class GamepackDownloader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getGamepackUrl()
|
private static String getGamepackUrl()
|
||||||
{
|
{
|
||||||
return codebase + initial_jar;
|
return codebase + initial_jar;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class HooksParser
|
|||||||
String f_owner = (String) field.get("owner");
|
String f_owner = (String) field.get("owner");
|
||||||
long f_decoder = (long) field.getOrDefault("decoder", (long) 1);
|
long f_decoder = (long) field.getOrDefault("decoder", (long) 1);
|
||||||
String f_deobbedOwner = null;
|
String f_deobbedOwner = null;
|
||||||
if(f_deobbedName.startsWith("__"))
|
if (f_deobbedName.startsWith("__"))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -104,7 +104,7 @@ public class HooksParser
|
|||||||
String m_deobbedOwner = null;
|
String m_deobbedOwner = null;
|
||||||
String m_obbedName = (String) method.get("name");
|
String m_obbedName = (String) method.get("name");
|
||||||
String m_descriptor = (String) method.get("descriptor");
|
String m_descriptor = (String) method.get("descriptor");
|
||||||
if(m_deobbedName.startsWith("__"))
|
if (m_deobbedName.startsWith("__"))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class MethodAnnotationParser
|
|||||||
|
|
||||||
public void run() throws ClassNotFoundException
|
public void run() throws ClassNotFoundException
|
||||||
{
|
{
|
||||||
for(CtMethod method : patch.getDeclaredMethods())
|
for (CtMethod method : patch.getDeclaredMethods())
|
||||||
{
|
{
|
||||||
Object[] annotations = method.getAnnotations();
|
Object[] annotations = method.getAnnotations();
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ public class MethodAnnotationParser
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(reobfuscate)
|
if (reobfuscate)
|
||||||
{
|
{
|
||||||
MixinProcessorMojo.log("Marking: %s %s %s", method.getDeclaringClass().getSimpleName(), methodName,
|
MixinProcessorMojo.log("Marking: %s %s %s", method.getDeclaringClass().getSimpleName(), methodName,
|
||||||
RefUtils.reobMethodDescriptor(method.getSignature()));
|
RefUtils.reobMethodDescriptor(method.getSignature()));
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public class AnnotationRemoverTransformer extends AsmBaseTransformer
|
|||||||
return cw.toByteArray();
|
return cw.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String makeAnnotationDescriptor(String s)
|
static String makeAnnotationDescriptor(String s)
|
||||||
{
|
{
|
||||||
return "Lus/runelitepl/mixinprocessor/annotations/" + s + ";";
|
return "Lus/runelitepl/mixinprocessor/annotations/" + s + ";";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,11 +34,12 @@ public abstract class AsmBaseTransformer implements Opcodes
|
|||||||
|
|
||||||
protected final ArrayList<String> validMethods = new ArrayList<>();
|
protected final ArrayList<String> validMethods = new ArrayList<>();
|
||||||
protected final ArrayList<String> validFields = new ArrayList<>();
|
protected final ArrayList<String> validFields = new ArrayList<>();
|
||||||
|
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
protected void buildMethodList(){}
|
protected void buildMethodList(){}
|
||||||
|
|
||||||
protected void buildFieldList(){}
|
protected void buildFieldList(){}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
public abstract byte[] transform();
|
public abstract byte[] transform();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ import org.objectweb.asm.MethodVisitor;
|
|||||||
import us.runelitepl.mixinprocessor.MethodGarbageValue;
|
import us.runelitepl.mixinprocessor.MethodGarbageValue;
|
||||||
import us.runelitepl.mixinprocessor.MixinProcessorMojo;
|
import us.runelitepl.mixinprocessor.MixinProcessorMojo;
|
||||||
import us.runelitepl.mixinprocessor.util.RefUtils;
|
import us.runelitepl.mixinprocessor.util.RefUtils;
|
||||||
|
|
||||||
import java.sql.Ref;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class AsmMethodGarbageTransformer extends AsmBaseTransformer
|
public class AsmMethodGarbageTransformer extends AsmBaseTransformer
|
||||||
@@ -74,13 +72,13 @@ public class AsmMethodGarbageTransformer extends AsmBaseTransformer
|
|||||||
// mv.visitLdcInsn(BIPUSH, constant);
|
// mv.visitLdcInsn(BIPUSH, constant);
|
||||||
// call super method with new descriptor
|
// call super method with new descriptor
|
||||||
|
|
||||||
if(RefUtils.shouldReobMethod(owner, name, desc))
|
if (RefUtils.shouldReobMethod(owner, name, desc))
|
||||||
{
|
{
|
||||||
String nc = RefUtils.reobMethodName(owner, name, desc).split(" ")[0];
|
String nc = RefUtils.reobMethodName(owner, name, desc).split(" ")[0];
|
||||||
String nn = RefUtils.reobMethodName(owner, name, desc).split(" ")[1];
|
String nn = RefUtils.reobMethodName(owner, name, desc).split(" ")[1];
|
||||||
String nd = RefUtils.reobMethodDescriptor(desc);
|
String nd = RefUtils.reobMethodDescriptor(desc);
|
||||||
MethodGarbageValue value;
|
MethodGarbageValue value;
|
||||||
if((value = MixinProcessorMojo.methodGarbageValues.getOrDefault(String.format("%s.%s%s",
|
if ((value = MixinProcessorMojo.methodGarbageValues.getOrDefault(String.format("%s.%s%s",
|
||||||
nc, nn, nd), null)) != null)
|
nc, nn, nd), null)) != null)
|
||||||
{
|
{
|
||||||
switch (value.getType())
|
switch (value.getType())
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class AsmMethodSignatureTransformer extends AsmBaseTransformer
|
|||||||
|
|
||||||
private String fixMethodDesc(String className, String name, String desc)
|
private String fixMethodDesc(String className, String name, String desc)
|
||||||
{
|
{
|
||||||
if(className.startsWith(RefUtils.TYPE_PREFIX))
|
if (className.startsWith(RefUtils.TYPE_PREFIX))
|
||||||
{
|
{
|
||||||
className = className.substring(RefUtils.TYPE_PREFIX.length());
|
className = className.substring(RefUtils.TYPE_PREFIX.length());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,11 +32,6 @@ import org.objectweb.asm.MethodVisitor;
|
|||||||
import us.runelitepl.mixinprocessor.MixinProcessorMojo;
|
import us.runelitepl.mixinprocessor.MixinProcessorMojo;
|
||||||
import us.runelitepl.mixinprocessor.util.RefUtils;
|
import us.runelitepl.mixinprocessor.util.RefUtils;
|
||||||
|
|
||||||
import static org.objectweb.asm.Opcodes.ASM6;
|
|
||||||
import static org.objectweb.asm.Opcodes.GETSTATIC;
|
|
||||||
import static org.objectweb.asm.Opcodes.INVOKESTATIC;
|
|
||||||
import static org.objectweb.asm.Opcodes.PUTSTATIC;
|
|
||||||
|
|
||||||
public class AsmStaticUsageTransformer extends AsmBaseTransformer
|
public class AsmStaticUsageTransformer extends AsmBaseTransformer
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -89,7 +84,7 @@ public class AsmStaticUsageTransformer extends AsmBaseTransformer
|
|||||||
@Override
|
@Override
|
||||||
public void visitMethodInsn(int opcode, String owner, String name, String descriptor, boolean isInterface)
|
public void visitMethodInsn(int opcode, String owner, String name, String descriptor, boolean isInterface)
|
||||||
{
|
{
|
||||||
if(opcode == INVOKESTATIC && owner.endsWith(RefUtils.STATICS_STRING))
|
if (opcode == INVOKESTATIC && owner.endsWith(RefUtils.STATICS_STRING))
|
||||||
{
|
{
|
||||||
String originalOwner = owner.replace(TYPE_PREFIX, "");
|
String originalOwner = owner.replace(TYPE_PREFIX, "");
|
||||||
String temp = RefUtils.reobMethodName(RefUtils.STATICS_STRING, name, descriptor);
|
String temp = RefUtils.reobMethodName(RefUtils.STATICS_STRING, name, descriptor);
|
||||||
|
|||||||
@@ -47,10 +47,10 @@ public class DoNothingTransformer extends AsmBaseTransformer
|
|||||||
|
|
||||||
ClassReader cr = new ClassReader(bytecode);
|
ClassReader cr = new ClassReader(bytecode);
|
||||||
ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_FRAMES);
|
ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_FRAMES);
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
cr.accept(new ClassVisitor(ASM6, cw)
|
cr.accept(new ClassVisitor(ASM6, cw)
|
||||||
{}, 0);
|
{}, 0);
|
||||||
|
//CHECKSTYLE:ON
|
||||||
return cw.toByteArray();
|
return cw.toByteArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,22 +53,22 @@ public class ProvidedRemoverTransformer extends AsmBaseTransformer
|
|||||||
ClassNode node = new ClassNode();
|
ClassNode node = new ClassNode();
|
||||||
cr.accept(node, 0);
|
cr.accept(node, 0);
|
||||||
|
|
||||||
for(Object obj : node.methods)
|
for (Object obj : node.methods)
|
||||||
{
|
{
|
||||||
MethodNode method = (MethodNode) obj;
|
MethodNode method = (MethodNode) obj;
|
||||||
if(method == null)
|
if (method == null)
|
||||||
{
|
{
|
||||||
MixinProcessorMojo.log("ProvidedRemoverTransformer: Method null?");
|
MixinProcessorMojo.log("ProvidedRemoverTransformer: Method null?");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(method.visibleAnnotations == null)
|
if (method.visibleAnnotations == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for(Object obj2 : method.visibleAnnotations)
|
for (Object obj2 : method.visibleAnnotations)
|
||||||
{
|
{
|
||||||
AnnotationNode annot = (AnnotationNode) obj2;
|
AnnotationNode annot = (AnnotationNode) obj2;
|
||||||
if(annot.desc.equals(AnnotationRemoverTransformer.makeAnnotationDescriptor("Provided")))
|
if (annot.desc.equals(AnnotationRemoverTransformer.makeAnnotationDescriptor("Provided")))
|
||||||
{
|
{
|
||||||
validMethods.add(method.access + " " + method.desc + " " + method.name);
|
validMethods.add(method.access + " " + method.desc + " " + method.name);
|
||||||
}
|
}
|
||||||
@@ -88,7 +88,7 @@ public class ProvidedRemoverTransformer extends AsmBaseTransformer
|
|||||||
public MethodVisitor visitMethod(int access, String name, String desc, String signature,
|
public MethodVisitor visitMethod(int access, String name, String desc, String signature,
|
||||||
String[] exceptions)
|
String[] exceptions)
|
||||||
{
|
{
|
||||||
if(validMethods.contains(access + " " + desc + " " + name))
|
if (validMethods.contains(access + " " + desc + " " + name))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ public class RefUtils
|
|||||||
public static String reobMethodName(String owner, String deob, String signature)
|
public static String reobMethodName(String owner, String deob, String signature)
|
||||||
{
|
{
|
||||||
String prefix = "";
|
String prefix = "";
|
||||||
if(owner.startsWith(RefUtils.TYPE_PREFIX))
|
if (owner.startsWith(RefUtils.TYPE_PREFIX))
|
||||||
{
|
{
|
||||||
owner = owner.substring(RefUtils.TYPE_PREFIX.length());
|
owner = owner.substring(RefUtils.TYPE_PREFIX.length());
|
||||||
}
|
}
|
||||||
@@ -169,11 +169,7 @@ public class RefUtils
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == 1)
|
return i == 1;
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@@ -187,11 +183,7 @@ public class RefUtils
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == 1)
|
return i == 1;
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean shouldReobField(String owner, String deob, String desc)
|
public static boolean shouldReobField(String owner, String deob, String desc)
|
||||||
@@ -205,7 +197,7 @@ public class RefUtils
|
|||||||
|
|
||||||
public static boolean shouldReobMethod(String owner, String deob, String desc)
|
public static boolean shouldReobMethod(String owner, String deob, String desc)
|
||||||
{
|
{
|
||||||
if(owner.startsWith(RefUtils.TYPE_PREFIX))
|
if (owner.startsWith(RefUtils.TYPE_PREFIX))
|
||||||
{
|
{
|
||||||
owner = owner.substring(RefUtils.TYPE_PREFIX.length());
|
owner = owner.substring(RefUtils.TYPE_PREFIX.length());
|
||||||
}
|
}
|
||||||
@@ -275,7 +267,7 @@ public class RefUtils
|
|||||||
{
|
{
|
||||||
obbedName = className;
|
obbedName = className;
|
||||||
}
|
}
|
||||||
deobbed.append("L" + obbedName + ";");
|
deobbed.append("L").append(obbedName ).append(";");
|
||||||
strIndex += sigPart.length();
|
strIndex += sigPart.length();
|
||||||
}
|
}
|
||||||
catch (StringIndexOutOfBoundsException ex)
|
catch (StringIndexOutOfBoundsException ex)
|
||||||
|
|||||||
@@ -50,14 +50,17 @@ public class WebUtils
|
|||||||
return pageText;
|
return pageText;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] downloadFile(String urlText) throws IOException {
|
public static byte[] downloadFile(String urlText) throws IOException
|
||||||
|
{
|
||||||
URL url = new URL(urlText);
|
URL url = new URL(urlText);
|
||||||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||||
|
|
||||||
try (InputStream inputStream = url.openStream()) {
|
try (InputStream inputStream = url.openStream())
|
||||||
int n = 0;
|
{
|
||||||
|
int n;
|
||||||
byte [] buffer = new byte[ 1024 ];
|
byte [] buffer = new byte[ 1024 ];
|
||||||
while (-1 != (n = inputStream.read(buffer))) {
|
while (-1 != (n = inputStream.read(buffer)))
|
||||||
|
{
|
||||||
output.write(buffer, 0, n);
|
output.write(buffer, 0, n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user