Skip to content

Commit 379e415

Browse files
committed
Add regression test for NullPointerException
The new test is similar to NullPointerException2. It checks that a NullPointerException is correctly caught if the catch block specifies one of its superclasses.
1 parent 41d77f4 commit 379e415

File tree

8 files changed

+32
-0
lines changed

8 files changed

+32
-0
lines changed
195 Bytes
Binary file not shown.
Binary file not shown.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class A {
2+
int i;
3+
}
4+
5+
public class Test {
6+
public static void main(String args[]) {
7+
A a=null;
8+
try {
9+
a.i=0;
10+
}
11+
catch (Exception exc) {
12+
assert false;
13+
}
14+
}
15+
}
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package java.lang;
2+
3+
public class NullPointerException extends RuntimeException {
4+
}
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package java.lang;
2+
3+
public class RuntimeException extends Exception {
4+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
Test.class
3+
--java-throw-runtime-exceptions
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^.*assertion at file Test.java line 12 function.*: FAILURE$
7+
^VERIFICATION FAILED$
8+
--
9+
^warning: ignoring

0 commit comments

Comments
 (0)