| JDK 18 |
|---|
| 18 b11Fixed |
|
CSR :
|
|
|
Relates :
|
|
JDK-8281508 :
|
This is a useful utility used in the doclet's new api and would be beneficial to other users of javax.lang.model.
Suggested code:
public TypeElement getOuterMostTypeElement(Element e) {
if (e.getKind() == ElementKind.PACKAGE)
return null;
Element encl = e.getEnclosingElement();
ElementKind kind = encl.getKind();
if (kind == ElementKind.PACKAGE)
return null;
while (!(kind.isClass() || kind.isInterface())) {
encl = encl.getEnclosingElement();
}
return (TypeElement)encl;
}
|