8265130: Make ConstantDesc class hierarchy sealed

Reviewed-by: mchung, jvernee, vromero
This commit is contained in:
Gavin Bierman 2021-06-02 00:49:49 +00:00 committed by Vicente Romero
parent 00c7aeee00
commit 379376f078
6 changed files with 25 additions and 38 deletions

View file

@ -35,15 +35,12 @@ import static java.lang.constant.DirectMethodHandleDesc.Kind.CONSTRUCTOR;
* A <a href="package-summary.html#nominal">nominal descriptor</a> for a
* {@link MethodHandle} constant.
*
* @apiNote In the future, if the Java language permits, {@linkplain MethodHandleDesc}
* may become a {@code sealed} interface, which would prohibit subclassing except
* by explicitly permitted types. Non-platform classes should not implement
* {@linkplain MethodHandleDesc} directly.
*
* @since 12
*/
public interface MethodHandleDesc
extends ConstantDesc {
public sealed interface MethodHandleDesc
extends ConstantDesc
permits AsTypeMethodHandleDesc,
DirectMethodHandleDesc {
/**
* Creates a {@linkplain MethodHandleDesc} corresponding to an invocation of a