diff --git a/debug/org.eclipse.debug.ui.launchview/META-INF/MANIFEST.MF b/debug/org.eclipse.debug.ui.launchview/META-INF/MANIFEST.MF
index 5a99768d0fb..a0cd1791f88 100644
--- a/debug/org.eclipse.debug.ui.launchview/META-INF/MANIFEST.MF
+++ b/debug/org.eclipse.debug.ui.launchview/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.debug.ui.launchview;singleton:=true
-Bundle-Version: 1.1.200.qualifier
+Bundle-Version: 1.1.300.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
@@ -13,8 +13,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.e4.ui.di,
org.eclipse.e4.ui.services
Bundle-RequiredExecutionEnvironment: JavaSE-17
-Import-Package: javax.annotation;version="[1.0.0,2.0.0)",
- javax.inject;version="[1.0.0,2.0.0)"
+Import-Package: jakarta.annotation;version="[2.0.0,3.0.0)",
+ jakarta.inject;version="[2.0.0,3.0.0)"
Bundle-ActivationPolicy: lazy
Service-Component: OSGI-INF/org.eclipse.debug.ui.launchview.internal.model.LaunchViewModel.xml,
OSGI-INF/org.eclipse.debug.ui.launchview.internal.impl.DebugCoreProvider.xml
diff --git a/debug/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/LaunchViewImpl.java b/debug/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/LaunchViewImpl.java
index ffcbc24a21d..d05362ff5d5 100644
--- a/debug/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/LaunchViewImpl.java
+++ b/debug/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/LaunchViewImpl.java
@@ -23,10 +23,6 @@
import java.util.function.Supplier;
import java.util.stream.Collectors;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.inject.Inject;
-
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -61,6 +57,10 @@
import org.eclipse.ui.dialogs.FilteredTree;
import org.eclipse.ui.dialogs.PatternFilter;
+import jakarta.annotation.PostConstruct;
+import jakarta.annotation.PreDestroy;
+import jakarta.inject.Inject;
+
public class LaunchViewImpl implements Supplier> {
private static final String CONTEXT_MENU_ID = "LaunchViewContextMenu"; //$NON-NLS-1$
diff --git a/runtime/bundles/org.eclipse.e4.core.contexts/META-INF/MANIFEST.MF b/runtime/bundles/org.eclipse.e4.core.contexts/META-INF/MANIFEST.MF
index d1e7d07c38f..80aa2e6bc5b 100644
--- a/runtime/bundles/org.eclipse.e4.core.contexts/META-INF/MANIFEST.MF
+++ b/runtime/bundles/org.eclipse.e4.core.contexts/META-INF/MANIFEST.MF
@@ -1,14 +1,15 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.e4.core.contexts
-Bundle-Version: 1.12.300.qualifier
+Bundle-Version: 1.12.400.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.e4.core.di
Bundle-RequiredExecutionEnvironment: JavaSE-17
-Import-Package: javax.inject;version="[1.0.0,2.0.0)",
+Import-Package: jakarta.inject;version="[2.0.0,3.0.0)",
+ javax.inject;version="[1.0.0,2.0.0)",
org.osgi.framework;version="[1.5.0,2.0.0)",
org.osgi.service.event;version="[1.3.0,2.0.0)"
Export-Package: org.eclipse.e4.core.contexts;version="1.7.0",
diff --git a/runtime/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/Active.java b/runtime/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/Active.java
index 3bac1597925..be16fbfd1c8 100644
--- a/runtime/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/Active.java
+++ b/runtime/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/Active.java
@@ -18,18 +18,18 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import javax.inject.Inject;
-import javax.inject.Qualifier;
/**
- * This annotation can be added to injectable fields ands methods
- * to indicate that the injected value should come from the active context.
+ * This annotation can be added to injectable fields ands methods to indicate
+ * that the injected value should come from the active context.
*
- * @see Inject
+ * @see javax.inject.Inject
+ * @see jakarta.inject.Inject
* @see IEclipseContext#activate
* @since 1.3
*/
-@Qualifier
+@javax.inject.Qualifier
+@jakarta.inject.Qualifier
@Documented
@Target({ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
diff --git a/runtime/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ContextObjectSupplier.java b/runtime/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ContextObjectSupplier.java
index bd4b0e9e8d0..c49528b6520 100644
--- a/runtime/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ContextObjectSupplier.java
+++ b/runtime/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ContextObjectSupplier.java
@@ -19,7 +19,6 @@
import java.lang.reflect.Type;
import java.util.Objects;
import java.util.Stack;
-import javax.inject.Named;
import org.eclipse.e4.core.contexts.Active;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.contexts.RunAndTrack;
@@ -189,8 +188,12 @@ else if (targetContext.containsKey(keys[i]))
}
private String getKey(IObjectDescriptor descriptor) {
- if (descriptor.hasQualifier(Named.class)) {
- Named namedAnnotation = descriptor.getQualifier(Named.class);
+ if (descriptor.hasQualifier(javax.inject.Named.class)) {
+ javax.inject.Named namedAnnotation = descriptor.getQualifier(javax.inject.Named.class);
+ return namedAnnotation.value();
+ }
+ if (descriptor.hasQualifier(jakarta.inject.Named.class)) {
+ jakarta.inject.Named namedAnnotation = descriptor.getQualifier(jakarta.inject.Named.class);
return namedAnnotation.value();
}
Type elementType = descriptor.getDesiredType();
diff --git a/runtime/bundles/org.eclipse.e4.core.di.annotations/META-INF/MANIFEST.MF b/runtime/bundles/org.eclipse.e4.core.di.annotations/META-INF/MANIFEST.MF
index e2bb00c4070..df1ef997d2f 100644
--- a/runtime/bundles/org.eclipse.e4.core.di.annotations/META-INF/MANIFEST.MF
+++ b/runtime/bundles/org.eclipse.e4.core.di.annotations/META-INF/MANIFEST.MF
@@ -2,9 +2,10 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.e4.core.di.annotations
-Bundle-Version: 1.8.100.qualifier
+Bundle-Version: 1.8.200.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-17
Export-Package: org.eclipse.e4.core.di.annotations;version="1.6.0"
-Import-Package: javax.inject;version="[1.0.0,2.0.0)"
+Import-Package: jakarta.inject;version="[2.0.0,3.0.0)",
+ javax.inject;version="[1.0.0,2.0.0)"
Bundle-Vendor: %Bundle-Vendor
Automatic-Module-Name: org.eclipse.e4.core.di.annotations
diff --git a/runtime/bundles/org.eclipse.e4.core.di.annotations/src/org/eclipse/e4/core/di/annotations/Creatable.java b/runtime/bundles/org.eclipse.e4.core.di.annotations/src/org/eclipse/e4/core/di/annotations/Creatable.java
index 0f8c56ccc5a..20a1fc91442 100644
--- a/runtime/bundles/org.eclipse.e4.core.di.annotations/src/org/eclipse/e4/core/di/annotations/Creatable.java
+++ b/runtime/bundles/org.eclipse.e4.core.di.annotations/src/org/eclipse/e4/core/di/annotations/Creatable.java
@@ -18,13 +18,13 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import javax.inject.Qualifier;
/**
* Specifies that the target class can be created by an injector as needed.
* @since 1.3
*/
-@Qualifier
+@javax.inject.Qualifier
+@jakarta.inject.Qualifier
@Documented
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
diff --git a/runtime/bundles/org.eclipse.e4.core.di.annotations/src/org/eclipse/e4/core/di/annotations/Optional.java b/runtime/bundles/org.eclipse.e4.core.di.annotations/src/org/eclipse/e4/core/di/annotations/Optional.java
index ac7db269365..96ae8c6c10e 100644
--- a/runtime/bundles/org.eclipse.e4.core.di.annotations/src/org/eclipse/e4/core/di/annotations/Optional.java
+++ b/runtime/bundles/org.eclipse.e4.core.di.annotations/src/org/eclipse/e4/core/di/annotations/Optional.java
@@ -21,8 +21,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-import javax.inject.Qualifier;
-
/**
* This annotation can be applied to methods, fields, and parameters to mark
* them as optional for the dependency injection. Typically, if the injector is
@@ -53,7 +51,8 @@
*
* @since 1.3
*/
-@Qualifier
+@javax.inject.Qualifier
+@jakarta.inject.Qualifier
@Documented
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
@Retention(RUNTIME)
diff --git a/runtime/bundles/org.eclipse.e4.core.di.extensions/META-INF/MANIFEST.MF b/runtime/bundles/org.eclipse.e4.core.di.extensions/META-INF/MANIFEST.MF
index 7d6281367f4..53bd676b15e 100644
--- a/runtime/bundles/org.eclipse.e4.core.di.extensions/META-INF/MANIFEST.MF
+++ b/runtime/bundles/org.eclipse.e4.core.di.extensions/META-INF/MANIFEST.MF
@@ -3,10 +3,11 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.e4.core.di.extensions;singleton:=true
-Bundle-Version: 0.18.0.qualifier
+Bundle-Version: 0.18.100.qualifier
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-17
Export-Package: org.eclipse.e4.core.di.extensions;version="0.16.0"
Bundle-Localization: fragment
-Import-Package: javax.inject;version="[1.0.0,2.0.0)"
+Import-Package: jakarta.inject;version="[2.0.0,3.0.0)",
+ javax.inject;version="[1.0.0,2.0.0)"
Automatic-Module-Name: org.eclipse.e4.core.di.extensions
diff --git a/runtime/bundles/org.eclipse.e4.core.di.extensions/src/org/eclipse/e4/core/di/extensions/EventTopic.java b/runtime/bundles/org.eclipse.e4.core.di.extensions/src/org/eclipse/e4/core/di/extensions/EventTopic.java
index 2a0848a6264..a571d72639c 100644
--- a/runtime/bundles/org.eclipse.e4.core.di.extensions/src/org/eclipse/e4/core/di/extensions/EventTopic.java
+++ b/runtime/bundles/org.eclipse.e4.core.di.extensions/src/org/eclipse/e4/core/di/extensions/EventTopic.java
@@ -19,7 +19,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import javax.inject.Qualifier;
/**
* This annotation can be applied to arguments and fields that want to receive notifications on the
@@ -46,7 +45,8 @@
*
* @since 0.16
*/
-@Qualifier
+@jakarta.inject.Qualifier
+@javax.inject.Qualifier
@Documented
@Target({ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
diff --git a/runtime/bundles/org.eclipse.e4.core.di.extensions/src/org/eclipse/e4/core/di/extensions/OSGiBundle.java b/runtime/bundles/org.eclipse.e4.core.di.extensions/src/org/eclipse/e4/core/di/extensions/OSGiBundle.java
index 8c764564579..b8e68ac79a2 100644
--- a/runtime/bundles/org.eclipse.e4.core.di.extensions/src/org/eclipse/e4/core/di/extensions/OSGiBundle.java
+++ b/runtime/bundles/org.eclipse.e4.core.di.extensions/src/org/eclipse/e4/core/di/extensions/OSGiBundle.java
@@ -18,7 +18,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import javax.inject.Qualifier;
/**
* A method or field of type {@link org.osgi.framework.BundleContext} and
@@ -53,7 +52,8 @@
*
* @since 0.16
*/
-@Qualifier
+@javax.inject.Qualifier
+@jakarta.inject.Qualifier
@Documented
@Target({ElementType.PARAMETER, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
diff --git a/runtime/bundles/org.eclipse.e4.core.di.extensions/src/org/eclipse/e4/core/di/extensions/Preference.java b/runtime/bundles/org.eclipse.e4.core.di.extensions/src/org/eclipse/e4/core/di/extensions/Preference.java
index c8eb38e9fdf..539e6d29f9e 100644
--- a/runtime/bundles/org.eclipse.e4.core.di.extensions/src/org/eclipse/e4/core/di/extensions/Preference.java
+++ b/runtime/bundles/org.eclipse.e4.core.di.extensions/src/org/eclipse/e4/core/di/extensions/Preference.java
@@ -18,12 +18,12 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import javax.inject.Qualifier;
/**
* @since 0.16
*/
-@Qualifier
+@javax.inject.Qualifier
+@jakarta.inject.Qualifier
@Documented
@Target({ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
diff --git a/runtime/bundles/org.eclipse.e4.core.di.extensions/src/org/eclipse/e4/core/di/extensions/Service.java b/runtime/bundles/org.eclipse.e4.core.di.extensions/src/org/eclipse/e4/core/di/extensions/Service.java
index f8f5158b261..2d45c2ae2de 100644
--- a/runtime/bundles/org.eclipse.e4.core.di.extensions/src/org/eclipse/e4/core/di/extensions/Service.java
+++ b/runtime/bundles/org.eclipse.e4.core.di.extensions/src/org/eclipse/e4/core/di/extensions/Service.java
@@ -18,14 +18,14 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import javax.inject.Qualifier;
/**
* Annotation to use with DI to support dynamics and multiple services
*
* @since 0.16
*/
-@Qualifier
+@javax.inject.Qualifier
+@jakarta.inject.Qualifier
@Documented
@Target({ ElementType.FIELD, ElementType.PARAMETER })
@Retention(RetentionPolicy.RUNTIME)
diff --git a/runtime/bundles/org.eclipse.e4.core.di/META-INF/MANIFEST.MF b/runtime/bundles/org.eclipse.e4.core.di/META-INF/MANIFEST.MF
index e4e8ea4310c..7c67322d83a 100644
--- a/runtime/bundles/org.eclipse.e4.core.di/META-INF/MANIFEST.MF
+++ b/runtime/bundles/org.eclipse.e4.core.di/META-INF/MANIFEST.MF
@@ -15,6 +15,8 @@ Export-Package: org.eclipse.e4.core.di;version="1.7.0",
Require-Bundle: org.eclipse.e4.core.di.annotations;bundle-version="[1.4.0,2.0.0)";visibility:=reexport
Import-Package: javax.annotation;version="[1.3.5,2.0.0)",
javax.inject;version="[1.0.0,2.0.0)",
+ jakarta.inject;version="[2,3)",
+ jakarta.annotation;version="[2,3)",
org.eclipse.osgi.framework.log;version="1.1.0",
org.osgi.framework;version="[1.8.0,2.0.0)",
org.osgi.util.tracker;version="[1.5.1,2.0.0)"
diff --git a/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/di/suppliers/IObjectDescriptor.java b/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/di/suppliers/IObjectDescriptor.java
index 490026c19b9..5fcd714a752 100644
--- a/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/di/suppliers/IObjectDescriptor.java
+++ b/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/di/suppliers/IObjectDescriptor.java
@@ -15,7 +15,6 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
-import javax.inject.Qualifier;
/**
* This interface describes objects created by the dependency injection.
@@ -24,7 +23,7 @@
* set of optional qualifiers.
*
*
- * @see Qualifier
+ * @see javax.inject.Qualifier
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
* @since 1.7
diff --git a/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ClassRequestor.java b/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ClassRequestor.java
index b2d128931c6..79c0cfd2315 100644
--- a/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ClassRequestor.java
+++ b/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ClassRequestor.java
@@ -13,8 +13,8 @@
*******************************************************************************/
package org.eclipse.e4.core.internal.di;
+import jakarta.inject.Named;
import java.lang.reflect.Field;
-import javax.inject.Named;
import org.eclipse.e4.core.di.IInjector;
import org.eclipse.e4.core.di.InjectionException;
import org.eclipse.e4.core.di.annotations.Optional;
diff --git a/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/InjectorImpl.java b/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/InjectorImpl.java
index 70a5d0e3ddd..55fd0155d50 100644
--- a/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/InjectorImpl.java
+++ b/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/InjectorImpl.java
@@ -27,6 +27,7 @@
import java.security.CodeSource;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
@@ -38,12 +39,6 @@
import java.util.Set;
import java.util.WeakHashMap;
import java.util.stream.Stream;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
import org.eclipse.e4.core.di.IBinding;
import org.eclipse.e4.core.di.IInjector;
import org.eclipse.e4.core.di.InjectionException;
@@ -137,9 +132,13 @@ private void internalInject(Object object, PrimaryObjectSupplier objectSupplier,
}
rememberInjectedObject(object, objectSupplier);
- // We call @PostConstruct after injection. This means that is is called
+ // We call @javax.annotation.PostConstruct after injection. This means that is
+ // is called
// as a part of both #make() and #inject().
- processAnnotated(PostConstruct.class, object, object.getClass(), objectSupplier, tempSupplier, new ArrayList<>(5));
+ processAnnotated(javax.annotation.PostConstruct.class, object, object.getClass(), objectSupplier, tempSupplier,
+ new ArrayList<>(5));
+ processAnnotated(jakarta.annotation.PostConstruct.class, object, object.getClass(), objectSupplier,
+ tempSupplier, new ArrayList<>(5));
// remove references to the temporary suppliers
for (Requestor> requestor : requestors) {
@@ -181,7 +180,10 @@ public void uninject(Object object, PrimaryObjectSupplier objectSupplier) {
try {
if (!forgetInjectedObject(object, objectSupplier))
return; // not injected at this time
- processAnnotated(PreDestroy.class, object, object.getClass(), objectSupplier, null, new ArrayList<>(5));
+ processAnnotated(javax.annotation.PreDestroy.class, object, object.getClass(), objectSupplier, null,
+ new ArrayList<>(5));
+ processAnnotated(jakarta.annotation.PreDestroy.class, object, object.getClass(), objectSupplier, null,
+ new ArrayList<>(5));
ArrayList> requestors = new ArrayList<>();
processClassHierarchy(object, objectSupplier, null, true /* track */, false /* inverse order */, requestors);
@@ -351,7 +353,8 @@ private Object internalMake(Class> clazz, PrimaryObjectSupplier objectSupplier
if (shouldDebug)
classesBeingCreated.add(clazz);
- boolean isSingleton = isAnnotationPresent(clazz, Singleton.class);
+ boolean isSingleton = isAnyAnnotationPresent(clazz,
+ List.of(javax.inject.Singleton.class, jakarta.inject.Singleton.class));
if (isSingleton) {
synchronized (singletonCache) {
if (singletonCache.containsKey(clazz))
@@ -372,7 +375,9 @@ private Object internalMake(Class> clazz, PrimaryObjectSupplier objectSupplier
continue;
// unless this is the default constructor, it has to be tagged
- if (!isAnnotationPresent(constructor, Inject.class) && constructor.getParameterTypes().length != 0)
+ if (!isAnyAnnotationPresent(constructor,
+ List.of(javax.inject.Inject.class, jakarta.inject.Inject.class))
+ && constructor.getParameterTypes().length != 0)
continue;
ConstructorRequestor requestor = new ConstructorRequestor(constructor, this, objectSupplier, tempSupplier);
@@ -432,7 +437,10 @@ public void disposed(PrimaryObjectSupplier objectSupplier) {
Object object = objects[i];
if (!forgetInjectedObject(object, objectSupplier))
continue; // not injected at this time
- processAnnotated(PreDestroy.class, object, object.getClass(), objectSupplier, null, new ArrayList<>(5));
+ processAnnotated(javax.annotation.PreDestroy.class, object, object.getClass(), objectSupplier, null,
+ new ArrayList<>(5));
+ processAnnotated(jakarta.annotation.PreDestroy.class, object, object.getClass(), objectSupplier, null,
+ new ArrayList<>(5));
}
forgetSupplier(objectSupplier);
}
@@ -681,8 +689,9 @@ private boolean processFields(Object userObject, PrimaryObjectSupplier objectSup
continue;
injectedStatic = true;
}
- if (!isAnnotationPresent(field, Inject.class))
+ if (!isAnyAnnotationPresent(field, List.of(javax.inject.Inject.class, jakarta.inject.Inject.class))) {
continue;
+ }
requestors.add(new FieldRequestor(field, this, objectSupplier, tempSupplier, userObject, track));
}
return injectedStatic;
@@ -723,7 +732,7 @@ private boolean processMethods(final Object userObject, PrimaryObjectSupplier ob
}
injectedStatic = true;
}
- if (!isAnnotationPresent(method, Inject.class)) {
+ if (!isAnyAnnotationPresent(method, List.of(javax.inject.Inject.class, jakarta.inject.Inject.class))) {
continue;
}
requestors.add(new MethodRequestor(method, this, objectSupplier, tempSupplier, userObject, track));
@@ -839,7 +848,7 @@ private Class> getProviderType(Type type) {
if (!(type instanceof ParameterizedType))
return null;
Type rawType = ((ParameterizedType) type).getRawType();
- if (!Provider.class.equals(rawType))
+ if (!javax.inject.Provider.class.equals(rawType) && !jakarta.inject.Provider.class.equals(rawType))
return null;
Type[] actualTypes = ((ParameterizedType) type).getActualTypeArguments();
if (actualTypes.length != 1)
@@ -888,8 +897,11 @@ private Binding findBinding(IObjectDescriptor descriptor) {
return null;
Set collection = bindings.get(desiredClass);
String desiredQualifierName = null;
- if (descriptor.hasQualifier(Named.class)) {
- Named namedAnnotation = descriptor.getQualifier(Named.class);
+ if (descriptor.hasQualifier(jakarta.inject.Named.class)) {
+ jakarta.inject.Named namedAnnotation = descriptor.getQualifier(jakarta.inject.Named.class);
+ desiredQualifierName = namedAnnotation.value();
+ } else if (descriptor.hasQualifier(javax.inject.Named.class)) {
+ javax.inject.Named namedAnnotation = descriptor.getQualifier(javax.inject.Named.class);
desiredQualifierName = namedAnnotation.value();
} else {
Annotation[] annotations = descriptor.getQualifiers();
@@ -993,6 +1005,16 @@ public void setDefaultSupplier(PrimaryObjectSupplier objectSupplier) {
defaultSupplier = objectSupplier;
}
+ private boolean isAnyAnnotationPresent(AnnotatedElement annotatedElement,
+ Collection> annotation) {
+ for (Class extends Annotation> a : annotation) {
+ if (isAnnotationPresent(annotatedElement, a)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
private boolean isAnnotationPresent(AnnotatedElement annotatedElement,
Class extends Annotation> annotation) {
Map cache = annotationsPresent.get(annotation);
diff --git a/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ObjectDescriptor.java b/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ObjectDescriptor.java
index 50051990228..e03d80932a3 100644
--- a/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ObjectDescriptor.java
+++ b/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ObjectDescriptor.java
@@ -17,7 +17,6 @@
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
-import javax.inject.Qualifier;
import org.eclipse.e4.core.di.suppliers.IObjectDescriptor;
public class ObjectDescriptor implements IObjectDescriptor {
@@ -97,7 +96,8 @@ private Annotation[] qualifiers(Annotation[] allAnnotations) {
Annotation[] result;
List qualifiers = new ArrayList<>();
for (Annotation annotation : allAnnotations) {
- if (annotation.annotationType().isAnnotationPresent(Qualifier.class))
+ if (annotation.annotationType().isAnnotationPresent(javax.inject.Qualifier.class)
+ || annotation.annotationType().isAnnotationPresent(jakarta.inject.Qualifier.class))
qualifiers.add(annotation);
}
if (qualifiers.isEmpty())
diff --git a/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ProviderImpl.java b/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ProviderImpl.java
index 07d3c8428e5..cf0347c34ed 100644
--- a/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ProviderImpl.java
+++ b/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ProviderImpl.java
@@ -13,12 +13,11 @@
*******************************************************************************/
package org.eclipse.e4.core.internal.di;
-import javax.inject.Provider;
import org.eclipse.e4.core.di.IInjector;
import org.eclipse.e4.core.di.suppliers.IObjectDescriptor;
import org.eclipse.e4.core.di.suppliers.PrimaryObjectSupplier;
-public class ProviderImpl implements Provider {
+public class ProviderImpl implements javax.inject.Provider, jakarta.inject.Provider {
final private PrimaryObjectSupplier objectProvider;
final private IObjectDescriptor objectDescriptor;
diff --git a/runtime/bundles/org.eclipse.e4.core.services/META-INF/MANIFEST.MF b/runtime/bundles/org.eclipse.e4.core.services/META-INF/MANIFEST.MF
index 8eb0a45ff52..7b70cf56aba 100644
--- a/runtime/bundles/org.eclipse.e4.core.services/META-INF/MANIFEST.MF
+++ b/runtime/bundles/org.eclipse.e4.core.services/META-INF/MANIFEST.MF
@@ -7,7 +7,9 @@ Bundle-Localization: plugin
Bundle-Version: 2.4.200.qualifier
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-17
-Import-Package: javax.annotation;version="[1.3.0,2.0.0)",
+Import-Package: jakarta.annotation;version="[2.0.0,3.0.0)",
+ jakarta.inject;version="[2.0.0,3.0.0)",
+ javax.annotation;version="[1.3.0,2.0.0)",
javax.inject;version="[1.0.0,2.0.0)",
org.eclipse.osgi.service.debug;version="1.1.0",
org.eclipse.osgi.service.localization;version="1.1.0",
diff --git a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/BundleTranslationProvider.java b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/BundleTranslationProvider.java
index f8b6855a75d..4f8d002403d 100644
--- a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/BundleTranslationProvider.java
+++ b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/BundleTranslationProvider.java
@@ -14,8 +14,8 @@
******************************************************************************/
package org.eclipse.e4.core.internal.services;
+import jakarta.inject.Inject;
import java.util.ResourceBundle;
-import javax.inject.Inject;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.core.services.translation.ResourceBundleProvider;
import org.eclipse.e4.core.services.translation.TranslationService;
diff --git a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/MessageFactoryServiceImpl.java b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/MessageFactoryServiceImpl.java
index 101e0ac4f3a..703c2f24db8 100644
--- a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/MessageFactoryServiceImpl.java
+++ b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/MessageFactoryServiceImpl.java
@@ -15,6 +15,7 @@
******************************************************************************/
package org.eclipse.e4.core.internal.services;
+import jakarta.annotation.PostConstruct;
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
import java.lang.ref.WeakReference;
@@ -29,7 +30,6 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.ResourceBundle;
-import javax.annotation.PostConstruct;
import org.eclipse.e4.core.services.nls.IMessageFactoryService;
import org.eclipse.e4.core.services.nls.Message;
import org.eclipse.e4.core.services.nls.Message.ReferenceType;
@@ -254,7 +254,8 @@ private void processPostConstruct(Object messageObject, Class> messageClass) {
if (messageObject != null) {
Method[] methods = messageClass.getDeclaredMethods();
for (Method method : methods) {
- if (!method.isAnnotationPresent(PostConstruct.class)) {
+ if (!method.isAnnotationPresent(javax.annotation.PostConstruct.class)
+ && !method.isAnnotationPresent(jakarta.annotation.PostConstruct.class)) {
continue;
} else {
try {
diff --git a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/TranslationObjectSupplier.java b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/TranslationObjectSupplier.java
index 8a61eb1cdb1..33cade2c5e5 100644
--- a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/TranslationObjectSupplier.java
+++ b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/TranslationObjectSupplier.java
@@ -14,6 +14,8 @@
******************************************************************************/
package org.eclipse.e4.core.internal.services;
+import jakarta.inject.Inject;
+import jakarta.inject.Named;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Collection;
@@ -25,8 +27,6 @@
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Predicate;
-import javax.inject.Inject;
-import javax.inject.Named;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.core.di.suppliers.ExtendedObjectSupplier;
diff --git a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/nls/BaseMessageRegistry.java b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/nls/BaseMessageRegistry.java
index 5ad8d5ca575..db7bf325297 100644
--- a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/nls/BaseMessageRegistry.java
+++ b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/nls/BaseMessageRegistry.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.e4.core.services.nls;
+import jakarta.annotation.PreDestroy;
+import jakarta.inject.Inject;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.security.AccessController;
@@ -21,8 +23,6 @@
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
-import javax.annotation.PreDestroy;
-import javax.inject.Inject;
import org.eclipse.e4.core.di.annotations.Optional;
import org.osgi.service.log.Logger;
import org.osgi.service.log.LoggerFactory;
diff --git a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/nls/Translation.java b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/nls/Translation.java
index 6aa54afb5ef..b4860641f11 100644
--- a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/nls/Translation.java
+++ b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/nls/Translation.java
@@ -18,8 +18,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import javax.inject.Inject;
-import javax.inject.Qualifier;
/**
*
@@ -38,7 +36,8 @@
*
* @since 1.2
*/
-@Qualifier
+@javax.inject.Qualifier
+@jakarta.inject.Qualifier
@Documented
@Target({ ElementType.FIELD, ElementType.PARAMETER })
@Retention(RetentionPolicy.RUNTIME)
diff --git a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/translation/TranslationService.java b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/translation/TranslationService.java
index 73c76fdcf93..0dbf35ade48 100644
--- a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/translation/TranslationService.java
+++ b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/translation/TranslationService.java
@@ -15,11 +15,11 @@
******************************************************************************/
package org.eclipse.e4.core.services.translation;
+import jakarta.inject.Inject;
+import jakarta.inject.Named;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-import javax.inject.Inject;
-import javax.inject.Named;
/**
* Provides localization service.