Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Fix a NullPointerException throwing during refactoring.#617

Merged
DayS merged 2 commits into
developandroidannotations/androidannotations:developfrom
616_ResIdNullPointerandroidannotations/androidannotations:616_ResIdNullPointerCopy head branch name to clipboard
Sep 20, 2013
Merged

Fix a NullPointerException throwing during refactoring.#617
DayS merged 2 commits into
developandroidannotations/androidannotations:developfrom
616_ResIdNullPointerandroidannotations/androidannotations:616_ResIdNullPointerCopy head branch name to clipboard

Conversation

@DayS

@DayS DayS commented Jun 6, 2013

Copy link
Copy Markdown
Contributor

Let the inform compiler the developer about the missing constant. This is related to #616, #612, and #530

…ler inform the developer about the missing constant
@JoanZapata

Copy link
Copy Markdown
Contributor

How is this ...

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

... related to that?

Progress: I was able to eliminate the error by removing all @click annotations in my project, even though there were no error markers at those annotations. Once I added one of the @click annotations, the error appeared again, this time located at the declaration of the class that contained the click listeners.

@DayS

DayS commented Jun 6, 2013

Copy link
Copy Markdown
Contributor Author

I think there are multiple way to have this error. The refactoring is one of them, but the cause is always the same : the id's field have a null value even if there is something written in the code.

In my case, because R.id.xxx doesn't exists, there is a Java compilation error on this. But the annotation processing seems to run anyway and considere the value is null.

In the case of #530, I suspect the same kind of thing. But as the error can shows up everywhere in the code, I think it's why this seems so weird.

I don't know if I'm clear but it's hard to understand without try to make it crash :)

@JoanZapata

Copy link
Copy Markdown
Contributor

And how does an empty array solve this problem ? Doesn't it break the generated classes ?

@DayS

DayS commented Jun 6, 2013

Copy link
Copy Markdown
Contributor Author

Just follows the hierarchy calls. I think it should works :-)

@DayS

DayS commented Jun 6, 2013

Copy link
Copy Markdown
Contributor Author

For example, for extractAnnotationResIdValueParameter, it's only called twice (here and here) and each time we check if the resulting resIds is empty or default. If so, we fallback to check with resName then method name.

@JoanZapata

Copy link
Copy Markdown
Contributor

I don't get it.

@Click(R.id.foo)
public void bar(){ }

If the error occurs, even with the fallbacks, what does the generated code looks like?

DayS added a commit that referenced this pull request Sep 20, 2013
Fix a NullPointerException throwing during refactoring.
@DayS DayS merged commit 04995ad into develop Sep 20, 2013
@DayS DayS deleted the 616_ResIdNullPointer branch September 20, 2013 15:21
@DayS

DayS commented Sep 20, 2013

Copy link
Copy Markdown
Contributor Author

This should works and reduce issues number by 20% :D

@DayS DayS mentioned this pull request Dec 23, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.