[JSR308] Constructor Annotation Inference
niko at alum.mit.edu
Thu Jan 15 16:17:47 EST 2009
> Before answering your email, I would like to mention a convention
> used within AnnotatedTypeFactory. Many methods in the class follow
> a naming convention: .fromFOO methods (e.g. fromTree,
> fromExpression) return types with only the annotations that the user
> explicitly inserted; .getAnnotatedType* methods (e.g.
> getAnnotatedType, getAnnotatedTypeFromTypeTree) return types with
> the annotations enforced in such trees whether explicitly inserted
> by the user or implicitly inserted by the checker.
Good to know. Perhaps I am using the wrong method. If I can't find a
better one, however, I will simply override fromExpression(). I have
to think about it a bit.
> In the checkers we have used so far, the receiver of a constructor
> isn't necessarily the type of the new class expression tree. For
> example, the constructor receiver is RAW according to the nullness
> checker, yet all new class trees are of type NonNull.
> If you can come up with a generalized proposal on how handle
> constructorFromUse(), we'll be happy to adopt it.
Yes, I agree that the code is correct as it is now --- it's not
obvious what the relation between constructorFromUse() and the
generated object is. I guess I will simply need to refactor the
inference code so it can be used from multiple contexts.
thanks for your help,
More information about the JSR308