Skip to content

Commit

Permalink
Migrate PDE from javax.inject/annotation to jakarta.inject/annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
HannesWell committed Oct 27, 2023
1 parent b3d1df7 commit e1b3e64
Show file tree
Hide file tree
Showing 54 changed files with 97 additions and 99 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,9 @@ protected boolean isProblem(IReference reference, IProgressMonitor monitor) {
// this is an unexpected condition - the enclosing type is
// visible, but it has no annotations - log an error
String memberName = member.getName();
if (memberName != null) {
if (!memberName.startsWith("javax.")) { //$NON-NLS-1$
ApiPlugin.log(Status.info(MessageFormat.format(BuilderMessages.AbstractTypeLeakDetector_vis_type_has_no_api_description, memberName)));
}
if (memberName != null && !memberName.startsWith("javax.") && !memberName.startsWith("jakarta.")) { //$NON-NLS-1$ //$NON-NLS-2$
ApiPlugin.log(Status.info(MessageFormat.format(
BuilderMessages.AbstractTypeLeakDetector_vis_type_has_no_api_description, memberName)));
}
} else {
// enclosing type is not visible - this is a problem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,9 @@ protected boolean isProblem(IReference reference, IProgressMonitor monitor) {
// this is an unexpected condition - the enclosing type is
// visible, but it has no annotations - log an error
String typeName = type.getName();
if (typeName != null) {
if (!typeName.startsWith("javax.")) { //$NON-NLS-1$
ApiPlugin.log(Status.info(MessageFormat.format(BuilderMessages.AbstractTypeLeakDetector_vis_type_has_no_api_description, typeName)));
}
if (typeName != null && !typeName.startsWith("javax.") && !typeName.startsWith("jakarta.")) { //$NON-NLS-1$ //$NON-NLS-2$
ApiPlugin.log(Status.info(MessageFormat.format(
BuilderMessages.AbstractTypeLeakDetector_vis_type_has_no_api_description, typeName)));
}
} else {
// enclosing type is not visible - this is a problem
Expand Down
4 changes: 2 additions & 2 deletions ui/org.eclipse.pde.spy.bundle/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.29.0",
org.eclipse.e4.core.di,
org.eclipse.e4.ui.di
Bundle-Localization: plugin
Import-Package: javax.annotation;version="[1.3.0,2.0.0)",
javax.inject;version="[1.0.0,2.0.0)"
Import-Package: jakarta.annotation;version="[2.1.0,3.0.0)",
jakarta.inject;version="[2.0.0,3.0.0)"
Bundle-Vendor: %provider-name
Bundle-ActivationPolicy: lazy
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

import java.util.Iterator;

import javax.annotation.PostConstruct;
import javax.inject.Inject;
import jakarta.annotation.PostConstruct;
import jakarta.inject.Inject;

import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*******************************************************************************/
package org.eclipse.pde.spy.bundle.internal;

import javax.inject.Inject;
import jakarta.inject.Inject;

import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jface.viewers.ColumnLabelProvider;
Expand Down
4 changes: 2 additions & 2 deletions ui/org.eclipse.pde.spy.context/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Require-Bundle: org.eclipse.jface;bundle-version="3.9.0",
org.eclipse.e4.core.services;bundle-version="1.1.0",
org.eclipse.pde.spy.core;bundle-version="1.0.100"
Bundle-ActivationPolicy: lazy
Import-Package: javax.annotation;version="[1.2.0,2.0.0)",
javax.inject;version="[1.0.0,2.0.0)"
Import-Package: jakarta.annotation;version="[2.1.0,3.0.0)",
jakarta.inject;version="[2.0.0,3.0.0)"
Bundle-Localization: plugin
Export-Package: org.eclipse.pde.spy.context

Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import java.util.Map;
import java.util.Set;

import javax.inject.Inject;
import javax.inject.Singleton;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;

import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Creatable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
*******************************************************************************/
package org.eclipse.pde.internal.spy.context;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
import javax.inject.Named;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import jakarta.inject.Inject;
import jakarta.inject.Named;

import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.util.Map;
import java.util.Set;

import javax.inject.Inject;
import jakarta.inject.Inject;

import org.eclipse.e4.core.internal.contexts.Computation;
import org.eclipse.e4.core.internal.contexts.EclipseContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.util.Collections;
import java.util.List;

import javax.inject.Inject;
import jakarta.inject.Inject;

import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.internal.contexts.EclipseContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
*******************************************************************************/
package org.eclipse.pde.spy.context;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import jakarta.inject.Inject;

import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
Expand Down
2 changes: 1 addition & 1 deletion ui/org.eclipse.pde.spy.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ Require-Bundle: org.eclipse.e4.ui.model.workbench,
org.eclipse.e4.ui.workbench,
org.eclipse.e4.ui.di,
org.eclipse.emf.ecore
Import-Package: javax.inject;version="[1.0.0,2.0.0)",
Import-Package: jakarta.inject;version="[2.0.0,3.0.0)",
org.eclipse.emf.ecore
Bundle-Vendor: %provider-name
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import java.text.MessageFormat;
import java.util.List;

import javax.inject.Named;
import jakarta.inject.Named;

import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import java.util.List;

import javax.inject.Inject;
import jakarta.inject.Inject;

import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
Expand Down
4 changes: 2 additions & 2 deletions ui/org.eclipse.pde.spy.css/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.29.0",
org.eclipse.e4.ui.model.workbench;bundle-version="0.9.1",
org.eclipse.pde.spy.core;bundle-version="1.0.200"
Bundle-ActivationPolicy: lazy
Import-Package: javax.annotation;version="[1.2.0,2.0.0)",
javax.inject;version="[1.0.0,2.0.0)",
Import-Package: jakarta.annotation;version="[2.1.0,3.0.0)",
jakarta.inject;version="[2.0.0,3.0.0)",
org.eclipse.e4.core.contexts,
org.eclipse.e4.core.di.annotations,
org.eclipse.e4.ui.services,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import java.util.HashMap;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.inject.Inject;
import jakarta.annotation.PostConstruct;
import jakarta.inject.Inject;

import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.css.core.dom.ExtendedDocumentCSS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import java.util.LinkedList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import jakarta.annotation.PostConstruct;
import jakarta.inject.Inject;
import jakarta.inject.Named;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
Expand Down
4 changes: 2 additions & 2 deletions ui/org.eclipse.pde.spy.event/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.databinding.property;bundle-version="1.9.0"
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-ActivationPolicy: lazy
Import-Package: javax.annotation;version="[1.2.0,2.0.0)",
javax.inject;version="[1.0.0,2.0.0)",
Import-Package: jakarta.annotation;version="[2.1.0,3.0.0)",
jakarta.inject;version="[2.0.0,3.0.0)",
org.osgi.service.event;version="[1.4.0,2.0.0)"
Bundle-Localization: plugin
Export-Package: org.eclipse.pde.spy.event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

import java.util.Collection;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import jakarta.inject.Inject;

import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Optional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*******************************************************************************/
package org.eclipse.pde.spy.event.internal.util;

import javax.inject.Inject;
import jakarta.inject.Inject;

import org.eclipse.e4.core.di.annotations.Creatable;
import org.eclipse.e4.core.di.annotations.Optional;
Expand Down
2 changes: 1 addition & 1 deletion ui/org.eclipse.pde.spy.model/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ Bundle-Localization: plugin
Bundle-Vendor: %provider-name
Service-Component: OSGI-INF/extensionlookup.xml
Bundle-ActivationPolicy: lazy
Import-Package: javax.inject;version="[1.0.0,2.0.0)"
Import-Package: jakarta.inject;version="[2.0.0,3.0.0)"
Export-Package: org.eclipse.pde.spy.model;x-internal:=true
Automatic-Module-Name: org.eclipse.pde.spy.model
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
******************************************************************************/
package org.eclipse.pde.spy.model;

import javax.inject.Inject;
import jakarta.inject.Inject;

import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
******************************************************************************/
package org.eclipse.pde.spy.model;

import javax.inject.Named;
import jakarta.inject.Named;

import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
Expand Down
4 changes: 2 additions & 2 deletions ui/org.eclipse.pde.spy.preferences/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.29.0,4.0.0)",
org.eclipse.core.runtime,
org.eclipse.e4.ui.dialogs;bundle-version="1.3.0",
org.eclipse.jface;bundle-version="3.24.0"
Import-Package: javax.annotation;version="[1.3.0,2.0.0)",
javax.inject;version="[1.0.0,2.0.0)"
Import-Package: jakarta.annotation;version="[2.1.0,3.0.0)",
jakarta.inject;version="[2.0.0,3.0.0)"
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*******************************************************************************/
package org.eclipse.pde.spy.preferences.addon;

import javax.inject.Inject;
import jakarta.inject.Inject;

import org.eclipse.core.internal.preferences.EclipsePreferences;
import org.eclipse.core.runtime.preferences.BundleDefaultsScope;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import java.util.List;

import javax.inject.Named;
import jakarta.inject.Named;

import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import java.util.List;

import javax.inject.Named;
import jakarta.inject.Named;

import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

import java.net.URL;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import jakarta.inject.Inject;

import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

import static org.eclipse.pde.spy.preferences.handler.ToggleLayoutControl.getImageDescriptor;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import jakarta.inject.Inject;

import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.e4.core.di.extensions.Preference;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import java.util.Collection;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.inject.Inject;
import jakarta.annotation.PostConstruct;
import jakarta.inject.Inject;

import org.eclipse.core.databinding.beans.typed.BeanProperties;
import org.eclipse.core.databinding.observable.Realm;
Expand Down
2 changes: 1 addition & 1 deletion ui/org.eclipse.pde.ui.templates/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Export-Package: org.eclipse.pde.internal.ui.templates;x-internal:=true,
org.eclipse.pde.internal.ui.templates.ide;x-internal:=true,
org.eclipse.pde.internal.ui.templates.osgi;x-internal:=true,
org.eclipse.pde.internal.ui.templates.rcp;x-internal:=true
Import-Package: javax.annotation;version="[1.3.0,2.0.0)"
Import-Package: jakarta.annotation;version="[2.1.0,3.0.0)"
Require-Bundle: org.eclipse.ui;bundle-version="[3.3.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.29.0,4.0.0)",
org.eclipse.pde.ui;bundle-version="[3.3.0,4.0.0)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
public class E4ApplicationNewWizard extends AbstractE4NewPluginTemplateWizard {

private static final List<String> PACKAGE_IMPORTS = List.of( //
"javax.annotation;version=\"[1.2.0,2.0.0)\"", //$NON-NLS-1$
"javax.inject;version=\"[1.0.0,2.0.0)\""); //$NON-NLS-1$
"jakarta.annotation;version=\"[2.1.0,3.0.0)\"", //$NON-NLS-1$
"jakarta.inject;version=\"[2.0.0,3.0.0)\""); //$NON-NLS-1$

@Override
public void init(IFieldData data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
public class E4HandlerNewWizard extends AbstractE4NewPluginTemplateWizard {

private static final List<String> PACKAGE_IMPORTS = List.of( //
"javax.annotation;version=\"[1.2.0,2.0.0)\"", //$NON-NLS-1$
"javax.inject;version=\"[1.0.0,2.0.0)\"", //$NON-NLS-1$
"jakarta.annotation;version=\"[2.1.0,3.0.0)\"", //$NON-NLS-1$
"jakarta.inject;version=\"[2.0.0,3.0.0)\"", //$NON-NLS-1$
"org.osgi.framework;version=\"[1.10.0,2.0.0)\""); //$NON-NLS-1$

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
public class E4ToolbarContributionNewWizard extends AbstractE4NewPluginTemplateWizard {

private static final List<String> PACKAGE_IMPORTS = List.of( //
"javax.annotation;version=\"[1.2.0,2.0.0)\"", //$NON-NLS-1$
"javax.inject;version=\"[1.0.0,2.0.0)\"", //$NON-NLS-1$
"jakarta.annotation;version=\"[2.1.0,3.0.0)\"", //$NON-NLS-1$
"jakarta.inject;version=\"[2.0.0,3.0.0)\"", //$NON-NLS-1$
"org.osgi.framework;version=\"[1.10.0,2.0.0)\""); //$NON-NLS-1$

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
public class E4ViewNewWizard extends AbstractE4NewPluginTemplateWizard {

private static final List<String> PACKAGE_IMPORTS = List.of( //
"javax.annotation;version=\"[1.2.0,2.0.0)\"", //$NON-NLS-1$
"javax.inject;version=\"[1.0.0,2.0.0)\"", //$NON-NLS-1$
"jakarta.annotation;version=\"[2.1.0,3.0.0)\"", //$NON-NLS-1$
"jakarta.inject;version=\"[2.0.0,3.0.0)\"", //$NON-NLS-1$
"org.osgi.framework;version=\"[1.10.0,2.0.0)\""); //$NON-NLS-1$

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public String getUsedExtensionPoint() {
protected void updateModel(IProgressMonitor monitor) throws CoreException {

IBundle bundle = ((IBundlePluginModelBase) model).getBundleModel().getBundle();
bundle.setHeader(Constants.IMPORT_PACKAGE, "javax.inject;version=\"[1.0.0,2.0.0)\""); //$NON-NLS-1$
bundle.setHeader(Constants.IMPORT_PACKAGE, "jakarta.inject;version=\"[2.0.0,3.0.0)\""); //$NON-NLS-1$

IPluginBase plugin = model.getPluginBase();
IPluginExtension extension = createExtension("org.eclipse.ui.views", true); //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public String getUsedExtensionPoint() {
protected void updateModel(IProgressMonitor monitor) throws CoreException {

IBundle bundle = ((IBundlePluginModelBase) model).getBundleModel().getBundle();
bundle.setHeader(Constants.IMPORT_PACKAGE, "javax.inject;version=\"[1.0.0,2.0.0)\""); //$NON-NLS-1$
bundle.setHeader(Constants.IMPORT_PACKAGE, "jakarta.inject;version=\"[2.0.0,3.0.0)\""); //$NON-NLS-1$

IPluginBase plugin = model.getPluginBase();
IPluginExtension extension = createExtension("org.eclipse.ui.views", true); //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected void updateModel(IProgressMonitor monitor) throws CoreException {
createProductExtension();

IBundle bundle = ((IBundlePluginModelBase) model).getBundleModel().getBundle();
bundle.setHeader(Constants.IMPORT_PACKAGE, "javax.inject;version=\"[1.0.0,2.0.0)\""); //$NON-NLS-1$
bundle.setHeader(Constants.IMPORT_PACKAGE, "jakarta.inject;version=\"[2.0.0,3.0.0)\""); //$NON-NLS-1$
}

private void createApplicationExtension() throws CoreException {
Expand Down
Loading

0 comments on commit e1b3e64

Please sign in to comment.