提交 91936637 编写于 作者: D darcy

8028229: Fix more raw types lint warning in core libraries

Reviewed-by: chegar, forax, lancea, alanb, jfranck
上级 5a92307d
...@@ -1248,7 +1248,7 @@ public class ObjectOutputStream ...@@ -1248,7 +1248,7 @@ public class ObjectOutputStream
handles.assign(unshared ? null : desc); handles.assign(unshared ? null : desc);
Class<?> cl = desc.forClass(); Class<?> cl = desc.forClass();
Class[] ifaces = cl.getInterfaces(); Class<?>[] ifaces = cl.getInterfaces();
bout.writeInt(ifaces.length); bout.writeInt(ifaces.length);
for (int i = 0; i < ifaces.length; i++) { for (int i = 0; i < ifaces.length; i++) {
bout.writeUTF(ifaces[i].getName()); bout.writeUTF(ifaces[i].getName());
......
/* /*
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -1746,7 +1746,7 @@ public class ObjectStreamClass implements Serializable { ...@@ -1746,7 +1746,7 @@ public class ObjectStreamClass implements Serializable {
dout.writeUTF("()V"); dout.writeUTF("()V");
} }
Constructor[] cons = cl.getDeclaredConstructors(); Constructor<?>[] cons = cl.getDeclaredConstructors();
MemberSignature[] consSigs = new MemberSignature[cons.length]; MemberSignature[] consSigs = new MemberSignature[cons.length];
for (int i = 0; i < cons.length; i++) { for (int i = 0; i < cons.length; i++) {
consSigs[i] = new MemberSignature(cons[i]); consSigs[i] = new MemberSignature(cons[i]);
......
/* /*
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -494,9 +494,10 @@ public class Proxy implements java.io.Serializable { ...@@ -494,9 +494,10 @@ public class Proxy implements java.io.Serializable {
private final int hash; private final int hash;
private final WeakReference<Class<?>>[] refs; private final WeakReference<Class<?>>[] refs;
@SuppressWarnings("unchecked")
KeyX(Class<?>[] interfaces) { KeyX(Class<?>[] interfaces) {
hash = Arrays.hashCode(interfaces); hash = Arrays.hashCode(interfaces);
refs = new WeakReference[interfaces.length]; refs = (WeakReference<Class<?>>[])new WeakReference<?>[interfaces.length];
for (int i = 0; i < interfaces.length; i++) { for (int i = 0; i < interfaces.length; i++) {
refs[i] = new WeakReference<>(interfaces[i]); refs[i] = new WeakReference<>(interfaces[i]);
} }
......
/* /*
* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -81,7 +81,7 @@ class TempFileHelper { ...@@ -81,7 +81,7 @@ class TempFileHelper {
String prefix, String prefix,
String suffix, String suffix,
boolean createDirectory, boolean createDirectory,
FileAttribute[] attrs) FileAttribute<?>[] attrs)
throws IOException throws IOException
{ {
if (prefix == null) if (prefix == null)
...@@ -155,7 +155,7 @@ class TempFileHelper { ...@@ -155,7 +155,7 @@ class TempFileHelper {
static Path createTempFile(Path dir, static Path createTempFile(Path dir,
String prefix, String prefix,
String suffix, String suffix,
FileAttribute[] attrs) FileAttribute<?>[] attrs)
throws IOException throws IOException
{ {
return create(dir, prefix, suffix, false, attrs); return create(dir, prefix, suffix, false, attrs);
...@@ -167,7 +167,7 @@ class TempFileHelper { ...@@ -167,7 +167,7 @@ class TempFileHelper {
*/ */
static Path createTempDirectory(Path dir, static Path createTempDirectory(Path dir,
String prefix, String prefix,
FileAttribute[] attrs) FileAttribute<?>[] attrs)
throws IOException throws IOException
{ {
return create(dir, prefix, null, true, attrs); return create(dir, prefix, null, true, attrs);
......
...@@ -1243,7 +1243,7 @@ public class IdentityHashMap<K,V> ...@@ -1243,7 +1243,7 @@ public class IdentityHashMap<K,V>
if (ti >= size) { if (ti >= size) {
throw new ConcurrentModificationException(); throw new ConcurrentModificationException();
} }
a[ti++] = (T) new AbstractMap.SimpleEntry(unmaskNull(key), tab[si + 1]); a[ti++] = (T) new AbstractMap.SimpleEntry<>(unmaskNull(key), tab[si + 1]);
} }
} }
// fewer elements than expected or concurrent modification from other thread detected // fewer elements than expected or concurrent modification from other thread detected
......
...@@ -351,7 +351,7 @@ public class Logger { ...@@ -351,7 +351,7 @@ public class Logger {
? caller.getClassLoader() ? caller.getClassLoader()
: null); : null);
if (callersClassLoader != null) { if (callersClassLoader != null) {
this.callersClassLoaderRef = new WeakReference(callersClassLoader); this.callersClassLoaderRef = new WeakReference<>(callersClassLoader);
} }
} }
......
/* /*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -55,11 +55,11 @@ class Logging implements LoggingMXBean { ...@@ -55,11 +55,11 @@ class Logging implements LoggingMXBean {
} }
public List<String> getLoggerNames() { public List<String> getLoggerNames() {
Enumeration loggers = logManager.getLoggerNames(); Enumeration<String> loggers = logManager.getLoggerNames();
ArrayList<String> array = new ArrayList<>(); ArrayList<String> array = new ArrayList<>();
for (; loggers.hasMoreElements();) { for (; loggers.hasMoreElements();) {
array.add((String) loggers.nextElement()); array.add(loggers.nextElement());
} }
return array; return array;
} }
......
/* /*
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -57,14 +57,14 @@ import java.security.PrivilegedAction; ...@@ -57,14 +57,14 @@ import java.security.PrivilegedAction;
*/ */
public class Cleaner public class Cleaner
extends PhantomReference extends PhantomReference<Object>
{ {
// Dummy reference queue, needed because the PhantomReference constructor // Dummy reference queue, needed because the PhantomReference constructor
// insists that we pass a queue. Nothing will ever be placed on this queue // insists that we pass a queue. Nothing will ever be placed on this queue
// since the reference handler invokes cleaners explicitly. // since the reference handler invokes cleaners explicitly.
// //
private static final ReferenceQueue dummyQueue = new ReferenceQueue(); private static final ReferenceQueue<Object> dummyQueue = new ReferenceQueue<>();
// Doubly-linked list of live cleaners, which prevents the cleaners // Doubly-linked list of live cleaners, which prevents the cleaners
// themselves from being GC'd before their referents // themselves from being GC'd before their referents
...@@ -119,6 +119,7 @@ public class Cleaner ...@@ -119,6 +119,7 @@ public class Cleaner
/** /**
* Creates a new cleaner. * Creates a new cleaner.
* *
* @param ob the referent object to be cleaned
* @param thunk * @param thunk
* The cleanup code to be run when the cleaner is invoked. The * The cleanup code to be run when the cleaner is invoked. The
* cleanup code is run directly from the reference-handler thread, * cleanup code is run directly from the reference-handler thread,
......
/* /*
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -384,7 +384,7 @@ public class ProxyGenerator { ...@@ -384,7 +384,7 @@ public class ProxyGenerator {
private String className; private String className;
/** proxy interfaces */ /** proxy interfaces */
private Class[] interfaces; private Class<?>[] interfaces;
/** proxy class access flags */ /** proxy class access flags */
private int accessFlags; private int accessFlags;
......
/* /*
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -494,7 +494,7 @@ public class Main implements sun.rmi.rmic.Constants { ...@@ -494,7 +494,7 @@ public class Main implements sun.rmi.rmic.Constants {
extDirsArg); extDirsArg);
BatchEnvironment result = null; BatchEnvironment result = null;
try { try {
Class[] ctorArgTypes = {OutputStream.class,ClassPath.class,Main.class}; Class<?>[] ctorArgTypes = {OutputStream.class,ClassPath.class,Main.class};
Object[] ctorArgs = {out,classPath,this}; Object[] ctorArgs = {out,classPath,this};
Constructor<? extends BatchEnvironment> constructor = Constructor<? extends BatchEnvironment> constructor =
environmentClass.getConstructor(ctorArgTypes); environmentClass.getConstructor(ctorArgTypes);
......
...@@ -692,7 +692,7 @@ public final class LoaderHandler { ...@@ -692,7 +692,7 @@ public final class LoaderHandler {
* Define a proxy class in the given class loader. The proxy * Define a proxy class in the given class loader. The proxy
* class will implement the given interfaces Classes. * class will implement the given interfaces Classes.
*/ */
private static Class<?> loadProxyClass(ClassLoader loader, Class[] interfaces) private static Class<?> loadProxyClass(ClassLoader loader, Class<?>[] interfaces)
throws ClassNotFoundException throws ClassNotFoundException
{ {
try { try {
...@@ -719,7 +719,7 @@ public final class LoaderHandler { ...@@ -719,7 +719,7 @@ public final class LoaderHandler {
*/ */
private static ClassLoader loadProxyInterfaces(String[] interfaces, private static ClassLoader loadProxyInterfaces(String[] interfaces,
ClassLoader loader, ClassLoader loader,
Class[] classObjs, Class<?>[] classObjs,
boolean[] nonpublic) boolean[] nonpublic)
throws ClassNotFoundException throws ClassNotFoundException
{ {
......
...@@ -299,7 +299,7 @@ public class UnicastServerRef extends UnicastRef ...@@ -299,7 +299,7 @@ public class UnicastServerRef extends UnicastRef
logCall(obj, method); logCall(obj, method);
// unmarshal parameters // unmarshal parameters
Class[] types = method.getParameterTypes(); Class<?>[] types = method.getParameterTypes();
Object[] params = new Object[types.length]; Object[] params = new Object[types.length];
try { try {
......
...@@ -87,7 +87,7 @@ public final class Util { ...@@ -87,7 +87,7 @@ public final class Util {
Collections.synchronizedMap(new WeakHashMap<Class<?>, Void>(11)); Collections.synchronizedMap(new WeakHashMap<Class<?>, Void>(11));
/** parameter types for stub constructor */ /** parameter types for stub constructor */
private static final Class[] stubConsParamTypes = { RemoteRef.class }; private static final Class<?>[] stubConsParamTypes = { RemoteRef.class };
private Util() { private Util() {
} }
...@@ -143,7 +143,7 @@ public final class Util { ...@@ -143,7 +143,7 @@ public final class Util {
} }
final ClassLoader loader = implClass.getClassLoader(); final ClassLoader loader = implClass.getClassLoader();
final Class[] interfaces = getRemoteInterfaces(implClass); final Class<?>[] interfaces = getRemoteInterfaces(implClass);
final InvocationHandler handler = final InvocationHandler handler =
new RemoteObjectInvocationHandler(clientRef); new RemoteObjectInvocationHandler(clientRef);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册