[concurrency-interest] Thread interruption protocol: InterruptedException is a "checked" exception, correct?

Péter Kovács peter.kovacs.1.0rc at gmail.com
Wed May 20 12:05:42 EDT 2009


Oh, I see Constructor.newInstance() as opposed to Class.newInstance().
But this probably irrelevant here as the stack trace fragment I
produced in my previous mail appears to show that the exception is
from Class.forName(String). Also, we call Constructor.newInstance()
instead of Class.newInstance():

	    Class<?> cl = Class.forName(name);
	    Constructor constr = cl.getConstructor(argcl);
	    return constr.newInstance(args);

I was just trying to apply Tom's input about passing exception
checking to the case we appear to have.

Thanks for making me aware of the difference anyway.

Peter


2009/5/20 Paulo Levi <i30817 at gmail.com>:
> You're not reading the javadoc correctly:
> newInstance()
> "Note that this method propagates any exception thrown by the nullary
> constructor, including a checked exception. Use of this method effectively
> bypasses the compile-time exception checking that would otherwise be
> performed by the compiler. The Constructor.newInstance method avoids this
> problem by wrapping any exception thrown by the constructor in a (checked)
> InvocationTargetException."
>


More information about the Concurrency-interest mailing list