mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-03 05:44:10 -08:00
Add methods to submit class file directly as byte array
This commit is contained in:
parent
c7d640a2af
commit
6d45f57a39
|
@ -44,6 +44,10 @@ public class DependencyAgent implements DependencyInfo, ServiceRepository {
|
||||||
return checker.generateClassName();
|
return checker.generateClassName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String submitClassFile(byte[] data) {
|
||||||
|
return checker.submitClassFile(data);
|
||||||
|
}
|
||||||
|
|
||||||
public void submitClass(ClassHolder cls) {
|
public void submitClass(ClassHolder cls) {
|
||||||
checker.submitClass(cls);
|
checker.submitClass(cls);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import org.teavm.callgraph.CallGraph;
|
import org.teavm.callgraph.CallGraph;
|
||||||
import org.teavm.callgraph.DefaultCallGraph;
|
import org.teavm.callgraph.DefaultCallGraph;
|
||||||
import org.teavm.callgraph.DefaultCallGraphNode;
|
import org.teavm.callgraph.DefaultCallGraphNode;
|
||||||
|
@ -52,6 +53,7 @@ import org.teavm.model.ValueType;
|
||||||
import org.teavm.model.util.ModelUtils;
|
import org.teavm.model.util.ModelUtils;
|
||||||
import org.teavm.model.util.ProgramUtils;
|
import org.teavm.model.util.ProgramUtils;
|
||||||
import org.teavm.optimization.UnreachableBasicBlockEliminator;
|
import org.teavm.optimization.UnreachableBasicBlockEliminator;
|
||||||
|
import org.teavm.parsing.Parser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -157,6 +159,14 @@ public class DependencyChecker implements DependencyInfo {
|
||||||
return "$$teavm_generated_class$$" + classNameSuffix++;
|
return "$$teavm_generated_class$$" + classNameSuffix++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String submitClassFile(byte[] data) {
|
||||||
|
ClassNode node = new ClassNode();
|
||||||
|
org.objectweb.asm.ClassReader reader = new org.objectweb.asm.ClassReader(data);
|
||||||
|
reader.accept(node, 0);
|
||||||
|
submitClass(Parser.parseClass(node));
|
||||||
|
return node.name;
|
||||||
|
}
|
||||||
|
|
||||||
public void submitClass(ClassHolder cls) {
|
public void submitClass(ClassHolder cls) {
|
||||||
if (completing) {
|
if (completing) {
|
||||||
throw new IllegalStateException("Can't submit class during completion phase");
|
throw new IllegalStateException("Can't submit class during completion phase");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user