diff --git a/Beethoven.iml b/Beethoven.iml index c90834f..e5d2daf 100644 --- a/Beethoven.iml +++ b/Beethoven.iml @@ -4,6 +4,7 @@ + diff --git a/test/MergeInject.java b/test/MergeInject.java new file mode 100644 index 0000000..7b19a6c --- /dev/null +++ b/test/MergeInject.java @@ -0,0 +1,20 @@ +import dev.w1zzrd.asm.InjectClass; +import dev.w1zzrd.asm.Inject; +import dev.w1zzrd.asm.Merger; + +@InjectClass(value = MergeTest.class) +public class MergeInject implements Runnable { + + @Inject + public String test(){ + System.out.println(Merger.field("s")); + return "Modified"; + } + + @Override + @Inject + public void run() { + for (int i = 0; i < 5; ++i) + System.out.println(test()); + } +} diff --git a/test/MergeTest.java b/test/MergeTest.java new file mode 100644 index 0000000..9d3055e --- /dev/null +++ b/test/MergeTest.java @@ -0,0 +1,21 @@ +public class MergeTest { + + private String s = "Hello"; + + + public MergeTest(){ + + } + + public MergeTest(String s) { + this.s = s; + } + + public String test(){ + return s; + } + + public String test1(){ + return s; + } +} diff --git a/test/Test.java b/test/Test.java new file mode 100644 index 0000000..6f1a0a4 --- /dev/null +++ b/test/Test.java @@ -0,0 +1,14 @@ +import dev.w1zzrd.asm.Merger; + +import java.io.IOException; + +public class Test { + public static void main(String... args) throws IOException { + Merger m = new Merger("MergeTest"); + m.inject(Merger.getClassNode("MergeInject")); + m.compile(); + + Runnable r = (Runnable)new MergeTest("Constructor message"); + r.run(); + } +}