eclipse-platform / eclipse.platform

https://eclipse.dev/eclipse/
Eclipse Public License 2.0
81 stars 112 forks source link

@PostConstruct sometimes not working when using higher jakarta inject version #1565

Open jukzi opened 1 month ago

jukzi commented 1 month ago

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 namejakarta.annotation.PostConstruct should matter

@HannesWell ?

HannesWell commented 1 month ago

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 namejakarta.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.

jukzi commented 1 month ago

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

merks commented 1 month ago

There are two in the target platform via Maven locations:

image

So I do expect there to be two.