class RecordAsTypeIdentifierNotAllowed extends VisitorValidator {

    private final String error;

    public RecordAsTypeIdentifierNotAllowed() {
        error = "'record' is a restricted identifier and cannot be used for type declarations";
    }

    @Override
    public void visit(Name n, ProblemReporter arg) {
        if ("record".equals(n.getIdentifier()) && !validUsage(n)) {
            arg.report(n, error);
        }
        super.visit(n, arg);
    }

    @Override
    public void visit(SimpleName n, ProblemReporter arg) {<FILL_FUNCTION_BODY>}

    private boolean validUsage(Node node) {
        if (!node.getParentNode().isPresent()) {
            return true;
        }
        Node parent = node.getParentNode().get();
        return !(parent instanceof TypeDeclaration);
    }
}

        if ("record".equals(n.getIdentifier()) && !validUsage(n)) {
            arg.report(n, error);
        }
        super.visit(n, arg);
    
<methods>public non-sealed void <init>() ,public void accept(com.github.javaparser.ast.Node, com.github.javaparser.ast.validator.ProblemReporter) <variables>