Name: dkC59003 Date: 05/25/99
JNI specification says that NewObject[A,V] can throw InstantiationException
if class argument is an interface. But this situation is impossible
because an interface can't have <init> method that required to be passed
as 3rd argument to NewObject[A,V]
The section "JNI Functions" of JNI spec says about function NewObjectV:
-----spec-----
"jobject NewObjectV(JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
Constructs a new Java object. The method ID indicates which constructor method
to invoke. This ID must be obtained by calling GetMethodID() with <init> as the
method name and void (V) as the return type.
Programmers place all arguments that are to be passed to the constructor in an
args argument of type va_list that immediately follows the methodID argument.
NewObjectV() accepts these arguments, and, in turn, passes them to the Java
method that the programmer wishes to invoke.
PARAMETERS:
env: the JNI interface pointer.
clazz: a Java class object.
methodID: the method ID of the constructor.
args: a va_list of arguments to the constructor.
RETURNS:
Returns a Java object, or NULL if the object cannot be constructed.
THROWS:
InstantiationException: if the class is an interface or an abstract class."
-----spec-----
But valid interface class file cannot contain a constructor. And therefore
a method ID of method <init> cannot be obtained for interface, valid
parameters cannot be passed to function NewObjectV and InstantiationException
cannot be thrown as effect of an attempt to constructe a interface object.
So JNI specification describes an impossible situation.
Same reasons are applicable for functions NewObject, NewObjectA.
======================================================================