You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need to read (and remember) the PermittedSubclasses attribute in the ClassFile structure, which lists the permitted subclasses of the present class. Its presence also signifies that the present class is sealed.
/** * Returns the set of permitted subclasses of this {@code sealed} class (or interface). * Returns an empty set if this class is not {@code sealed}. * * @return immutable set of names of this class's permitted subclasses, never {@code null} */publicSet<DotName> permittedSubclasses() {
...
}
and a helper method
/** * @return {@code true} if this class object represents a sealed class (or interface) */publicbooleanisSealed() {
return !permittedSubclasses().isEmpty();
}
We don't need an isNonSealed() method, because we already have isFinal() and a permitted subclass of a sealed class must always be either sealed, non-sealed or final.
I'm not aware of any prospective user, so filing this just for tracking. I'm thinking 3.x only, unless someone actually asks for a backport to 2.x.
The text was updated successfully, but these errors were encountered: