-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
5.0
-
Fix Understood
-
generic
-
generic
Name: bkR10012 Date: 06/01/2004
The description of java.lang.Class.newInstance() says:
"Throws:
...
InstantiationException - if this Class represents an abstract class,
an interface, an array class, a primitive type, or void; or if the
class has no nullary constructor; or if the instantiation fails for
some other reason."
This sentence may be interpreted in different ways:
1. All uncatched exceptions in <init> method should be wrapped/translated
into InstantiationException.
2. newInstance() throws InstantiationException only if instantiation
fails BEFORE <init> method execution. All unchecked exceptions that get
thrown by the <init> method will get passed back to the caller of
Class.newInstance().
The specification should be clarified. The sentence "or if the instantiation
fails for some other reason" should be removed or reworded.
Note, now the RI does not translate <init> exceptions into an
InstantiationException.
======================================================================
The description of java.lang.Class.newInstance() says:
"Throws:
...
InstantiationException - if this Class represents an abstract class,
an interface, an array class, a primitive type, or void; or if the
class has no nullary constructor; or if the instantiation fails for
some other reason."
This sentence may be interpreted in different ways:
1. All uncatched exceptions in <init> method should be wrapped/translated
into InstantiationException.
2. newInstance() throws InstantiationException only if instantiation
fails BEFORE <init> method execution. All unchecked exceptions that get
thrown by the <init> method will get passed back to the caller of
Class.newInstance().
The specification should be clarified. The sentence "or if the instantiation
fails for some other reason" should be removed or reworded.
Note, now the RI does not translate <init> exceptions into an
InstantiationException.
======================================================================