public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/33023]  New: throw null
@ 2007-08-08 10:31 mark at gcc dot gnu dot org
  2007-08-09 18:07 ` [Bug java/33023] " tromey at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: mark at gcc dot gnu dot org @ 2007-08-08 10:31 UTC (permalink / raw)
  To: java-prs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1012 bytes --]

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug java/33023] throw null
  2007-08-08 10:31 [Bug java/33023] New: throw null mark at gcc dot gnu dot org
@ 2007-08-09 18:07 ` tromey at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: tromey at gcc dot gnu dot org @ 2007-08-09 18:07 UTC (permalink / raw)
  To: java-prs



------- Comment #1 from tromey at gcc dot gnu dot org  2007-08-09 18:07 -------
Yup, it's a bug.
We aren't really fixing bugs in the old front end though.
I'm closing it because this is a weird case and has a couple
simple workarounds.


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WONTFIX
   Target Milestone|---                         |4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33023


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-08-09 18:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-08 10:31 [Bug java/33023] New: throw null mark at gcc dot gnu dot org
2007-08-09 18:07 ` [Bug java/33023] " tromey at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).