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.

@Pref not processed on project->clean #450

Description

@KoljaTM

I am using a @SharedPref, that I am referencing as a @PREF in other classes. It gets generated correctly on incremental builds, i.e. when I save the enclosing file. But on project->clean it is missing.
I have debugged a bit and found (I hope) the most likely culprit for my problem. When the annotations are processed, in the "clean-case", the @SharedPrefs class doesn't exist yet. This case is guarded against by this statement:
com.googlecode.androidannotations.helper.ValidatorHelper.isSharedPreference(Element, AnnotationElements, IsValid):Line 637

        if (type instanceof ErrorType) {

However this doesn't seem to work correctly (at least not in my eclipse version). Adding

        if (type instanceof ErrorType || type.getKind() == TypeKind.ERROR) {

and the same in com.googlecode.androidannotations.processing.PrefProcessor.process(Element, JCodeModel, EBeanHolder)
however did work. I would think that checking the Kind that is explicitly returned would be better than checking a class, but I don't know the details here very well.
Will you investigate this further on your own or do you want me to create a pull request?

Activity

  1. pyricau commented on Feb 27, 2013

    @pyricau
    Contributor

    Wow. I think you may have found the fix for a very old AA bug. I had this bug a long time ago, and I didn't have it recently (I don't use shared prefs a lot).

    You are very welcome to send a pull request and become an AndroidAnnotations contributor :) . Let us know if you want to do it, or if you prefer to leave that to us.

  2. pyricau commented on Feb 27, 2013

    @pyricau
    Contributor

    And once done, we should not forget to check if the #438 problem disappears.

  3. pyricau commented on Feb 27, 2013

    @pyricau
    Contributor

    Also note that the real fix would be to implement multiple processing round and delaying the processing of annotations that rely on code about to be generated. This is quite a piece of work though.

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