Bug 543963 - If loading Annotation Processor (.factorypath) fails, error message is useless.
Summary: If loading Annotation Processor (.factorypath) fails, error message is useless.
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: APT (show other bugs)
Version: 4.10   Edit
Hardware: PC Mac OS X
: P3 normal with 4 votes (vote)
Target Milestone: ---   Edit
Assignee: Jay Arthanareeswaran CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-30 03:31 EST by Reinier Zwitserloot CLA
Modified: 2024-01-02 13:12 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Reinier Zwitserloot CLA 2019-01-30 03:31:56 EST
Eclipse loads annotation processors configured via a java project settings: "Java Compiler > Annotation Processing" section with its own VM (the VM used to start eclipse).

PROBLEM:
If loading the AP causes some exception to be thrown, eclipse eats this message. It is not visible anywhere (not in the error log, nor on the terminal if you run eclipse from terminal). Eclipse DOES apply an error marker on the entire project, but this error marker doesn't have the exception trace either, and has a rather uninformative error message.

The full message is:

Unable to load annotation processor factory 'fully.qualified.name.of.AnnotationProcessorClass' for project project.with.configured.ap

on element: The project
In folder: (Blank string)
Severity: Error
Location: the string "Annotation processor factory path" (as in, that exact string, not the actual path)

and that's it. No stack trace or any other hint.

Googling for this message mostly gets you red herrings (not something eclipse can fix short of writing a blog post, but this puts some mild pressure on fixing the issue).

HOW TO REPRODUCE:

You are upgrading your projects from JDK8 to, say, JDK11. You run your eclipse on a JRE8, but you've hooked up an OpenJDK11 impl and told eclipse that your own AP project is now OpenJDK11. You compile it, and then apply your freshly compiled annotation processor to some other projects in eclipse (right click project, "properties...", annotation processing, enable it, and point at the jar just made).

Then, this bug occurs: These class files (which are "-target 11") cannot be loaded by a JDK8. The uninformative error message appears, and the annotation processor is not applied when eclipse builds this project.

Separate from this, the error marker blinks into and out of existence seemingly randomly: When you close such a project (one with the error marker) and re-open it, _ALL_ such markers disappear for _ALL_ projects that have one, even if you close and re-open a project that is NOT a dependency of another project with such markers. The markers remain missing (even though the configured annotation processor did not run, so the lack of marker is itself a bug), until you for example touch the .factorypath file or open the project config, or just change any sourcefile in it, which causes eclipse to attempt to load the AP.

Given that this secondary issue only occurs when there is a problem with the AP, that part is a minor nag and becomes far less relevant once the primary issue (of uninformative error messaging) is taken care of.

NB: Whilst writing annotation processors and using them on your own projects is perhaps somewhat rare, if this bug occurs it's a wild goose chase to attempt to figure out what's going on. I find it hard to attempt to apply a severity to 'rarely happens, but if it happens, takes ages to chase down'.

suggested fix: Eclipse should update the message to INCLUDE the stack trace. At the very least, the stack trace of the failed classload should be put in the error log.
Comment 1 Jay Arthanareeswaran CLA 2019-02-13 02:25:39 EST
I will keep this on my plate, but can't promise yet about the timeline.
Comment 2 Eclipse Genie CLA 2021-02-03 12:52:16 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 3 Stanislav Spiridonov CLA 2021-05-23 09:37:34 EDT
The bug is actual. I see this message and no exceptions in workspace log
Comment 4 Steven Schlansker CLA 2021-09-27 20:31:09 EDT
I am facing this problem right now - upgraded my JVM, and now annotation processors will not load, but I have no clue what to debug next, since there is no useful error message. Very frustrating.
Comment 5 Jay Arthanareeswaran CLA 2021-09-28 06:35:32 EDT
(In reply to Steven Schlansker from comment #4)
> I am facing this problem right now - upgraded my JVM, and now annotation
> processors will not load, but I have no clue what to debug next, since there
> is no useful error message. Very frustrating.

Steven, can you confirm you see an error marker on the project as reported in comment #0. I will work on a fix to log the exception before creating the marker.
Comment 6 Steven Schlansker CLA 2021-09-28 17:50:04 EDT
I was for certain yesterday, that's how I tracked down this issue. (Un)Fortunately, I cannot reproduce today. I tried restarting Eclipse, reimporting projects, etc yesterday to no avail, but when I come back today, it's gone just as fast as it appeared.

So I'm glad that the issue is resolved for me for the moment, but hopefully it's a small change to help add diagnostics for the next time it happens. Thanks!
Comment 7 Eclipse Genie CLA 2023-09-19 02:14:29 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 8 Nathaniel Mills CLA 2024-01-02 13:12:03 EST
I'm seeing this problem with the latest 2023-Dec build... so it hasn't been resolved. In my case, it is complaining about:

Unable to load annotation processor factory 'M2_REPO/org/apache/commons/commons-text/1.10.0/commons-text-1.10.0.jar' for project MarkdownGenerator