提交 f25fffb5 编写于 作者: A art

8022185: Fix Raw and unchecked warnings in classes belonging to java.awt.datatransfer

Reviewed-by: art, pchelko
Contributed-by: NSrikalyan Chandrashekar <srikalyan.chandrashekar@oracle.com>
上级 08d5fa6f
......@@ -101,7 +101,7 @@ import sun.awt.datatransfer.DataTransferer;
public class DataFlavor implements Externalizable, Cloneable {
private static final long serialVersionUID = 8367026044764648243L;
private static final Class ioInputStreamClass = java.io.InputStream.class;
private static final Class<InputStream> ioInputStreamClass = InputStream.class;
/**
* Tries to load a class from: the bootstrap loader, the system loader,
......@@ -116,10 +116,10 @@ public class DataFlavor implements Externalizable, Cloneable {
ClassLoader fallback)
throws ClassNotFoundException
{
ClassLoader systemClassLoader = (ClassLoader)
ClassLoader systemClassLoader =
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
public Object run() {
new java.security.PrivilegedAction<ClassLoader>() {
public ClassLoader run() {
ClassLoader cl = Thread.currentThread().
getContextClassLoader();
return (cl != null)
......@@ -142,7 +142,7 @@ public class DataFlavor implements Externalizable, Cloneable {
/*
* private initializer
*/
static private DataFlavor createConstant(Class rc, String prn) {
static private DataFlavor createConstant(Class<?> rc, String prn) {
try {
return new DataFlavor(rc, prn);
} catch (Exception e) {
......@@ -314,7 +314,7 @@ public class DataFlavor implements Externalizable, Cloneable {
* @exception NullPointerException if either <code>primaryType</code>,
* <code>subType</code> or <code>representationClass</code> is null
*/
private DataFlavor(String primaryType, String subType, MimeTypeParameterList params, Class representationClass, String humanPresentableName) {
private DataFlavor(String primaryType, String subType, MimeTypeParameterList params, Class<?> representationClass, String humanPresentableName) {
super();
if (primaryType == null) {
throw new NullPointerException("primaryType");
......@@ -331,7 +331,7 @@ public class DataFlavor implements Externalizable, Cloneable {
params.set("class", representationClass.getName());
if (humanPresentableName == null) {
humanPresentableName = (String)params.get("humanPresentableName");
humanPresentableName = params.get("humanPresentableName");
if (humanPresentableName == null)
humanPresentableName = primaryType + "/" + subType;
......@@ -732,7 +732,7 @@ public class DataFlavor implements Externalizable, Cloneable {
return bestFlavor;
}
private static Comparator textFlavorComparator;
private static Comparator<DataFlavor> textFlavorComparator;
static class TextFlavorComparator
extends DataTransferer.DataFlavorComparator {
......@@ -1438,6 +1438,6 @@ public class DataFlavor implements Externalizable, Cloneable {
/** Java class of objects this DataFlavor represents **/
private Class representationClass;
private Class<?> representationClass;
} // class DataFlavor
......@@ -44,13 +44,13 @@ class MimeTypeParameterList implements Cloneable {
* Default constructor.
*/
public MimeTypeParameterList() {
parameters = new Hashtable();
parameters = new Hashtable<>();
}
public MimeTypeParameterList(String rawdata)
throws MimeTypeParseException
{
parameters = new Hashtable();
parameters = new Hashtable<>();
// now parse rawdata
parse(rawdata);
......@@ -59,10 +59,10 @@ class MimeTypeParameterList implements Cloneable {
public int hashCode() {
int code = Integer.MAX_VALUE/45; // "random" value for empty lists
String paramName = null;
Enumeration enum_ = this.getNames();
Enumeration<String> enum_ = this.getNames();
while (enum_.hasMoreElements()) {
paramName = (String)enum_.nextElement();
paramName = enum_.nextElement();
code += paramName.hashCode();
code += this.get(paramName).hashCode();
}
......@@ -87,14 +87,14 @@ class MimeTypeParameterList implements Cloneable {
String name = null;
String thisValue = null;
String thatValue = null;
Set entries = parameters.entrySet();
Iterator iterator = entries.iterator();
Map.Entry entry = null;
Set<Map.Entry<String, String>> entries = parameters.entrySet();
Iterator<Map.Entry<String, String>> iterator = entries.iterator();
Map.Entry<String, String> entry = null;
while (iterator.hasNext()) {
entry = (Map.Entry)iterator.next();
name = (String)entry.getKey();
thisValue = (String)entry.getValue();
thatValue = (String)that.parameters.get(name);
entry = iterator.next();
name = entry.getKey();
thisValue = entry.getValue();
thatValue = that.parameters.get(name);
if ((thisValue == null) || (thatValue == null)) {
// both null -> equal, only one null -> not equal
if (thisValue != thatValue) {
......@@ -250,7 +250,7 @@ class MimeTypeParameterList implements Cloneable {
* is no current association.
*/
public String get(String name) {
return (String)parameters.get(name.trim().toLowerCase());
return parameters.get(name.trim().toLowerCase());
}
/**
......@@ -271,7 +271,7 @@ class MimeTypeParameterList implements Cloneable {
/**
* Retrieve an enumeration of all the names in this list.
*/
public Enumeration getNames() {
public Enumeration<String> getNames() {
return parameters.keys();
}
......@@ -279,15 +279,15 @@ class MimeTypeParameterList implements Cloneable {
// Heuristic: 8 characters per field
StringBuilder buffer = new StringBuilder(parameters.size() * 16);
Enumeration keys = parameters.keys();
Enumeration<String> keys = parameters.keys();
while(keys.hasMoreElements())
{
buffer.append("; ");
String key = (String)keys.nextElement();
String key = keys.nextElement();
buffer.append(key);
buffer.append('=');
buffer.append(quote((String)parameters.get(key)));
buffer.append(quote(parameters.get(key)));
}
return buffer.toString();
......@@ -307,7 +307,7 @@ class MimeTypeParameterList implements Cloneable {
return newObj;
}
private Hashtable parameters;
private Hashtable<String, String> parameters;
// below here be scary parsing related things
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册