Skip to content

Compiler warning in apps that don't use androidx.annotation:annotation #424

@jpd236

Description

@jpd236

(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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions