Class Instrumenter
- java.lang.Object
-
- com.offbynull.coroutines.instrumenter.Instrumenter
-
public final class Instrumenter extends java.lang.ObjectInstruments methods in Java classes that are intended to be run as coroutines. Tested with Java 1.4 and Java 8, so hopefully thing should work with all versions of Java inbetween.
-
-
Field Summary
Fields Modifier and Type Field Description private ClassInformationRepositoryclassRepo
-
Constructor Summary
Constructors Constructor Description Instrumenter(ClassInformationRepository repo)Constructs aInstrumenterobject.Instrumenter(java.util.List<java.io.File> classpath)Constructs aInstrumenterobject from a filesystem classpath (folders and JARs).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InstrumentationResultinstrument(byte[] input, InstrumentationSettings settings)Instruments a class.private org.objectweb.asm.tree.ClassNodereconstructStackMapFrames(org.objectweb.asm.tree.ClassNode classNode)private voidverifyClassIntegrity(org.objectweb.asm.tree.ClassNode classNode)
-
-
-
Field Detail
-
classRepo
private ClassInformationRepository classRepo
-
-
Constructor Detail
-
Instrumenter
public Instrumenter(java.util.List<java.io.File> classpath) throws java.io.IOExceptionConstructs aInstrumenterobject from a filesystem classpath (folders and JARs).- Parameters:
classpath- classpath JARs and folders to use for instrumentation (this is needed by ASM to generate stack map frames).- Throws:
java.io.IOException- if classes in the classpath could not be loaded upjava.lang.NullPointerException- if any argument isnullor containsnull
-
Instrumenter
public Instrumenter(ClassInformationRepository repo)
Constructs aInstrumenterobject.- Parameters:
repo- class information repository (this is needed by ASM to generate stack map frames).- Throws:
java.lang.NullPointerException- if any argument isnull
-
-
Method Detail
-
instrument
public InstrumentationResult instrument(byte[] input, InstrumentationSettings settings)
Instruments a class.- Parameters:
input- class file contentssettings- instrumentation settings- Returns:
- instrumentation results
- Throws:
java.lang.IllegalArgumentException- if the class could not be instrumented for some reasonjava.lang.NullPointerException- if any argument isnull
-
verifyClassIntegrity
private void verifyClassIntegrity(org.objectweb.asm.tree.ClassNode classNode)
-
reconstructStackMapFrames
private org.objectweb.asm.tree.ClassNode reconstructStackMapFrames(org.objectweb.asm.tree.ClassNode classNode)
-
-