Community
Participate
Working Groups
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.
*** This bug has been marked as a duplicate of 7184 ***