mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
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
2 changed files with 8 additions and 10 deletions
|
@ -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();
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue