Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Thoms2019-02-21 01:18:02 -0500
committerAlexander Kurtakov2019-06-11 07:53:59 -0400
commit92caf107f6ae105e9352a472e21cf7cc8d1fee36 (patch)
tree189e406b799f2e30171ae28c5943396aca9a85ce
parent470c0d5f2f487f5a41a22372c2ac920b93df1b8a (diff)
downloadrt.equinox.bundles-92caf107f6ae105e9352a472e21cf7cc8d1fee36.tar.gz
rt.equinox.bundles-92caf107f6ae105e9352a472e21cf7cc8d1fee36.tar.xz
rt.equinox.bundles-92caf107f6ae105e9352a472e21cf7cc8d1fee36.zip
Resolve raw type warnings. Remove unneccessary casts. Change-Id: I00f520dc23d50d7265bf5bd33966b2ccb1f51614 Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
-rw-r--r--bundles/org.eclipse.equinox.app/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.app/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/AppCommands.java24
-rw-r--r--bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/AppPersistence.java24
-rw-r--r--bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppContainer.java46
-rw-r--r--bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppDescriptor.java10
-rw-r--r--bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppHandle.java18
-rw-r--r--bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseScheduledApplication.java12
-rw-r--r--bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/ProductExtensionBranding.java6
9 files changed, 71 insertions, 73 deletions
diff --git a/bundles/org.eclipse.equinox.app/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.app/META-INF/MANIFEST.MF
index 8896f60b..477770c9 100644
--- a/bundles/org.eclipse.equinox.app/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.app/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.app; singleton:=true
-Bundle-Version: 1.4.200.qualifier
+Bundle-Version: 1.4.300.qualifier
Bundle-Vendor: %providerName
Bundle-Activator: org.eclipse.equinox.internal.app.Activator
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.equinox.app/pom.xml b/bundles/org.eclipse.equinox.app/pom.xml
index 84636733..259ee753 100644
--- a/bundles/org.eclipse.equinox.app/pom.xml
+++ b/bundles/org.eclipse.equinox.app/pom.xml
@@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.app</artifactId>
- <version>1.4.200-SNAPSHOT</version>
+ <version>1.4.300-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
diff --git a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/AppCommands.java b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/AppCommands.java
index ce6db7ec..846c2e37 100644
--- a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/AppCommands.java
+++ b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/AppCommands.java
@@ -31,7 +31,7 @@ public class AppCommands implements CommandProvider {
private final static String TAB = "\t"; //$NON-NLS-1$
// holds the mappings from command name to command arguments and command description
- private Map commandsHelp = null;
+ private Map<String, String[]> commandsHelp = null;
private static AppCommands instance;
private BundleContext context;
@@ -107,17 +107,17 @@ public class AppCommands implements CommandProvider {
if (commandName != null) {
if (commandsHelp.containsKey(commandName)) {
- addCommand(commandName, (String[]) commandsHelp.get(commandName), sb);
+ addCommand(commandName, commandsHelp.get(commandName), sb);
}
return sb.toString();
}
addHeader(Messages.console_help_app_commands_header, sb);
- Iterator i = commandsHelp.entrySet().iterator();
+ Iterator<Entry<String, String[]>> i = commandsHelp.entrySet().iterator();
while (i.hasNext()) {
- Entry entry = (Entry) i.next();
- String command = (String) entry.getKey();
- String[] attributes = (String[]) entry.getValue();
+ Entry<String, String[]> entry = i.next();
+ String command = entry.getKey();
+ String[] attributes = entry.getValue();
addCommand(command, attributes, sb);
}
@@ -125,7 +125,7 @@ public class AppCommands implements CommandProvider {
}
private void initializeCommandsHelp() {
- commandsHelp = new LinkedHashMap();
+ commandsHelp = new LinkedHashMap<>();
commandsHelp.put("activeApps", new String[] {Messages.console_help_activeapps_description}); //$NON-NLS-1$
commandsHelp.put("apps", new String[] {Messages.console_help_apps_description}); //$NON-NLS-1$
commandsHelp.put("lockApp", new String[] {Messages.console_help_arguments, Messages.console_help_lockapp_description}); //$NON-NLS-1$
@@ -173,9 +173,9 @@ public class AppCommands implements CommandProvider {
}
}
- private Dictionary getServiceProps(ServiceReference ref) {
+ private Dictionary<String, Object> getServiceProps(ServiceReference ref) {
String[] keys = ref.getPropertyKeys();
- Hashtable props = new Hashtable(keys.length);
+ Hashtable<String, Object> props = new Hashtable<>(keys.length);
for (int i = 0; i < keys.length; i++)
props.put(keys[i], ref.getProperty(keys[i]));
return props;
@@ -249,16 +249,16 @@ public class AppCommands implements CommandProvider {
if (application == null)
intp.println("\"" + appId + "\" does not exist or is ambigous."); //$NON-NLS-1$ //$NON-NLS-2$
else {
- ArrayList argList = new ArrayList();
+ ArrayList<String> argList = new ArrayList<>();
String arg = null;
while ((arg = intp.nextArgument()) != null)
argList.add(arg);
String[] args = argList.size() == 0 ? null : (String[]) argList.toArray(new String[argList.size()]);
try {
- HashMap launchArgs = new HashMap(1);
+ HashMap<String, Object> launchArgs = new HashMap<>(1);
if (args != null)
launchArgs.put(IApplicationContext.APPLICATION_ARGS, args);
- ApplicationDescriptor appDesc = ((ApplicationDescriptor) context.getService(application));
+ ApplicationDescriptor appDesc = (context.<ApplicationDescriptor> getService(application));
ApplicationHandle handle = appDesc.launch(launchArgs);
intp.println("Launched application instance: " + handle.getInstanceId()); //$NON-NLS-1$
} finally {
diff --git a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/AppPersistence.java b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/AppPersistence.java
index ec87eb42..188f57e0 100644
--- a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/AppPersistence.java
+++ b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/AppPersistence.java
@@ -46,9 +46,9 @@ public class AppPersistence implements ServiceTrackerCustomizer {
private static BundleContext context;
private static ServiceTracker configTracker;
private static Location configLocation;
- private static Collection locks = new ArrayList();
- private static Map scheduledApps = new HashMap();
- static ArrayList timerApps = new ArrayList();
+ private static Collection<String> locks = new ArrayList<>();
+ private static Map<String, EclipseScheduledApplication> scheduledApps = new HashMap<>();
+ static ArrayList<EclipseScheduledApplication> timerApps = new ArrayList<>();
private static StorageManager storageManager;
private static boolean scheduling = false;
static boolean shutdown = false;
@@ -144,7 +144,7 @@ public class AppPersistence implements ServiceTrackerCustomizer {
* @throws InvalidSyntaxException
* @throws ApplicationException
*/
- public static ScheduledApplication addScheduledApp(ApplicationDescriptor descriptor, String scheduleId, Map arguments, String topic, String eventFilter, boolean recurring) throws InvalidSyntaxException, ApplicationException {
+ public static ScheduledApplication addScheduledApp(ApplicationDescriptor descriptor, String scheduleId, Map<String, Object> arguments, String topic, String eventFilter, boolean recurring) throws InvalidSyntaxException, ApplicationException {
if (!scheduling && !checkSchedulingSupport())
throw new ApplicationException(ApplicationException.APPLICATION_SCHEDULING_FAILED, "Cannot support scheduling without org.osgi.service.event package"); //$NON-NLS-1$
// check the event filter for correct syntax
@@ -168,7 +168,7 @@ public class AppPersistence implements ServiceTrackerCustomizer {
}
}
scheduledApps.put(scheduledApp.getScheduleId(), scheduledApp);
- Hashtable serviceProps = new Hashtable();
+ Hashtable<String, Object> serviceProps = new Hashtable<>();
if (scheduledApp.getTopic() != null)
serviceProps.put(EventConstants.EVENT_TOPIC, new String[] {scheduledApp.getTopic()});
if (scheduledApp.getEventFilter() != null)
@@ -299,8 +299,8 @@ public class AppPersistence implements ServiceTrackerCustomizer {
try (ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(locksData))) {
out.writeInt(DATA_VERSION);
out.writeInt(locks.size());
- for (Iterator iterLocks = locks.iterator(); iterLocks.hasNext();)
- out.writeUTF((String) iterLocks.next());
+ for (Iterator<String> iterLocks = locks.iterator(); iterLocks.hasNext();)
+ out.writeUTF(iterLocks.next());
}
}
@@ -309,8 +309,8 @@ public class AppPersistence implements ServiceTrackerCustomizer {
try (ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(schedulesData))) {
out.writeInt(DATA_VERSION);
out.writeInt(scheduledApps.size());
- for (Iterator apps = scheduledApps.values().iterator(); apps.hasNext();) {
- EclipseScheduledApplication app = (EclipseScheduledApplication) apps.next();
+ for (Iterator<EclipseScheduledApplication> apps = scheduledApps.values().iterator(); apps.hasNext();) {
+ EclipseScheduledApplication app = apps.next();
writeStringOrNull(out, app.getScheduleId());
writeStringOrNull(out, app.getAppPid());
writeStringOrNull(out, app.getTopic());
@@ -344,20 +344,20 @@ public class AppPersistence implements ServiceTrackerCustomizer {
if (minute == lastMin)
continue;
lastMin = minute;
- Hashtable props = new Hashtable();
+ Hashtable<String, Object> props = new Hashtable<>();
props.put(ScheduledApplication.YEAR, Integer.valueOf(cal.get(Calendar.YEAR)));
props.put(ScheduledApplication.MONTH, Integer.valueOf(cal.get(Calendar.MONTH)));
props.put(ScheduledApplication.DAY_OF_MONTH, Integer.valueOf(cal.get(Calendar.DAY_OF_MONTH)));
props.put(ScheduledApplication.DAY_OF_WEEK, Integer.valueOf(cal.get(Calendar.DAY_OF_WEEK)));
props.put(ScheduledApplication.HOUR_OF_DAY, Integer.valueOf(cal.get(Calendar.HOUR_OF_DAY)));
props.put(ScheduledApplication.MINUTE, Integer.valueOf(minute));
- Event timerEvent = new Event(ScheduledApplication.TIMER_TOPIC, (Dictionary) props);
+ Event timerEvent = new Event(ScheduledApplication.TIMER_TOPIC, (Dictionary<String, ?>) props);
EclipseScheduledApplication[] apps = null;
// poor mans implementation of dispatching events; the spec will not allow us to use event admin to dispatch the virtual timer events; boo!!
synchronized (timerApps) {
if (timerApps.size() == 0)
continue;
- apps = (EclipseScheduledApplication[]) timerApps.toArray(new EclipseScheduledApplication[timerApps.size()]);
+ apps = timerApps.toArray(new EclipseScheduledApplication[timerApps.size()]);
}
for (int i = 0; i < apps.length; i++) {
try {
diff --git a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppContainer.java b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppContainer.java
index b3aba5f9..65709f60 100644
--- a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppContainer.java
+++ b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppContainer.java
@@ -64,7 +64,7 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
private final Object lock = new Object();
// A map of ApplicationDescriptors keyed by eclipse application ID
/* @GuardedBy(lock) */
- final private HashMap apps = new HashMap();
+ final private HashMap<String, EclipseAppDescriptor> apps = new HashMap<>();
final private IExtensionRegistry extensionRegistry;
final private ServiceTracker launcherTracker;
@@ -72,7 +72,7 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
private boolean missingProductReported;
/* @GuardedBy(lock) */
- final private Collection activeHandles = new ArrayList(); // the currently active application handles
+ final private Collection<EclipseAppHandle> activeHandles = new ArrayList<>(); // the currently active application handles
/* @GuardedBy(lock) */
private EclipseAppHandle activeMain; // the handle currently running on the main thread
/* @GuardedBy(lock) */
@@ -80,7 +80,7 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
/* @GuardedBy(lock) */
private EclipseAppHandle activeScopedSingleton; // the current scoped singleton handle
/* @GuardedBy(lock) */
- private HashMap/*<<String> <ArrayList <EclipseAppHandle>> */ activeLimited; // Map of handles that have cardinality limits
+ private HashMap<String, ArrayList<EclipseAppHandle>> activeLimited; // Map of handles that have cardinality limits
private String defaultAppId;
private DefaultApplicationListener defaultAppListener;
private ParameterizedRunnable defaultMainThreadAppHandle; // holds the default app handle to be run on the main thread
@@ -129,12 +129,12 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
private EclipseAppDescriptor getAppDescriptor(String applicationId) {
EclipseAppDescriptor result = null;
synchronized (lock) {
- result = (EclipseAppDescriptor) apps.get(applicationId);
+ result = apps.get(applicationId);
}
if (result == null) {
registerAppDescriptor(applicationId); // try again just in case we are waiting for an event
synchronized (lock) {
- result = (EclipseAppDescriptor) apps.get(applicationId);
+ result = apps.get(applicationId);
}
}
return result;
@@ -145,7 +145,7 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
System.out.println("Creating application descriptor: " + appExtension.getUniqueIdentifier()); //$NON-NLS-1$
String iconPath = null;
synchronized (lock) {
- EclipseAppDescriptor appDescriptor = (EclipseAppDescriptor) apps.get(appExtension.getUniqueIdentifier());
+ EclipseAppDescriptor appDescriptor = apps.get(appExtension.getUniqueIdentifier());
if (appDescriptor != null)
return appDescriptor;
// the appDescriptor does not exist for the app ID; create it
@@ -200,7 +200,7 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
if (Activator.DEBUG)
System.out.println("Removing application descriptor: " + applicationId); //$NON-NLS-1$
synchronized (lock) {
- EclipseAppDescriptor appDescriptor = (EclipseAppDescriptor) apps.remove(applicationId);
+ EclipseAppDescriptor appDescriptor = apps.remove(applicationId);
if (appDescriptor == null)
return null;
appDescriptor.unregister();
@@ -211,7 +211,7 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
/*
* Gives access to the RegisterService privileged action.
*/
- PrivilegedAction getRegServiceAction(String[] serviceClasses, Object serviceObject, Dictionary serviceProps) {
+ PrivilegedAction getRegServiceAction(String[] serviceClasses, Object serviceObject, Dictionary<String, ?> serviceProps) {
return new RegisterService(serviceClasses, serviceObject, serviceProps);
}
@@ -221,9 +221,9 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
private class RegisterService implements PrivilegedAction {
String[] serviceClasses;
Object serviceObject;
- Dictionary serviceProps;
+ Dictionary<String, ?> serviceProps;
- RegisterService(String[] serviceClasses, Object serviceObject, Dictionary serviceProps) {
+ RegisterService(String[] serviceClasses, Object serviceObject, Dictionary<String, ?> serviceProps) {
this.serviceClasses = serviceClasses;
this.serviceObject = serviceObject;
this.serviceProps = serviceProps;
@@ -239,7 +239,7 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
// find the default application
String applicationId = getDefaultAppId();
EclipseAppDescriptor defaultDesc = null;
- Map args = new HashMap(2);
+ Map<String, Object> args = new HashMap<>(2);
args.put(EclipseAppDescriptor.APP_DEFAULT, Boolean.TRUE);
if (applicationId == null && !delayError) {
// the application id is not set; use a descriptor that will throw an exception
@@ -438,7 +438,7 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
return branding;
}
IConfigurationElement[] elements = extensionRegistry.getConfigurationElementsFor(PI_RUNTIME, PT_PRODUCTS);
- List logEntries = null;
+ List<FrameworkLogEntry> logEntries = null;
for (int i = 0; i < elements.length; i++) {
IConfigurationElement element = elements[i];
if (element.getName().equalsIgnoreCase("provider")) { //$NON-NLS-1$
@@ -454,13 +454,13 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
}
} catch (CoreException e) {
if (logEntries == null)
- logEntries = new ArrayList(3);
+ logEntries = new ArrayList<>(3);
logEntries.add(new FrameworkLogEntry(Activator.PI_APP, NLS.bind(Messages.provider_invalid, element.getParent().toString()), 0, e, null));
}
}
}
if (logEntries != null)
- Activator.log(new FrameworkLogEntry(Activator.PI_APP, Messages.provider_invalid_general, 0, null, (FrameworkLogEntry[]) logEntries.toArray(new FrameworkLogEntry[logEntries.size()])));
+ Activator.log(new FrameworkLogEntry(Activator.PI_APP, Messages.provider_invalid_general, 0, null, logEntries.toArray(new FrameworkLogEntry[logEntries.size()])));
if (!missingProductReported) {
Activator.log(new FrameworkLogEntry(Activator.PI_APP, NLS.bind(Messages.product_notFound, productId), 0, null, null));
@@ -471,8 +471,8 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
private void refreshAppDescriptors() {
synchronized (lock) {
- for (Iterator allApps = apps.values().iterator(); allApps.hasNext();)
- ((EclipseAppDescriptor) allApps.next()).refreshProperties();
+ for (Iterator<EclipseAppDescriptor> allApps = apps.values().iterator(); allApps.hasNext();)
+ allApps.next().refreshProperties();
}
}
@@ -506,10 +506,10 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
break;
case EclipseAppDescriptor.FLAG_CARD_LIMITED :
if (activeLimited == null)
- activeLimited = new HashMap(3);
- ArrayList limited = (ArrayList) activeLimited.get(eclipseApp.getApplicationId());
+ activeLimited = new HashMap<>(3);
+ ArrayList<EclipseAppHandle> limited = activeLimited.get(eclipseApp.getApplicationId());
if (limited == null) {
- limited = new ArrayList(eclipseApp.getCardinality());
+ limited = new ArrayList<>(eclipseApp.getCardinality());
activeLimited.put(eclipseApp.getApplicationId(), limited);
}
limited.add(appHandle);
@@ -534,7 +534,7 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
activeScopedSingleton = null;
else if (((EclipseAppDescriptor) appHandle.getApplicationDescriptor()).getCardinalityType() == EclipseAppDescriptor.FLAG_CARD_LIMITED) {
if (activeLimited != null) {
- ArrayList limited = (ArrayList) activeLimited.get(((EclipseAppDescriptor) appHandle.getApplicationDescriptor()).getApplicationId());
+ ArrayList<EclipseAppHandle> limited = activeLimited.get(((EclipseAppDescriptor) appHandle.getApplicationDescriptor()).getApplicationId());
if (limited != null)
limited.remove(appHandle);
}
@@ -561,7 +561,7 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
break;
case EclipseAppDescriptor.FLAG_CARD_LIMITED :
if (activeLimited != null) {
- ArrayList limited = (ArrayList) activeLimited.get(eclipseApp.getApplicationId());
+ ArrayList<EclipseAppHandle> limited = activeLimited.get(eclipseApp.getApplicationId());
if (limited != null && limited.size() >= eclipseApp.getCardinality())
return LOCKED_SINGLETON_LIMITED_RUNNING;
}
@@ -577,7 +577,7 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
}
}
- static Object callMethod(Object obj, String methodName, Class[] argTypes, Object[] args) {
+ static Object callMethod(Object obj, String methodName, Class<?>[] argTypes, Object[] args) {
try {
return callMethodWithException(obj, methodName, argTypes, args);
} catch (Throwable t) {
@@ -586,7 +586,7 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
return null;
}
- static Object callMethodWithException(Object obj, String methodName, Class[] argTypes, Object[] args) throws Exception {
+ static Object callMethodWithException(Object obj, String methodName, Class<?>[] argTypes, Object[] args) throws Exception {
try {
Method method = obj.getClass().getMethod(methodName, argTypes);
return method.invoke(obj, args);
diff --git a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppDescriptor.java b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppDescriptor.java
index 7282e61d..4853b95e 100644
--- a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppDescriptor.java
+++ b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppDescriptor.java
@@ -73,9 +73,9 @@ public class EclipseAppDescriptor extends ApplicationDescriptor {
baseIconDir = iconPath.substring(0, lastSlash);
iconFile = iconPath.substring(lastSlash + 1);
}
- Enumeration urls = contributor.findEntries(baseIconDir, iconFile, false);
+ Enumeration<URL> urls = contributor.findEntries(baseIconDir, iconFile, false);
if (urls != null && urls.hasMoreElements())
- iconResult = (URL) urls.nextElement();
+ iconResult = urls.nextElement();
}
this.iconURL = iconResult;
}
@@ -163,8 +163,8 @@ public class EclipseAppDescriptor extends ApplicationDescriptor {
/*
* Gets a snapshot of the current service properties.
*/
- Hashtable getServiceProperties() {
- Hashtable props = new Hashtable(10);
+ Hashtable<String, Object> getServiceProperties() {
+ Hashtable<String, Object> props = new Hashtable<>(10);
props.put(ApplicationDescriptor.APPLICATION_PID, getApplicationId());
if (name != null)
props.put(ApplicationDescriptor.APPLICATION_NAME, name);
@@ -192,7 +192,7 @@ public class EclipseAppDescriptor extends ApplicationDescriptor {
/*
* Returns the appHandle. If it does not exist then one is created.
*/
- private EclipseAppHandle createAppHandle(Map arguments) throws ApplicationException {
+ private EclipseAppHandle createAppHandle(Map<String, Object> arguments) throws ApplicationException {
EclipseAppHandle newAppHandle = new EclipseAppHandle(getInstanceID(), arguments, this);
appContainer.lock(newAppHandle);
ServiceRegistration appHandleReg = (ServiceRegistration) AccessController.doPrivileged(appContainer.getRegServiceAction(new String[] {ApplicationHandle.class.getName(), IApplicationContext.class.getName()}, newAppHandle, newAppHandle.getServiceProperties()));
diff --git a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppHandle.java b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppHandle.java
index 7d800ce6..b884eb41 100644
--- a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppHandle.java
+++ b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppHandle.java
@@ -45,7 +45,7 @@ public class EclipseAppHandle extends ApplicationHandle implements ApplicationRu
private volatile ServiceRegistration handleRegistration;
private int status = EclipseAppHandle.FLAG_STARTING;
- private final Map arguments;
+ private final Map<String, Object> arguments;
private Object application;
private final Boolean defaultAppInstance;
private Object result;
@@ -56,13 +56,13 @@ public class EclipseAppHandle extends ApplicationHandle implements ApplicationRu
/*
* Constructs a handle for a single running instance of a eclipse application.
*/
- EclipseAppHandle(String instanceId, Map arguments, EclipseAppDescriptor descriptor) {
+ EclipseAppHandle(String instanceId, Map<String, Object> arguments, EclipseAppDescriptor descriptor) {
super(instanceId, descriptor);
defaultAppInstance = arguments == null || arguments.get(EclipseAppDescriptor.APP_DEFAULT) == null ? Boolean.FALSE : (Boolean) arguments.remove(EclipseAppDescriptor.APP_DEFAULT);
if (arguments == null)
- this.arguments = new HashMap(2);
+ this.arguments = new HashMap<>(2);
else
- this.arguments = new HashMap(arguments);
+ this.arguments = new HashMap<>(arguments);
}
@Override
@@ -131,8 +131,8 @@ public class EclipseAppHandle extends ApplicationHandle implements ApplicationRu
/*
* Gets a snapshot of the current service properties.
*/
- Dictionary getServiceProperties() {
- Dictionary props = new Hashtable(6);
+ Dictionary<String, Object> getServiceProperties() {
+ Dictionary<String, Object> props = new Hashtable<>(6);
props.put(ApplicationHandle.APPLICATION_PID, getInstanceId());
props.put(ApplicationHandle.APPLICATION_STATE, getState());
props.put(ApplicationHandle.APPLICATION_DESCRIPTOR, getApplicationDescriptor().getApplicationId());
@@ -296,13 +296,11 @@ public class EclipseAppHandle extends ApplicationHandle implements ApplicationRu
if (refs == null || refs.length == 0)
return null;
// Implement our own Comparator to sort services
- Arrays.sort(refs, new Comparator() {
+ Arrays.sort(refs, new Comparator<ServiceReference>() {
@Override
- public int compare(Object o1, Object o2) {
+ public int compare(ServiceReference ref1, ServiceReference ref2) {
// sort in descending order
// sort based on service ranking first; highest rank wins
- ServiceReference ref1 = (ServiceReference) o1;
- ServiceReference ref2 = (ServiceReference) o2;
Object property = ref1.getProperty(Constants.SERVICE_RANKING);
int rank1 = (property instanceof Integer) ? ((Integer) property).intValue() : 0;
property = ref2.getProperty(Constants.SERVICE_RANKING);
diff --git a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseScheduledApplication.java b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseScheduledApplication.java
index 6b70469d..3a242b08 100644
--- a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseScheduledApplication.java
+++ b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseScheduledApplication.java
@@ -33,14 +33,14 @@ public class EclipseScheduledApplication implements ScheduledApplication, EventH
private boolean recurring;
private String topic;
private String eventFilter;
- private Map args;
+ private Map<String, Object> args;
private String appPid;
private String id;
private ServiceRegistration sr;
private ServiceTracker appTracker;
private boolean removed = false;
- EclipseScheduledApplication(BundleContext context, String id, String appPid, Map args, String topic, String eventFilter, boolean recurring) throws InvalidSyntaxException {
+ EclipseScheduledApplication(BundleContext context, String id, String appPid, Map<String, Object> args, String topic, String eventFilter, boolean recurring) throws InvalidSyntaxException {
this.id = id;
this.appPid = appPid;
this.args = args;
@@ -89,14 +89,14 @@ public class EclipseScheduledApplication implements ScheduledApplication, EventH
}
@Override
- public synchronized Map getArguments() {
+ public synchronized Map<String, Object> getArguments() {
if (removed)
throw new IllegalStateException(Messages.scheduled_app_removed);
- return args == null ? null : new HashMap(args);
+ return args == null ? null : new HashMap<>(args);
}
- private Map getArguments(Event trigger) {
- Map result = args == null ? new HashMap() : getArguments();
+ private Map<String, Object> getArguments(Event trigger) {
+ Map<String, Object> result = args == null ? new HashMap<String, Object>() : getArguments();
result.put(TRIGGERING_EVENT, new GuardedObject(trigger, new TriggerGuard(trigger.getTopic())));
return result;
}
diff --git a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/ProductExtensionBranding.java b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/ProductExtensionBranding.java
index 13f4b0f3..445f742b 100644
--- a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/ProductExtensionBranding.java
+++ b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/ProductExtensionBranding.java
@@ -27,7 +27,7 @@ public class ProductExtensionBranding implements IBranding {
String name = null;
String id = null;
String description = null;
- HashMap properties;
+ HashMap<String, String> properties;
Bundle definingBundle = null;
public ProductExtensionBranding(String id, IConfigurationElement element) {
@@ -42,7 +42,7 @@ public class ProductExtensionBranding implements IBranding {
private void loadProperties(IConfigurationElement element) {
IConfigurationElement[] children = element.getChildren();
- properties = new HashMap(children.length);
+ properties = new HashMap<>(children.length);
for (int i = 0; i < children.length; i++) {
IConfigurationElement child = children[i];
String key = child.getAttribute(ATTR_NAME);
@@ -80,7 +80,7 @@ public class ProductExtensionBranding implements IBranding {
@Override
public String getProperty(String key) {
- return (String) properties.get(key);
+ return properties.get(key);
}
@Override

Back to the top