Bug 3386 - JCK 1.4 - EXCP - checked exception in variable initializer of anonymous class (1GK7B5L)
Summary: JCK 1.4 - EXCP - checked exception in variable initializer of anonymous class...
Status: RESOLVED DUPLICATE of bug 7184
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: All Windows 2000
: P3 normal (vote)
Target Milestone: 2.0 M2   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-10 22:54 EDT by Olivier Thomann CLA
Modified: 2002-01-11 08:37 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2001-10-10 22:54:15 EDT
http://www.ott.oti.com/uvm/OTIIBM/numbat/Testing/JCK-
14/tests/lang/EXCP/excp013/excp01306/excp01306.html - POSITIVE TEST

	We failed to compile the following code:
----------
1. ERROR in excp01306.java (at line 13)
        int inst_var = ini( 1, "ini" );
                       ^^^^^^^^^^^^^^^
Exception java.lang.Exception thrown within an initializer must be handled 
locally
----------

	javac 1.4 compiles this code correctly.

NOTES:

OT (17/09/2001 10:48:39 AM)
	javac 1.3 fails as well.
excp01306.java:13: unreported exception java.lang.Exception; must be caught or 
declared to be thrown
                int inst_var = ini( 1, "ini" );
                               ^
1 error

OT (17/09/2001 6:15:57 PM)
	I found this on the Bug parage web page:
http://developer.java.sun.com/developer/bugParade/bugs/4030341.html

	See also http://java.sun.com/products/jdk/1.1/knownbugs/compiler.html.
4030341
          The inner classes white paper says that a checked exception may be 
raised in an instance initializer if all constructors declare a throw for it, 
and that the automatically
          generated constructor for an anonymous class automatically throws the 
correct exceptions, so that any exception can be raised in the body of an 
anonymous class. 
Comment 1 Philipe Mulet CLA 2002-01-07 12:30:36 EST

*** This bug has been marked as a duplicate of 7184 ***