Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Conversation

@DayS
Copy link
Contributor

@DayS DayS commented Jun 6, 2013

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
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
Copy link
Contributor Author

DayS commented Jun 6, 2013

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
Contributor

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

@DayS
Copy link
Contributor Author

DayS commented Jun 6, 2013

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

@DayS
Copy link
Contributor Author

DayS commented Jun 6, 2013

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
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
Copy link
Contributor Author

DayS commented Sep 20, 2013

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.

3 participants