< prev index next >

src/java.base/share/native/include/jni.h

Print this page

   1 /*
   2  * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any

 766     /* New JNI 1.6 Features */
 767 
 768     jobjectRefType (JNICALL *GetObjectRefType)
 769         (JNIEnv* env, jobject obj);
 770 
 771     /* Module Features */
 772 
 773     jobject (JNICALL *GetModule)
 774        (JNIEnv* env, jclass clazz);
 775 
 776     /* Virtual threads */
 777 
 778     jboolean (JNICALL *IsVirtualThread)
 779        (JNIEnv* env, jobject obj);
 780 
 781     /* Large UTF8 Support */
 782 
 783     jlong (JNICALL *GetStringUTFLengthAsLong)
 784       (JNIEnv *env, jstring str);
 785 





 786 };
 787 
 788 /*
 789  * We use inlined functions for C++ so that programmers can write:
 790  *
 791  *    env->FindClass("java/lang/String")
 792  *
 793  * in C++ rather than:
 794  *
 795  *    (*env)->FindClass(env, "java/lang/String")
 796  *
 797  * in C.
 798  */
 799 
 800 struct JNIEnv_ {
 801     const struct JNINativeInterface_ *functions;
 802 #ifdef __cplusplus
 803 
 804     jint GetVersion() {
 805         return functions->GetVersion(this);

1873     }
1874     jlong GetDirectBufferCapacity(jobject buf) {
1875         return functions->GetDirectBufferCapacity(this, buf);
1876     }
1877     jobjectRefType GetObjectRefType(jobject obj) {
1878         return functions->GetObjectRefType(this, obj);
1879     }
1880 
1881     /* Module Features */
1882 
1883     jobject GetModule(jclass clazz) {
1884         return functions->GetModule(this, clazz);
1885     }
1886 
1887     /* Virtual threads */
1888 
1889     jboolean IsVirtualThread(jobject obj) {
1890         return functions->IsVirtualThread(this, obj);
1891     }
1892 






1893 #endif /* __cplusplus */
1894 };
1895 
1896 /*
1897  * optionString may be any option accepted by the JVM, or one of the
1898  * following:
1899  *
1900  * -D<name>=<value>          Set a system property.
1901  * -verbose[:class|gc|jni]   Enable verbose output, comma-separated. E.g.
1902  *                           "-verbose:class" or "-verbose:gc,class"
1903  *                           Standard names include: gc, class, and jni.
1904  *                           All nonstandard (VM-specific) names must begin
1905  *                           with "X".
1906  * vfprintf                  extraInfo is a pointer to the vfprintf hook.
1907  * exit                      extraInfo is a pointer to the exit hook.
1908  * abort                     extraInfo is a pointer to the abort hook.
1909  */
1910 typedef struct JavaVMOption {
1911     char *optionString;
1912     void *extraInfo;

   1 /*
   2  * Copyright (c) 1996, 2026, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any

 766     /* New JNI 1.6 Features */
 767 
 768     jobjectRefType (JNICALL *GetObjectRefType)
 769         (JNIEnv* env, jobject obj);
 770 
 771     /* Module Features */
 772 
 773     jobject (JNICALL *GetModule)
 774        (JNIEnv* env, jclass clazz);
 775 
 776     /* Virtual threads */
 777 
 778     jboolean (JNICALL *IsVirtualThread)
 779        (JNIEnv* env, jobject obj);
 780 
 781     /* Large UTF8 Support */
 782 
 783     jlong (JNICALL *GetStringUTFLengthAsLong)
 784       (JNIEnv *env, jstring str);
 785 
 786     /* Value classes */
 787 
 788     jboolean (JNICALL *IsValueObject)
 789       (JNIEnv* env, jobject obj);
 790 
 791 };
 792 
 793 /*
 794  * We use inlined functions for C++ so that programmers can write:
 795  *
 796  *    env->FindClass("java/lang/String")
 797  *
 798  * in C++ rather than:
 799  *
 800  *    (*env)->FindClass(env, "java/lang/String")
 801  *
 802  * in C.
 803  */
 804 
 805 struct JNIEnv_ {
 806     const struct JNINativeInterface_ *functions;
 807 #ifdef __cplusplus
 808 
 809     jint GetVersion() {
 810         return functions->GetVersion(this);

1878     }
1879     jlong GetDirectBufferCapacity(jobject buf) {
1880         return functions->GetDirectBufferCapacity(this, buf);
1881     }
1882     jobjectRefType GetObjectRefType(jobject obj) {
1883         return functions->GetObjectRefType(this, obj);
1884     }
1885 
1886     /* Module Features */
1887 
1888     jobject GetModule(jclass clazz) {
1889         return functions->GetModule(this, clazz);
1890     }
1891 
1892     /* Virtual threads */
1893 
1894     jboolean IsVirtualThread(jobject obj) {
1895         return functions->IsVirtualThread(this, obj);
1896     }
1897 
1898     /* Value classes */
1899 
1900     jboolean IsValueObject(jobject obj) {
1901         return functions->IsValueObject(this, obj);
1902     }
1903 
1904 #endif /* __cplusplus */
1905 };
1906 
1907 /*
1908  * optionString may be any option accepted by the JVM, or one of the
1909  * following:
1910  *
1911  * -D<name>=<value>          Set a system property.
1912  * -verbose[:class|gc|jni]   Enable verbose output, comma-separated. E.g.
1913  *                           "-verbose:class" or "-verbose:gc,class"
1914  *                           Standard names include: gc, class, and jni.
1915  *                           All nonstandard (VM-specific) names must begin
1916  *                           with "X".
1917  * vfprintf                  extraInfo is a pointer to the vfprintf hook.
1918  * exit                      extraInfo is a pointer to the exit hook.
1919  * abort                     extraInfo is a pointer to the abort hook.
1920  */
1921 typedef struct JavaVMOption {
1922     char *optionString;
1923     void *extraInfo;
< prev index next >