Search code examples
javaandroidgoogle-apilintandroid-lint

Custom Lint Rules - JavaScanner @Deprecated


I would like to write some custom lint rules for my company android project. I was reading a few tutorials and successfully created a sample rule.

Problem is that I was using a @Deprecated JavaScanner API. I was reading official google doc located here but it's not up to date. I tried to dig into exisiting rules, found this google git repository but it also uses deprecated APIs. So my questions are

1) Is there any up to date documentation out there, but I just simply can not find it?

2) Is there git repository of current lint rules available? So I could analise it?

Thanks!


Solution

  • Ok I've already found an JavaScanner replacement. It does not anwser 2 questions I've asked bellow but it solves deprecation interface problem so I have decided to post an answer.

    According to this google groups - API changed twice since JavaScanner.

    First change was to JavaPsiScanner but they "didn't advertise this widely, since I already knew that we wanted to switch over to UAST (which was still in development)"

    Second and final change is to UastScanner. So one should use it now for Java Classes.

    You can even find short documentation writen by Tor Norbye (7th comment from above)

    Edit: Sample UastDetector class