Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2017-07-12 14:18:59 +0000
committerAndrey Loskutov2017-07-12 14:18:59 +0000
commit16ac0f7fcd3ec2db793fc077b2cc67b2dfa72c8e (patch)
tree9c378c38187cdd7d83049273f35d6e861bf7a1fa
parente7b6b39346529ae4262b502d6383cc6f8c27ba20 (diff)
downloadrt.equinox.bundles-16ac0f7fcd3ec2db793fc077b2cc67b2dfa72c8e.tar.gz
rt.equinox.bundles-16ac0f7fcd3ec2db793fc077b2cc67b2dfa72c8e.tar.xz
rt.equinox.bundles-16ac0f7fcd3ec2db793fc077b2cc67b2dfa72c8e.zip
Bug 519547 - generification for internal classes
Change-Id: Ie6c6ee7b34cf8184ab24b828aa9cde290a75ebc6 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/adapter/AdapterFactoryProxy.java8
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/adapter/AdapterManagerListener.java8
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/BaseExtensionPointHandle.java4
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/CombinedEventDelta.java73
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ConfigurationElement.java4
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/Extension.java6
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionPoint.java6
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionRegistry.java52
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionsParser.java44
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ReferenceMap.java16
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryChangeEvent.java8
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryDelta.java16
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryObjectManager.java94
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableReader.java24
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableWriter.java37
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TemporaryObjectManager.java4
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/Activator.java8
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/EclipseBundleListener.java18
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/EquinoxRegistryStrategy.java2
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/EquinoxUtils.java6
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/ExtensionEventDispatcherJob.java4
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/OSGIUtils.java12
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/RegistryStrategyOSGI.java14
23 files changed, 237 insertions, 231 deletions
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/adapter/AdapterFactoryProxy.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/adapter/AdapterFactoryProxy.java
index 4880e25a9..9fc1f9f2d 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/adapter/AdapterFactoryProxy.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/adapter/AdapterFactoryProxy.java
@@ -77,14 +77,14 @@ class AdapterFactoryProxy implements IAdapterFactory, IAdapterFactoryExt {
}
@Override
- public Object getAdapter(Object adaptableObject, Class adapterType) {
+ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (!factoryLoaded)
loadFactory(false);
return factory == null ? null : factory.getAdapter(adaptableObject, adapterType);
}
@Override
- public Class[] getAdapterList() {
+ public Class<?>[] getAdapterList() {
if (!factoryLoaded)
loadFactory(false);
return factory == null ? null : factory.getAdapterList();
@@ -93,7 +93,7 @@ class AdapterFactoryProxy implements IAdapterFactory, IAdapterFactoryExt {
@Override
public String[] getAdapterNames() {
IConfigurationElement[] children = element.getChildren();
- ArrayList adapters = new ArrayList(children.length);
+ ArrayList<String> adapters = new ArrayList<>(children.length);
for (int i = 0; i < children.length; i++) {
//ignore unknown children for forward compatibility
if ("adapter".equals(children[i].getName())) { //$NON-NLS-1$
@@ -104,7 +104,7 @@ class AdapterFactoryProxy implements IAdapterFactory, IAdapterFactoryExt {
}
if (adapters.isEmpty())
logError();
- return (String[]) adapters.toArray(new String[adapters.size()]);
+ return adapters.toArray(new String[adapters.size()]);
}
IExtension getExtension() {
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/adapter/AdapterManagerListener.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/adapter/AdapterManagerListener.java
index 80c65b599..3aa265d8d 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/adapter/AdapterManagerListener.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/adapter/AdapterManagerListener.java
@@ -23,7 +23,7 @@ import org.eclipse.core.runtime.*;
public final class AdapterManagerListener implements IRegistryEventListener, IAdapterManagerProvider {
public static final String ADAPTER_POINT_ID = "org.eclipse.core.runtime.adapters"; //$NON-NLS-1$
- private AdapterManager theAdapterManager;
+ private final AdapterManager theAdapterManager;
/**
* Constructs a new adapter manager.
@@ -80,9 +80,9 @@ public final class AdapterManagerListener implements IRegistryEventListener, IAd
public synchronized void removed(IExtension[] extensions) {
theAdapterManager.flushLookup();
for (int i = 0; i < extensions.length; i++) {
- for (Iterator it = theAdapterManager.getFactories().values().iterator(); it.hasNext();) {
- for (Iterator it2 = ((List) it.next()).iterator(); it2.hasNext();) {
- IAdapterFactory factory = (IAdapterFactory) it2.next();
+ for (Iterator<List<IAdapterFactory>> it = theAdapterManager.getFactories().values().iterator(); it.hasNext();) {
+ for (Iterator<IAdapterFactory> it2 = (it.next()).iterator(); it2.hasNext();) {
+ IAdapterFactory factory = it2.next();
if (!(factory instanceof AdapterFactoryProxy))
continue;
if (((AdapterFactoryProxy) factory).originatesFrom(extensions[i]))
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/BaseExtensionPointHandle.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/BaseExtensionPointHandle.java
index a9a4c2751..b34298ae1 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/BaseExtensionPointHandle.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/BaseExtensionPointHandle.java
@@ -73,11 +73,11 @@ public class BaseExtensionPointHandle extends Handle implements IExtensionPoint
if (tmpExtensions.length == 0)
return ConfigurationElementHandle.EMPTY_ARRAY;
- ArrayList result = new ArrayList();
+ ArrayList<Handle> result = new ArrayList<>();
for (int i = 0; i < tmpExtensions.length; i++) {
result.addAll(Arrays.asList(objectManager.getHandles(tmpExtensions[i].getRawChildren(), RegistryObjectManager.CONFIGURATION_ELEMENT)));
}
- return (IConfigurationElement[]) result.toArray(new IConfigurationElement[result.size()]);
+ return result.toArray(new IConfigurationElement[result.size()]);
}
public String getLabelAsIs() {
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/CombinedEventDelta.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/CombinedEventDelta.java
index a4ea4a3a4..6eb87ccaf 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/CombinedEventDelta.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/CombinedEventDelta.java
@@ -32,11 +32,11 @@ public class CombinedEventDelta {
// an empty array trail used to reduce re-allocations
final static private int arrayGrowthSpace = 5;
- private Map extensionsByID = null; // extension point ID -> List of Integer extensions IDs
- private Map extPointsByID = null; // extension point ID -> List of Integer extension point IDs
+ private Map<String, List<Integer>> extensionsByID; // extension point ID -> List of Integer extensions IDs
+ private Map<String, List<Integer>> extPointsByID; // extension point ID -> List of Integer extension point IDs
- private ArrayList allExtensions = null; // List of Integer IDs
- private ArrayList allExtensionPoints = null; // List if Integer IDs
+ private List<Integer> allExtensions; // List of Integer IDs
+ private List<Integer> allExtensionPoints; // List if Integer IDs
private CombinedEventDelta(boolean addition) {
this.addition = addition;
@@ -66,50 +66,54 @@ public class CombinedEventDelta {
return objectManager;
}
- private List getExtensionsBucket(String id) {
- if (extensionsByID == null)
- extensionsByID = new HashMap();
- List extensions = (List) extensionsByID.get(id);
+ private List<Integer> getExtensionsBucket(String id) {
+ if (extensionsByID == null) {
+ extensionsByID = new HashMap<>();
+ }
+ List<Integer> extensions = extensionsByID.get(id);
if (extensions == null) {
- extensions = new ArrayList(arrayGrowthSpace);
+ extensions = new ArrayList<>(arrayGrowthSpace);
extensionsByID.put(id, extensions);
}
return extensions;
}
- private List getExtPointsBucket(String id) {
- if (extPointsByID == null)
- extPointsByID = new HashMap();
- List extensionPoints = (List) extPointsByID.get(id);
+ private List<Integer> getExtPointsBucket(String id) {
+ if (extPointsByID == null) {
+ extPointsByID = new HashMap<>();
+ }
+ List<Integer> extensionPoints = extPointsByID.get(id);
if (extensionPoints == null) {
- extensionPoints = new ArrayList(arrayGrowthSpace);
+ extensionPoints = new ArrayList<>(arrayGrowthSpace);
extPointsByID.put(id, extensionPoints);
}
return extensionPoints;
}
- private List getExtPointsGlobal() {
- if (allExtensionPoints == null)
- allExtensionPoints = new ArrayList();
+ private List<Integer> getExtPointsGlobal() {
+ if (allExtensionPoints == null) {
+ allExtensionPoints = new ArrayList<>();
+ }
return allExtensionPoints;
}
- private List getExtensionsGlobal() {
- if (allExtensions == null)
- allExtensions = new ArrayList();
+ private List<Integer> getExtensionsGlobal() {
+ if (allExtensions == null) {
+ allExtensions = new ArrayList<>();
+ }
return allExtensions;
}
public void rememberExtensionPoint(ExtensionPoint extensionPoint) {
String bucketId = extensionPoint.getUniqueIdentifier();
- Object extPt = new Integer(extensionPoint.getObjectId());
+ Integer extPt = new Integer(extensionPoint.getObjectId());
getExtPointsBucket(bucketId).add(extPt);
getExtPointsGlobal().add(extPt);
}
public void rememberExtension(ExtensionPoint extensionPoint, int ext) {
String bucketId = extensionPoint.getUniqueIdentifier();
- Object extension = new Integer(ext);
+ Integer extension = new Integer(ext);
getExtensionsBucket(bucketId).add(extension);
getExtensionsGlobal().add(extension);
@@ -125,40 +129,41 @@ public class CombinedEventDelta {
}
public IExtensionPoint[] getExtensionPoints(String id) {
- List extensionPoints = null;
+ List<Integer> extensionPoints = null;
if (id != null && extPointsByID != null)
- extensionPoints = (List) extPointsByID.get(id);
+ extensionPoints = extPointsByID.get(id);
else if (id == null)
extensionPoints = allExtensionPoints;
if (extensionPoints == null) // no changes that fit the filter
return null;
int size = extensionPoints.size();
- ArrayList result = new ArrayList(size);
+ ArrayList<IExtensionPoint> result = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
- Integer extPt = (Integer) extensionPoints.get(i);
+ Integer extPt = extensionPoints.get(i);
IExtensionPoint extensionPoint = new ExtensionPointHandle(objectManager, extPt.intValue());
result.add(extensionPoint);
}
if (result.size() == 0)
return null;
- return (IExtensionPoint[]) result.toArray(new IExtensionPoint[result.size()]);
+ return result.toArray(new IExtensionPoint[result.size()]);
}
public IExtension[] getExtensions(String id) {
- List extensions = null;
- if (id != null && extensionsByID != null)
- extensions = (List) extensionsByID.get(id);
- else if (id == null)
+ List<Integer> extensions = null;
+ if (id != null && extensionsByID != null) {
+ extensions = extensionsByID.get(id);
+ } else if (id == null) {
extensions = allExtensions;
+ }
if (extensions == null) // no changes that fit the filter
return null;
int size = extensions.size();
- ArrayList result = new ArrayList(size);
+ ArrayList<IExtension> result = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
- Integer ext = (Integer) extensions.get(i);
+ Integer ext = extensions.get(i);
IExtension extension = new ExtensionHandle(objectManager, ext.intValue());
result.add(extension);
}
- return (IExtension[]) result.toArray(new IExtension[result.size()]);
+ return result.toArray(new IExtension[result.size()]);
}
}
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ConfigurationElement.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ConfigurationElement.java
index 10ca0f528..0787dd5dc 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ConfigurationElement.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ConfigurationElement.java
@@ -198,7 +198,7 @@ public class ConfigurationElement extends RegistryObject {
ConfigurationElement[] exec;
ConfigurationElement[] parms;
ConfigurationElement element;
- Hashtable initParms;
+ Hashtable<String, String> initParms;
String pname;
exec = getChildren(attributeName);
@@ -208,7 +208,7 @@ public class ConfigurationElement extends RegistryObject {
className = element.getAttribute("class"); //$NON-NLS-1$
parms = element.getChildren("parameter"); //$NON-NLS-1$
if (parms.length != 0) {
- initParms = new Hashtable(parms.length + 1);
+ initParms = new Hashtable<>(parms.length + 1);
for (i = 0; i < parms.length; i++) {
pname = parms[i].getAttribute("name"); //$NON-NLS-1$
if (pname != null)
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/Extension.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/Extension.java
index 58c12f524..bece50478 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/Extension.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/Extension.java
@@ -82,9 +82,9 @@ public class Extension extends RegistryObject {
//The extension has been loaded from the cache.
String[] result = null;
- if (extraInformation == null || (result = ((extraInformation instanceof SoftReference) ? (String[]) ((SoftReference) extraInformation).get() : (String[]) extraInformation)) == null) {
+ if (extraInformation == null || (result = ((extraInformation instanceof SoftReference) ? (String[]) ((SoftReference<?>) extraInformation).get() : (String[]) extraInformation)) == null) {
result = registry.getTableReader().loadExtensionExtraData(getExtraDataOffset());
- extraInformation = new SoftReference(result);
+ extraInformation = new SoftReference<>(result);
}
return result;
}
@@ -135,7 +135,7 @@ public class Extension extends RegistryObject {
*/
private void ensureExtraInformationType() {
if (extraInformation instanceof SoftReference) {
- extraInformation = ((SoftReference) extraInformation).get();
+ extraInformation = ((SoftReference<?>) extraInformation).get();
}
if (extraInformation == null) {
extraInformation = new String[EXTRA_SIZE];
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionPoint.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionPoint.java
index fbff5aec4..2093f79e6 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionPoint.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionPoint.java
@@ -58,9 +58,9 @@ public class ExtensionPoint extends RegistryObject {
//The extension point has been loaded from the cache.
String[] result = null;
- if (extraInformation == null || (result = ((extraInformation instanceof SoftReference) ? (String[]) ((SoftReference) extraInformation).get() : (String[]) extraInformation)) == null) {
+ if (extraInformation == null || (result = ((extraInformation instanceof SoftReference) ? (String[]) ((SoftReference<?>) extraInformation).get() : (String[]) extraInformation)) == null) {
result = registry.getTableReader().loadExtensionPointExtraData(getExtraDataOffset());
- extraInformation = new SoftReference(result);
+ extraInformation = new SoftReference<>(result);
}
return result;
}
@@ -70,7 +70,7 @@ public class ExtensionPoint extends RegistryObject {
*/
private void ensureExtraInformationType() {
if (extraInformation instanceof SoftReference) {
- extraInformation = ((SoftReference) extraInformation).get();
+ extraInformation = ((SoftReference<?>) extraInformation).get();
}
if (extraInformation == null) {
extraInformation = new String[EXTRA_SIZE];
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionRegistry.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionRegistry.java
index 317b60898..ada1c3226 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionRegistry.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionRegistry.java
@@ -56,28 +56,28 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR
}
// used to enforce concurrent access policy for readers/writers
- private ReadWriteMonitor access = new ReadWriteMonitor();
+ private final ReadWriteMonitor access = new ReadWriteMonitor();
// deltas not broadcasted yet. Deltas are kept organized by the namespace name (objects with the same namespace are grouped together)
- private transient Map deltas = new HashMap(11);
+ private transient Map<String, Object> deltas = new HashMap<>(11);
//storage manager associated with the registry cache
protected StorageManager cacheStorageManager;
// all registry change listeners
- private transient ListenerList listeners = new ListenerList();
+ private transient ListenerList<ListenerInfo> listeners = new ListenerList<>();
private RegistryObjectManager registryObjects = null;
// Table reader associated with this extension registry
protected TableReader theTableReader = new TableReader(this);
- private Object masterToken; // use to get full control of the registry; objects created as "static"
- private Object userToken; // use to modify non-persisted registry elements
+ private final Object masterToken; // use to get full control of the registry; objects created as "static"
+ private final Object userToken; // use to modify non-persisted registry elements
protected RegistryStrategy strategy; // overridable portions of the registry functionality
- private RegistryTimestamp aggregatedTimestamp = new RegistryTimestamp(); // tracks current contents of the registry
+ private final RegistryTimestamp aggregatedTimestamp = new RegistryTimestamp(); // tracks current contents of the registry
// encapsulates processing of new registry deltas
private CombinedEventDelta eventDelta = null;
@@ -181,9 +181,9 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR
return recordChange(extensionPoint, orphans, IExtensionDelta.ADDED);
}
- private Set addExtensionsAndExtensionPoints(Contribution element) {
+ private Set<String> addExtensionsAndExtensionPoints(Contribution element) {
// now add and resolve extensions and extension points
- Set affectedNamespaces = new HashSet();
+ Set<String> affectedNamespaces = new HashSet<>();
int[] extPoints = element.getExtensionPoints();
for (int i = 0; i < extPoints.length; i++) {
String namespace = this.addExtensionPoint(extPoints[i]);
@@ -230,13 +230,13 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR
registryObjects.addContribution(element);
if (!link)
return;
- Set affectedNamespaces = addExtensionsAndExtensionPoints(element);
+ Set<String> affectedNamespaces = addExtensionsAndExtensionPoints(element);
setObjectManagers(affectedNamespaces, registryObjects.createDelegatingObjectManager(registryObjects.getAssociatedObjects(element.getContributorId())));
}
- private void setObjectManagers(Set affectedNamespaces, IObjectManager manager) {
- for (Iterator iter = affectedNamespaces.iterator(); iter.hasNext();) {
- getDelta((String) iter.next()).setObjectManager(manager);
+ private void setObjectManagers(Set<String> affectedNamespaces, IObjectManager manager) {
+ for (Iterator<String> iter = affectedNamespaces.iterator(); iter.hasNext();) {
+ getDelta(iter.next()).setObjectManager(manager);
}
if (eventDelta != null)
eventDelta.setObjectManager(manager);
@@ -244,8 +244,8 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR
private void basicRemove(String contributorId) {
// ignore anonymous namespaces
- Set affectedNamespaces = removeExtensionsAndExtensionPoints(contributorId);
- Map associatedObjects = registryObjects.getAssociatedObjects(contributorId);
+ Set<String> affectedNamespaces = removeExtensionsAndExtensionPoints(contributorId);
+ Map<Integer, RegistryObject> associatedObjects = registryObjects.getAssociatedObjects(contributorId);
registryObjects.removeObjects(associatedObjects);
registryObjects.addNavigableObjects(associatedObjects); // put the complete set of navigable objects
setObjectManagers(affectedNamespaces, registryObjects.createDelegatingObjectManager(associatedObjects));
@@ -277,7 +277,7 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR
}
// for thread safety, create tmp collections
Object[] tmpListeners = listeners.getListeners();
- Map tmpDeltas = new HashMap(this.deltas);
+ Map<String, Object> tmpDeltas = new HashMap<>(this.deltas);
// the deltas have been saved for notification - we can clear them now
deltas.clear();
// do the notification asynchronously
@@ -640,8 +640,8 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR
return recordChange(extensionPoint, existingExtensions, IExtensionDelta.REMOVED);
}
- private Set removeExtensionsAndExtensionPoints(String contributorId) {
- Set affectedNamespaces = new HashSet();
+ private Set<String> removeExtensionsAndExtensionPoints(String contributorId) {
+ Set<String> affectedNamespaces = new HashSet<>();
int[] extensions = registryObjects.getExtensionsFrom(contributorId);
for (int i = 0; i < extensions.length; i++) {
String namespace = this.removeExtension(extensions[i]);
@@ -934,7 +934,7 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR
//////////////////////////////////////////////////////////////////////////////////////////
// Registry change events processing
- public IStatus processChangeEvent(Object[] listenerInfos, final Map scheduledDeltas) {
+ public IStatus processChangeEvent(Object[] listenerInfos, final Map<String, ?> scheduledDeltas) {
// Separate new event delta from the pack
final CombinedEventDelta extendedDelta = (CombinedEventDelta) scheduledDeltas.remove(notNamespace);
@@ -975,7 +975,7 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR
}
}
}
- for (Iterator iter = scheduledDeltas.values().iterator(); iter.hasNext();) {
+ for (Iterator<?> iter = scheduledDeltas.values().iterator(); iter.hasNext();) {
((RegistryDelta) iter.next()).getObjectManager().close();
}
IObjectManager manager = extendedDelta.getObjectManager();
@@ -985,11 +985,11 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR
}
private RegistryEventThread eventThread = null; // registry event loop
- protected final List queue = new LinkedList(); // stores registry events info
+ protected final List<QueueElement> queue = new LinkedList<>(); // stores registry events info
// Registry events notifications are done on a separate thread in a sequential manner
// (first in - first processed)
- public void scheduleChangeEvent(Object[] listenerInfos, Map scheduledDeltas) {
+ public void scheduleChangeEvent(Object[] listenerInfos, Map<String, ?> scheduledDeltas) {
QueueElement newElement = new QueueElement(listenerInfos, scheduledDeltas);
if (eventThread == null) {
eventThread = new RegistryEventThread(this);
@@ -1004,16 +1004,16 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR
// The pair of values we store in the event queue
private class QueueElement {
Object[] listenerInfos;
- Map scheduledDeltas;
+ Map<String, ?> scheduledDeltas;
- QueueElement(Object[] infos, Map deltas) {
+ QueueElement(Object[] infos, Map<String, ?> deltas) {
this.scheduledDeltas = deltas;
listenerInfos = infos;
}
}
private class RegistryEventThread extends Thread {
- private ExtensionRegistry registry;
+ private final ExtensionRegistry registry;
public RegistryEventThread(ExtensionRegistry registry) {
super("Extension Registry Event Dispatcher"); //$NON-NLS-1$
@@ -1032,7 +1032,7 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR
} catch (InterruptedException e) {
return;
}
- element = (QueueElement) queue.remove(0);
+ element = queue.remove(0);
}
registry.processChangeEvent(element.listenerInfos, element.scheduledDeltas);
}
@@ -1363,7 +1363,7 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR
namespace = removeExtensionPoint(id);
else
namespace = removeExtension(id);
- Map removed = new HashMap(1);
+ Map<Integer, RegistryObject> removed = new HashMap<>(1);
removed.put(new Integer(id), registryObject);
// There is some asymmetry between extension and extension point removal. Removing extension point makes
// extensions "orphans" but does not remove them. As a result, only extensions needs to be processed.
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionsParser.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionsParser.java
index 386250d3b..76e3beadb 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionsParser.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionsParser.java
@@ -25,7 +25,7 @@ public class ExtensionsParser extends DefaultHandler {
private final static String NO_EXTENSION_MUNGING = "eclipse.noExtensionMunging"; //$NON-NLS-1$ //System property
private static final String VERSION_3_0 = "3.0"; //$NON-NLS-1$
private static final String VERSION_3_2 = "3.2"; //$NON-NLS-1$
- private static Map extensionPointMap;
+ private static Map<String, String> extensionPointMap;
static {
initializeExtensionPointMap();
@@ -35,7 +35,7 @@ public class ExtensionsParser extends DefaultHandler {
* Initialize the list of renamed extension point ids
*/
private static void initializeExtensionPointMap() {
- Map map = new HashMap(13);
+ Map<String, String> map = new HashMap<>(13);
map.put("org.eclipse.ui.markerImageProvider", "org.eclipse.ui.ide.markerImageProvider"); //$NON-NLS-1$ //$NON-NLS-2$
map.put("org.eclipse.ui.markerHelp", "org.eclipse.ui.ide.markerHelp"); //$NON-NLS-1$ //$NON-NLS-2$
map.put("org.eclipse.ui.markerImageProviders", "org.eclipse.ui.ide.markerImageProviders"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -62,19 +62,19 @@ public class ExtensionsParser extends DefaultHandler {
private String locationName = null;
// Current State Information
- private Stack stateStack = new Stack();
+ private final Stack<Integer> stateStack = new Stack<>();
// Current object stack (used to hold the current object we are
// populating in this plugin descriptor
- private Stack objectStack = new Stack();
+ private final Stack<KeyedElement> objectStack = new Stack<>();
private String schemaVersion = null;
// A status for holding results.
- private MultiStatus status;
+ private final MultiStatus status;
// Owning extension registry
- private ExtensionRegistry registry;
+ private final ExtensionRegistry registry;
// Resource bundle used to translate the content of the plugin.xml
protected ResourceBundle resources;
@@ -132,18 +132,18 @@ public class ExtensionsParser extends DefaultHandler {
private static final int EXTENSION_INDEX = 1;
private static final int LAST_INDEX = 1;
- private ArrayList scratchVectors[] = new ArrayList[LAST_INDEX + 1];
+ private final ArrayList<RegistryObject> scratchVectors[] = new ArrayList[LAST_INDEX + 1];
private Locator locator = null;
// Cache the behavior toggle (true: attempt to extract namespace from qualified IDs)
private boolean extractNamespaces = false;
- private ArrayList processedExtensionIds = null;
+ private ArrayList<String> processedExtensionIds = null;
// Keep track of elements added into the registry manager in case we encounter a error
// and need to rollback
- private ArrayList addedRegistryObjects = new ArrayList(5);
+ private final ArrayList<RegistryObject> addedRegistryObjects = new ArrayList<>(5);
public ExtensionsParser(MultiStatus status, ExtensionRegistry registry) {
super();
@@ -164,7 +164,7 @@ public class ExtensionsParser extends DefaultHandler {
*/
@Override
public void characters(char[] ch, int start, int length) {
- int state = ((Integer) stateStack.peek()).intValue();
+ int state = stateStack.peek().intValue();
if (state != CONFIGURATION_ELEMENT_STATE)
return;
if (state == CONFIGURATION_ELEMENT_STATE) {
@@ -197,7 +197,7 @@ public class ExtensionsParser extends DefaultHandler {
*/
@Override
public void endElement(String uri, String elementName, String qName) {
- switch (((Integer) stateStack.peek()).intValue()) {
+ switch (stateStack.peek().intValue()) {
case IGNORED_ELEMENT_STATE :
stateStack.pop();
break;
@@ -208,14 +208,14 @@ public class ExtensionsParser extends DefaultHandler {
case BUNDLE_STATE :
stateStack.pop();
- ArrayList extensionPoints = scratchVectors[EXTENSION_POINT_INDEX];
- ArrayList extensions = scratchVectors[EXTENSION_INDEX];
+ ArrayList<?> extensionPoints = scratchVectors[EXTENSION_POINT_INDEX];
+ ArrayList<?> extensions = scratchVectors[EXTENSION_INDEX];
int[] namespaceChildren = new int[2 + extensionPoints.size() + extensions.size()];
int position = 2;
// Put the extension points into this namespace
if (extensionPoints.size() > 0) {
namespaceChildren[Contribution.EXTENSION_POINT] = extensionPoints.size();
- for (Iterator iter = extensionPoints.iterator(); iter.hasNext();) {
+ for (Iterator<?> iter = extensionPoints.iterator(); iter.hasNext();) {
namespaceChildren[position++] = ((RegistryObject) iter.next()).getObjectId();
}
extensionPoints.clear();
@@ -223,7 +223,7 @@ public class ExtensionsParser extends DefaultHandler {
// Put the extensions into this namespace too
if (extensions.size() > 0) {
- Extension[] renamedExtensions = fixRenamedExtensionPoints((Extension[]) extensions.toArray(new Extension[extensions.size()]));
+ Extension[] renamedExtensions = fixRenamedExtensionPoints(extensions.toArray(new Extension[extensions.size()]));
namespaceChildren[Contribution.EXTENSION] = renamedExtensions.length;
for (int i = 0; i < renamedExtensions.length; i++) {
namespaceChildren[position++] = renamedExtensions[i].getObjectId();
@@ -298,8 +298,8 @@ public class ExtensionsParser extends DefaultHandler {
* Remove all elements that we have added so far into registry manager
*/
private void cleanup() {
- for (Iterator i = addedRegistryObjects.iterator(); i.hasNext();) {
- RegistryObject object = (RegistryObject) i.next();
+ for (Iterator<RegistryObject> i = addedRegistryObjects.iterator(); i.hasNext();) {
+ RegistryObject object = i.next();
if (object instanceof ExtensionPoint) {
String id = ((ExtensionPoint) object).getUniqueIdentifier();
objectManager.removeExtensionPoint(id);
@@ -491,7 +491,7 @@ public class ExtensionsParser extends DefaultHandler {
String msg = NLS.bind(RegistryMessages.parse_duplicateExtension, new String[] {currentSupplier, existingSupplier, uniqueId});
registry.log(new Status(IStatus.WARNING, RegistryMessages.OWNER_NAME, 0, msg, null));
} else if (processedExtensionIds != null) { // check elements in this contribution
- for (Iterator i = processedExtensionIds.iterator(); i.hasNext();) {
+ for (Iterator<String> i = processedExtensionIds.iterator(); i.hasNext();) {
if (uniqueId.equals(i.next())) {
String currentSupplier = contribution.getDefaultNamespace();
String existingSupplier = currentSupplier;
@@ -502,7 +502,7 @@ public class ExtensionsParser extends DefaultHandler {
}
}
if (processedExtensionIds == null)
- processedExtensionIds = new ArrayList(10);
+ processedExtensionIds = new ArrayList<>(10);
processedExtensionIds.add(uniqueId);
}
@@ -597,7 +597,7 @@ public class ExtensionsParser extends DefaultHandler {
public void startDocument() {
stateStack.push(new Integer(INITIAL_STATE));
for (int i = 0; i <= LAST_INDEX; i++) {
- scratchVectors[i] = new ArrayList();
+ scratchVectors[i] = new ArrayList<>();
}
}
@@ -606,7 +606,7 @@ public class ExtensionsParser extends DefaultHandler {
*/
@Override
public void startElement(String uri, String elementName, String qName, Attributes attributes) {
- switch (((Integer) stateStack.peek()).intValue()) {
+ switch (stateStack.peek().intValue()) {
case INITIAL_STATE :
handleInitialState(elementName, attributes);
break;
@@ -693,7 +693,7 @@ public class ExtensionsParser extends DefaultHandler {
for (int i = 0; i < extensions.length; i++) {
Extension extension = extensions[i];
String oldPointId = extension.getExtensionPointIdentifier();
- String newPointId = (String) extensionPointMap.get(oldPointId);
+ String newPointId = extensionPointMap.get(oldPointId);
if (newPointId != null) {
extension.setExtensionPointIdentifier(newPointId);
}
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ReferenceMap.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ReferenceMap.java
index 3a9b9c670..91ab4cda8 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ReferenceMap.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ReferenceMap.java
@@ -58,12 +58,12 @@ public class ReferenceMap {
*/
private static class HardRef implements IEntry {
- private int key;
+ private final int key;
private IEntry next;
/**
* Reference value. Note this can never be null.
*/
- private Object value;
+ private final Object value;
public HardRef(int key, Object value, IEntry next) {
this.key = key;
@@ -135,14 +135,14 @@ public class ReferenceMap {
* Augments a normal soft reference with additional information
* required to implement the IEntry interface.
*/
- private static class SoftRef extends SoftReference implements IEntry {
- private int key;
+ private static class SoftRef extends SoftReference<Object> implements IEntry {
+ private final int key;
/**
* For chained collisions
*/
private IEntry next;
- public SoftRef(int key, Object value, IEntry next, ReferenceQueue q) {
+ public SoftRef(int key, Object value, IEntry next, ReferenceQueue<Object> q) {
super(value, q);
this.key = key;
this.next = next;
@@ -186,12 +186,12 @@ public class ReferenceMap {
* didn't compile under JDK1.2.2.
* @serial
*/
- private float loadFactor;
+ private final float loadFactor;
/**
* ReferenceQueue used to eliminate stale mappings.
*/
- private transient ReferenceQueue queue = new ReferenceQueue();
+ private transient ReferenceQueue<Object> queue = new ReferenceQueue<>();
/**
* Number of mappings in this map.
@@ -342,7 +342,7 @@ public class ReferenceMap {
* background thread.
*/
private void purge() {
- Reference ref = queue.poll();
+ Reference<?> ref = queue.poll();
while (ref != null) {
doRemove(((IEntry) ref).getKey(), true);
ref.clear();
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryChangeEvent.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryChangeEvent.java
index 4f348e3ec..e8564fc61 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryChangeEvent.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryChangeEvent.java
@@ -20,10 +20,10 @@ import org.eclipse.core.runtime.IRegistryChangeEvent;
* deltas for the selected host will be available to clients.
*/
public final class RegistryChangeEvent implements IRegistryChangeEvent {
- private String filter;
- private Map deltas;
+ private final String filter;
+ private final Map<String, ?> deltas;
- public RegistryChangeEvent(Map deltas, String filter) {
+ public RegistryChangeEvent(Map<String, ?> deltas, String filter) {
this.deltas = deltas;
this.filter = filter;
}
@@ -35,7 +35,7 @@ public final class RegistryChangeEvent implements IRegistryChangeEvent {
return singleDelta == null ? new RegistryDelta[0] : new RegistryDelta[] {singleDelta};
}
// there is no filter - return all deltas
- return (RegistryDelta[]) deltas.values().toArray(new RegistryDelta[deltas.size()]);
+ return deltas.values().toArray(new RegistryDelta[deltas.size()]);
}
private RegistryDelta getHostDelta(String pluginId) {
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryDelta.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryDelta.java
index 9cfc4e1bf..047a69577 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryDelta.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryDelta.java
@@ -18,7 +18,7 @@ import org.eclipse.core.runtime.IExtensionDelta;
* The extension deltas are grouped by namespace. There is one registry delta by namespace.
*/
public class RegistryDelta {
- private Set extensionDeltas = new HashSet(); //the extension deltas (each element indicate the type of the delta)
+ private final Set<IExtensionDelta> extensionDeltas = new HashSet<>(); //the extension deltas (each element indicate the type of the delta)
private IObjectManager objectManager; //The object manager from which all the objects contained in the deltas will be found.
RegistryDelta() {
@@ -30,17 +30,17 @@ public class RegistryDelta {
}
public IExtensionDelta[] getExtensionDeltas() {
- return (IExtensionDelta[]) extensionDeltas.toArray(new ExtensionDelta[extensionDeltas.size()]);
+ return extensionDeltas.toArray(new ExtensionDelta[extensionDeltas.size()]);
}
public IExtensionDelta[] getExtensionDeltas(String extensionPoint) {
- Collection selectedExtDeltas = new LinkedList();
- for (Iterator extDeltasIter = extensionDeltas.iterator(); extDeltasIter.hasNext();) {
- IExtensionDelta extensionDelta = (IExtensionDelta) extDeltasIter.next();
+ Collection<IExtensionDelta> selectedExtDeltas = new LinkedList<>();
+ for (Iterator<IExtensionDelta> extDeltasIter = extensionDeltas.iterator(); extDeltasIter.hasNext();) {
+ IExtensionDelta extensionDelta = extDeltasIter.next();
if (extensionDelta.getExtension().getExtensionPointUniqueIdentifier().equals(extensionPoint))
selectedExtDeltas.add(extensionDelta);
}
- return (IExtensionDelta[]) selectedExtDeltas.toArray(new IExtensionDelta[selectedExtDeltas.size()]);
+ return selectedExtDeltas.toArray(new IExtensionDelta[selectedExtDeltas.size()]);
}
/**
@@ -48,8 +48,8 @@ public class RegistryDelta {
* @param extensionId must not be null
*/
public IExtensionDelta getExtensionDelta(String extensionPointId, String extensionId) {
- for (Iterator extDeltasIter = extensionDeltas.iterator(); extDeltasIter.hasNext();) {
- IExtensionDelta extensionDelta = (IExtensionDelta) extDeltasIter.next();
+ for (Iterator<IExtensionDelta> extDeltasIter = extensionDeltas.iterator(); extDeltasIter.hasNext();) {
+ IExtensionDelta extensionDelta = extDeltasIter.next();
IExtension extension = extensionDelta.getExtension();
if (extension.getExtensionPointUniqueIdentifier().equals(extensionPointId) && extension.getUniqueIdentifier() != null && extension.getUniqueIdentifier().equals(extensionId))
return extensionDelta;
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryObjectManager.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryObjectManager.java
index f772d94c2..a973cd6e2 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryObjectManager.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryObjectManager.java
@@ -49,25 +49,25 @@ public class RegistryObjectManager implements IObjectManager {
//Those two data structures are only used when the addition or the removal of a plugin occurs.
//They are used to keep track on a contributor basis of the extension being added or removed
- private KeyedHashSet newContributions; //represents the contributers added during this session.
+ private final KeyedHashSet newContributions; //represents the contributers added during this session.
private Object formerContributions; //represents the contributers encountered in previous sessions. This is loaded lazily.
- private HashMap contributors; // key: contributor ID; value: contributor name
- private HashMap removedContributors; // key: contributor ID; value: contributor name
+ private HashMap<String, RegistryContributor> contributors; // key: contributor ID; value: contributor name
+ private HashMap<String, RegistryContributor> removedContributors; // key: contributor ID; value: contributor name
private KeyedHashSet namespacesIndex; // registry elements (extension & extensionpoints) indexed by namespaces
// Map key: extensionPointFullyQualifiedName, value int[] of orphan extensions.
// The orphan access does not need to be synchronized because the it is protected by the lock in extension registry.
private Object orphanExtensions;
- private KeyedHashSet heldObjects = new KeyedHashSet(); //strong reference to the objects that must be hold on to
+ private final KeyedHashSet heldObjects = new KeyedHashSet(); //strong reference to the objects that must be hold on to
//Indicate if objects have been removed or added from the table. This only needs to be set in a couple of places (addNamespace and removeNamespace)
private boolean isDirty = false;
private boolean fromCache = false;
- private ExtensionRegistry registry;
+ private final ExtensionRegistry registry;
// TODO this option is not used
// OSGI system properties. Copied from EclipseStarter
@@ -220,9 +220,9 @@ public class RegistryObjectManager implements IObjectManager {
if (fromCache == false)
return new KeyedHashSet(0);
- if (formerContributions == null || (result = ((KeyedHashSet) ((formerContributions instanceof SoftReference) ? ((SoftReference) formerContributions).get() : formerContributions))) == null) {
+ if (formerContributions == null || (result = ((KeyedHashSet) ((formerContributions instanceof SoftReference) ? ((SoftReference<?>) formerContributions).get() : formerContributions))) == null) {
result = registry.getTableReader().loadContributions();
- formerContributions = new SoftReference(result);
+ formerContributions = new SoftReference<>(result);
}
return result;
}
@@ -475,21 +475,21 @@ public class RegistryObjectManager implements IObjectManager {
}
- private Map getOrphans() {
- Object result = orphanExtensions;
+ private Map<String, int[]> getOrphans() {
+ Object result;
if (orphanExtensions == null && !fromCache) {
- result = new HashMap();
+ result = new HashMap<>();
orphanExtensions = result;
- } else if (orphanExtensions == null || (result = ((orphanExtensions instanceof SoftReference) ? ((SoftReference) orphanExtensions).get() : orphanExtensions)) == null) {
+ } else if (orphanExtensions == null || (result = ((orphanExtensions instanceof SoftReference) ? ((SoftReference<?>) orphanExtensions).get() : orphanExtensions)) == null) {
result = registry.getTableReader().loadOrphans();
- orphanExtensions = new SoftReference(result);
+ orphanExtensions = new SoftReference<>(result);
}
- return (HashMap) result;
+ return (HashMap<String, int[]>) result;
}
void addOrphans(String extensionPoint, int[] extensions) {
- Map orphans = getOrphans();
- int[] existingOrphanExtensions = (int[]) orphans.get(extensionPoint);
+ Map<String, int[]> orphans = getOrphans();
+ int[] existingOrphanExtensions = orphans.get(extensionPoint);
if (existingOrphanExtensions != null) {
// just add
@@ -504,13 +504,13 @@ public class RegistryObjectManager implements IObjectManager {
markOrphansHasDirty(orphans);
}
- void markOrphansHasDirty(Map orphans) {
+ void markOrphansHasDirty(Map<String, int[]> orphans) {
orphanExtensions = orphans;
}
void addOrphan(String extensionPoint, int extension) {
- Map orphans = getOrphans();
- int[] existingOrphanExtensions = (int[]) orphans.get(extensionPoint);
+ Map<String, int[]> orphans = getOrphans();
+ int[] existingOrphanExtensions = orphans.get(extensionPoint);
if (existingOrphanExtensions != null) {
// just add
@@ -526,8 +526,8 @@ public class RegistryObjectManager implements IObjectManager {
}
int[] removeOrphans(String extensionPoint) {
- Map orphans = getOrphans();
- int[] existingOrphanExtensions = (int[]) orphans.remove(extensionPoint);
+ Map<String, int[]> orphans = getOrphans();
+ int[] existingOrphanExtensions = orphans.remove(extensionPoint);
if (existingOrphanExtensions != null) {
markOrphansHasDirty(orphans);
}
@@ -535,8 +535,8 @@ public class RegistryObjectManager implements IObjectManager {
}
void removeOrphan(String extensionPoint, int extension) {
- Map orphans = getOrphans();
- int[] existingOrphanExtensions = (int[]) orphans.get(extensionPoint);
+ Map<String, int[]> orphans = getOrphans();
+ int[] existingOrphanExtensions = orphans.get(extensionPoint);
if (existingOrphanExtensions == null)
return;
@@ -558,7 +558,7 @@ public class RegistryObjectManager implements IObjectManager {
}
//This method is only used by the writer to reach in
- Map getOrphanExtensions() {
+ Map<String, int[]> getOrphanExtensions() {
return getOrphans();
}
@@ -579,10 +579,10 @@ public class RegistryObjectManager implements IObjectManager {
// This method is used internally and by the writer to reach in. Notice that it doesn't
// return contributors marked as removed.
- HashMap getContributors() {
+ HashMap<String, RegistryContributor> getContributors() {
if (contributors == null) {
if (fromCache == false)
- contributors = new HashMap();
+ contributors = new HashMap<>();
else
contributors = registry.getTableReader().loadContributors();
}
@@ -590,19 +590,19 @@ public class RegistryObjectManager implements IObjectManager {
}
synchronized IContributor[] getContributorsSync() {
- Collection contributorValues = getContributors().values();
- return (IContributor[]) contributorValues.toArray(new IContributor[contributorValues.size()]);
+ Collection<RegistryContributor> contributorValues = getContributors().values();
+ return contributorValues.toArray(new IContributor[contributorValues.size()]);
}
synchronized RegistryContributor getContributor(String id) {
- RegistryContributor contributor = (RegistryContributor) getContributors().get(id);
+ RegistryContributor contributor = getContributors().get(id);
if (contributor != null)
return contributor;
// check if we have it among removed contributors - potentially
// notification of removals might be processed after the contributor
// marked as removed:
if (removedContributors != null)
- return (RegistryContributor) removedContributors.get(id);
+ return removedContributors.get(id);
return null;
}
@@ -619,10 +619,10 @@ public class RegistryObjectManager implements IObjectManager {
synchronized void removeContributor(String id) {
isDirty = true;
- RegistryContributor removed = (RegistryContributor) getContributors().remove(id);
+ RegistryContributor removed = getContributors().remove(id);
if (removed != null) {
if (removedContributors == null)
- removedContributors = new HashMap();
+ removedContributors = new HashMap<>();
removedContributors.put(id, removed);
}
}
@@ -652,11 +652,11 @@ public class RegistryObjectManager implements IObjectManager {
* them in a IObjectManager so that they can be accessed from the appropriate
* deltas but not from the registry.
*/
- synchronized Map getAssociatedObjects(String contributionId) {
+ synchronized Map<Integer, RegistryObject> getAssociatedObjects(String contributionId) {
//Collect all the objects associated with this contribution
int[] xpts = getExtensionPointsFrom(contributionId);
int[] exts = getExtensionsFrom(contributionId);
- Map actualObjects = new HashMap(xpts.length + exts.length);
+ Map<Integer, RegistryObject> actualObjects = new HashMap<>(xpts.length + exts.length);
for (int i = 0; i < exts.length; i++) {
Extension tmp = (Extension) basicGetObject(exts[i], RegistryObjectManager.EXTENSION);
actualObjects.put(new Integer(exts[i]), tmp);
@@ -673,7 +673,7 @@ public class RegistryObjectManager implements IObjectManager {
/**
* Adds elements to be removed along with the registry object.
*/
- synchronized void addAssociatedObjects(Map map, RegistryObject registryObject) {
+ synchronized void addAssociatedObjects(Map<Integer, RegistryObject> map, RegistryObject registryObject) {
collectChildren(registryObject, 0, map);
}
@@ -681,10 +681,10 @@ public class RegistryObjectManager implements IObjectManager {
* Add to the set of the objects all extensions and extension points that
* could be navigated to from the objects in the set.
*/
- synchronized void addNavigableObjects(Map associatedObjects) {
- Map result = new HashMap();
- for (Iterator iter = associatedObjects.values().iterator(); iter.hasNext();) {
- RegistryObject object = (RegistryObject) iter.next();
+ synchronized void addNavigableObjects(Map<Integer, RegistryObject> associatedObjects) {
+ Map<Integer, RegistryObject> result = new HashMap<>();
+ for (Iterator<RegistryObject> iter = associatedObjects.values().iterator(); iter.hasNext();) {
+ RegistryObject object = iter.next();
if (object instanceof Extension) {
// add extension point
ExtensionPoint extPoint = getExtensionPointObject(((Extension) object).getExtensionPointIdentifier());
@@ -709,9 +709,9 @@ public class RegistryObjectManager implements IObjectManager {
}
} else if (object instanceof ExtensionPoint) {
// by now extensions of this extension point have been marked as orphans
- Map orphans = getOrphans();
+ Map<String, int[]> orphans = getOrphans();
String name = ((ExtensionPoint) object).getUniqueIdentifier();
- int[] extensions = (int[]) orphans.get(name);
+ int[] extensions = orphans.get(name);
if (extensions != null) {
for (int j = 0; j < extensions.length; j++) {
Extension tmp = (Extension) basicGetObject(extensions[j], RegistryObjectManager.EXTENSION);
@@ -729,10 +729,10 @@ public class RegistryObjectManager implements IObjectManager {
associatedObjects.putAll(result);
}
- synchronized void removeObjects(Map associatedObjects) {
+ synchronized void removeObjects(Map<?, ?> associatedObjects) {
//Remove the objects from the main object manager so they can no longer be accessed.
- Collection allValues = associatedObjects.values();
- for (Iterator iter = allValues.iterator(); iter.hasNext();) {
+ Collection<?> allValues = associatedObjects.values();
+ for (Iterator<?> iter = allValues.iterator(); iter.hasNext();) {
RegistryObject toRemove = (RegistryObject) iter.next();
remove((toRemove).getObjectId(), true);
if (toRemove instanceof ExtensionPoint)
@@ -740,11 +740,11 @@ public class RegistryObjectManager implements IObjectManager {
}
}
- IObjectManager createDelegatingObjectManager(Map object) {
+ IObjectManager createDelegatingObjectManager(Map<?, ?> object) {
return new TemporaryObjectManager(object, this);
}
- private void collectChildren(RegistryObject ce, int level, Map collector) {
+ private void collectChildren(RegistryObject ce, int level, Map<Integer, RegistryObject> collector) {
ConfigurationElement[] children = (ConfigurationElement[]) getObjects(ce.getRawChildren(), level == 0 || ce.noExtraData() ? RegistryObjectManager.CONFIGURATION_ELEMENT : RegistryObjectManager.THIRDLEVEL_CONFIGURATION_ELEMENT);
for (int j = 0; j < children.length; j++) {
collector.put(new Integer(children[j].getObjectId()), children[j]);
@@ -795,7 +795,7 @@ public class RegistryObjectManager implements IObjectManager {
int[] namespaceExtensions = indexElement.getExtensions();
// filter extensions with no extension point (orphan extensions)
- List tmp = new ArrayList();
+ List<Handle> tmp = new ArrayList<>();
Extension[] exts = (Extension[]) getObjects(namespaceExtensions, EXTENSION);
for (int i = 0; i < exts.length; i++) {
if (getExtensionPointObject(exts[i].getExtensionPointIdentifier()) != null)
@@ -804,7 +804,7 @@ public class RegistryObjectManager implements IObjectManager {
if (tmp.size() == 0)
return EMPTY_EXTENSIONS_ARRAY;
ExtensionHandle[] result = new ExtensionHandle[tmp.size()];
- return (ExtensionHandle[]) tmp.toArray(result);
+ return tmp.toArray(result);
}
public ExtensionHandle[] getExtensionsFromContributor(String contributorId) {
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableReader.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableReader.java
index 2ef548bb2..fcb39898f 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableReader.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableReader.java
@@ -73,9 +73,9 @@ public class TableReader {
private boolean holdObjects = false;
- private ExtensionRegistry registry;
+ private final ExtensionRegistry registry;
- private SoftReference stringPool;
+ private SoftReference<Map<String, String>> stringPool;
void setMainDataFile(File main) throws IOException {
mainDataFile = new BufferedRandomInputStream(main);
@@ -462,14 +462,14 @@ public class TableReader {
final static float contributorsLoadFactor = 1.2f; // allocate more memory to avoid resizing
- public HashMap loadContributors() {
- HashMap result = null;
+ public HashMap<String, RegistryContributor> loadContributors() {
+ HashMap<String, RegistryContributor> result = null;
DataInputStream contributorsInput = null;
try {
synchronized (contributorsFile) {
contributorsInput = new DataInputStream(new BufferedInputStream(new FileInputStream(contributorsFile)));
int size = contributorsInput.readInt();
- result = new HashMap((int) (size * contributorsLoadFactor));
+ result = new HashMap<>((int) (size * contributorsLoadFactor));
for (int i = 0; i < size; i++) {
String id = readStringOrNull(contributorsInput);
String name = readStringOrNull(contributorsInput);
@@ -595,13 +595,13 @@ public class TableReader {
return loaded;
}
- public HashMap loadOrphans() {
+ public HashMap<String, int[]> loadOrphans() {
DataInputStream orphanInput = null;
try {
synchronized (orphansFile) {
orphanInput = new DataInputStream(new BufferedInputStream(new FileInputStream(orphansFile)));
int size = orphanInput.readInt();
- HashMap result = new HashMap(size);
+ HashMap<String, int[]> result = new HashMap<>(size);
for (int i = 0; i < size; i++) {
String key = readUTF(orphanInput, OBJECT);
int[] value = readArray(orphanInput);
@@ -661,16 +661,16 @@ public class TableReader {
value = in.readUTF();
}
- Map map = null;
+ Map<String, String> map = null;
if (stringPool != null) {
- map = (Map) stringPool.get();
+ map = stringPool.get();
}
if (map == null) {
- map = new HashMap();
- stringPool = new SoftReference(map);
+ map = new HashMap<>();
+ stringPool = new SoftReference<>(map);
}
- String pooledString = (String) map.get(value);
+ String pooledString = map.get(value);
if (pooledString == null) {
map.put(value, value);
return value;
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableWriter.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableWriter.java
index 98ea1a3bd..d23a58c76 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableWriter.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableWriter.java
@@ -12,6 +12,7 @@ package org.eclipse.core.internal.registry;
import java.io.*;
import java.util.*;
+import java.util.Map.Entry;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.spi.RegistryContributor;
@@ -61,7 +62,7 @@ public class TableWriter {
private OffsetTable offsets;
- private ExtensionRegistry registry;
+ private final ExtensionRegistry registry;
private RegistryObjectManager objectManager;
public TableWriter(ExtensionRegistry registry) {
@@ -230,14 +231,14 @@ public class TableWriter {
outputNamespace.close();
}
- private void saveContributors(HashMap contributors) throws IOException {
+ private void saveContributors(HashMap<?, ?> contributors) throws IOException {
FileOutputStream fosContributors = new FileOutputStream(contributorsFile);
DataOutputStream outputContributors = new DataOutputStream(new BufferedOutputStream(fosContributors));
- Collection entries = contributors.values();
+ Collection<?> entries = contributors.values();
outputContributors.writeInt(entries.size());
- for (Iterator i = entries.iterator(); i.hasNext();) {
+ for (Iterator<?> i = entries.iterator(); i.hasNext();) {
RegistryContributor contributor = (RegistryContributor) i.next();
writeStringOrNull(contributor.getActualId(), outputContributors);
writeStringOrNull(contributor.getActualName(), outputContributors);
@@ -430,27 +431,27 @@ public class TableWriter {
}
private void saveOrphans() throws IOException {
- Map orphans = objectManager.getOrphanExtensions();
- Map filteredOrphans = new HashMap();
- for (Iterator iter = orphans.entrySet().iterator(); iter.hasNext();) {
- Map.Entry entry = (Map.Entry) iter.next();
- int[] filteredValue = filter((int[]) entry.getValue());
+ Map<String, int[]> orphans = objectManager.getOrphanExtensions();
+ Map<String, int[]> filteredOrphans = new HashMap<>();
+ for (Iterator<Entry<String, int[]>> iter = orphans.entrySet().iterator(); iter.hasNext();) {
+ Entry<String, int[]> entry = iter.next();
+ int[] filteredValue = filter(entry.getValue());
if (filteredValue.length != 0)
filteredOrphans.put(entry.getKey(), filteredValue);
}
FileOutputStream fosOrphan = new FileOutputStream(orphansFile);
DataOutputStream outputOrphan = new DataOutputStream(new BufferedOutputStream(fosOrphan));
outputOrphan.writeInt(filteredOrphans.size());
- Set elements = filteredOrphans.entrySet();
- for (Iterator iter = elements.iterator(); iter.hasNext();) {
- Map.Entry entry = (Map.Entry) iter.next();
- outputOrphan.writeUTF((String) entry.getKey());
- saveArray((int[]) entry.getValue(), outputOrphan);
+ Set<Entry<String, int[]>> elements = filteredOrphans.entrySet();
+ for (Iterator<Entry<String, int[]>> iter = elements.iterator(); iter.hasNext();) {
+ Entry<String, int[]> entry = iter.next();
+ outputOrphan.writeUTF(entry.getKey());
+ saveArray(entry.getValue(), outputOrphan);
}
- for (Iterator iter = elements.iterator(); iter.hasNext();) {
- Map.Entry entry = (Map.Entry) iter.next();
- mainOutput.writeInt(((int[]) entry.getValue()).length);
- saveExtensions((IExtension[]) objectManager.getHandles((int[]) entry.getValue(), RegistryObjectManager.EXTENSION), mainOutput);
+ for (Iterator<Entry<String, int[]>> iter = elements.iterator(); iter.hasNext();) {
+ Entry<String, int[]> entry = iter.next();
+ mainOutput.writeInt(entry.getValue().length);
+ saveExtensions((IExtension[]) objectManager.getHandles(entry.getValue(), RegistryObjectManager.EXTENSION), mainOutput);
}
outputOrphan.flush();
fosOrphan.getFD().sync();
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TemporaryObjectManager.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TemporaryObjectManager.java
index 8c081e19c..e58090b21 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TemporaryObjectManager.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TemporaryObjectManager.java
@@ -17,10 +17,10 @@ import org.eclipse.core.runtime.InvalidRegistryObjectException;
* @since 3.1
*/
public class TemporaryObjectManager implements IObjectManager {
- private Map actualObjects; //id --> registry objects
+ private Map<?, ?> actualObjects; //id --> registry objects
private RegistryObjectManager parent; //the main object manager (should be equals to extensionRegistry.getObjectManager)
- public TemporaryObjectManager(Map actualObjects, RegistryObjectManager parent) {
+ public TemporaryObjectManager(Map<?, ?> actualObjects, RegistryObjectManager parent) {
this.actualObjects = actualObjects;
this.parent = parent;
}
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/Activator.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/Activator.java
index af778d72d..b1775f705 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/Activator.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/Activator.java
@@ -41,8 +41,8 @@ public class Activator implements BundleActivator {
private Object userRegistryKey = new Object();
private IExtensionRegistry defaultRegistry = null;
- private ServiceRegistration registryRegistration;
- private ServiceRegistration commandRegistration;
+ private ServiceRegistration<?> registryRegistration;
+ private ServiceRegistration<?> commandRegistration;
private RegistryProviderOSGI defaultProvider;
private AdapterManagerListener adapterManagerListener = null;
@@ -81,7 +81,7 @@ public class Activator implements BundleActivator {
*/
private void processCommandLine() {
// use a string here instead of the class to prevent class loading.
- ServiceReference ref = getContext().getServiceReference("org.eclipse.osgi.service.environment.EnvironmentInfo"); //$NON-NLS-1$
+ ServiceReference<?> ref = getContext().getServiceReference("org.eclipse.osgi.service.environment.EnvironmentInfo"); //$NON-NLS-1$
if (ref == null)
return;
String[] args = EquinoxUtils.getCommandLine(bundleContext, ref);
@@ -138,7 +138,7 @@ public class Activator implements BundleActivator {
defaultRegistry = RegistryFactory.createRegistry(strategy, masterRegistryKey, userRegistryKey);
- registryRegistration = Activator.getContext().registerService(IExtensionRegistry.class.getName(), defaultRegistry, new Hashtable());
+ registryRegistration = Activator.getContext().registerService(IExtensionRegistry.class.getName(), defaultRegistry, new Hashtable<String, Object>());
defaultProvider = new RegistryProviderOSGI(defaultRegistry);
// Set the registry provider and specify this as a default registry:
RegistryProviderFactory.setDefault(defaultProvider);
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/EclipseBundleListener.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/EclipseBundleListener.java
index aa354bebc..d6418945c 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/EclipseBundleListener.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/EclipseBundleListener.java
@@ -35,11 +35,11 @@ public class EclipseBundleListener implements SynchronousBundleListener {
private static final String PLUGIN_MANIFEST = "plugin.xml"; //$NON-NLS-1$
private static final String FRAGMENT_MANIFEST = "fragment.xml"; //$NON-NLS-1$
- private ExtensionRegistry registry;
- private RegistryStrategyOSGI strategy;
- private Object token;
- private HashMap dynamicAddStateStamps = new HashMap();
- private long currentStateStamp[] = new long[] {0};
+ private final ExtensionRegistry registry;
+ private final RegistryStrategyOSGI strategy;
+ private final Object token;
+ private final HashMap<String, Long> dynamicAddStateStamps = new HashMap<>();
+ private final long currentStateStamp[] = new long[] {0};
public EclipseBundleListener(ExtensionRegistry registry, Object key, RegistryStrategyOSGI strategy) {
this.registry = registry;
@@ -203,7 +203,7 @@ public class EclipseBundleListener implements SynchronousBundleListener {
String hostID = Long.toString(host.getBundleId());
synchronized (currentStateStamp) {
- Long hostStateStamp = (Long) dynamicAddStateStamps.get(hostID);
+ Long hostStateStamp = dynamicAddStateStamps.get(hostID);
if (hostStateStamp != null && currentStateStamp[0] == hostStateStamp.longValue())
return; // already processed this host
}
@@ -244,7 +244,7 @@ public class EclipseBundleListener implements SynchronousBundleListener {
if (!registry.hasContributor(Long.toString(target.getBundleId())))
return false;
// get the base localization path from the target
- Dictionary targetHeaders = target.getHeaders(""); //$NON-NLS-1$
+ Dictionary<?, ?> targetHeaders = target.getHeaders(""); //$NON-NLS-1$
String localization = (String) targetHeaders.get(Constants.BUNDLE_LOCALIZATION);
if (localization == null)
// localization may be empty in which case we should check the default
@@ -259,12 +259,12 @@ public class EclipseBundleListener implements SynchronousBundleListener {
return false; // just to be safe
String baseDir = lastSlash < 0 ? "" : localization.substring(0, lastSlash); //$NON-NLS-1$
String filePattern = (lastSlash < 0 ? localization : localization.substring(lastSlash + 1)) + "_*.properties"; //$NON-NLS-1$
- Enumeration nlsFiles = fragment.findEntries(baseDir, filePattern, false);
+ Enumeration<?> nlsFiles = fragment.findEntries(baseDir, filePattern, false);
return nlsFiles != null;
}
private static boolean isSingleton(Bundle bundle) {
- Dictionary allHeaders = bundle.getHeaders(""); //$NON-NLS-1$
+ Dictionary<?, ?> allHeaders = bundle.getHeaders(""); //$NON-NLS-1$
String symbolicNameHeader = (String) allHeaders.get(Constants.BUNDLE_SYMBOLICNAME);
try {
if (symbolicNameHeader != null) {
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/EquinoxRegistryStrategy.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/EquinoxRegistryStrategy.java
index 4497d4292..7a0730431 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/EquinoxRegistryStrategy.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/EquinoxRegistryStrategy.java
@@ -69,7 +69,7 @@ public class EquinoxRegistryStrategy extends RegistryStrategyOSGI {
return -1;
}
// use a string here instead of the class to prevent class loading.
- ServiceReference ref = context.getServiceReference("org.eclipse.osgi.service.resolver.PlatformAdmin"); //$NON-NLS-1$
+ ServiceReference<?> ref = context.getServiceReference("org.eclipse.osgi.service.resolver.PlatformAdmin"); //$NON-NLS-1$
if (ref == null)
return -1;
return EquinoxUtils.getContainerTimestamp(context, ref);
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/EquinoxUtils.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/EquinoxUtils.java
index 96597e620..a67684808 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/EquinoxUtils.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/EquinoxUtils.java
@@ -28,7 +28,7 @@ public class EquinoxUtils {
/**
* Get the command line arguments from the EnvironmentInfo service
*/
- public static String[] getCommandLine(BundleContext context, ServiceReference ref) {
+ public static String[] getCommandLine(BundleContext context, ServiceReference<?> ref) {
if (ref == null)
return null;
try {
@@ -42,7 +42,7 @@ public class EquinoxUtils {
/**
* Get the time stamp from the PlatformAdmin service.
*/
- public static long getContainerTimestamp(BundleContext context, ServiceReference ref) {
+ public static long getContainerTimestamp(BundleContext context, ServiceReference<?> ref) {
if (ref == null)
return -1;
try {
@@ -53,7 +53,7 @@ public class EquinoxUtils {
}
}
- public static ServiceRegistration registerCommandProvider(BundleContext context) {
+ public static ServiceRegistration<?> registerCommandProvider(BundleContext context) {
// try to register the registry command provider
try {
// refer to the CommandProvider by name here so that even if VM
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/ExtensionEventDispatcherJob.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/ExtensionEventDispatcherJob.java
index bc23d1b9a..ca03f3d3f 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/ExtensionEventDispatcherJob.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/ExtensionEventDispatcherJob.java
@@ -33,11 +33,11 @@ final public class ExtensionEventDispatcherJob extends Job {
return rule == this;
}
};
- private Map deltas;
+ private Map<?, ?> deltas;
private Object[] listenerInfos;
private Object registry;
- public ExtensionEventDispatcherJob(Object[] listenerInfos, Map deltas, Object registry) {
+ public ExtensionEventDispatcherJob(Object[] listenerInfos, Map<?, ?> deltas, Object registry) {
// name not NL'd since it is a system job
super("Registry event dispatcher"); //$NON-NLS-1$
setSystem(true);
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/OSGIUtils.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/OSGIUtils.java
index 3bf2828d5..b445d7e25 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/OSGIUtils.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/OSGIUtils.java
@@ -27,9 +27,9 @@ import org.osgi.util.tracker.ServiceTracker;
* @since org.eclipse.equinox.registry 3.2
*/
public class OSGIUtils {
- private ServiceTracker debugTracker = null;
- private ServiceTracker bundleTracker = null;
- private ServiceTracker configurationLocationTracker = null;
+ private ServiceTracker<?, ?> debugTracker = null;
+ private ServiceTracker<?, ?> bundleTracker = null;
+ private ServiceTracker<?, ?> configurationLocationTracker = null;
// OSGI system properties. Copied from EclipseStarter
public static final String PROP_CONFIG_AREA = "osgi.configuration.area"; //$NON-NLS-1$
@@ -56,10 +56,10 @@ public class OSGIUtils {
return;
}
- debugTracker = new ServiceTracker(context, DebugOptions.class.getName(), null);
+ debugTracker = new ServiceTracker<>(context, DebugOptions.class.getName(), null);
debugTracker.open();
- bundleTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null);
+ bundleTracker = new ServiceTracker<>(context, PackageAdmin.class.getName(), null);
bundleTracker.open();
// locations
@@ -70,7 +70,7 @@ public class OSGIUtils {
} catch (InvalidSyntaxException e) {
// ignore this. It should never happen as we have tested the above format.
}
- configurationLocationTracker = new ServiceTracker(context, filter, null);
+ configurationLocationTracker = new ServiceTracker<>(context, filter, null);
configurationLocationTracker.open();
}
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/RegistryStrategyOSGI.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/RegistryStrategyOSGI.java
index b5f36cab9..3218effd2 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/RegistryStrategyOSGI.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/RegistryStrategyOSGI.java
@@ -44,7 +44,7 @@ public class RegistryStrategyOSGI extends RegistryStrategy {
/**
* Registry access key
*/
- private Object token;
+ private final Object token;
/**
* Debug extension registry
@@ -59,12 +59,12 @@ public class RegistryStrategyOSGI extends RegistryStrategy {
/**
* Tracker for the XML parser service
*/
- private ServiceTracker xmlTracker = null;
+ private ServiceTracker<?, ?> xmlTracker = null;
/**
* Tracker for the LocaleProvider service
*/
- private ServiceTracker localeTracker = null;
+ private ServiceTracker<?, ?> localeTracker = null;
/**
* Value of the query "should we track contributions timestamps" is cached
@@ -131,7 +131,7 @@ public class RegistryStrategyOSGI extends RegistryStrategy {
* The Bundle object is stored as a weak reference to facilitate GC
* in case the bundle was uninstalled during the Eclipse run.
*/
- private ReferenceMap bundleMap = new ReferenceMap(ReferenceMap.SOFT, DEFAULT_BUNDLECACHE_SIZE, DEFAULT_BUNDLECACHE_LOADFACTOR);
+ private final ReferenceMap bundleMap = new ReferenceMap(ReferenceMap.SOFT, DEFAULT_BUNDLECACHE_SIZE, DEFAULT_BUNDLECACHE_LOADFACTOR);
// String Id to OSGi Bundle conversion
private Bundle getBundle(String id) {
@@ -172,7 +172,7 @@ public class RegistryStrategyOSGI extends RegistryStrategy {
throwException(NLS.bind(RegistryMessages.plugin_loadClassError, "UNKNOWN BUNDLE", className), new InvalidRegistryObjectException()); //$NON-NLS-1$
// load the requested class from this bundle
- Class classInstance = null;
+ Class<?> classInstance = null;
try {
classInstance = contributingBundle.loadClass(className);
} catch (Exception e1) {
@@ -309,7 +309,7 @@ public class RegistryStrategyOSGI extends RegistryStrategy {
@Override
public SAXParserFactory getXMLParser() {
if (xmlTracker == null) {
- xmlTracker = new ServiceTracker(Activator.getContext(), SAXParserFactory.class.getName(), null);
+ xmlTracker = new ServiceTracker<>(Activator.getContext(), SAXParserFactory.class.getName(), null);
xmlTracker.open();
}
return (SAXParserFactory) xmlTracker.getService();
@@ -321,7 +321,7 @@ public class RegistryStrategyOSGI extends RegistryStrategy {
@Override
public String getLocale() {
if (localeTracker == null) {
- localeTracker = new ServiceTracker(Activator.getContext(), LocaleProvider.class.getName(), null);
+ localeTracker = new ServiceTracker<>(Activator.getContext(), LocaleProvider.class.getName(), null);
localeTracker.open();
}
LocaleProvider localeProvider = (LocaleProvider) localeTracker.getService();

Back to the top