slackhq / slack-lints

A collection of custom Android/Kotlin lint checks we use in our Android and Kotlin code bases at Slack.
Apache License 2.0
225 stars 11 forks source link

Use kotlinx-metadata for more accurate Kotlin checks #75

Closed ZacSweers closed 1 year ago

ZacSweers commented 1 year ago

Resolves #53

This implements a new decorating SlackJavaEvaluator that leverages Kotlin Metadata to understand kotlin langauge features of externally compiled elements. This is important as these elements otherwise appear to lint as just plain Java classes. I've done a bunch of testing with this in the Slack Android repo, and the timings are always ~1ms, rarely exceeding it to 2ms. Just in case though, I've gated this behavior with a system property.

Currently this is only used in the DoNotMock checkers, but is usable in other future checkers.