On Wed, 29 Jun 2022 18:11:50 GMT, liach <d...@openjdk.org> wrote: >> Сергей Цыпанов has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8288327: Mark ParameterData.parameters as @Stable and rename real -> isReal > > src/java.base/share/classes/java/lang/reflect/Executable.java line 413: > >> 411: } >> 412: >> 413: boolean hasRealParameterData() { > > Since `privateGetParameters` and `hasRealParameterData` are now both simple > methods with only one use site, they can be simply inlined in > `getParameters()` and `getAllGenericParameterTypes()` instead: > > > public Parameter[] getParameters() { > // Need to copy the cached array to prevent users from messing > // with it. Since parameters are immutable, we can > // shallow-copy. > return parameterData().parameters.clone(); > } > ... > final boolean realParamData = parameterData().isReal(); > final Type[] genericParamTypes = getGenericParameterTypes(); > final Type[] nonGenericParamTypes = getParameterTypes();
True for `privateGetParameters`, but `hasRealParameterData` is called also from `Parameter.isNamePresent()`, so I suggest to keep it > src/java.base/share/classes/java/lang/reflect/Executable.java line 777: > >> 775: } >> 776: >> 777: record ParameterData(@Stable Parameter[] parameters, boolean >> isReal) {} > > I recommend declaring this right next to `parameterData` field for the ease > of maintenance, like how `EntrySet` in map implementations are declared right > next to `entrySet` methods. Done! ------------- PR: https://git.openjdk.org/jdk/pull/9143