An annotation processor for Java and Kotlin that will throw an error if @Deprecated code is found.
Deprecated code is usually removed on major releases. It can happen that we forget to remove deprecated code before shipping a new major version.
Best Before is here to handle those cases. By enabling the annotation processor during major versions, and failing the build if some deprecated code is found, one can ensure major versions are free of deprecated code.
Best Before is composed of two annotation processors:
bestbefore-processor-javawhich handlesjava.lang.Deprecatedbestbefore-processor-kotlinwhich handleskotlin.Deprecated, and needs to be used with KSP
Apply the dependency only if the version is a major version:
if (version.toString().contains(".0.0")) {
annotationProcessor 'com.github.gotson.bestbefore:bestbefore-processor-java:0.1.0'
ksp 'com.github.gotson.bestbefore:bestbefore-processor-kotlin:0.1.0'
}if (version.toString().contains(".0.0")) {
annotationProcessor("com.github.gotson.bestbefore:bestbefore-processor-java:0.1.0")
ksp("com.github.gotson.bestbefore:bestbefore-processor-kotlin:0.1.0")
}