Skip to content

Android Parcelable unused import #1150

Closed

Description

@hannesa2

image

How to get rid of this unused imports ?

Activity

  1. hannesa2 commented on Aug 12, 2020

    @hannesa2
    ContributorAuthor

    This is the only place I found, but to be honest, I don't understand what's going on there

    JClass creatorType = jclass.owner().directClass("android.os.Parcelable.Creator").narrow(jclass);

  2. unkish commented on Nov 13, 2020

    @unkish
    Collaborator

    To get rid of the imports code would have to be modified.

    As android.os.Parcelable.Creator is a nested interface defined within android.os.Parcelable and latter is imported due to:

    jclass._implements(jclass.owner().directClass("android.os.Parcelable"));

    Changing

    JClass creatorType = jclass.owner().directClass("android.os.Parcelable.Creator").narrow(jclass);

    to:
    JClass creatorType = jclass.owner().directClass("Creator").narrow(jclass);
    would yield desired result.

    Note however that since ParcelableHelper::addCreator is public such a change could cause issues in case method would be invoked without call that would generate import of android.os.Parcelable

  3. eirnym commented on Mar 8, 2021

    @eirnym

    I don't see any reason against importing the android.os.Parcelable.Creator class, but I see no reason to have it twice in imports.

  4. hannesa2 commented on Mar 8, 2021

    @hannesa2
    ContributorAuthor

    If you use ktLint, you will run into errors with unused imports.
    It's simply noise

  5. added this to the 1.1.2 milestone on Apr 24, 2021
  6. added a commit that references this issue on Aug 8, 2024
    7b24986
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions