8235359: Simplify method Class.getRecordComponents()
Change getRecordComponents0() to return an array of RecordComponent's so no conversion is needed Reviewed-by: lfoltan, chegar, fparain, vromero, mchung
This commit is contained in:
parent
7eadf5b372
commit
b8dbdd1232
@ -2315,15 +2315,11 @@ public final class Class<T> implements java.io.Serializable,
|
||||
if (isPrimitive() || isArray()) {
|
||||
return new RecordComponent[0];
|
||||
}
|
||||
Object[] recordComponents = getRecordComponents0();
|
||||
if (recordComponents == null || recordComponents.length == 0) {
|
||||
RecordComponent[] recordComponents = getRecordComponents0();
|
||||
if (recordComponents == null) {
|
||||
return new RecordComponent[0];
|
||||
}
|
||||
RecordComponent[] result = new RecordComponent[recordComponents.length];
|
||||
for (int i = 0; i < recordComponents.length; i++) {
|
||||
result[i] = (RecordComponent)recordComponents[i];
|
||||
}
|
||||
return result;
|
||||
return recordComponents;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3483,7 +3479,8 @@ public final class Class<T> implements java.io.Serializable,
|
||||
private native Method[] getDeclaredMethods0(boolean publicOnly);
|
||||
private native Constructor<T>[] getDeclaredConstructors0(boolean publicOnly);
|
||||
private native Class<?>[] getDeclaredClasses0();
|
||||
private native Object[] getRecordComponents0();
|
||||
@SuppressWarnings("preview")
|
||||
private native RecordComponent[] getRecordComponents0();
|
||||
private native boolean isRecord0();
|
||||
|
||||
/**
|
||||
|
@ -51,6 +51,7 @@ extern jboolean VerifyFixClassname(char *utf_name);
|
||||
#define CTR "Ljava/lang/reflect/Constructor;"
|
||||
#define PD "Ljava/security/ProtectionDomain;"
|
||||
#define BA "[B"
|
||||
#define RC "Ljava/lang/reflect/RecordComponent;"
|
||||
|
||||
static JNINativeMethod methods[] = {
|
||||
{"initClassName", "()" STR, (void *)&JVM_InitClassName},
|
||||
@ -77,8 +78,8 @@ static JNINativeMethod methods[] = {
|
||||
{"getRawTypeAnnotations", "()" BA, (void *)&JVM_GetClassTypeAnnotations},
|
||||
{"getNestHost0", "()" CLS, (void *)&JVM_GetNestHost},
|
||||
{"getNestMembers0", "()[" CLS, (void *)&JVM_GetNestMembers},
|
||||
{"getRecordComponents0", "()[" OBJ, (void *)&JVM_GetRecordComponents},
|
||||
{"isRecord0", "()Z", (void *)&JVM_IsRecord},
|
||||
{"getRecordComponents0", "()[" RC, (void *)&JVM_GetRecordComponents},
|
||||
{"isRecord0", "()Z", (void *)&JVM_IsRecord},
|
||||
};
|
||||
|
||||
#undef OBJ
|
||||
|
Loading…
x
Reference in New Issue
Block a user