Fix #312
All checks were successful
Build and Test with Maven / Build-and-test-with-Maven (push) Successful in 2m45s
All checks were successful
Build and Test with Maven / Build-and-test-with-Maven (push) Successful in 2m45s
This commit is contained in:
parent
46a7f61234
commit
da74898f9d
8
resources/bytecode/javFiles/Bug312.jav
Normal file
8
resources/bytecode/javFiles/Bug312.jav
Normal file
@ -0,0 +1,8 @@
|
||||
public class Bug312 {
|
||||
Bug312A i = new Bug312A();
|
||||
public main() {
|
||||
if (i == null) {}
|
||||
}
|
||||
}
|
||||
|
||||
class Bug312A {}
|
@ -281,9 +281,12 @@ public class Codegen {
|
||||
return TargetType.Float;
|
||||
} else if (left.equals(TargetType.Long) || right.equals(TargetType.Long)) {
|
||||
return TargetType.Long;
|
||||
} else {
|
||||
} else if (left.equals(TargetType.Integer) || right.equals(TargetType.Integer)) {
|
||||
return TargetType.Integer;
|
||||
} else if (left.equals(TargetType.Short) || right.equals(TargetType.Short)) {
|
||||
return TargetType.Short;
|
||||
}
|
||||
return left;
|
||||
}
|
||||
|
||||
private void generateBinaryOp(State state, TargetBinaryOp op) {
|
||||
|
@ -1039,4 +1039,12 @@ public class TestComplete {
|
||||
var instance = clazz.getDeclaredConstructor().newInstance();
|
||||
assertEquals(clazz.getDeclaredMethod("toString").invoke(instance), "3");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBug312() throws Exception {
|
||||
var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Bug312.jav");
|
||||
var clazz = classFiles.get("Bug312");
|
||||
var instance = clazz.getDeclaredConstructor().newInstance();
|
||||
clazz.getDeclaredMethod("main").invoke(instance);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user