diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml index 8dd4ff06375..1372e21cbfb 100644 --- a/.mvn/extensions.xml +++ b/.mvn/extensions.xml @@ -4,6 +4,6 @@ org.eclipse.tycho tycho-build - 4.0.0 + 4.0.3 \ No newline at end of file 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/resources/tests/org.eclipse.core.tests.resources/META-INF/MANIFEST.MF b/resources/tests/org.eclipse.core.tests.resources/META-INF/MANIFEST.MF index cd9807aa5ae..253adf99e69 100644 --- a/resources/tests/org.eclipse.core.tests.resources/META-INF/MANIFEST.MF +++ b/resources/tests/org.eclipse.core.tests.resources/META-INF/MANIFEST.MF @@ -34,6 +34,7 @@ Require-Bundle: org.eclipse.core.resources, org.eclipse.core.filesystem, org.eclipse.core.runtime, org.eclipse.pde.junit.runtime;bundle-version="3.5.0" +Import-Package: org.mockito Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-17 Eclipse-BundleShape: dir diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/AllRegressionTests.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/AllRegressionTests.java index fd7fe2a6cab..eb6e316a161 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/AllRegressionTests.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/AllRegressionTests.java @@ -25,8 +25,9 @@ Bug_029116.class, Bug_029671.class, Bug_029851.class, Bug_032076.class, Bug_044106.class, Bug_092108.class, Bug_097608.class, Bug_098740.class, Bug_126104.class, Bug_127562.class, Bug_132510.class, Bug_134364.class, Bug_147232.class, Bug_160251.class, Bug_165892.class, Bug_192631.class, Bug_226264.class, Bug_231301.class, - Bug_233939.class, Bug_265810.class, Bug_264182.class, Bug_288315.class, Bug_303517.class, Bug_329836.class, - Bug_331445.class, Bug_332543.class, Bug_378156.class, IFileTest.class, IFolderTest.class, IProjectTest.class, + Bug_233939.class, Bug_265810.class, Bug_264182.class, Bug_297635.class, Bug_288315.class, Bug_303517.class, + Bug_329836.class, Bug_331445.class, Bug_332543.class, Bug_378156.class, + IFileTest.class, IFolderTest.class, IProjectTest.class, IResourceTest.class, IWorkspaceTest.class, LocalStoreRegressionTests.class, NLTest.class, PR_1GEAB3C_Test.class, PR_1GH2B0N_Test.class, PR_1GHOM0N_Test.class, Bug_530868.class, Bug_185247_recursiveLinks.class, diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_297635.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_297635.java new file mode 100644 index 00000000000..b7a497eb239 --- /dev/null +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_297635.java @@ -0,0 +1,157 @@ +/******************************************************************************* + * Copyright (c) 2010, 2015 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + * Alexander Kurtakov - Bug 459343 + *******************************************************************************/ +package org.eclipse.core.tests.resources.regression; + +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; + +import java.lang.reflect.Field; +import java.util.function.Consumer; +import org.eclipse.core.internal.resources.SaveManager; +import org.eclipse.core.resources.ISaveContext; +import org.eclipse.core.resources.ISaveParticipant; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.tests.harness.BundleTestingHelper; +import org.eclipse.core.tests.resources.ResourceTest; +import org.eclipse.core.tests.resources.content.ContentTypeTest; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.BundleException; + +/** + * Tests regression of bug 297635 + */ +public class Bug_297635 extends ResourceTest { + + @Override + protected void setUp() throws Exception { + super.setUp(); + BundleWithSaveParticipant.install(); + saveFull(); + } + + @Override + protected void tearDown() throws Exception { + try { + BundleWithSaveParticipant.uninstall(); + } finally { + super.tearDown(); + } + } + + public void testCleanSaveStateBySaveParticipantOnSnapshotSave() throws Exception { + executeWithSaveManagerSpy(saveManagerSpy -> { + try { + saveSnapshot(saveManagerSpy); + } catch (CoreException e) { + } + verify(saveManagerSpy).forgetSavedTree(BundleWithSaveParticipant.getBundleName()); + }); + } + + private void saveFull() throws CoreException { + getWorkspace().save(true, getMonitor()); + } + + private void saveSnapshot(SaveManager saveManager) throws CoreException { + saveManager.save(ISaveContext.SNAPSHOT, true, null, getMonitor()); + } + + private void executeWithSaveManagerSpy(Consumer executeOnSpySaveManager) throws Exception { + IWorkspace workspace = getWorkspace(); + String saveManagerFieldName = "saveManager"; + SaveManager originalSaveManager = (SaveManager) getField(workspace, saveManagerFieldName); + SaveManager spySaveManager = spy(originalSaveManager); + try { + setField(workspace, saveManagerFieldName, spySaveManager); + executeOnSpySaveManager.accept(spySaveManager); + } finally { + setField(workspace, saveManagerFieldName, originalSaveManager); + } + } + + private static Object getField(Object object, String fieldName) throws Exception { + Field field = object.getClass().getDeclaredField(fieldName); + field.setAccessible(true); + return field.get(object); + } + + private static void setField(Object object, String fieldName, Object value) throws Exception { + Field field = object.getClass().getDeclaredField(fieldName); + field.setAccessible(true); + field.set(object, value); + } + + private static final class BundleWithSaveParticipant { + private static String TEST_BUNDLE_LOCATION = "content/bundle01"; + + private static Bundle bundle; + + private static ISaveParticipant saveParticipant = new ISaveParticipant() { + @Override + public void doneSaving(ISaveContext context) { + // nothing to do + } + + @Override + public void prepareToSave(ISaveContext context) { + context.needDelta(); + context.needSaveNumber(); + } + + @Override + public void rollback(ISaveContext context) { + // nothing to do + } + + @Override + public void saving(ISaveContext context) { + // nothing to do + } + }; + + public static String getBundleName() { + if (bundle == null) { + throw new IllegalStateException("Bundle has not been installed"); + } + return bundle.getSymbolicName(); + } + + public static void uninstall() throws BundleException { + if (bundle != null) { + bundle.uninstall(); + } + } + + public static void install() throws Exception { + bundle = BundleTestingHelper.installBundle("", getContext(), + ContentTypeTest.TEST_FILES_ROOT + TEST_BUNDLE_LOCATION); + BundleTestingHelper.resolveBundles(getContext(), new Bundle[] { bundle }); + bundle.start(Bundle.START_TRANSIENT); + registerSaveParticipant(bundle); + } + + private static BundleContext getContext() { + return Platform.getBundle(PI_RESOURCES_TESTS).getBundleContext(); + } + + private static void registerSaveParticipant(Bundle saveParticipantsBundle) throws CoreException { + getWorkspace().addSaveParticipant(saveParticipantsBundle.getSymbolicName(), saveParticipant); + } + + } +} diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/AllSessionTests.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/AllSessionTests.java index c97f899e85a..97fa896b60d 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/AllSessionTests.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/AllSessionTests.java @@ -25,7 +25,7 @@ TestBug12575.class, WorkspaceDescriptionTest.class, TestBug30015.class, TestMasterTableCleanup.class, ProjectPreferenceSessionTest.class, TestBug113943.class, TestCreateLinkedResourceInHiddenProject.class, - Bug_266907.class, TestBug297635.class, TestBug323833.class, + Bug_266907.class, TestBug323833.class, org.eclipse.core.tests.resources.regression.TestMultipleBuildersOfSameType.class, org.eclipse.core.tests.resources.usecase.SnapshotTest.class, ProjectDescriptionDynamicTest.class, TestBug202384.class, TestBug369177.class, TestBug316182.class, TestBug294854.class, TestBug426263.class, diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestBug297635.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestBug297635.java deleted file mode 100644 index 372845e7104..00000000000 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestBug297635.java +++ /dev/null @@ -1,190 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - * Alexander Kurtakov - Bug 459343 - *******************************************************************************/ -package org.eclipse.core.tests.resources.session; - -import java.io.IOException; -import java.lang.reflect.Field; -import java.net.MalformedURLException; -import java.util.Map; -import junit.framework.Test; -import org.eclipse.core.internal.resources.SaveManager; -import org.eclipse.core.internal.resources.SavedState; -import org.eclipse.core.internal.resources.Workspace; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ISaveContext; -import org.eclipse.core.resources.ISaveParticipant; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.tests.harness.BundleTestingHelper; -import org.eclipse.core.tests.resources.AutomatedResourceTests; -import org.eclipse.core.tests.resources.ResourceTest; -import org.eclipse.core.tests.resources.content.ContentTypeTest; -import org.eclipse.core.tests.session.WorkspaceSessionTestSuite; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleException; - -/** - * Tests regression of bug 297635 - */ -public class TestBug297635 extends ResourceTest implements ISaveParticipant { - - private static final String BUNDLE01_ID = "org.eclipse.bundle01"; - private static final String FILE = "file1.txt"; - private static final String ANOTHER_FILE = "file2.txt"; - - public static Test suite() { - return new WorkspaceSessionTestSuite(AutomatedResourceTests.PI_RESOURCES_TESTS, TestBug297635.class); - } - - public BundleContext getContext() { - return Platform.getBundle(PI_RESOURCES_TESTS).getBundleContext(); - } - - public void testBug() throws Exception { - installBundle(); - - addSaveParticipant(); - - IProject project = getProject("Project1"); - ensureExistsInWorkspace(project, true); - createFileInProject(FILE, project); - - saveFull(); - - reinstallBundle(); - - project = getProject("Project1"); - createFileInProject(ANOTHER_FILE, project); - - Map savedStates = getSavedStatesFromSaveManager(); - - addSaveParticipant(); - - assertStateTreesIsNotNull(savedStates.get(BUNDLE01_ID)); - - saveSnapshot(); - - assertStateTreesIsNull(savedStates.get(BUNDLE01_ID)); - } - - private void assertStateTreesIsNotNull(SavedState savedState) throws Exception { - assertStateTrees(savedState, false); - } - - private void assertStateTreesIsNull(SavedState savedState) throws Exception { - assertStateTrees(savedState, true); - } - - private IFile createFileInProject(String fileName, IProject project) { - IFile file = project.getFile(fileName); - ensureExistsInWorkspace(file, getRandomContents()); - return file; - } - - private IProject getProject(String projectName) { - return getWorkspace().getRoot().getProject(projectName); - } - - private void installBundle() throws BundleException, MalformedURLException, IOException { - Bundle b = BundleTestingHelper.installBundle("1", getContext(), - ContentTypeTest.TEST_FILES_ROOT + "content/bundle01"); - BundleTestingHelper.resolveBundles(getContext(), new Bundle[] { b }); - b.start(Bundle.START_TRANSIENT); - } - - private void addSaveParticipant() throws CoreException { - getWorkspace().addSaveParticipant(BUNDLE01_ID, TestBug297635.this); - } - - private void saveFull() throws CoreException { - getWorkspace().save(true, getMonitor()); - } - - private void reinstallBundle() throws BundleException, MalformedURLException, IOException { - /* - * install the bundle again. We need to restart the org.eclipse.core.resources - * bundle to read the tree file again. We rely on the fact that the - * core.resources bundle doesn't save the tree when it is stopped - */ - Bundle coreResourcesBundle = Platform.getBundle(ResourcesPlugin.PI_RESOURCES); - coreResourcesBundle.stop(Bundle.STOP_TRANSIENT); - Bundle b = BundleTestingHelper.installBundle("1", getContext(), - ContentTypeTest.TEST_FILES_ROOT + "content/bundle01"); - BundleTestingHelper.resolveBundles(getContext(), new Bundle[] { b }); - coreResourcesBundle.start(Bundle.START_TRANSIENT); - } - - @SuppressWarnings("unchecked") - private Map getSavedStatesFromSaveManager() - throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { - // get access to SaveManager#savedStates to verify that tress are being kept - // there - Field field = SaveManager.class.getDeclaredField("savedStates"); - field.setAccessible(true); - return (Map) field.get(((Workspace) getWorkspace()).getSaveManager()); - } - - private void saveSnapshot() throws CoreException { - ((Workspace) getWorkspace()).getSaveManager().save(ISaveContext.SNAPSHOT, true, null, getMonitor()); - } - - private void assertStateTrees(SavedState savedState, boolean isNull) - throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { - Object oldTree = null; - Object newTree = null; - - Field oldTreeField = SavedState.class.getDeclaredField("oldTree"); - oldTreeField.setAccessible(true); - oldTree = oldTreeField.get(savedState); - - Field newTreeField = SavedState.class.getDeclaredField("newTree"); - newTreeField.setAccessible(true); - newTree = newTreeField.get(savedState); - - if (isNull) { - assertNull(oldTree); - assertNull(newTree); - } else { - assertNotNull(oldTree); - assertNotNull(newTree); - } - } - - // ISaveParticipant methods - - @Override - public void doneSaving(ISaveContext context) { - // nothing to do - } - - @Override - public void prepareToSave(ISaveContext context) { - context.needDelta(); - context.needSaveNumber(); - } - - @Override - public void rollback(ISaveContext context) { - // nothing to do - } - - @Override - public void saving(ISaveContext context) { - // nothing to do - } -} 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/contexts/ContextInjectionFactory.java b/runtime/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/ContextInjectionFactory.java index c44e834f6a3..60d79af3371 100644 --- a/runtime/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/ContextInjectionFactory.java +++ b/runtime/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/ContextInjectionFactory.java @@ -14,9 +14,9 @@ *******************************************************************************/ package org.eclipse.e4.core.contexts; +import jakarta.inject.Scope; +import jakarta.inject.Singleton; import java.lang.annotation.Annotation; -import javax.inject.Scope; -import javax.inject.Singleton; import org.eclipse.e4.core.di.IInjector; import org.eclipse.e4.core.di.InjectionException; import org.eclipse.e4.core.di.InjectorFactory; 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/IInjector.java b/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/di/IInjector.java index aeefb468b29..bde2a23b358 100644 --- a/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/di/IInjector.java +++ b/runtime/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/di/IInjector.java @@ -14,11 +14,11 @@ *******************************************************************************/ package org.eclipse.e4.core.di; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; +import jakarta.inject.Scope; +import jakarta.inject.Singleton; import java.lang.annotation.Annotation; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import javax.inject.Scope; -import javax.inject.Singleton; import org.eclipse.e4.core.di.suppliers.PrimaryObjectSupplier; /** 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 a : annotation) { + if (isAnnotationPresent(annotatedElement, a)) { + return true; + } + } + return false; + } + private boolean isAnnotationPresent(AnnotatedElement annotatedElement, Class 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. diff --git a/team/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java b/team/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java index 32f5d45d4f9..b7565473dc9 100644 --- a/team/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java +++ b/team/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java @@ -80,6 +80,7 @@ import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Layout; import org.eclipse.swt.widgets.Sash; import org.eclipse.swt.widgets.Shell; @@ -128,8 +129,15 @@ public abstract class ContentMergeViewer extends ContentViewer private class ContentMergeViewerLayout extends Layout { @Override - public Point computeSize(Composite c, int w, int h, boolean force) { - return new Point(100, 100); + public Point computeSize(Composite composite, int wHint, int hHint, boolean force) { + if (hHint > SWT.DEFAULT && wHint > SWT.DEFAULT) { + return new Point(wHint, hHint); + } + + Rectangle r = composite.getClientArea(); + + + return new Point(r.width, r.height); } @Override @@ -810,8 +818,12 @@ private void internalRefresh(Object input) { tbm.appendToGroup("diffLabel", labelContributionItem); //$NON-NLS-1$ } updateToolItems(); - tbm.update(true); - tbm.getControl().getParent().layout(true); + Display.getDefault().asyncExec(() -> { + // relayout in next tick + tbm.update(true); + tbm.getControl().getParent().setRedraw(true); + }); + } } }