Community
Participate
Working Groups
enum XXX { A { void foo() {}}; } - currently there is now API to access the typ[e binding of the anonymous enum created by { void foo() {}} To make anonymous enums more consistent with AnonymousClassDeclaration the EnumConstantDeclaration should have a subnode AnonymousEnumDeclaration. The AnonymousEnumDeclaration would then resolve to a ITypeBinding. As with type declarations there should be an abstract class AbstractAnonymousTypeDeclaration which works as a super class for AnonymousEnumDeclaration and AnonymousTypeDeclaration.
I agree. EnumConstantDeclaration should have the same form as ClassInstanceCreation nodes, which factors off the class body declarations into an AnonymousClassDeclaration. However, I don't see any real need to introduce a new AnonymousEnumDeclaration node type; the existing AnonymousClassDeclaration is sufficient.
Only having the AnonymousClassDeclaration is fine with me. I proposed the split since enums aren't classes <g>.
I've changed the API to add a new anonymousClassDeclaration property to EnumConstantDeclaration nodes. The old bodyDeclarations property has been deprecated, and will be deleted after 3.1 M4 (it is JLS3-specific API). (Note: Change affects NaiveASTFlattener as well.) Olivier, please fix up the AST converter. Martin, please fix up the AST rewriter.
fixed AST rewriter. Test currently disabled, until AST converter is updated (ASTRewritingMethodDeclTest.testEnumConstantDeclaration2()).
Fixed and released in HEAD. Regression test added. Updated test0026 in ASTConverter15Test.
Reopen to assign to Martin.
Martin, I enable your test case, but I had to add an extra empty line between two methods in the anonymous declaration for constant E5Add. Please check the test case and update it according to what you expect.
Thanks! The fix is correct, the empty line is what is to be expected. Back to Olivier to mark as fixed
Fixed and released in HEAD.
Verified for 3.1 M4 using build I200412142000 + ASTView 1.0.2.