Community
Participate
Working Groups
BETA_JAVA8 MethodDeclaration needs updates for the ReceiverParameter in recent versions of the 308 grammar: ReceiverParameter: {VariableModifier} UnannType {Identifier .} this The current DOM API is based on the original grammar, which looked like this: Type [Identifier .] this Given that we now have a separate grammar rule and a third property, I think it's best to get rid of the "receiverType" and "receiverQualifier" properties in MethodDeclaration and instead add a new optional property "receiverParameter" of a new AST node type "ReceiverParameter" with properties - ChildListPropertyDescriptor(.., "modifiers", IExtendedModifier.class, ..) - ChildPropertyDescriptor(.., "type", Type.class, MANDATORY, ..) - ChildPropertyDescriptor(.., "qualifier", Name.class, OPTIONAL, ..)
org.eclipse.jdt.internal.compiler.ast.Receiver.qualifyingName already captures the full name, so no grammar changes are required.
Please hold any work on this until the 308 spec is finalized. The grammar will probably be changed to only allow {Annotation} instead of {VariableModifier}. Then, there are two ways how we could structure the DOM AST: a) still go the full way suggested in comment 0 b) just add annotations to the appropriate AnnotatableType in the receiverType (ensuring correct source ranges, see below) The {Identifier .} is also under dispute, so the qualifier property can maybe stay a SimpleName. (In reply to Markus Keller from bug 419748 comment #1) > I've added ASTConverter18Test#testParameterizedReceiverType(), but I had to > release it in an incomplete version since the source range of the outermost > ParameterizedType doesn't include the annotation. See the commented > //TODO: bad AST node structure: > for the remaining work to be done for this bug. Here's the example. The bug is that there's e.g. a SimpleType "@A X", but the parent of that node is only ParameterizedType "X<T>". import java.lang.annotation.*; public class X<T extends Exception> { class Y<K, V> { class Z { public Z(@A X<T>.@B Y<K, V> Y.this){ } public void foo(@B Y<K, V>.@C Z this){ } } } } @Target(ElementType.TYPE_USE) @interface A {} @Target(ElementType.TYPE_USE) @interface B {} @Target(ElementType.TYPE_USE) @interface C {}
The grammar is back to ReceiverParameter: {Annotation} UnannType [Identifier .] this I've verified that there's nothing left to do. Closing this bug.