Fixed gradle complaining about absolutely nothing

This commit is contained in:
Anuken
2019-12-10 10:45:07 -05:00
parent b74696b312
commit f4ee67c08b

View File

@@ -12,7 +12,6 @@ import com.android.dx.merge.*;
import dalvik.system.*; import dalvik.system.*;
import io.anuke.arc.*; import io.anuke.arc.*;
import io.anuke.arc.backends.android.surfaceview.*; import io.anuke.arc.backends.android.surfaceview.*;
import io.anuke.mindustry.AndroidRhinoContext.BaseAndroidClassLoader.*;
import org.mozilla.javascript.*; import org.mozilla.javascript.*;
import java.io.*; import java.io.*;
@@ -149,77 +148,78 @@ public class AndroidRhinoContext{
} }
return loadedClass; return loadedClass;
} }
}
/** Might be thrown in any Rhino method that loads bytecode if the loading failed. */
public static class FatalLoadingException extends RuntimeException{ /** Might be thrown in any Rhino method that loads bytecode if the loading failed. */
FatalLoadingException(Throwable t){ public static class FatalLoadingException extends RuntimeException{
super("Failed to define class", t); FatalLoadingException(Throwable t){
} super("Failed to define class", t);
}
}
static class FileAndroidClassLoader extends BaseAndroidClassLoader{
private static int instanceCounter = 0;
private final File dexFile;
public FileAndroidClassLoader(ClassLoader parent, File cacheDir){
super(parent);
int id = instanceCounter++;
dexFile = new File(cacheDir, id + ".dex");
cacheDir.mkdirs();
reset();
} }
static class FileAndroidClassLoader extends BaseAndroidClassLoader{ @Override
private static int instanceCounter = 0; protected Class<?> loadClass(Dex dex, String name) throws ClassNotFoundException{
private final File dexFile; try{
dex.writeTo(dexFile);
public FileAndroidClassLoader(ClassLoader parent, File cacheDir){ }catch(IOException e){
super(parent); e.printStackTrace();
int id = instanceCounter++;
dexFile = new File(cacheDir, id + ".dex");
cacheDir.mkdirs();
reset();
} }
return new DexClassLoader(dexFile.getPath(), ((AndroidApplication)Core.app).getContext().getCacheDir().getAbsolutePath(), null, getParent()).loadClass(name);
}
@Override @Override
protected Class<?> loadClass(Dex dex, String name) throws ClassNotFoundException{ protected Dex getLastDex(){
if(dexFile.exists()){
try{ try{
dex.writeTo(dexFile); return new Dex(dexFile);
}catch(IOException e){ }catch(IOException e){
e.printStackTrace(); e.printStackTrace();
} }
return new DexClassLoader(dexFile.getPath(), ((AndroidApplication)Core.app).getContext().getCacheDir().getAbsolutePath(), null, getParent()).loadClass(name);
}
@Override
protected Dex getLastDex(){
if(dexFile.exists()){
try{
return new Dex(dexFile);
}catch(IOException e){
e.printStackTrace();
}
}
return null;
}
@Override
protected void reset(){
dexFile.delete();
} }
return null;
} }
@TargetApi(Build.VERSION_CODES.O) @Override
static class InMemoryAndroidClassLoader extends BaseAndroidClassLoader{ protected void reset(){
private Dex last; dexFile.delete();
}
}
public InMemoryAndroidClassLoader(ClassLoader parent){ @TargetApi(Build.VERSION_CODES.O)
super(parent); static class InMemoryAndroidClassLoader extends BaseAndroidClassLoader{
} private Dex last;
@Override public InMemoryAndroidClassLoader(ClassLoader parent){
protected Class<?> loadClass(Dex dex, String name) throws ClassNotFoundException{ super(parent);
last = dex; }
return new InMemoryDexClassLoader(ByteBuffer.wrap(dex.getBytes()), getParent()).loadClass(name);
}
@Override @Override
protected Dex getLastDex(){ protected Class<?> loadClass(Dex dex, String name) throws ClassNotFoundException{
return last; last = dex;
} return new InMemoryDexClassLoader(ByteBuffer.wrap(dex.getBytes()), getParent()).loadClass(name);
}
@Override @Override
protected void reset(){ protected Dex getLastDex(){
last = null; return last;
} }
@Override
protected void reset(){
last = null;
} }
} }
} }