The following statement was executed in both Oracle JDK1.8 and OpenJDK 16, but the different results returned. Founded during daily developping, the confusing issue is whether the difference are intended to be so or just an obscure bug? I've already done searching the similary questions but no expected ones was founded.
Examples,
Field[] declaredFields = Field.class.getFields();
// Field[12] with all private fields which are expected. (JDK 1.8)
// Empty field array. (JDK 16)
Through debug mode, the critical statements are located: line 293, 309 in jdk.internal.reflect.Reflections. Those methods left without javadoc.
// line 293
return (Field[])filter(fields, fieldFilterMap.get(containingClass));
// line 309
if (filteredNames.contains(WILDCARD)) {
return (Member[]) Array.newInstance(memberType, 0);
}
Aucun commentaire:
Enregistrer un commentaire