);
}
@Override
public Void visitConstructorDeclaration(final ConstructorDeclaration node, final Void _) {
final MethodDefinition method = node.getUserData(Keys.METHOD_DEFINITION);
if (method != null) {
if (AstBuilder.isMemberHidden(method, context)) {
if (method.getDeclaringType().isEnum() &&
method.getDeclaringType().isAnonymous() &&
!node.getBody().getStatements().isEmpty()) {
//
// Keep initializer blocks in anonymous enum value bodies.
//
return super.visitConstructorDeclaration(node, _);
}
node.remove();
return null;
}
if (!context.getSettings().getShowSyntheticMembers() &&
node.getParameters().isEmpty() &&
DEFAULT_CONSTRUCTOR_BODY.matches(node.getBody())) {
//
// Remove redundant default constructors.
//
final TypeDefinition declaringType = method.getDeclaringType();
if (declaringType != null) {
final boolean hasOtherConstructors = any(
declaringType.getDeclaredMethods(),
new Predicate<MethodDefinition>() {
@Override
public boolean test(final MethodDefinition m) {
return m.isConstructor() &&
!m.isSynthetic() &&
!StringUtilities.equals(m.getErasedSignature(), method.getErasedSignature());
}
}
);
if (!hasOtherConstructors) {