[JSR308] ElementUtils.enclosingClass()
Mahmood Ali
mahmood at MIT.EDU
Wed Feb 4 11:40:49 EST 2009
Greetings,
> Question: when ElementUtils.enclosingClass() is invoked with a class
> element E, is it intended that it always returns E?
I think so. TreeUtils.enclosingFOO() and ElementUtils.enclosingFOO()
all return the passed element if it happens to be of the desired type.
> I would expect that it would return some TypeElement E' where the
> definition of E is nested inside of E', or null if E is a top-level
> class.
I agree and find the naming misleading.
However, many places in the checker framework rely on .enclosingFOO()
return the same element if it is of the desired type.
It's an unfortunate naming convention, but I think it's better to keep
the current implementation as is and clarify the specification for now
at least.
Regards,
Mahmood
More information about the JSR308
mailing list