roterdam / checker-framework

Automatically exported from code.google.com/p/checker-framework
Other
0 stars 0 forks source link

Add support for reading and storing non-type-qualifier annotations #383

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently, the StubParser only reads and stores type-qualifier annotations - 
annotations that have the @TypeQualifier meta-annotation. It would be desirable 
for it to read and store non-type-qualifier annotations too.

Original issue reported on code.google.com by pbsf...@gmail.com on 8 Dec 2014 at 2:34

GoogleCodeExporter commented 9 years ago
Can you point out where @TypeQualifier is used to limit the behavior of the 
StubParser? I don't see any code that does this.
I think the behavior is restricted to only read type annotations that are 
supported by the current checker - the behavior of every AnnotatedTypeMirror.
Can you explain in more detail what problem you see and what a fix for the 
problem is?

Original comment by wdi...@gmail.com on 8 Dec 2014 at 9:25

GoogleCodeExporter commented 9 years ago
Terminology:  
type-qualifier annotation (type qualifier): Any annotation with the 
@TypeQualifier meta-annotation regardless of the ElementTypes in its @Target 
annotation.

non-type-qualifier annotations: Any annotation without the @TypeQualifier 
meta-annotation regardless of the ElementTypes in its @Target annotation.

type annotation: Any annotation with @Target(TYPE_USE) and/or 
@Target(TYPE_PARAMETER)

declaration annotation: Any annotation where @Target contains ElementTypes 
other than TYPE_USE and TYPE_PARAMETER

Feature request:

Currently, the stub parser only stores type qualifiers supported by the current 
checker and all non-type-qualifier annotations on method, constructor, package, 
and type declarations.  The stub parser should be extended to store 
non-type-qualifier annotations in other locations including all type uses.

In order for this to be useful, annotated type factories will need some 
mechanism to store and retrieve these annotations.  

The Aliasing Checker requires this feature to implement @Leaked and 
@LeakedToResult as non-type-qualifier annotations. 

Original comment by Suzanne....@gmail.com on 9 Dec 2014 at 5:08

GoogleCodeExporter commented 9 years ago
Thanks for the clarification.

The distinction between having @TypeQualifier and not having @TypeQualifier 
currently doesn't make sense - that annotation is only used for documentation. 
We should separately discuss this and see whether we want to enforce 
@TypeQualifier in some way.

At the moment it makes sense to talk about type annotations that are supported 
by a particular checker and other type annotations.
This change would not be limited to the StubParser, but would need to touch 
either AnnotatedTypeMirror or the AnnotatedTypeFactories to expose 
non-supported type annotations somehow. I've removed the stub-references from 
the title.
I assume you want support for @Leaked and @LeakedToResult in normal source 
files, not just in stub files.

Original comment by wdi...@gmail.com on 9 Dec 2014 at 10:08