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.

As asked, reporting Unexpected error. #616

Description

@Arynderquane

Well i was refactoring my code, specifically changing name to id inside layouts. Logically the code appeared to be messy everywhere and i'm not concerned by this error, but since you're asking, i'm reporting :)
I'm using version 2.7.1.

Unexpected error. Please report an issue on AndroidAnnotations, with the following content: java.lang.NullPointerException
at com.googlecode.androidannotations.helper.AnnotationHelper.extractAnnotationResIdValueParameter(AnnotationHelper.java:272)
at com.googlecode.androidannotations.helper.IdValidatorHelper.resIdsExist(IdValidatorHelper.java:45)
at com.googlecode.androidannotations.validation.ItemClickValidator.validate(ItemClickValidator.java:58)
at com.googlecode.androidannotations.validation.ModelValidator.validate(ModelValidator.java:56)
at com.googlecode.androidannotations.AndroidAnnotationProcessor.validateAnnotations(AndroidAnnotationProcessor.java:414)
at com.googlecode.androidannotations.AndroidAnnotationProcessor.processThrowing(AndroidAnnotationProcessor.java:364)
at com.googlecode.androidannotations.AndroidAnnotationProcessor.process(AndroidAnnotationProcessor.java:341)
at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.handleProcessor(RoundDispatcher.java:139)
at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.round(RoundDispatcher.java:110)
at org.eclipse.jdt.internal.compiler.apt.dispatch.BaseAnnotationProcessorManager.processAnnotations(BaseAnnotationProcessorManager.java:159)
at org.eclipse.jdt.internal.apt.pluggable.core.dispatch.IdeAnnotationProcessorManager.processAnnotations(IdeAnnotationProcessorManager.java:134)
at org.eclipse.jdt.internal.compiler.Compiler.processAnnotations(Compiler.java:820)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:434)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:365)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.compile(IncrementalImageBuilder.java:329)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:302)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.build(IncrementalImageBuilder.java:134)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildDeltas(JavaBuilder.java:265)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:193)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Activity

  1. DayS commented on Jun 6, 2013

    @DayS
    Contributor

    That's a known issue but since it's difficult to reproduce, the bug's still there...
    Thanks to your explanation, it seems it's happening during layout refactoring. Do you think you could try to reproduce this bug in a smaller project ?

  2. DayS commented on Jun 6, 2013

    @DayS
    Contributor

    Could you also provide the line of code on which the error was thrown ?

  3. DayS commented on Jun 6, 2013

    @DayS
    Contributor

    Ok, so... In fact, it's dead simple to reproduce :)

    Just create an activity like this :

    @EActivity(R.layout.activity_issue_616)
    public class ActivityIssue616 extends Activity {
        @Click(R.id.issue616Button)
        void buttonClicked() {
        }
    }

    With the layout :

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    
        <Button
            android:id="@+id/issue616Button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button" />
    
    </RelativeLayout>

    Then, we just have to rename the id attribute in the layout to see the error.

    As there is also a javac error because R.id.issue616Button is unkown, I think the annotation processing is still triggered but the method to extract annotation value seems to return null which is why we have a NullPointerException.
    As we have a compiler error, I think we should just check the value and return an empty array if it's null.

    Ho, and the bug is still here in 3.0

  4. ghost assigned on Jul 19, 2013
  5. DayS commented on Sep 20, 2013

    @DayS
    Contributor

    Should be fixed on 3.0

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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions