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.

NPE when AA injects into a non-generated class #1207

@WonderCsabo

Description

@WonderCsabo

Steps to reproduce:

  1. Create an Activity, annotate with @EActivity
  2. Create MyPref interface, annotate with @SharedPref
  3. Inject MyPref_ mypref field into the Activity with @Pref
  4. Make sure not the generated class is in the manifest.

After that, AA will crash with NPE in the PrefHandler. This is because we do not generate the class, instead we print an error about wrong component name in the manifest. But the PrefHandler still runs, and thinks the generated class holder exists...

Stacktrace:

java.lang.NullPointerException
    at org.androidannotations.handler.PrefHandler.process(PrefHandler.java:75)
    at org.androidannotations.handler.PrefHandler.process(PrefHandler.java:36)
    at org.androidannotations.process.ModelProcessor.processThrowing(ModelProcessor.java:145)
    at org.androidannotations.process.ModelProcessor.process(ModelProcessor.java:129)
    at org.androidannotations.AndroidAnnotationProcessor.processAnnotations(AndroidAnnotationProcessor.java:242)
    at org.androidannotations.AndroidAnnotationProcessor.processThrowing(AndroidAnnotationProcessor.java:184)
    at org.androidannotations.AndroidAnnotationProcessor.process(AndroidAnnotationProcessor.java:112)

Example project demonstrating the issue. The issue can be reproduced both from command line and Eclipse.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions