java.lang.Class.
Two parallel sets of definitions are used here, one for internal implementation purposes, the other for JNI the interface. The first uses internal data types (via #ifdef JLCLASS_LOCAL_DEFINED) where the second does not. Instead, it uses <jni.h> data
types. Those types must match up for JNI to work, yet by keeping them absolutely separate, application JNI code does not have any dependencies on the core code of this JVM implementation.
Even though there is only apparently one set of definitions, the #ifdef statement
controls which set is used.
This file must be included by JNI code along with the java.lang.Class JNI
header file. The following example shows how to call one of the local native methods of this class from the JNI environment. Notice that although this is not necessary due to the local implementation shortcut defined in native.c, it is not only possible, but sometimes quite desirable to do so.
#include <jni.h> #include <solaris/jni_md.h> ... or appropriate platform-specifics #include "java_lang_Class.h" ... JNI definitions #include "jlClass.h" ... this file JNIEXPORT jboolean JNICALL Java_java_lang_Class_isArray(JNIEnv *env, jobject thisobj) { jboolean b; b = jlClass_isArray(thisobj); ... call native implementation return(b); }
Although jvalue is indeed a part of both this implementation and the standard JNI interface through <jni.h>
, it is not recommended to use it if at all possible. Due to the fact that both definitions involve unions, along with the slightly differing contents between the two versions, it is almost certain that there will be compilation compatibility problems in the memory layouts from one platform to another, and possibly between the layouts between them on any given platform. Since jvalue is not specificaly a Java type, but instead a JNI construction, this may not be a problem, but this advisory is raised anyway in order to encourage reliable implementation of JNI.
Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
Licensed under the Apache License, Version 2.0 ("the License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
Definition in file jlClass.h.
#include "jlObject.h"
Go to the source code of this file.
Connection to local native method tables. | |
These manifest constant code fragments are designed to be inserted directly into locations in native.c without any other modification to that file except a single entry to actually invoke the method. | |
#define | NATIVE_TABLE_JLCLASS |
Complete list of local native method ordinals for java.lang.Class. | |
#define | NATIVE_TABLE_JLCLASS_JDOUBLE |
No (jdouble ) methods. | |
#define | NATIVE_TABLE_JLCLASS_JFLOAT |
No (jfloat ) methods. | |
#define | NATIVE_TABLE_JLCLASS_JINT |
(jint ) local native method ordinal table for java.lang.Class | |
#define | NATIVE_TABLE_JLCLASS_JLONG |
No (jlong ) methods. | |
#define | NATIVE_TABLE_JLCLASS_JOBJECT |
No (jobject ) methods. | |
#define | NATIVE_TABLE_JLCLASS_JVOID |
No (jvoid ) methods. | |
#define | NATIVE_TABLE_JLCLASS_ORDINALS |
Table of local native methods and their descriptors for java.lang.Class. | |
Unified set of prototypes for functions | |
JNI table index and external reference to each function that locally implements a JNI native method. in jlClass.c
The JVM native interface ordinal definition base for this class is 20. An enumeration is used so the compiler can help the use to not choose duplicate values. | |
enum | jlClass_nmo_enum { JLCLASS_NMO_ISARRAY = 20, JLCLASS_NMO_ISPRIMATIVE = 21 } |
jboolean | jlClass_isArray (jvm_object_hash objhash) |
JNI hook to isArray(). | |
jboolean | jlClass_isPrimative (jvm_object_hash objhash) |
JNI hook to isPrimative(). |
|
Value: case JLCLASS_NMO_ISARRAY: \ case JLCLASS_NMO_ISPRIMATIVE: java.lang.Class.
Definition at line 176 of file jlClass.h. Referenced by native_verify_ordinal_definition(). |
|
Value: { \ { JLCLASS_NMO_ISARRAY, "isArray", "()V" }, \ { JLCLASS_NMO_ISPRIMATIVE, "isPrimative", "()V" }, \ \ /* Add other method entries here */ \ \ \ /* End of table marker */ \ { JVMCFG_JLOBJECT_NMO_NULL, \ CHEAT_AND_USE_NULL_TO_INITIALIZE, \ CHEAT_AND_USE_NULL_TO_INITIALIZE } \ } java.lang.Class.
|
|
No
|
|
No
|
|
Value: case JLCLASS_NMO_ISARRAY: \ case JLCLASS_NMO_ISPRIMATIVE: (jint ) local native method ordinal table for java.lang.Class
|
|
No
|
|
No
|
|
No
|
|
|
|
JNI hook to isArray().
arraydims contains number of dimensions
Definition at line 93 of file jlClass.c. References CLASS, CLASS_STATUS_ARRAY, jfalse, jtrue, jvm_class_index_null, and OBJECT_CLASS_LINKAGE. Referenced by Java_java_lang_Class_isArray(), and native_run_local_return_jint(). |
|
JNI hook to isPrimative().
java.lang.Class
Definition at line 124 of file jlClass.c. References jfalse. Referenced by Java_java_lang_Class_isPrimitive(), and native_run_local_return_jint(). |