[JSR308] AnnotatedTypeFactory.getSelfType

Mahmood Ali mahmood at MIT.EDU
Sat Aug 9 17:00:30 EDT 2008


On Aug 9, 2008, at 4:35 PM, Artemus Harper wrote:

> If I understand this correctly there will be a hook to annotate the  
> "self type" of enclosing classes?
Yes.  This is correct.

In your example (slightly modified):
> public class Foo
> {
>    public void method() [@A]
>    {
>       Object o = new Object() {
>            public void method2() [@B]
>            {
>               method3(); //line A
>               method4(); //line B
>               Foo.this.method4(); //line C
>            }
>            public void method3() { }
>        };
>    }
>    public void method4() { }
>
> }

In my opinion, getReceiver() when called on lines A, B, C, you should  
get:

line A   -->   @B Object
line B   -->   @A Foo
line C   -->   @A Foo

The Framework needs to reflect this.


> Will I be able to annotate the receiver on line A differently from  
> the receiver on line B or line C?

Yes, view the above.

I am sorry, but I didn't examined the other example you wrote to  
comment.

Regards,
Mahmood




More information about the JSR308 mailing list