Update test files

This commit is contained in:
Gabriel Tofvesson 2021-01-28 18:21:46 +01:00
parent 1a7383278d
commit 8d9575cc57
2 changed files with 11 additions and 26 deletions

View File

@ -13,17 +13,17 @@ public class MergeInject extends MergeTest implements Runnable {
public int number; public int number;
// Dummy field // Dummy field
String s; @Inject
private String s;
/*
@Inject @Inject
MergeInject() { MergeInject() {
Directives.callSuper();
s = "Hello"; s = "Hello";
number = 10; number = 10;
} }
*/
@Inject(value = BEFORE, target = "stackTest()I") @Inject(value = BEFORE, target = "stackTest()I")
public int beforeStackTest() { public int beforeStackTest() {
@ -33,12 +33,16 @@ public class MergeInject extends MergeTest implements Runnable {
return 69420; return 69420;
} }
this.number = ThreadLocalRandom.current().nextInt();
System.out.println(number);
Directives.callOriginal(); Directives.callOriginal();
return 0; return 0;
} }
@Inject(value = AFTER, target = "stackTest()I", acceptOriginalReturn = true) @Inject(value = AFTER, acceptOriginalReturn = true)
public int stackTest(int arg) { public int stackTest(int arg) {
Runnable r = () -> { Runnable r = () -> {
System.out.println(arg / 15); 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){ public String test(String retVal){
System.out.println(retVal + "Cringe"); System.out.println(retVal + "Cringe");
@ -57,23 +61,6 @@ public class MergeInject extends MergeTest implements Runnable {
return "Modified"; 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 @Override
@Inject @Inject
@ -83,6 +70,4 @@ public class MergeInject extends MergeTest implements Runnable {
System.out.println(test()+'\n'); System.out.println(test()+'\n');
} }
} }
public String test1(){ return null; }
} }

View File

@ -2,7 +2,7 @@ import dev.w1zzrd.asm.Combine;
public class MergeTest { public class MergeTest {
String s; private final String s;
public MergeTest(){ public MergeTest(){