Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Simple @SharedPref with APPLICATION_DEFAULT scope creates unused field #1030

Description

@nomis

With the following simple preferences interface, there is an unused "private Context context_" in the generated class that the compiler generates a warning for:

@SharedPref(value = Scope.APPLICATION_DEFAULT)
public interface Prefs {
String a();

String b();

}

Activity

  1. WonderCsabo commented on Jun 5, 2014

    @WonderCsabo
    Member

    This is normal. If you would use the keyRes parameter that field would be utilized. For simplicity, we always generate that field. Generally you should ignore warnings in generated classes.

  2. WonderCsabo commented on Jun 5, 2014

    @WonderCsabo
    Member

    By the way, it is easy to lazily generate that field. I'll create a PR soon to resolve this issue.

  3. WonderCsabo commented on Aug 22, 2014

    @WonderCsabo
    Member

    Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions