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.

redundant cast to android.view.View #835

Description

@dant3

My code looks like this:

@EActivity(R.layout.my_activity)
public class MyActivity {
    @ViewById(R.id.login_activity__login_progress) protected View connectionProgressView;
   ...
}

Then I compile I getting this warning which leads to compile error due to -Werror

Activity

  1. WonderCsabo commented on Dec 29, 2013

    @WonderCsabo
    Member

    Actually there are warnings in lot of AA generated classes and these can be hard to filter or would overcomplicate the generation code. I think you should not use -Werror with AA. Altought this is only my opinion, @DayS can give you a proper answer.

  2. DayS commented on Dec 29, 2013

    @DayS
    Contributor

    I never understand the need to use -Werror option. Sometimes you have to use libraries which contains warnings and you just can't do much about it.
    I don't like to have warnings in my project neither, but code generation is complicated enough to write (mostly to read). So, we could make some work to remove all warnings but I think it's overkill.

    I'm closing this issue but we could continue to debate about it here :)

  3. dant3 commented on Dec 30, 2013

    @dant3
    Author

    Then library contains such code it's library author choice, but as a user I still want a freedom, in this case - whenever I should use -Werror or not - it's my choice.
    Take a look at lombok, their code contains tons of warning as well, but they at least suppress it with

    @SuppressWarnings("all")

    I suggest to do the same at least. As long as code with warnings works I don't care about it since I didn't written it by hand and it is there just to reduce boilerplate.

  4. WonderCsabo commented on Dec 30, 2013

    @WonderCsabo
    Member

    It's not a good idea to use this even on the generated code. The warning can be really serious, in that case the developer should fix the generation mechanism to avoid that warning. If the code uses this annotation, no warning will be raised, ever. Of course he can remove the annotation while developing and add back before committing, but it's a pain in the ass. Of course a deployment script could also do it, bad the whole idea smells bad for me. :)

  5. dant3 commented on Dec 30, 2013

    @dant3
    Author

    I see your point here. But people are lazy creatures. Having always lots of warnings makes us lazily ignore them, so its really easy to miss that critical warning you say about, if you always see tons of them. This is why some people use -Werror - to don't let laziness win, but fix troubles instead of lazy "ok, I'll deal with it later".

  6. WonderCsabo commented on Dec 30, 2013

    @WonderCsabo
    Member

    What IDE are you using? In Eclipse, you can filter warnings from different folders. See this SO answer for details. You can set the .apt_generated folder to be ignored, so you only get the compilation messages for your code.

  7. dant3 commented on Dec 31, 2013

    @dant3
    Author

    I'm using maven and build my app only using maven, so it does not matter that IDE I'm using. There is no such thing like suppressing warnings from folder for javac afaik.

  8. WonderCsabo commented on Dec 31, 2013

    @WonderCsabo
    Member

    I see. Then you have too options left: turning off -Werror or convincing @DayS . :)

  9. DayS commented on Dec 31, 2013

    @DayS
    Contributor

    I'll keep this in mind and check the amount of work to do.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions