8328877: [JNI] The JNI Specification needs to address the limitations of integer UTF-8 String lengths

Reviewed-by: cjplummer, alanb
This commit is contained in:
David Holmes 2024-09-04 03:41:42 +00:00
parent bbb516163d
commit 90f3f43257
9 changed files with 208 additions and 27 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2024, 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
@ -775,6 +775,12 @@ struct JNINativeInterface_ {
jboolean (JNICALL *IsVirtualThread)
(JNIEnv* env, jobject obj);
/* Large UTF8 Support */
jlong (JNICALL *GetStringUTFLengthAsLong)
(JNIEnv *env, jstring str);
};
/*
@ -1623,6 +1629,9 @@ struct JNIEnv_ {
jsize GetStringUTFLength(jstring str) {
return functions->GetStringUTFLength(this,str);
}
jlong GetStringUTFLengthAsLong(jstring str) {
return functions->GetStringUTFLengthAsLong(this,str);
}
const char* GetStringUTFChars(jstring str, jboolean *isCopy) {
return functions->GetStringUTFChars(this,str,isCopy);
}
@ -1993,6 +2002,7 @@ JNI_OnUnload(JavaVM *vm, void *reserved);
#define JNI_VERSION_19 0x00130000
#define JNI_VERSION_20 0x00140000
#define JNI_VERSION_21 0x00150000
#define JNI_VERSION_24 0x00180000
#ifdef __cplusplus
} /* extern "C" */