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.

Honor Nullable/Nonnull method signature annotations when generating code #782

Description

@alexander-stepanov

Please copy Nullable/Nonnull annotations into the generated (via Background, UIThread annotations) method's signature to avoid code inspection warnings (e.g. in IDEA).

Activity

  1. DayS commented on Nov 7, 2013

    @DayS
    Contributor

    In fact, we should copy everything annotations with root package javax.annotation.

    EDIT: We'll work on this for 3.1

  2. yDelouis commented on Apr 28, 2014

    @yDelouis
    Contributor

    I think we should copy all annotations which are not coming from AA.
    I'm working on a PR.

  3. WonderCsabo commented on Apr 28, 2014

    @WonderCsabo
    Member

    I think we should copy all annotations which are not coming from AA.

    Hmm, are you sure? AA is integrating with other frameworks like Otto, etc. I am not sure copying everything will not mess up some of them.

  4. yDelouis commented on Apr 28, 2014

    @yDelouis
    Contributor

    The integration of Otto consist in copying @Produce and @Subscribe annotations in the generated class, so the behavior will be the same.
    More generally, all runtime annotations should be copied in the generated class so that the other framework won't even know that we are using AA and it should work fine.

    The issue appears when you are using two annotations processors.
    But, if you can specify the order of processing, you can have both frameworks working together.
    For example, if you use AA and johncarl81's parceler, and parceler is processing after AA, you can annotate a class with both @EBEan and @Parcel and it will work fine because parceler will process both the base and the generated class.

    About the frameworks integrated by AA, they are :

    • Otto : copying annotations will enable us to remove the integration (ProduceHandler and SubscribeHandler.
    • RoboGuice : There are annotations on fields, not method. So, there is no overriding so no problem.
    • GreenDroid, SherlockActionBar, HoloEverywhere : No annotations
    • OrmLite : It's not a common case to have a POJO being annotated with @EBean. But, if someone does it, it will need annotations to be copied to the generated class.

    I hope I didn't forgot any integrated frameworks.

  5. WonderCsabo commented on Apr 28, 2014

    @WonderCsabo
    Member

    Thanks for the detailed explanation!
    I think your are right.

    About Ormlite: It does not uses any method annotations, but one class annotation @DatabaseTable. That should be copied, too, if there is no annotation on the generated class, it will be persisted to another table, and use another DaoClass. But you are right: using any AA annotation on OrmLite-persisted classes is a bad practice and should be avoided.

  6. DayS commented on May 4, 2014

    @DayS
    Contributor

    More generally, all runtime annotations should be copied in the generated class so that the other framework won't even know that we are using AA and it should work fine.

    That's the idea :) This should work work fine.

  7. DayS commented on May 11, 2014

    @DayS
    Contributor

    This should be ok now :)

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions