Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2016-09-29 13:27:28 +0000
committerThomas Watson2016-09-29 14:33:27 +0000
commit61d4d356b63091bb27ea0c7be0a6daaf06b74c28 (patch)
tree6fd39d3bb846a8fbfa5d4ea58e0a077f432e0591 /bundles/org.eclipse.osgi/supplement/src
parentd200e63587ccac6d7c2d0f506b8f30a2ebe47fe5 (diff)
downloadrt.equinox.framework-61d4d356b63091bb27ea0c7be0a6daaf06b74c28.tar.gz
rt.equinox.framework-61d4d356b63091bb27ea0c7be0a6daaf06b74c28.tar.xz
rt.equinox.framework-61d4d356b63091bb27ea0c7be0a6daaf06b74c28.zip
Bug 502425 - Refactor code for Java 7
Change-Id: I64d3a28a743a0292db27fd421294421dc51eb2e1 Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
Diffstat (limited to 'bundles/org.eclipse.osgi/supplement/src')
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/CopyOnWriteIdentityMap.java12
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/EventListeners.java4
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/EventManager.java6
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/ListenerQueue.java4
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java6
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/util/Tokenizer.java4
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/ManifestElement.java12
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/NLS.java6
8 files changed, 27 insertions, 27 deletions
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/CopyOnWriteIdentityMap.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/CopyOnWriteIdentityMap.java
index 9b575fc25..4564f32db 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/CopyOnWriteIdentityMap.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/CopyOnWriteIdentityMap.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -84,7 +84,7 @@ public class CopyOnWriteIdentityMap<K, V> implements Map<K, V> {
@SuppressWarnings("unchecked")
Entry<K, V>[] newEntries = new Entry[size];
System.arraycopy(entries, 0, newEntries, 0, size);
- newEntries[i] = new Entry<K, V>(key, value);
+ newEntries[i] = new Entry<>(key, value);
entries = newEntries;
return v;
}
@@ -95,7 +95,7 @@ public class CopyOnWriteIdentityMap<K, V> implements Map<K, V> {
if (size > 0) {
System.arraycopy(entries, 0, newEntries, 0, size);
}
- newEntries[size] = new Entry<K, V>(key, value);
+ newEntries[size] = new Entry<>(key, value);
entries = newEntries;
return null;
}
@@ -337,7 +337,7 @@ public class CopyOnWriteIdentityMap<K, V> implements Map<K, V> {
* The entries returned by the set cannot be modified.
*/
public Set<Map.Entry<K, V>> entrySet() {
- return new Snapshot<K, V>(entries()).entrySet();
+ return new Snapshot<>(entries()).entrySet();
}
/**
@@ -347,7 +347,7 @@ public class CopyOnWriteIdentityMap<K, V> implements Map<K, V> {
* @return A Set of the key objects in this map
*/
public Set<K> keySet() {
- return new Snapshot<K, V>(entries()).keySet();
+ return new Snapshot<>(entries()).keySet();
}
/**
@@ -357,7 +357,7 @@ public class CopyOnWriteIdentityMap<K, V> implements Map<K, V> {
* @return A Collection of the value objects in this map.
*/
public Collection<V> values() {
- return new Snapshot<K, V>(entries()).values();
+ return new Snapshot<>(entries()).values();
}
/**
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/EventListeners.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/EventListeners.java
index 431e4be94..e40ce2920 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/EventListeners.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/EventListeners.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,7 +26,7 @@ import java.util.Set;
* @noextend This class is not intended to be subclassed by clients.
*/
public class EventListeners<K, V> {
- private final CopyOnWriteIdentityMap<K, V> list = new CopyOnWriteIdentityMap<K, V>();
+ private final CopyOnWriteIdentityMap<K, V> list = new CopyOnWriteIdentityMap<>();
/**
* Creates an empty listener list.
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/EventManager.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/EventManager.java
index 9e371ee34..900eaf5aa 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/EventManager.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/EventManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -194,7 +194,7 @@ public class EventManager {
/* if there is no thread, then create a new one */
thread = AccessController.doPrivileged(new PrivilegedAction<EventThread<K, V, E>>() {
public EventThread<K, V, E> run() {
- EventThread<K, V, E> t = new EventThread<K, V, E>(threadGroup, threadName);
+ EventThread<K, V, E> t = new EventThread<>(threadGroup, threadName);
return t;
}
});
@@ -371,7 +371,7 @@ public class EventManager {
throw new IllegalStateException();
}
- Queued<K, V, E> item = new Queued<K, V, E>(l, d, a, o);
+ Queued<K, V, E> item = new Queued<>(l, d, a, o);
if (head == null) /* if the queue was empty */
{
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/ListenerQueue.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/ListenerQueue.java
index 40fbf99d3..7e78bac01 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/ListenerQueue.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/ListenerQueue.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -63,7 +63,7 @@ public class ListenerQueue<K, V, E> {
}
this.manager = manager;
- queue = new CopyOnWriteIdentityMap<Set<Map.Entry<K, V>>, EventDispatcher<K, V, E>>();
+ queue = new CopyOnWriteIdentityMap<>();
readOnly = false;
}
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java
index f0b0ffb5c..6fd13b2e4 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java
@@ -125,7 +125,7 @@ public class ReliableFile {
private File referenceFile;
/** List of checksum file objects: File => specific ReliableFile generation */
- private static Hashtable<File, CacheInfo> cacheFiles = new Hashtable<File, CacheInfo>(20);
+ private static Hashtable<File, CacheInfo> cacheFiles = new Hashtable<>(20);
private File inputFile = null;
private File outputFile = null;
@@ -192,7 +192,7 @@ public class ReliableFile {
String[] files = parent.list();
if (files == null)
return null;
- List<Integer> list = new ArrayList<Integer>(defaultMaxGenerations);
+ List<Integer> list = new ArrayList<>(defaultMaxGenerations);
if (file.exists())
list.add(Integer.valueOf(0)); //base file exists
for (int i = 0; i < files.length; i++) {
@@ -637,7 +637,7 @@ public class ReliableFile {
if (!directory.isDirectory())
throw new IOException("Not a valid directory"); //$NON-NLS-1$
String files[] = directory.list();
- Set<String> list = new HashSet<String>(files.length / 2);
+ Set<String> list = new HashSet<>(files.length / 2);
for (int idx = 0; idx < files.length; idx++) {
String file = files[idx];
int pos = file.lastIndexOf('.');
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/util/Tokenizer.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/util/Tokenizer.java
index 893e72a44..62c48749d 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/util/Tokenizer.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/util/Tokenizer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2013 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -91,7 +91,7 @@ public class Tokenizer {
}
public List<String> getEscapedTokens(String terminals) {
- List<String> result = new ArrayList<String>();
+ List<String> result = new ArrayList<>();
for (String token = getEscapedToken(terminals); token != null; token = getEscapedToken(terminals)) {
result.add(token);
getChar(); // consume terminal
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/ManifestElement.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/ManifestElement.java
index 10616c3a9..87095cf44 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/ManifestElement.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/ManifestElement.java
@@ -310,7 +310,7 @@ public class ManifestElement {
@SuppressWarnings("unchecked")
private Hashtable<String, Object> addTableValue(Hashtable<String, Object> table, String key, String value) {
if (table == null) {
- table = new Hashtable<String, Object>(7);
+ table = new Hashtable<>(7);
}
Object curValue = table.get(key);
if (curValue != null) {
@@ -319,7 +319,7 @@ public class ManifestElement {
if (curValue instanceof List) {
newList = (List<String>) curValue;
} else {
- newList = new ArrayList<String>(5);
+ newList = new ArrayList<>(5);
newList.add((String) curValue);
}
newList.add(value);
@@ -345,13 +345,13 @@ public class ManifestElement {
public static ManifestElement[] parseHeader(String header, String value) throws BundleException {
if (value == null)
return (null);
- List<ManifestElement> headerElements = new ArrayList<ManifestElement>(10);
+ List<ManifestElement> headerElements = new ArrayList<>(10);
Tokenizer tokenizer = new Tokenizer(value);
parseloop: while (true) {
String next = tokenizer.getString(";,"); //$NON-NLS-1$
if (next == null)
throw new BundleException(NLS.bind(Msg.MANIFEST_INVALID_HEADER_EXCEPTION, header, value), BundleException.MANIFEST_ERROR);
- List<String> headerValues = new ArrayList<String>();
+ List<String> headerValues = new ArrayList<>();
StringBuffer headerValue = new StringBuffer(next);
headerValues.add(next);
@@ -473,7 +473,7 @@ public class ManifestElement {
public static String[] getArrayFromList(String stringList, String separator) {
if (stringList == null || stringList.trim().length() == 0)
return new String[0];
- List<String> list = new ArrayList<String>();
+ List<String> list = new ArrayList<>();
StringTokenizer tokens = new StringTokenizer(stringList, separator);
while (tokens.hasMoreTokens()) {
String token = tokens.nextToken().trim();
@@ -500,7 +500,7 @@ public class ManifestElement {
*/
public static Map<String, String> parseBundleManifest(InputStream manifest, Map<String, String> headers) throws IOException, BundleException {
if (headers == null)
- headers = new HashMap<String, String>();
+ headers = new HashMap<>();
manifest = new BufferedInputStream(manifest);
try {
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/NLS.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/NLS.java
index 3a454094a..a95afd5e9 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/NLS.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/NLS.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2014 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -247,7 +247,7 @@ public abstract class NLS {
if (nlSuffixes == null) {
//build list of suffixes for loading resource bundles
String nl = Locale.getDefault().toString();
- List<String> result = new ArrayList<String>(4);
+ List<String> result = new ArrayList<>(4);
int lastSeparator;
while (true) {
result.add('_' + nl + EXTENSION);
@@ -309,7 +309,7 @@ public abstract class NLS {
//build a map of field names to Field objects
final int len = fieldArray.length;
- Map<Object, Object> fields = new HashMap<Object, Object>(len * 2);
+ Map<Object, Object> fields = new HashMap<>(len * 2);
for (int i = 0; i < len; i++)
fields.put(fieldArray[i].getName(), fieldArray[i]);

Back to the top