https://github.com/gotson/best-before
Annotation processor raising errors for Deprecated annotations
https://github.com/gotson/best-before
Last synced: 4 months ago
JSON representation
Annotation processor raising errors for Deprecated annotations
- Host: GitHub
- URL: https://github.com/gotson/best-before
- Owner: gotson
- License: mit
- Created: 2023-07-20T07:06:38.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-25T02:45:03.000Z (over 1 year ago)
- Last Synced: 2025-02-25T03:30:09.732Z (over 1 year ago)
- Language: Java
- Homepage:
- Size: 96.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/gotson/best-before/actions/workflows/ci.yml)
[](https://search.maven.org/search?q=g:com.github.gotson.bestbefore)

# Best Before
An annotation processor for Java and Kotlin that will throw an error if `@Deprecated` code is found.
## But why?
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.
## How to use?
Best Before is composed of two annotation processors:
- `bestbefore-processor-java` which handles `java.lang.Deprecated`
- `bestbefore-processor-kotlin` which handles `kotlin.Deprecated`, and needs to be used with KSP
Apply the dependency only if the version is a major version:
### Gradle (Groovy)
```groovy
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'
}
```
### Gradle (Kotlin DSL)
```kotlin
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")
}
```