To Strings...

This commit is contained in:
zaxar163 2018-12-03 17:54:22 +03:00
parent d18978cffb
commit 32082e4e36
No known key found for this signature in database
GPG key ID: E3B309DD3852DE06
4 changed files with 9 additions and 8 deletions

View file

@ -162,7 +162,7 @@ public void build() throws IOException {
String filename = e.getName(); String filename = e.getName();
output.putNextEntry(IOHelper.newZipEntry(e.getName())); output.putNextEntry(IOHelper.newZipEntry(e.getName()));
if (filename.endsWith(".class")) { if (filename.endsWith(".class")) {
CharSequence classname = filename.replace('/', '.').subSequence(0, String classname = filename.replace('/', '.').substring(0,
filename.length() - ".class".length()); filename.length() - ".class".length());
byte[] bytes; byte[] bytes;
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream(2048)) { try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream(2048)) {
@ -231,7 +231,7 @@ private void stdBuild() throws IOException {
continue; continue;
} }
if (filename.endsWith(".class")) { if (filename.endsWith(".class")) {
CharSequence classname = filename.replace('/', '.').subSequence(0, String classname = filename.replace('/', '.').substring(0,
filename.length() - ".class".length()); filename.length() - ".class".length());
byte[] bytes; byte[] bytes;
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream(2048)) { try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream(2048)) {

View file

@ -25,7 +25,7 @@ public static interface BuildHook {
@FunctionalInterface @FunctionalInterface
public static interface Transformer { public static interface Transformer {
byte[] transform(byte[] input, CharSequence classname, JARLauncherBinary data); byte[] transform(byte[] input, String classname, JARLauncherBinary data);
} }
private boolean BUILDRUNTIME; private boolean BUILDRUNTIME;
@ -95,13 +95,13 @@ public boolean buildRuntime() {
return BUILDRUNTIME; return BUILDRUNTIME;
} }
public byte[] classTransform(byte[] clazz, CharSequence classname, JARLauncherBinary reader) { public byte[] classTransform(byte[] clazz, String classname, JARLauncherBinary reader) {
byte[] result = clazz; byte[] result = clazz;
for (Transformer transformer : CLASS_TRANSFORMER) result = transformer.transform(result, classname, reader); for (Transformer transformer : CLASS_TRANSFORMER) result = transformer.transform(result, classname, reader);
return result; return result;
} }
public byte[] proGuardClassTransform(byte[] clazz, CharSequence classname, JARLauncherBinary reader) { public byte[] proGuardClassTransform(byte[] clazz, String classname, JARLauncherBinary reader) {
byte[] result = clazz; byte[] result = clazz;
for (Transformer transformer : POST_PROGUARD_HOOKS) result = transformer.transform(result, classname, reader); for (Transformer transformer : POST_PROGUARD_HOOKS) result = transformer.transform(result, classname, reader);
return result; return result;

View file

@ -14,7 +14,7 @@
public class NodeTransformer implements Transformer { public class NodeTransformer implements Transformer {
@FunctionalInterface @FunctionalInterface
public static interface ClassNodeTransformer { public static interface ClassNodeTransformer {
void transform(ClassNode node, CharSequence classname, JARLauncherBinary data); void transform(ClassNode node, String classname, JARLauncherBinary data);
} }
private final List<ClassNodeTransformer> transLst; private final List<ClassNodeTransformer> transLst;
@ -28,7 +28,7 @@ public NodeTransformer() {
} }
@Override @Override
public byte[] transform(byte[] input, CharSequence classname, JARLauncherBinary data) { public byte[] transform(byte[] input, String classname, JARLauncherBinary data) {
ClassReader cr = new ClassReader(input); ClassReader cr = new ClassReader(input);
ClassNode cn = new ClassNode(); ClassNode cn = new ClassNode();
cr.accept(cn, ClassReader.EXPAND_FRAMES); cr.accept(cn, ClassReader.EXPAND_FRAMES);

View file

@ -55,8 +55,9 @@ public static void makeJsonRequest(RequestInterface request, Runnable callback)
{ {
} }
@LauncherAPI @LauncherAPI
public static void startTask(Task task) public static void startTask(@SuppressWarnings("rawtypes") Task task)
{ {
try { try {
worker.queue.put(task); worker.queue.put(task);