Open FagnerMartinsBrack opened 9 years ago
Hi, this occasionally happens when there are compiler errors on a field. We get elements from javac as an annotation processor, and when there are compiler errors, javac for some reason also returns non related elements (that are erroneous, and have null properties as you can see by the NPE).
Could you maybe check to see if there are no uncommitted changes?
If there are errors like @NoCache is not an annotation type
, that is a compiler error
Hi @Shredder121, thanks for the answer!
No, there is no uncommited changes and eclipse doesn't point any compile error. But maybe this is related to the fact org.jboss.resteasy.annotations.cache.NoCache
represents a package inside an artifact that is not present physically in the project, Eclipse adds the JBoss libraries to the workspace in order to avoid compile errors, but those classes are available in the JBoss server at runtime.
I will take a look for any evidence that this is indeed what is causing this problem.
In the mean time, do you agree this is an abstraction leak from apt-maven-plugin? It is pretty hard to infer a classpath issue from the NPE error message, do you think it is possible to provide a better message for this problem?
Note: I vaguely remember of something like this happening a long time ago, but the root cause was something else.
Yeah, the problem was really related to my classpath. Maven didn't know about my dependencies that were added by JBoss Tools. To fix this I removed the eclipse dependencies to see compile errors in eclipse before running the build.
Here is the build that fixes the issue: https://travis-ci.org/FagnerMartinsBrack/WebStories/builds/54607699
But I believe the issue still stands, is there a way to provide a clearer error message to avoid this abstraction leak? Or there's a limitation that prevents you to do so?
I see you mentioned:
when there are compiler errors, javac for some reason also returns non related elements
Is there a workaround that could provide a better error message? Maybe detect the NPE and do something about that?
Thanks again!
Yes, I believe there is a workaround for exactly that.
If you ask for all elements annotated with @ImpossibleAnnotation
you could filter out the bogus elements.
You can then precisely say which elements are at fault.
I still have to see if that is practical, but it looks like a very reproducible way of going about this.
As for the clearer error message, I agree that it should be done, and a way back (with PR #34) I wanted to add support for 'generic' messages from javac/apt. I have some code that does this, just not the effective code that prints the actual error, since I still had to see if it was practical or not.
Well then, it seems at least this was useful to document a valid use case :D
Hi @timowest,
I am sorry to bother but something very strange started happening in my build today related to the apt plugin, here is the offending build log: https://travis-ci.org/FagnerMartinsBrack/WebStories/builds/54536967
it throws an "execute error" when executing the "--- apt-maven-plugin:1.1.1:process (default)" goal:
This happened exactly after the following commit: https://github.com/FagnerMartinsBrack/WebStories/commit/11ebada01824777391d6f56097cab85bc548c884
Now, here is the problem: I have no idea where to start looking for it. This clearly seems to be happening due to some abstraction leak, but since I don't understand Maven and apt-maven-plugin internals, I have no idea where to start looking!
Do you have any idea of what could be happening in this case, maybe just to have something for me to look into? Could this be related to something that was already reported?
Local system data (if relevant):
pom.xml:
NOTE: I didn't started yet to create a reduced test case in hope you could find the root cause by the symptoms.
Thanks.