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?
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?