Fix #296
Some checks failed
Build and Test with Maven / Build-and-test-with-Maven (push) Failing after 3m29s

This commit is contained in:
Daniel Holle 2024-03-18 10:14:40 +01:00
parent a1b5c0541b
commit 01e374eadd
3 changed files with 20 additions and 1 deletions

View File

@ -0,0 +1,11 @@
import java.lang.Integer;
public class Bug296 {
public static m1() {
return m2();
}
static m2() {
return 10;
}
}

View File

@ -1008,7 +1008,8 @@ public class Codegen {
break;
}
case TargetMethodCall call: {
generate(state, call.expr());
if (!call.isStatic())
generate(state, call.expr());
for (var i = 0; i < call.args().size(); i++) {
var e = call.args().get(i);
var arg = call.parameterTypes().get(i);

View File

@ -940,4 +940,11 @@ public class TestComplete {
var clazz = classFiles.get("Bug293");
var instance = clazz.getDeclaredConstructor().newInstance();
}
@Test
public void testBug296() throws Exception {
var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Bug296.jav");
var clazz = classFiles.get("Bug296");
clazz.getDeclaredMethod("m1").invoke(null);
}
}