8320645: DocLint should use javax.lang.model to detect default constructors

Reviewed-by: jlahoda, jjg
This commit is contained in:
Pavel Rappo 2023-11-23 15:52:04 +00:00
parent beaa79c28b
commit 06f040ba3a

View File

@ -1248,14 +1248,8 @@ public class Checker extends DocTreePathScanner<Void, Void> {
}
private boolean isDefaultConstructor() {
if (env.currElement.getKind() == ElementKind.CONSTRUCTOR) {
// A synthetic default constructor has the same pos as the
// enclosing class
TreePath p = env.currPath;
return env.getPos(p) == env.getPos(p.getParentPath());
} else {
return false;
}
return env.currElement.getKind() == ElementKind.CONSTRUCTOR
&& env.elements.getOrigin(env.currElement) == Elements.Origin.MANDATED;
}
private boolean isDeclaredType() {