diff --git a/test/MergeInject.java b/test/MergeInject.java index 4c244ea..bcd33e4 100644 --- a/test/MergeInject.java +++ b/test/MergeInject.java @@ -13,17 +13,17 @@ public class MergeInject extends MergeTest implements Runnable { public int number; // Dummy field - String s; + @Inject + private String s; + - /* @Inject MergeInject() { + Directives.callSuper(); s = "Hello"; number = 10; } - */ - @Inject(value = BEFORE, target = "stackTest()I") public int beforeStackTest() { @@ -33,12 +33,16 @@ public class MergeInject extends MergeTest implements Runnable { return 69420; } + this.number = ThreadLocalRandom.current().nextInt(); + + System.out.println(number); + Directives.callOriginal(); return 0; } - @Inject(value = AFTER, target = "stackTest()I", acceptOriginalReturn = true) + @Inject(value = AFTER, acceptOriginalReturn = true) public int stackTest(int arg) { Runnable r = () -> { System.out.println(arg / 15); @@ -49,7 +53,7 @@ public class MergeInject extends MergeTest implements Runnable { } - @Inject(value = AFTER, target = "test()Ljava/lang/String;", acceptOriginalReturn = true) + @Inject(value = AFTER, acceptOriginalReturn = true) public String test(String retVal){ System.out.println(retVal + "Cringe"); @@ -57,23 +61,6 @@ public class MergeInject extends MergeTest implements Runnable { return "Modified"; } - /* - @Inject(value = AFTER, target = "test()Ljava/lang/String;", acceptOriginalReturn = true) - public String test_inject$1(String retVal) { - System.out.println("Another injection: "+retVal); - return retVal; - } - */ - - - - - - - - - - @Override @Inject @@ -83,6 +70,4 @@ public class MergeInject extends MergeTest implements Runnable { System.out.println(test()+'\n'); } } - - public String test1(){ return null; } } diff --git a/test/MergeTest.java b/test/MergeTest.java index 27bb505..337a903 100644 --- a/test/MergeTest.java +++ b/test/MergeTest.java @@ -2,7 +2,7 @@ import dev.w1zzrd.asm.Combine; public class MergeTest { - String s; + private final String s; public MergeTest(){