[Bug java/33023] New: throw null
mark at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Aug 8 10:31:00 GMT 2007
gcj (GCC) 4.1.2 20070626 (Red Hat 4.1.2-13)
public class n
{
public static void main(String[] args)
{
throw null;
}
}
$ gcj -C n.java
n.java: In class 'n':
n.java: In method 'n.main(java.lang.String[])':
n.java:5: error: Checked exception Ânull isn't thrown from a Âtry block.
throw null;
^
1 error
This is allowed according to JLS 14.18 "throw Expression ; [...] f evaluation
of the Expression completes normally, producing a null value, then an instance
V' of class NullPointerException is created and thrown instead of null."
This is with the old source frontend, with the new frontend based on ecj, this
does compile correctly.
--
Summary: throw null
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mark at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33023
More information about the Java-prs
mailing list