Annotations in Java can be restricted to some languages types like Method or Class. In ThirtyInch some of our annotations so are allowed but are useless and will not trigger the job for what they are intended.
This PR will bring Lint Checks will warn the dev about those cases right at the annotation usage.
How to Test
Play with the following scenarios:
Add a return type to fun showText(text: String) in the SampleView of the sample app
Add @DistinctUntilChanged and a return type to fun showText(text: String) in the SampleView of the sample app
Add @DistinctUntilChanged remove all parameters from fun showText(text: String) in the SampleView of the sample app
Add @DistinctUntilChanged to any method in an arbitary class which is not an interface
Add @CallOnMainThread to any method in an arbitary class which is not an interface
Add @DistinctUntilChanged to any method in an arbitary class which does not extends TiView
Add @CallOnMainThread to any method in an arbitary class which does not extends TiView
Use TI v0.10.0-SNAPSHOT of this branch in another project where the cases above might be existing or produce them
Note: Always do a rebuild if you do a change in the Sample Project as it might has to be recompiled to pick the lint checks up.
Merge Information
This PR builds on top of #187 so please do not merge this after #187 .
It will also ease the PR review a lot.
Note
Testing Lint Checks in the Sample Project did not work reliably for me. This seems to be an Android Studio Issue as quite often an Invalidate Caches and Restart help.
A commandline lint run were reporting the errors reliably.
Description
Annotations in Java can be restricted to some languages types like
Method
orClass
. In ThirtyInch some of our annotations so are allowed but are useless and will not trigger the job for what they are intended. This PR will bring Lint Checks will warn the dev about those cases right at the annotation usage.How to Test
Play with the following scenarios:
fun showText(text: String)
in theSampleView
of the sample app@DistinctUntilChanged
and a return type tofun showText(text: String)
in theSampleView
of the sample app@DistinctUntilChanged
remove all parameters fromfun showText(text: String)
in theSampleView
of the sample app@DistinctUntilChanged
to any method in an arbitary class which is not an interface@CallOnMainThread
to any method in an arbitary class which is not an interface@DistinctUntilChanged
to any method in an arbitary class which does not extendsTiView
@CallOnMainThread
to any method in an arbitary class which does not extendsTiView
0.10.0-SNAPSHOT
of this branch in another project where the cases above might be existing or produce themNote: Always do a rebuild if you do a change in the Sample Project as it might has to be recompiled to pick the lint checks up.
Merge Information
This PR builds on top of #187 so please do not merge this after #187 . It will also ease the PR review a lot.
Note
Testing Lint Checks in the Sample Project did not work reliably for me. This seems to be an Android Studio Issue as quite often an
Invalidate Caches and Restart
help. A commandline lint run were reporting the errors reliably.