eclipse-platform/eclipse.platform

@PostConstruct sometimes not working when using higher jakarta inject version

Opened this issue · 3 comments

org.eclipse.ui.tests.api.workbenchpart.DependencyInjectionViewTest.testDependencyInjectionLifecycle() fails locally.
Enabling debug output in org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(AnnotationProxy, Object, Class<?>, PrimaryObjectSupplier, PrimaryObjectSupplier, List<Class<?>>) reveals
annotated with

 "jakarta.annotation-api:3.0.0:jakarta.annotation.PostConstruct" but was looking for 
 "jakarta.annotation-api:2.1.1:jakarta.annotation.PostConstruct or jakarta.annotation-api:1.3.5:javax.annotation.PostConstruct"

I think it should not matter which API version is used. Only the qualified name jakarta.annotation.PostConstruct should matter

@HannesWell ?

This should be fixed by #1566.

But where do you get version 3 from? AFAICT it's not in the SDK TP yet.

I think it should not matter which API version is used. Only the qualified name jakarta.annotation.PostConstruct should matter

In general this is right, but I'm not sure that there are no corner cases where just comparing the FQN is not correct.
On the other hand I don't know if there's another good way to support version 2 and 3 of the jakarta.annotation in the same application, so we maybe have no other choice.

i have a OOmphed workspace and ended with this v3:
image

There are two in the target platform via Maven locations:

image

So I do expect there to be two.