Bug 127462 - Add API to get parent of IAnnotationBinding and IMemberValuePairBinding
Summary: Add API to get parent of IAnnotationBinding and IMemberValuePairBinding
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-13 09:55 EST by Markus Keller CLA
Modified: 2006-02-13 09:58 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2006-02-13 09:55:53 EST
I20060213-0010

From bug 123470: 

For consistency, there should be API to get the parent of an IAnnotationBinding or an IMemberValuePairBinding:
- IMemberValuePairBinding#getDeclaringAnnotation(): IAnnotationBinding
- IAnnotationBinding#getDeclaringBinding(): IBinding

(In reply to bug 123470 comment #34)
> re:- IMemberValuePairBinding#getDeclaringAnnotation(): IAnnotationBinding
> An annotation is homogenous to a paramType or a message send. Arguments are
> not connected to the parent container. So I wouldn't add this one.

I disagree. An IMemberValuePairBinding has a unique parent, and there should be
a query to get that parent. We already have this for all other containment
relations, namely ITypeBinding#getPackage() and
IType/Variable/MethodBinding#getDeclaringClass/Method().
typeArgument -> parameterizedType and parameterType -> methodBinding are not
one-to-one mappings, and therefore it's clear that there's no link to a parent.

> re:- IAnnotationBinding#getDeclaringBinding(): IBinding
> What is that ? Isn't it a dup of #getAnnotationType() ?

No, like IType/Variable/MethodBinding#getDeclaringClass/Method(), this would
return the parent binding that has this IAnnotationBinding attached, i.e
binding.getAnnotations() would contain the receiver.