I’m loving the new Lint API checks of ADT rev 17, but the new API Correctness Check has got me stumped. I have the following line of code:
Lint is reporting on this line:
Call requires API level 9 (current min is 4)
According to the documentation, I should just be able to add an annotation above the line, like so:
This, however, gives a syntax error in Java 1.6:
Syntax error on token(s), misplaced construct(s)
That’s not allowed in Java (until/if JSR 308 gets added); you can only annotate classes, methods, fields, parameters and variable declarations. It’s the latter that is shown in the docs. However, for bytecode based checks like the api check you may need to place it on a method or class (or anonymous/inner class). The Add Annotation quickfix for these warnings in lint should do the right thing.