mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8231355: Remove unused utility methods in libjava
Reviewed-by: dholmes, jrose, alanb
This commit is contained in:
parent
d10abea7cf
commit
f8f7cdcbe3
7 changed files with 3 additions and 434 deletions
|
@ -377,7 +377,7 @@ Handle java_lang_String::create_from_platform_dependent_str(const char* str, TRA
|
||||||
|
|
||||||
if (_to_java_string_fn == NULL) {
|
if (_to_java_string_fn == NULL) {
|
||||||
void *lib_handle = os::native_java_library();
|
void *lib_handle = os::native_java_library();
|
||||||
_to_java_string_fn = CAST_TO_FN_PTR(to_java_string_fn_t, os::dll_lookup(lib_handle, "NewStringPlatform"));
|
_to_java_string_fn = CAST_TO_FN_PTR(to_java_string_fn_t, os::dll_lookup(lib_handle, "JNU_NewStringPlatform"));
|
||||||
if (_to_java_string_fn == NULL) {
|
if (_to_java_string_fn == NULL) {
|
||||||
fatal("NewStringPlatform missing");
|
fatal("NewStringPlatform missing");
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,11 +42,6 @@ Java_jdk_internal_misc_VM_latestUserDefinedLoader0(JNIEnv *env, jclass cls) {
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_jdk_internal_misc_VM_initialize(JNIEnv *env, jclass cls) {
|
Java_jdk_internal_misc_VM_initialize(JNIEnv *env, jclass cls) {
|
||||||
if (!JDK_InitJvmHandle()) {
|
|
||||||
JNU_ThrowInternalError(env, "Handle for JVM not found for symbol lookup");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Registers implementations of native methods described in methods[]
|
// Registers implementations of native methods described in methods[]
|
||||||
// above.
|
// above.
|
||||||
// In particular, registers JVM_GetNanoTimeAdjustment as the implementation
|
// In particular, registers JVM_GetNanoTimeAdjustment as the implementation
|
||||||
|
|
|
@ -45,20 +45,6 @@ extern "C" {
|
||||||
JNIEXPORT void
|
JNIEXPORT void
|
||||||
JDK_GetVersionInfo0(jdk_version_info* info, size_t info_size);
|
JDK_GetVersionInfo0(jdk_version_info* info, size_t info_size);
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------
|
|
||||||
* Internal interface for JDK to use
|
|
||||||
*-------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Init JVM handle for symbol lookup;
|
|
||||||
* Return 0 if JVM handle not found.
|
|
||||||
*/
|
|
||||||
int JDK_InitJvmHandle();
|
|
||||||
|
|
||||||
/* Find the named JVM entry; returns NULL if not found. */
|
|
||||||
void* JDK_FindJvmEntry(const char* name);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
|
@ -76,78 +76,24 @@ JNU_ThrowIllegalArgumentException(JNIEnv *env, const char *msg)
|
||||||
JNU_ThrowByName(env, "java/lang/IllegalArgumentException", msg);
|
JNU_ThrowByName(env, "java/lang/IllegalArgumentException", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_ThrowIllegalAccessError(JNIEnv *env, const char *msg)
|
|
||||||
{
|
|
||||||
JNU_ThrowByName(env, "java/lang/IllegalAccessError", msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_ThrowIllegalAccessException(JNIEnv *env, const char *msg)
|
|
||||||
{
|
|
||||||
JNU_ThrowByName(env, "java/lang/IllegalAccessException", msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
JNU_ThrowInternalError(JNIEnv *env, const char *msg)
|
JNU_ThrowInternalError(JNIEnv *env, const char *msg)
|
||||||
{
|
{
|
||||||
JNU_ThrowByName(env, "java/lang/InternalError", msg);
|
JNU_ThrowByName(env, "java/lang/InternalError", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_ThrowNoSuchFieldException(JNIEnv *env, const char *msg)
|
|
||||||
{
|
|
||||||
JNU_ThrowByName(env, "java/lang/NoSuchFieldException", msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_ThrowNoSuchMethodException(JNIEnv *env, const char *msg)
|
|
||||||
{
|
|
||||||
JNU_ThrowByName(env, "java/lang/NoSuchMethodException", msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
JNU_ThrowClassNotFoundException(JNIEnv *env, const char *msg)
|
JNU_ThrowClassNotFoundException(JNIEnv *env, const char *msg)
|
||||||
{
|
{
|
||||||
JNU_ThrowByName(env, "java/lang/ClassNotFoundException", msg);
|
JNU_ThrowByName(env, "java/lang/ClassNotFoundException", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_ThrowNumberFormatException(JNIEnv *env, const char *msg)
|
|
||||||
{
|
|
||||||
JNU_ThrowByName(env, "java/lang/NumberFormatException", msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
JNU_ThrowIOException(JNIEnv *env, const char *msg)
|
JNU_ThrowIOException(JNIEnv *env, const char *msg)
|
||||||
{
|
{
|
||||||
JNU_ThrowByName(env, "java/io/IOException", msg);
|
JNU_ThrowByName(env, "java/io/IOException", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_ThrowNoSuchFieldError(JNIEnv *env, const char *msg)
|
|
||||||
{
|
|
||||||
JNU_ThrowByName(env, "java/lang/NoSuchFieldError", msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_ThrowNoSuchMethodError(JNIEnv *env, const char *msg)
|
|
||||||
{
|
|
||||||
JNU_ThrowByName(env, "java/lang/NoSuchMethodError", msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_ThrowStringIndexOutOfBoundsException(JNIEnv *env, const char *msg)
|
|
||||||
{
|
|
||||||
JNU_ThrowByName(env, "java/lang/StringIndexOutOfBoundsException", msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_ThrowInstantiationException(JNIEnv *env, const char *msg)
|
|
||||||
{
|
|
||||||
JNU_ThrowByName(env, "java/lang/InstantiationException", msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Throw an exception by name, using the string returned by
|
* Throw an exception by name, using the string returned by
|
||||||
* getLastErrorString for the detail string. If the last-error
|
* getLastErrorString for the detail string. If the last-error
|
||||||
|
@ -845,12 +791,6 @@ InitializeEncoding(JNIEnv *env, const char *encname)
|
||||||
CHECK_NULL(String_value_ID);
|
CHECK_NULL(String_value_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring
|
|
||||||
NewStringPlatform(JNIEnv *env, const char *str)
|
|
||||||
{
|
|
||||||
return JNU_NewStringPlatform(env, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL
|
JNIEXPORT jstring JNICALL
|
||||||
JNU_NewStringPlatform(JNIEnv *env, const char *str)
|
JNU_NewStringPlatform(JNIEnv *env, const char *str)
|
||||||
{
|
{
|
||||||
|
@ -1024,54 +964,6 @@ JNU_ClassString(JNIEnv *env)
|
||||||
return cls;
|
return cls;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jclass JNICALL
|
|
||||||
JNU_ClassClass(JNIEnv *env)
|
|
||||||
{
|
|
||||||
static jclass cls = 0;
|
|
||||||
if (cls == 0) {
|
|
||||||
jclass c;
|
|
||||||
if ((*env)->EnsureLocalCapacity(env, 1) < 0)
|
|
||||||
return 0;
|
|
||||||
c = (*env)->FindClass(env, "java/lang/Class");
|
|
||||||
CHECK_NULL_RETURN(c, NULL);
|
|
||||||
cls = (*env)->NewGlobalRef(env, c);
|
|
||||||
(*env)->DeleteLocalRef(env, c);
|
|
||||||
}
|
|
||||||
return cls;
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT jclass JNICALL
|
|
||||||
JNU_ClassObject(JNIEnv *env)
|
|
||||||
{
|
|
||||||
static jclass cls = 0;
|
|
||||||
if (cls == 0) {
|
|
||||||
jclass c;
|
|
||||||
if ((*env)->EnsureLocalCapacity(env, 1) < 0)
|
|
||||||
return 0;
|
|
||||||
c = (*env)->FindClass(env, "java/lang/Object");
|
|
||||||
CHECK_NULL_RETURN(c, NULL);
|
|
||||||
cls = (*env)->NewGlobalRef(env, c);
|
|
||||||
(*env)->DeleteLocalRef(env, c);
|
|
||||||
}
|
|
||||||
return cls;
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT jclass JNICALL
|
|
||||||
JNU_ClassThrowable(JNIEnv *env)
|
|
||||||
{
|
|
||||||
static jclass cls = 0;
|
|
||||||
if (cls == 0) {
|
|
||||||
jclass c;
|
|
||||||
if ((*env)->EnsureLocalCapacity(env, 1) < 0)
|
|
||||||
return 0;
|
|
||||||
c = (*env)->FindClass(env, "java/lang/Throwable");
|
|
||||||
CHECK_NULL_RETURN(c, NULL);
|
|
||||||
cls = (*env)->NewGlobalRef(env, c);
|
|
||||||
(*env)->DeleteLocalRef(env, c);
|
|
||||||
}
|
|
||||||
return cls;
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
JNU_CopyObjectArray(JNIEnv *env, jobjectArray dst, jobjectArray src,
|
JNU_CopyObjectArray(JNIEnv *env, jobjectArray dst, jobjectArray src,
|
||||||
jint count)
|
jint count)
|
||||||
|
@ -1110,125 +1002,10 @@ JNU_IsInstanceOfByName(JNIEnv *env, jobject object, const char* classname)
|
||||||
return JNI_ERR;
|
return JNI_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL
|
|
||||||
JNU_Equals(JNIEnv *env, jobject object1, jobject object2)
|
|
||||||
{
|
|
||||||
static jmethodID mid = NULL;
|
|
||||||
if (mid == NULL) {
|
|
||||||
jclass objClazz = JNU_ClassObject(env);
|
|
||||||
CHECK_NULL_RETURN(objClazz, JNI_FALSE);
|
|
||||||
mid = (*env)->GetMethodID(env, objClazz, "equals",
|
|
||||||
"(Ljava/lang/Object;)Z");
|
|
||||||
CHECK_NULL_RETURN(mid, JNI_FALSE);
|
|
||||||
}
|
|
||||||
return (*env)->CallBooleanMethod(env, object1, mid, object2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Thread calls
|
|
||||||
*/
|
|
||||||
|
|
||||||
static jmethodID Object_waitMID;
|
|
||||||
static jmethodID Object_notifyMID;
|
|
||||||
static jmethodID Object_notifyAllMID;
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_MonitorWait(JNIEnv *env, jobject object, jlong timeout)
|
|
||||||
{
|
|
||||||
if (object == NULL) {
|
|
||||||
JNU_ThrowNullPointerException(env, "JNU_MonitorWait argument");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Object_waitMID == NULL) {
|
|
||||||
jclass cls = JNU_ClassObject(env);
|
|
||||||
if (cls == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Object_waitMID = (*env)->GetMethodID(env, cls, "wait", "(J)V");
|
|
||||||
if (Object_waitMID == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(*env)->CallVoidMethod(env, object, Object_waitMID, timeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_Notify(JNIEnv *env, jobject object)
|
|
||||||
{
|
|
||||||
if (object == NULL) {
|
|
||||||
JNU_ThrowNullPointerException(env, "JNU_Notify argument");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Object_notifyMID == NULL) {
|
|
||||||
jclass cls = JNU_ClassObject(env);
|
|
||||||
if (cls == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Object_notifyMID = (*env)->GetMethodID(env, cls, "notify", "()V");
|
|
||||||
if (Object_notifyMID == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(*env)->CallVoidMethod(env, object, Object_notifyMID);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_NotifyAll(JNIEnv *env, jobject object)
|
|
||||||
{
|
|
||||||
if (object == NULL) {
|
|
||||||
JNU_ThrowNullPointerException(env, "JNU_NotifyAll argument");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Object_notifyAllMID == NULL) {
|
|
||||||
jclass cls = JNU_ClassObject(env);
|
|
||||||
if (cls == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Object_notifyAllMID = (*env)->GetMethodID(env, cls,"notifyAll", "()V");
|
|
||||||
if (Object_notifyAllMID == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(*env)->CallVoidMethod(env, object, Object_notifyAllMID);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Debugging utilities
|
* Debugging utilities
|
||||||
*/
|
*/
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_PrintString(JNIEnv *env, char *hdr, jstring string)
|
|
||||||
{
|
|
||||||
if (string == NULL) {
|
|
||||||
fprintf(stderr, "%s: is NULL\n", hdr);
|
|
||||||
} else {
|
|
||||||
const char *stringPtr = JNU_GetStringPlatformChars(env, string, 0);
|
|
||||||
if (stringPtr == 0)
|
|
||||||
return;
|
|
||||||
fprintf(stderr, "%s: %s\n", hdr, stringPtr);
|
|
||||||
JNU_ReleaseStringPlatformChars(env, string, stringPtr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_PrintClass(JNIEnv *env, char* hdr, jobject object)
|
|
||||||
{
|
|
||||||
if (object == NULL) {
|
|
||||||
fprintf(stderr, "%s: object is NULL\n", hdr);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
jclass cls = (*env)->GetObjectClass(env, object);
|
|
||||||
jstring clsName = JNU_ToString(env, cls);
|
|
||||||
if (clsName == NULL) {
|
|
||||||
JNU_PrintString(env, hdr, clsName);
|
|
||||||
}
|
|
||||||
(*env)->DeleteLocalRef(env, cls);
|
|
||||||
(*env)->DeleteLocalRef(env, clsName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL
|
JNIEXPORT jstring JNICALL
|
||||||
JNU_ToString(JNIEnv *env, jobject object)
|
JNU_ToString(JNIEnv *env, jobject object)
|
||||||
{
|
{
|
||||||
|
@ -1437,70 +1214,3 @@ JNU_GetStaticFieldByName(JNIEnv *env,
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_SetStaticFieldByName(JNIEnv *env,
|
|
||||||
jboolean *hasException,
|
|
||||||
const char *classname,
|
|
||||||
const char *name,
|
|
||||||
const char *signature,
|
|
||||||
...)
|
|
||||||
{
|
|
||||||
jclass cls;
|
|
||||||
jfieldID fid;
|
|
||||||
va_list args;
|
|
||||||
|
|
||||||
if ((*env)->EnsureLocalCapacity(env, 3) < 0)
|
|
||||||
goto done2;
|
|
||||||
|
|
||||||
cls = (*env)->FindClass(env, classname);
|
|
||||||
if (cls == 0)
|
|
||||||
goto done2;
|
|
||||||
|
|
||||||
fid = (*env)->GetStaticFieldID(env, cls, name, signature);
|
|
||||||
if (fid == 0)
|
|
||||||
goto done1;
|
|
||||||
|
|
||||||
va_start(args, signature);
|
|
||||||
switch (*signature) {
|
|
||||||
case '[':
|
|
||||||
case 'L':
|
|
||||||
(*env)->SetStaticObjectField(env, cls, fid, va_arg(args, jobject));
|
|
||||||
break;
|
|
||||||
case 'Z':
|
|
||||||
(*env)->SetStaticBooleanField(env, cls, fid, (jboolean)va_arg(args, int));
|
|
||||||
break;
|
|
||||||
case 'B':
|
|
||||||
(*env)->SetStaticByteField(env, cls, fid, (jbyte)va_arg(args, int));
|
|
||||||
break;
|
|
||||||
case 'C':
|
|
||||||
(*env)->SetStaticCharField(env, cls, fid, (jchar)va_arg(args, int));
|
|
||||||
break;
|
|
||||||
case 'S':
|
|
||||||
(*env)->SetStaticShortField(env, cls, fid, (jshort)va_arg(args, int));
|
|
||||||
break;
|
|
||||||
case 'I':
|
|
||||||
(*env)->SetStaticIntField(env, cls, fid, va_arg(args, jint));
|
|
||||||
break;
|
|
||||||
case 'J':
|
|
||||||
(*env)->SetStaticLongField(env, cls, fid, va_arg(args, jlong));
|
|
||||||
break;
|
|
||||||
case 'F':
|
|
||||||
(*env)->SetStaticFloatField(env, cls, fid, (jfloat)va_arg(args, jdouble));
|
|
||||||
break;
|
|
||||||
case 'D':
|
|
||||||
(*env)->SetStaticDoubleField(env, cls, fid, va_arg(args, jdouble));
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
(*env)->FatalError(env, "JNU_SetStaticFieldByName: illegal signature");
|
|
||||||
}
|
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
done1:
|
|
||||||
(*env)->DeleteLocalRef(env, cls);
|
|
||||||
done2:
|
|
||||||
if (hasException) {
|
|
||||||
*hasException = (*env)->ExceptionCheck(env);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -61,42 +61,15 @@ JNU_ThrowOutOfMemoryError(JNIEnv *env, const char *msg);
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
JNU_ThrowIllegalArgumentException(JNIEnv *env, const char *msg);
|
JNU_ThrowIllegalArgumentException(JNIEnv *env, const char *msg);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_ThrowIllegalAccessError(JNIEnv *env, const char *msg);
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_ThrowIllegalAccessException(JNIEnv *env, const char *msg);
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
JNU_ThrowInternalError(JNIEnv *env, const char *msg);
|
JNU_ThrowInternalError(JNIEnv *env, const char *msg);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
JNU_ThrowIOException(JNIEnv *env, const char *msg);
|
JNU_ThrowIOException(JNIEnv *env, const char *msg);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_ThrowNoSuchFieldException(JNIEnv *env, const char *msg);
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_ThrowNoSuchMethodException(JNIEnv *env, const char *msg);
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
JNU_ThrowClassNotFoundException(JNIEnv *env, const char *msg);
|
JNU_ThrowClassNotFoundException(JNIEnv *env, const char *msg);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_ThrowNumberFormatException(JNIEnv *env, const char *msg);
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_ThrowNoSuchFieldError(JNIEnv *env, const char *msg);
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_ThrowNoSuchMethodError(JNIEnv *env, const char *msg);
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_ThrowStringIndexOutOfBoundsException(JNIEnv *env, const char *msg);
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_ThrowInstantiationException(JNIEnv *env, const char *msg);
|
|
||||||
|
|
||||||
/* Throw an exception by name, using the string returned by
|
/* Throw an exception by name, using the string returned by
|
||||||
* getLastErrorString for the detail string. If the last-error
|
* getLastErrorString for the detail string. If the last-error
|
||||||
* string is NULL, use the given default detail string.
|
* string is NULL, use the given default detail string.
|
||||||
|
@ -120,9 +93,6 @@ JNIEXPORT void JNICALL
|
||||||
JNU_ThrowIOExceptionWithLastError(JNIEnv *env, const char *defaultDetail);
|
JNU_ThrowIOExceptionWithLastError(JNIEnv *env, const char *defaultDetail);
|
||||||
|
|
||||||
/* Convert between Java strings and i18n C strings */
|
/* Convert between Java strings and i18n C strings */
|
||||||
JNIEXPORT jstring
|
|
||||||
NewStringPlatform(JNIEnv *env, const char *str);
|
|
||||||
|
|
||||||
JNIEXPORT const char *
|
JNIEXPORT const char *
|
||||||
GetStringPlatformChars(JNIEnv *env, jstring jstr, jboolean *isCopy);
|
GetStringPlatformChars(JNIEnv *env, jstring jstr, jboolean *isCopy);
|
||||||
|
|
||||||
|
@ -139,15 +109,6 @@ JNU_ReleaseStringPlatformChars(JNIEnv *env, jstring jstr, const char *str);
|
||||||
JNIEXPORT jclass JNICALL
|
JNIEXPORT jclass JNICALL
|
||||||
JNU_ClassString(JNIEnv *env);
|
JNU_ClassString(JNIEnv *env);
|
||||||
|
|
||||||
JNIEXPORT jclass JNICALL
|
|
||||||
JNU_ClassClass(JNIEnv *env);
|
|
||||||
|
|
||||||
JNIEXPORT jclass JNICALL
|
|
||||||
JNU_ClassObject(JNIEnv *env);
|
|
||||||
|
|
||||||
JNIEXPORT jclass JNICALL
|
|
||||||
JNU_ClassThrowable(JNIEnv *env);
|
|
||||||
|
|
||||||
/* Copy count number of arguments from src to dst. Array bounds
|
/* Copy count number of arguments from src to dst. Array bounds
|
||||||
* and ArrayStoreException are checked.
|
* and ArrayStoreException are checked.
|
||||||
*/
|
*/
|
||||||
|
@ -246,36 +207,6 @@ JNU_GetStaticFieldByName(JNIEnv *env,
|
||||||
const char *classname,
|
const char *classname,
|
||||||
const char *name,
|
const char *name,
|
||||||
const char *sig);
|
const char *sig);
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_SetStaticFieldByName(JNIEnv *env,
|
|
||||||
jboolean *hasException,
|
|
||||||
const char *classname,
|
|
||||||
const char *name,
|
|
||||||
const char *sig,
|
|
||||||
...);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Calls the .equals method.
|
|
||||||
*/
|
|
||||||
JNIEXPORT jboolean JNICALL
|
|
||||||
JNU_Equals(JNIEnv *env, jobject object1, jobject object2);
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Thread calls
|
|
||||||
*
|
|
||||||
* Convenience thread-related calls on the java.lang.Object class.
|
|
||||||
*/
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_MonitorWait(JNIEnv *env, jobject object, jlong timeout);
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_Notify(JNIEnv *env, jobject object);
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_NotifyAll(JNIEnv *env, jobject object);
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
|
@ -349,19 +280,15 @@ JNU_NotifyAll(JNIEnv *env, jobject object);
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Debugging utilities
|
* Debugging utilities
|
||||||
*/
|
*/
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_PrintString(JNIEnv *env, char *hdr, jstring string);
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JNU_PrintClass(JNIEnv *env, char *hdr, jobject object);
|
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL
|
JNIEXPORT jstring JNICALL
|
||||||
JNU_ToString(JNIEnv *env, jobject object);
|
JNU_ToString(JNIEnv *env, jobject object);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Package shorthand for use by native libraries
|
* Package shorthand for use by native libraries
|
||||||
*/
|
*/
|
||||||
|
@ -402,8 +329,6 @@ enum {
|
||||||
FAST_UTF_8
|
FAST_UTF_8
|
||||||
};
|
};
|
||||||
|
|
||||||
int getFastEncoding();
|
|
||||||
|
|
||||||
JNIEXPORT void InitializeEncoding(JNIEnv *env, const char *name);
|
JNIEXPORT void InitializeEncoding(JNIEnv *env, const char *name);
|
||||||
|
|
||||||
void* getProcessHandle();
|
void* getProcessHandle();
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
|
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
*
|
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
|
||||||
* published by the Free Software Foundation. Oracle designates this
|
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Oracle in the LICENSE file that accompanied this code.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <dlfcn.h>
|
|
||||||
#include "jdk_util.h"
|
|
||||||
|
|
||||||
int JDK_InitJvmHandle() {
|
|
||||||
/* nop */
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void* JDK_FindJvmEntry(const char* name) {
|
|
||||||
return dlsym(RTLD_DEFAULT, name);
|
|
||||||
}
|
|
|
@ -28,17 +28,6 @@
|
||||||
|
|
||||||
#define JVM_DLL "jvm.dll"
|
#define JVM_DLL "jvm.dll"
|
||||||
|
|
||||||
static HMODULE jvm_handle = NULL;
|
|
||||||
|
|
||||||
int JDK_InitJvmHandle() {
|
|
||||||
jvm_handle = GetModuleHandle(JVM_DLL);
|
|
||||||
return (jvm_handle != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void* JDK_FindJvmEntry(const char* name) {
|
|
||||||
return (void*) GetProcAddress(jvm_handle, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT HMODULE JDK_LoadSystemLibrary(const char* name) {
|
JNIEXPORT HMODULE JDK_LoadSystemLibrary(const char* name) {
|
||||||
HMODULE handle = NULL;
|
HMODULE handle = NULL;
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue