// Can not access non-public record's component without accessor declared in public interface
MethodHandle get_inaccessible = linker.link(makePropertyGetter("inaccessible")).dynamicInvoker(); try {
get_inaccessible.invoke(new B(100, 200)); thrownew AssertionError(); // should've failed
} catch (NoSuchDynamicMethodException e) { // This is expected
}
// Record components show up in the list of readable instance property names.
List.of(A.class, B.class, C.class).forEach(clazz -> { var propNames = BeansLinker.getReadableInstancePropertyNames(clazz); assert propNames.equals(Set.of("num", "class")): String.valueOf(propNames);
});
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.