[Checkers] Status and meetings

Daniel Wand daniel.wand at gmail.com
Fri Sep 12 06:55:49 EDT 2008


Hi

> To type-check a method invocation, your checker will override this method:
> 
>     public Void visitMethodInvocation(MethodInvocationTree node, Void p)
> 
> You can use its methods to get information about the method invocation.
> 
> I would expect, though, that you only need the type signature, not the
> name, of the method being invoked, so that you can check that the arguments
> are compatible with the parameters.
> 
> (If you had already figured this out, can you let me know where your
> problem lies?  That way I won't just repeat information you already know.)

Well, I actually did not want to check that the arguments are compatible
but that it is legal to call the method. Let say I have to methods
open() and use() and use() should only occur if open() has been called.
So as soon as open() is called on an object I need to change the
object's (to which the methods belong) type and when use() is called I
do need to check if the type of the object(to which the methods belong)
is correct. My problem is now how do I get the type of the object(to
which the methods belong) within visitMethodInvocation?

> 
> > - Annotations in front of methods seem to annotated the return type, is
> > there a way around that or do I misinterpret something? (e.g:
> > @Annotation public void foo() { ... } , everytime I visit a call to
> > foo() I will get the type @Annotation void) If I am annotating state
> > changes to a method I probably do not want the return type to be
> > annotated with those.
> 
> Please see
>   http://groups.csail.mit.edu/pag/jsr308/specification/java-annotation-design.html#htoc18
> and let me know whether that answers your questions.  If not, then please
> let me know how I can improve that part of the document.

Thanks.

> 
> > - Is there a way to annotate return statements? (I read something in JSR
> > 308 that annotations on statements are considered) This could be a nice
> > way to annotate flowsensetive state changes, which could be usefull e.g.
> > for iterators: verifying that next() ist only called if hasNext()
> > returns true.
> 
> Currently, there is no way tot annotate a statement.  See
>   http://groups.csail.mit.edu/pag/jsr308/specification/java-annotation-design.html#htoc27
> 
> (That is a possible future extension, but isn't currently supported.)  I'm
> not sure why an annotation on the return type wouldn't be adequate, though.

I was thinking about how to annotate a typestate automaton. So the
return type of the method must not be annotated. Or does the return type
also reflect the type of the object (to which the method belongs to)?

Daniel




More information about the checkers mailing list