getPermittedSubclasses() on j.l.rClass returning an array of ClassDesc

Chris Hegarty chris.hegarty at
Thu Nov 5 11:18:27 UTC 2020

> On 29 Oct 2020, at 21:38, Dan Smith <daniel.smith at> wrote:
>> ...
> You're not wrong, but I'm not sure this is reason not to provide better typing information. It certainly is the contract of the 'getPermittedSubclasses' method not to pollute it with non-subclasses of T.
> That said, Class<?>[] seems to be the precedent followed by other methods:
> Class<? super T> getSuperclass()
> vs.
> Class<?>[] getInterfaces()
> Constructor<T> getConstructor(Class<?>)
> vs.
> Constructor<?>[] getConstructors()
> So I guess we should do the same with 'getPermittedSubclasses'.

For reference, 8246278 "Refine API for sealing in java.lang.Class” [1], tracks this issue.

An additional point for consideration, the return "container". Returning a Class<?>[] or maybe an immutable List<? extendsT>. The latter allows for sharper type information in the signature, the former does not. 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the amber-spec-experts mailing list