Bug 558037 - Annotation processing fails on Java 13
Summary: Annotation processing fails on Java 13
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: APT (show other bugs)
Version: 4.13   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Generic inbox for the JDT-APT component CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-09 12:33 EST by Missing name CLA
Modified: 2023-11-24 14:00 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Missing name CLA 2019-12-09 12:33:53 EST
I've run into a problem while running Eclipse on Java 13.
We use the Velocity Annotation processor to generate code.
When Eclipse runs the plugin, it is throwing a:

java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
...
at org.eclipse.jdt.apt.core.internal.ClassServiceFactory.newInstance(ClassServiceFactory.java:30)
at org.eclipse.jdt.internal.apt.pluggable.core.dispatch.IdeAnnotationProcessorManager.discoverNextProcessor(IdeAnnotationProcessorManager.java:96)
at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.round(RoundDispatcher.java:119)
at org.eclipse.jdt.internal.compiler.apt.dispatch.BaseAnnotationProcessorManager.processAnnotations(BaseAnnotationProcessorManager.java:171)
at org.eclipse.jdt.internal.apt.pluggable.core.dispatch.IdeAnnotationProcessorManager.processAnnotations(IdeAnnotationProcessorManager.java:138)
at org.eclipse.jdt.internal.compiler.Compiler.processAnnotations(Compiler.java:934)

Since the java 13 runtime no longer includes the JAXB classes, it appears that Eclipse will need to be updated to include the relevant .jar.
The .jar is already in our Plugin project, but it appears that Eclipse is referencing it outside of our project.

Then I switched Eclipse back to Java 8, and our project, and our annotation plugin - and it still fails, though with a different exception:

java.lang.Exception: java.lang.NoClassDefFoundError: org/apache/velocity/context/Context
at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.handleProcessor(RoundDispatcher.java:172)
at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.round(RoundDispatcher.java:124)
at org.eclipse.jdt.internal.compiler.apt.dispatch.BaseAnnotationProcessorManager.processAnnotations(BaseAnnotationProcessorManager.java:171)
at org.eclipse.jdt.internal.apt.pluggable.core.dispatch.IdeAnnotationProcessorManager.processAnnotations(IdeAnnotationProcessorManager.java:138)
at org.eclipse.jdt.internal.compiler.Compiler.processAnnotations(Compiler.java:934)

That class is in one of the .jar files our annotation plugin uses.

This all worked fine with Eclipse 4.7.3a on Java 8.
Comment 1 Missing name CLA 2019-12-10 16:06:18 EST
Something seems to be wrong with the way the Annotation processing finds the needed .jar files.
In our app that uses Annotations, the Build path was referencing the "velocity-engine-core-2.0.jar" in the AnnotationPlugin project.

So the .jar was in the project classpath.

Since the error appeared to indicate that it couldn't find that .jar, I copied it to the project lib directory, and updated the Build path to the new location.

Now it can find it.

Note that in the previous version of Eclipse I was using, 4.7.3a, it was working fine with the .jar in the other project.
Comment 2 Missing name CLA 2019-12-13 13:14:28 EST
I should note that eclipse definitely DOES have the issue where it can't run under Java 13, as it is missing the jaxb support.
I'm having to run Eclipse 4.13 under Java 8 in order to get the annotation support to work.
Comment 3 Eclipse Genie CLA 2021-12-03 09:01:48 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 4 Eclipse Genie CLA 2023-11-24 14:00:36 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.