Community
Participate
Working Groups
Using generics in DOM APIs sounds as easy as turning "(element type: XXX)" comments into proper type arguments, but there are quite a few caveats: ChildPropertyDescriptor and ChildListPropertyDescriptor should also get a type parameter, so that APIs like ASTRewrite#getListRewrite(ASTNode, ChildListPropertyDescriptor) can return a properly-typed ListRewrite<T>. Some child list properties have type IExtendedModifier or IDocElement (bug 416586), which are not subtypes of ASTNode. We probably need a new super-interface IASTNode. But this introduces problems in all APIs that currently use ASTNode. A few helper methods like ASTNode#copySubtree(AST, ASTNode) or ASTRewrite#createCopyTarget(ASTNode) should get a method type parameter.
https://wiki.eclipse.org/Generify_A_Java_Project#Required_Projects contains a few helpful regular expressions for this undertaking. > ChildPropertyDescriptor and ChildListPropertyDescriptor should also get a type > parameter StructuralPropertyDescriptor probably also needs a type parameter <N extends IASTNode> for the nodeClass field. Then, the Child(List)PropertyDescriptor classes would get two type parameters. The only thing that this changes is everything. The "// stuff nodeClass at head of list for future ref" in ASTNode#createPropertyList(..) would make this part of ASTNodes' implementation effectively unchecked. Code like this should be replaced by a proper fluent builder: static { List properyList = new ArrayList(2); createPropertyList(BooleanLiteral.class, properyList); addProperty(BOOLEAN_VALUE_PROPERTY, properyList); PROPERTY_DESCRIPTORS = reapPropertyList(properyList); }
*** Bug 562669 has been marked as a duplicate of this bug. ***