Fix #310
All checks were successful
Build and Test with Maven / Build-and-test-with-Maven (push) Successful in 2m49s
All checks were successful
Build and Test with Maven / Build-and-test-with-Maven (push) Successful in 2m49s
This commit is contained in:
parent
e59accf7ee
commit
46a7f61234
9
resources/bytecode/javFiles/Bug310.jav
Normal file
9
resources/bytecode/javFiles/Bug310.jav
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import java.lang.Integer;
|
||||||
|
import java.lang.String;
|
||||||
|
|
||||||
|
public class Bug310 {
|
||||||
|
Integer i = 3;
|
||||||
|
public toString() {
|
||||||
|
return i.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -1029,8 +1029,10 @@ public class Codegen {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TargetMethodCall call: {
|
case TargetMethodCall call: {
|
||||||
if (!call.isStatic())
|
if (!call.isStatic()) {
|
||||||
generate(state, call.expr());
|
generate(state, call.expr());
|
||||||
|
boxPrimitive(state, call.expr().type());
|
||||||
|
}
|
||||||
for (var i = 0; i < call.args().size(); i++) {
|
for (var i = 0; i < call.args().size(); i++) {
|
||||||
var e = call.args().get(i);
|
var e = call.args().get(i);
|
||||||
var arg = call.parameterTypes().get(i);
|
var arg = call.parameterTypes().get(i);
|
||||||
|
@ -1031,4 +1031,12 @@ public class TestComplete {
|
|||||||
var instance = clazz.getDeclaredConstructor().newInstance();
|
var instance = clazz.getDeclaredConstructor().newInstance();
|
||||||
clazz.getDeclaredMethod("main").invoke(instance);
|
clazz.getDeclaredMethod("main").invoke(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBug310() throws Exception {
|
||||||
|
var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Bug310.jav");
|
||||||
|
var clazz = classFiles.get("Bug310");
|
||||||
|
var instance = clazz.getDeclaredConstructor().newInstance();
|
||||||
|
assertEquals(clazz.getDeclaredMethod("toString").invoke(instance), "3");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user