Skip to content

[java] Add new node for anonymous class declaration #905

@oowekyala

Description

@oowekyala

Proper metrics support for anonymous classes would need anonymous class declaration to be an ASTAnyTypeDeclaration. For now though, anonymous class declarations are just AllocationExpression or ASTEnumConstant with a body, which means that if those nodes extended ASTAnyTypeDeclaration, most of the time they wouldn't be an actual type declaration.

The cleanest solution I see to preserve the type safe API of the metrics framework would be to add a child node of these nodes that's there only if they declare an anonymous class (an ASTAnonymousClassDeclaration), which contains the ASTClassOrInterfaceBody. This requires a change to the AST, and would certainly break some rules, so we can't do that before 7.0.0.

Other ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    in:astAbout the AST structure or API, the parsing step

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions