mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-10 08:54:11 -08:00
Fix nullness detection on exception variable
This commit is contained in:
parent
6ef08ae709
commit
a94686ddf6
|
@ -203,7 +203,7 @@ class NullnessInformationBuilder {
|
||||||
currentState = new State();
|
currentState = new State();
|
||||||
|
|
||||||
if (block.getExceptionVariable() != null) {
|
if (block.getExceptionVariable() != null) {
|
||||||
notNullVariables.set(block.getIndex());
|
notNullVariables.set(block.getExceptionVariable().getIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
currentBlock = block;
|
currentBlock = block;
|
||||||
|
|
|
@ -80,6 +80,11 @@ public class NullnessAnalysisTest {
|
||||||
test();
|
test();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void exception() {
|
||||||
|
test();
|
||||||
|
}
|
||||||
|
|
||||||
private void test() {
|
private void test() {
|
||||||
String baseName = "model/analysis/nullness/" + name.getMethodName();
|
String baseName = "model/analysis/nullness/" + name.getMethodName();
|
||||||
String originalResourceName = baseName + ".original.txt";
|
String originalResourceName = baseName + ".original.txt";
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
var @this as this
|
||||||
|
$start
|
||||||
|
@str := invokeStatic `Foo.getData()Ljava/lang/String;`
|
||||||
|
@n := invokeStatic `java.lang.Integer.parseInt(Ljava/lang/String;)I` @str
|
||||||
|
return @n
|
||||||
|
catch java.lang.RuntimeException goto $handle
|
||||||
|
$handle
|
||||||
|
@e := exception
|
||||||
|
@m := invoke `java.lang.Throwable.getMessage()Ljava/lang/String;` @e
|
||||||
|
@z := invoke `java.lang.String.length()I` @m
|
||||||
|
@m_1 := nullCheck @m
|
||||||
|
return @z
|
|
@ -0,0 +1,11 @@
|
||||||
|
var @this as this
|
||||||
|
$start
|
||||||
|
@str := invokeStatic `Foo.getData()Ljava/lang/String;`
|
||||||
|
@n := invokeStatic `java.lang.Integer.parseInt(Ljava/lang/String;)I` @str
|
||||||
|
return @n
|
||||||
|
catch java.lang.RuntimeException goto $handle
|
||||||
|
$handle
|
||||||
|
@e := exception
|
||||||
|
@m := invoke `java.lang.Throwable.getMessage()Ljava/lang/String;` @e
|
||||||
|
@z := invoke `java.lang.String.length()I` @m
|
||||||
|
return @z
|
Loading…
Reference in New Issue
Block a user