Skip to content

Commit 55a1c43

Browse files
committed
Remove remaining pseudo dependency of E4-Injector to jakarta annotations
This ensures that the E4-Injector does not work with any specific annotation class.
1 parent cf1f7bd commit 55a1c43

5 files changed

Lines changed: 17 additions & 38 deletions

File tree

runtime/bundles/org.eclipse.e4.core.di/.settings/org.eclipse.jdt.core.prefs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
4949
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
5050
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
5151
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
52-
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
52+
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
5353
org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
5454
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
55-
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
55+
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
5656
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
5757
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
5858
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning

runtime/bundles/org.eclipse.e4.core.di/META-INF/MANIFEST.MF

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ Export-Package: org.eclipse.e4.core.di;version="1.7.0",
1515
org.eclipse.e4.core.internal.di.osgi;x-internal:=true,
1616
org.eclipse.e4.core.internal.di.shared;x-friends:="org.eclipse.e4.core.contexts,org.eclipse.e4.core.di.extensions.supplier"
1717
Require-Bundle: org.eclipse.e4.core.di.annotations;bundle-version="[1.4.0,2.0.0)";visibility:=reexport
18-
Import-Package: jakarta.annotation;version="[2.0.0,4.0.0)",
19-
jakarta.inject;version="[2,3)",
20-
org.eclipse.osgi.framework.log;version="1.1.0",
18+
Import-Package: org.eclipse.osgi.framework.log;version="1.1.0",
2119
org.osgi.framework;version="[1.8.0,2.0.0)",
2220
org.osgi.util.tracker;version="[1.5.1,2.0.0)"
2321
Automatic-Module-Name: org.eclipse.e4.core.di

runtime/bundles/org.eclipse.e4.core.di/build.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ bin.includes = META-INF/,\
1818
plugin.properties,\
1919
about.html,\
2020
.options
21+
additional.bundles = jakarta.annotation-api,\
22+
jakarta.inject.jakarta.inject-api
2123
src.includes = about.html

runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/di/IInjector.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2010, 2017 IBM Corporation and others.
2+
* Copyright (c) 2010, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,10 +14,6 @@
1414
*******************************************************************************/
1515
package org.eclipse.e4.core.di;
1616

17-
import jakarta.annotation.PostConstruct;
18-
import jakarta.annotation.PreDestroy;
19-
import jakarta.inject.Scope;
20-
import jakarta.inject.Singleton;
2117
import java.lang.annotation.Annotation;
2218
import org.eclipse.e4.core.di.suppliers.PrimaryObjectSupplier;
2319

@@ -37,7 +33,8 @@
3733
* The injection of values is generally done as a number of calls. User objects
3834
* that want to finalize the injected data (for instance, to perform
3935
* calculations based on multiple injected values) can place such calculations
40-
* in a method with the {@link PostConstruct} annotation.
36+
* in a method with the {@link jakarta.annotation.PostConstruct PostConstruct}
37+
* annotation.
4138
* </p>
4239
* <p>
4340
* When injecting values, all fields are injected prior to injection of methods.
@@ -51,7 +48,8 @@
5148
* </p>
5249
* <p>
5350
* When supplier is disposed, the injector will attempt to notify all injected
54-
* objects by calling methods with the {@link PreDestroy} annotation.
51+
* objects by calling methods with the {@link jakarta.annotation.PreDestroy
52+
* PreDestroy} annotation.
5553
*
5654
* @noimplement This interface is not intended to be implemented by clients.
5755
* @noextend This interface is not intended to be extended by clients.
@@ -156,8 +154,8 @@ void inject(Object object, PrimaryObjectSupplier objectSupplier, PrimaryObjectSu
156154
* @param objectSupplier primary object supplier for the injection
157155
* @return an instance of the specified class
158156
* @throws InjectionException if an exception occurred while performing this operation
159-
* @see Scope
160-
* @see Singleton
157+
* @see jakarta.inject.Scope
158+
* @see jakarta.inject.Singleton
161159
*/
162160
<T> T make(Class<T> clazz, PrimaryObjectSupplier objectSupplier) throws InjectionException;
163161

@@ -174,8 +172,8 @@ void inject(Object object, PrimaryObjectSupplier objectSupplier, PrimaryObjectSu
174172
* @param staticSupplier additional object supplier for the injection, changes in injected values are not tracked
175173
* @return an instance of the specified class
176174
* @throws InjectionException if an exception occurred while performing this operation
177-
* @see Scope
178-
* @see Singleton
175+
* @see jakarta.inject.Scope
176+
* @see jakarta.inject.Singleton
179177
*/
180178
<T> T make(Class<T> clazz, PrimaryObjectSupplier objectSupplier, PrimaryObjectSupplier staticSupplier) throws InjectionException;
181179

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2010, 2015 IBM Corporation and others.
2+
* Copyright (c) 2010, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,11 +13,8 @@
1313
*******************************************************************************/
1414
package org.eclipse.e4.core.internal.di;
1515

16-
import jakarta.inject.Named;
17-
import java.lang.reflect.Field;
1816
import org.eclipse.e4.core.di.IInjector;
1917
import org.eclipse.e4.core.di.InjectionException;
20-
import org.eclipse.e4.core.di.annotations.Optional;
2118
import org.eclipse.e4.core.di.suppliers.IObjectDescriptor;
2219
import org.eclipse.e4.core.di.suppliers.PrimaryObjectSupplier;
2320

@@ -29,11 +26,7 @@
2926
*/
3027
public class ClassRequestor extends Requestor<Class<?>> {
3128

32-
@Optional
33-
@Named("e4.internal.injectionLink")
34-
final static public String pseudoVariable = null;
35-
36-
private static IObjectDescriptor[] pseudoVariableDescriptor;
29+
private static IObjectDescriptor[] pseudoVariableDescriptor = {};
3730

3831
public ClassRequestor(Class<?> clazz, IInjector injector, PrimaryObjectSupplier primarySupplier, PrimaryObjectSupplier tempSupplier, Object requestingObject, boolean track) {
3932
super(clazz, injector, primarySupplier, tempSupplier, requestingObject, track);
@@ -47,18 +40,6 @@ public Object execute() throws InjectionException {
4740

4841
@Override
4942
public IObjectDescriptor[] calcDependentObjects() {
50-
if (pseudoVariableDescriptor == null) {
51-
Field field = null;
52-
try {
53-
field = ClassRequestor.class.getField("pseudoVariable"); //$NON-NLS-1$
54-
} catch (SecurityException | NoSuchFieldException e) {
55-
e.printStackTrace(); // tested - not going to happen
56-
return null;
57-
}
58-
pseudoVariableDescriptor = new IObjectDescriptor[] {
59-
new ObjectDescriptor(field.getGenericType(), field.getAnnotations()) };
60-
}
61-
6243
return pseudoVariableDescriptor;
6344
}
6445

@@ -69,7 +50,7 @@ public String toString() {
6950
tmp.append(location.getSimpleName());
7051
}
7152
tmp.append('.');
72-
tmp.append(pseudoVariable);
53+
tmp.append("pseudoVariable"); //$NON-NLS-1$
7354
return tmp.toString();
7455
}
7556
}

0 commit comments

Comments
 (0)