Compiler warning in apps that don't use androidx.annotation:annotation
- Dominant language
- Java
- Stars
- 3.4k
- Forks
- 751
- Avg merge
- 8h 49m
- Merged PRs (30d)
- 2
Description
(Forking from #402)
When an app depends on Volley (1.2.0+, possibly older as well), and doesn't also depend on androidx.annotation:annotation, the resulting build will have compiler warnings:
```
> Task :app:compileReleaseJavaWithJavac
warning: unknown enum constant Scope.LIBRARY_GROUP
reason: class file for androidx.annotation.RestrictTo$Scope not found
```
These are non-fatal by default, but become fatal if `-Werror` is enabled.
This doesn't seem to have bothered anyone through now, but it'd be nice to fix. The problem is that neither option seems great. `@RestrictTo` needs to be retained at class-time, not source-time, so it's technically not safe to depend on as compileOnly. However, androidx.annotation:annotation isn't available on Maven Central, so we'd be requiring a dependency on something that can't actually be obtained there, though in practice this may be perfectly reasonable since you can't build a Google app without artifacts from the Google repository anyway. Removing the annotation wouldn't be ideal since it'd provide no protection (however light) against applications depending on methods meant for internal use in Volley.
Contributor guide
Assessment
This issue has not been assessed yet.