eclipse.platform icon indicating copy to clipboard operation
eclipse.platform copied to clipboard

@PostConstruct sometimes not working when using higher jakarta inject version

Open jukzi opened this issue 1 year ago • 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 ?

jukzi avatar Sep 23 '24 16:09 jukzi

This should be fixed by https://github.com/eclipse-platform/eclipse.platform/pull/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.

HannesWell avatar Sep 23 '24 17:09 HannesWell

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

jukzi avatar Sep 24 '24 07:09 jukzi

There are two in the target platform via Maven locations:

image

So I do expect there to be two.

merks avatar Sep 24 '24 09:09 merks