[Checkers] Status and meetings
Michael Ernst
mernst at csail.mit.edu
Fri Sep 12 00:46:31 EDT 2008
Daniel-
[In general, the public lists are the best place to send these questions,
but I've copied this one to the internal "checkers" mailing list.]
> - In my understanding I can use the BaseTypeVistor class of Checkers to
> perform type checking. Is there a way to find out the name of the method
> and the (annotated) type of the object while checking method invocation?
> I was planning to check the method's name and the object's state and
> then changing the object's state accordingly. Or do I have to use a
> different approach here?
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.)
> - 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.
> - 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.
-Mike
More information about the checkers
mailing list