diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..356f474 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/out.class b/out.class new file mode 100644 index 0000000..ba6065b Binary files /dev/null and b/out.class differ diff --git a/test/MergeInject.java b/test/MergeInject.java index c38515c..ab9a3fb 100644 --- a/test/MergeInject.java +++ b/test/MergeInject.java @@ -1,5 +1,6 @@ import dev.w1zzrd.asm.InjectClass; import dev.w1zzrd.asm.Inject; + import static dev.w1zzrd.asm.InPlaceInjection.*; @InjectClass(value = MergeTest.class) @@ -27,12 +28,15 @@ public class MergeInject extends MergeTest implements Runnable { public String test(String retVal){ System.out.println("Got retval: "+retVal); - if (retVal.equals("Test")) { - System.out.println("Test"); + if (retVal.endsWith("e!!Test")) { + System.out.println("Special case!"); + return "Not Modified?"; } retVal = "ASDF"; + System.out.println("Eyyyy"); + String a = "retVal"; System.out.println(a); @@ -63,6 +67,10 @@ public class MergeInject extends MergeTest implements Runnable { + + + + @Override @Inject public void run() { diff --git a/test/Test.java b/test/Test.java index 9c4456e..13ccc6c 100644 --- a/test/Test.java +++ b/test/Test.java @@ -1,11 +1,23 @@ import dev.w1zzrd.asm.Merger; +import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; public class Test { public static void main(String... args) throws IOException { Merger m = new Merger("MergeTest"); m.inject("MergeInject"); + + // Save injected data + File f = new File("out.class"); + if(f.isFile() && f.delete() && f.createNewFile()) { + FileOutputStream fos = new FileOutputStream(f); + fos.write(m.toByteArray()); + fos.close(); + } + + // Compile and run m.compile(); Runnable r = (Runnable)new MergeTest("Constructor message");