提交 3e00a900 编写于 作者: A alanb

7116404: Miscellaneous warnings (java.rmi.**, serialization, some core classes)

Reviewed-by: lancea, chegar, smarks
上级 3e7e23be
...@@ -2006,7 +2006,7 @@ public class File ...@@ -2006,7 +2006,7 @@ public class File
throws IOException throws IOException
{ {
s.defaultWriteObject(); s.defaultWriteObject();
s.writeChar(this.separatorChar); // Add the separator character s.writeChar(separatorChar); // Add the separator character
} }
/** /**
......
...@@ -689,9 +689,9 @@ public class ObjectInputStream ...@@ -689,9 +689,9 @@ public class ObjectInputStream
boolean hasNonPublicInterface = false; boolean hasNonPublicInterface = false;
// define proxy in class loader of non-public interface(s), if any // define proxy in class loader of non-public interface(s), if any
Class[] classObjs = new Class[interfaces.length]; Class<?>[] classObjs = new Class<?>[interfaces.length];
for (int i = 0; i < interfaces.length; i++) { for (int i = 0; i < interfaces.length; i++) {
Class cl = Class.forName(interfaces[i], false, latestLoader); Class<?> cl = Class.forName(interfaces[i], false, latestLoader);
if ((cl.getModifiers() & Modifier.PUBLIC) == 0) { if ((cl.getModifiers() & Modifier.PUBLIC) == 0) {
if (hasNonPublicInterface) { if (hasNonPublicInterface) {
if (nonPublicLoader != cl.getClassLoader()) { if (nonPublicLoader != cl.getClassLoader()) {
...@@ -1229,7 +1229,7 @@ public class ObjectInputStream ...@@ -1229,7 +1229,7 @@ public class ObjectInputStream
* "enableSubclassImplementation" SerializablePermission is checked. * "enableSubclassImplementation" SerializablePermission is checked.
*/ */
private void verifySubclass() { private void verifySubclass() {
Class cl = getClass(); Class<?> cl = getClass();
if (cl == ObjectInputStream.class) { if (cl == ObjectInputStream.class) {
return; return;
} }
...@@ -1473,12 +1473,12 @@ public class ObjectInputStream ...@@ -1473,12 +1473,12 @@ public class ObjectInputStream
* ClassNotFoundException will be associated with the class' handle in the * ClassNotFoundException will be associated with the class' handle in the
* handle table). * handle table).
*/ */
private Class readClass(boolean unshared) throws IOException { private Class<?> readClass(boolean unshared) throws IOException {
if (bin.readByte() != TC_CLASS) { if (bin.readByte() != TC_CLASS) {
throw new InternalError(); throw new InternalError();
} }
ObjectStreamClass desc = readClassDesc(false); ObjectStreamClass desc = readClassDesc(false);
Class cl = desc.forClass(); Class<?> cl = desc.forClass();
passHandle = handles.assign(unshared ? unsharedMarker : cl); passHandle = handles.assign(unshared ? unsharedMarker : cl);
ClassNotFoundException resolveEx = desc.getResolveException(); ClassNotFoundException resolveEx = desc.getResolveException();
...@@ -1542,7 +1542,7 @@ public class ObjectInputStream ...@@ -1542,7 +1542,7 @@ public class ObjectInputStream
ifaces[i] = bin.readUTF(); ifaces[i] = bin.readUTF();
} }
Class cl = null; Class<?> cl = null;
ClassNotFoundException resolveEx = null; ClassNotFoundException resolveEx = null;
bin.setBlockDataMode(true); bin.setBlockDataMode(true);
try { try {
...@@ -1586,7 +1586,7 @@ public class ObjectInputStream ...@@ -1586,7 +1586,7 @@ public class ObjectInputStream
"failed to read class descriptor").initCause(ex); "failed to read class descriptor").initCause(ex);
} }
Class cl = null; Class<?> cl = null;
ClassNotFoundException resolveEx = null; ClassNotFoundException resolveEx = null;
bin.setBlockDataMode(true); bin.setBlockDataMode(true);
try { try {
...@@ -1643,7 +1643,7 @@ public class ObjectInputStream ...@@ -1643,7 +1643,7 @@ public class ObjectInputStream
int len = bin.readInt(); int len = bin.readInt();
Object array = null; Object array = null;
Class cl, ccl = null; Class<?> cl, ccl = null;
if ((cl = desc.forClass()) != null) { if ((cl = desc.forClass()) != null) {
ccl = cl.getComponentType(); ccl = cl.getComponentType();
array = Array.newInstance(ccl, len); array = Array.newInstance(ccl, len);
...@@ -1696,7 +1696,7 @@ public class ObjectInputStream ...@@ -1696,7 +1696,7 @@ public class ObjectInputStream
* Reads in and returns enum constant, or null if enum type is * Reads in and returns enum constant, or null if enum type is
* unresolvable. Sets passHandle to enum constant's assigned handle. * unresolvable. Sets passHandle to enum constant's assigned handle.
*/ */
private Enum readEnum(boolean unshared) throws IOException { private Enum<?> readEnum(boolean unshared) throws IOException {
if (bin.readByte() != TC_ENUM) { if (bin.readByte() != TC_ENUM) {
throw new InternalError(); throw new InternalError();
} }
...@@ -1713,24 +1713,26 @@ public class ObjectInputStream ...@@ -1713,24 +1713,26 @@ public class ObjectInputStream
} }
String name = readString(false); String name = readString(false);
Enum en = null; Enum<?> result = null;
Class cl = desc.forClass(); Class<?> cl = desc.forClass();
if (cl != null) { if (cl != null) {
try { try {
en = Enum.valueOf(cl, name); @SuppressWarnings("unchecked")
Enum<?> en = Enum.valueOf((Class)cl, name);
result = en;
} catch (IllegalArgumentException ex) { } catch (IllegalArgumentException ex) {
throw (IOException) new InvalidObjectException( throw (IOException) new InvalidObjectException(
"enum constant " + name + " does not exist in " + "enum constant " + name + " does not exist in " +
cl).initCause(ex); cl).initCause(ex);
} }
if (!unshared) { if (!unshared) {
handles.setObject(enumHandle, en); handles.setObject(enumHandle, result);
} }
} }
handles.finish(enumHandle); handles.finish(enumHandle);
passHandle = enumHandle; passHandle = enumHandle;
return en; return result;
} }
/** /**
...@@ -1941,7 +1943,7 @@ public class ObjectInputStream ...@@ -1941,7 +1943,7 @@ public class ObjectInputStream
throws IOException throws IOException
{ {
// REMIND: is isInstance check necessary? // REMIND: is isInstance check necessary?
Class cl = desc.forClass(); Class<?> cl = desc.forClass();
if (cl != null && obj != null && !cl.isInstance(obj)) { if (cl != null && obj != null && !cl.isInstance(obj)) {
throw new ClassCastException(); throw new ClassCastException();
} }
...@@ -2140,7 +2142,7 @@ public class ObjectInputStream ...@@ -2140,7 +2142,7 @@ public class ObjectInputStream
* class descriptor, returns -1. Throws IllegalArgumentException if * class descriptor, returns -1. Throws IllegalArgumentException if
* neither incoming nor local class descriptor contains a match. * neither incoming nor local class descriptor contains a match.
*/ */
private int getFieldOffset(String name, Class type) { private int getFieldOffset(String name, Class<?> type) {
ObjectStreamField field = desc.getField(name, type); ObjectStreamField field = desc.getField(name, type);
if (field != null) { if (field != null) {
return field.getOffset(); return field.getOffset();
...@@ -2838,6 +2840,7 @@ public class ObjectInputStream ...@@ -2838,6 +2840,7 @@ public class ObjectInputStream
return readUTFBody(readUnsignedShort()); return readUTFBody(readUnsignedShort());
} }
@SuppressWarnings("deprecation")
public String readLine() throws IOException { public String readLine() throws IOException {
return din.readLine(); // deprecated, not worth optimizing return din.readLine(); // deprecated, not worth optimizing
} }
......
...@@ -1034,7 +1034,7 @@ public class ObjectOutputStream ...@@ -1034,7 +1034,7 @@ public class ObjectOutputStream
* "enableSubclassImplementation" SerializablePermission is checked. * "enableSubclassImplementation" SerializablePermission is checked.
*/ */
private void verifySubclass() { private void verifySubclass() {
Class cl = getClass(); Class<?> cl = getClass();
if (cl == ObjectOutputStream.class) { if (cl == ObjectOutputStream.class) {
return; return;
} }
...@@ -1060,17 +1060,17 @@ public class ObjectOutputStream ...@@ -1060,17 +1060,17 @@ public class ObjectOutputStream
* override security-sensitive non-final methods. Returns true if subclass * override security-sensitive non-final methods. Returns true if subclass
* is "safe", false otherwise. * is "safe", false otherwise.
*/ */
private static boolean auditSubclass(final Class subcl) { private static boolean auditSubclass(final Class<?> subcl) {
Boolean result = AccessController.doPrivileged( Boolean result = AccessController.doPrivileged(
new PrivilegedAction<Boolean>() { new PrivilegedAction<Boolean>() {
public Boolean run() { public Boolean run() {
for (Class cl = subcl; for (Class<?> cl = subcl;
cl != ObjectOutputStream.class; cl != ObjectOutputStream.class;
cl = cl.getSuperclass()) cl = cl.getSuperclass())
{ {
try { try {
cl.getDeclaredMethod( cl.getDeclaredMethod(
"writeUnshared", new Class[] { Object.class }); "writeUnshared", new Class<?>[] { Object.class });
return Boolean.FALSE; return Boolean.FALSE;
} catch (NoSuchMethodException ex) { } catch (NoSuchMethodException ex) {
} }
...@@ -1122,11 +1122,11 @@ public class ObjectOutputStream ...@@ -1122,11 +1122,11 @@ public class ObjectOutputStream
// check for replacement object // check for replacement object
Object orig = obj; Object orig = obj;
Class cl = obj.getClass(); Class<?> cl = obj.getClass();
ObjectStreamClass desc; ObjectStreamClass desc;
for (;;) { for (;;) {
// REMIND: skip this check for strings/arrays? // REMIND: skip this check for strings/arrays?
Class repCl; Class<?> repCl;
desc = ObjectStreamClass.lookup(cl, true); desc = ObjectStreamClass.lookup(cl, true);
if (!desc.hasWriteReplaceMethod() || if (!desc.hasWriteReplaceMethod() ||
(obj = desc.invokeWriteReplace(obj)) == null || (obj = desc.invokeWriteReplace(obj)) == null ||
...@@ -1169,7 +1169,7 @@ public class ObjectOutputStream ...@@ -1169,7 +1169,7 @@ public class ObjectOutputStream
} else if (cl.isArray()) { } else if (cl.isArray()) {
writeArray(obj, desc, unshared); writeArray(obj, desc, unshared);
} else if (obj instanceof Enum) { } else if (obj instanceof Enum) {
writeEnum((Enum) obj, desc, unshared); writeEnum((Enum<?>) obj, desc, unshared);
} else if (obj instanceof Serializable) { } else if (obj instanceof Serializable) {
writeOrdinaryObject(obj, desc, unshared); writeOrdinaryObject(obj, desc, unshared);
} else { } else {
...@@ -1204,7 +1204,7 @@ public class ObjectOutputStream ...@@ -1204,7 +1204,7 @@ public class ObjectOutputStream
/** /**
* Writes representation of given class to stream. * Writes representation of given class to stream.
*/ */
private void writeClass(Class cl, boolean unshared) throws IOException { private void writeClass(Class<?> cl, boolean unshared) throws IOException {
bout.writeByte(TC_CLASS); bout.writeByte(TC_CLASS);
writeClassDesc(ObjectStreamClass.lookup(cl, true), false); writeClassDesc(ObjectStreamClass.lookup(cl, true), false);
handles.assign(unshared ? null : cl); handles.assign(unshared ? null : cl);
...@@ -1237,7 +1237,7 @@ public class ObjectOutputStream ...@@ -1237,7 +1237,7 @@ public class ObjectOutputStream
bout.writeByte(TC_PROXYCLASSDESC); bout.writeByte(TC_PROXYCLASSDESC);
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++) {
...@@ -1269,7 +1269,7 @@ public class ObjectOutputStream ...@@ -1269,7 +1269,7 @@ public class ObjectOutputStream
writeClassDescriptor(desc); writeClassDescriptor(desc);
} }
Class cl = desc.forClass(); Class<?> cl = desc.forClass();
bout.setBlockDataMode(true); bout.setBlockDataMode(true);
annotateClass(cl); annotateClass(cl);
bout.setBlockDataMode(false); bout.setBlockDataMode(false);
...@@ -1306,7 +1306,7 @@ public class ObjectOutputStream ...@@ -1306,7 +1306,7 @@ public class ObjectOutputStream
writeClassDesc(desc, false); writeClassDesc(desc, false);
handles.assign(unshared ? null : array); handles.assign(unshared ? null : array);
Class ccl = desc.forClass().getComponentType(); Class<?> ccl = desc.forClass().getComponentType();
if (ccl.isPrimitive()) { if (ccl.isPrimitive()) {
if (ccl == Integer.TYPE) { if (ccl == Integer.TYPE) {
int[] ia = (int[]) array; int[] ia = (int[]) array;
...@@ -1377,7 +1377,7 @@ public class ObjectOutputStream ...@@ -1377,7 +1377,7 @@ public class ObjectOutputStream
/** /**
* Writes given enum constant to stream. * Writes given enum constant to stream.
*/ */
private void writeEnum(Enum en, private void writeEnum(Enum<?> en,
ObjectStreamClass desc, ObjectStreamClass desc,
boolean unshared) boolean unshared)
throws IOException throws IOException
...@@ -1700,7 +1700,7 @@ public class ObjectOutputStream ...@@ -1700,7 +1700,7 @@ public class ObjectOutputStream
* types, and any other non-null type matches assignable types only. * types, and any other non-null type matches assignable types only.
* Throws IllegalArgumentException if no matching field found. * Throws IllegalArgumentException if no matching field found.
*/ */
private int getFieldOffset(String name, Class type) { private int getFieldOffset(String name, Class<?> type) {
ObjectStreamField field = desc.getField(name, type); ObjectStreamField field = desc.getField(name, type);
if (field == null) { if (field == null) {
throw new IllegalArgumentException("no such field " + name + throw new IllegalArgumentException("no such field " + name +
......
...@@ -144,7 +144,7 @@ public class ObjectStreamClass implements Serializable { ...@@ -144,7 +144,7 @@ public class ObjectStreamClass implements Serializable {
private volatile ClassDataSlot[] dataLayout; private volatile ClassDataSlot[] dataLayout;
/** serialization-appropriate constructor, or null if none */ /** serialization-appropriate constructor, or null if none */
private Constructor cons; private Constructor<?> cons;
/** class-defined writeObject method, or null if none */ /** class-defined writeObject method, or null if none */
private Method writeObjectMethod; private Method writeObjectMethod;
/** class-defined readObject method, or null if none */ /** class-defined readObject method, or null if none */
...@@ -1308,9 +1308,9 @@ public class ObjectStreamClass implements Serializable { ...@@ -1308,9 +1308,9 @@ public class ObjectStreamClass implements Serializable {
* Access checks are disabled on the returned constructor (if any), since * Access checks are disabled on the returned constructor (if any), since
* the defining class may still be non-public. * the defining class may still be non-public.
*/ */
private static Constructor getExternalizableConstructor(Class<?> cl) { private static Constructor<?> getExternalizableConstructor(Class<?> cl) {
try { try {
Constructor cons = cl.getDeclaredConstructor((Class<?>[]) null); Constructor<?> cons = cl.getDeclaredConstructor((Class<?>[]) null);
cons.setAccessible(true); cons.setAccessible(true);
return ((cons.getModifiers() & Modifier.PUBLIC) != 0) ? return ((cons.getModifiers() & Modifier.PUBLIC) != 0) ?
cons : null; cons : null;
...@@ -1324,7 +1324,7 @@ public class ObjectStreamClass implements Serializable { ...@@ -1324,7 +1324,7 @@ public class ObjectStreamClass implements Serializable {
* superclass, or null if none found. Access checks are disabled on the * superclass, or null if none found. Access checks are disabled on the
* returned constructor (if any). * returned constructor (if any).
*/ */
private static Constructor getSerializableConstructor(Class<?> cl) { private static Constructor<?> getSerializableConstructor(Class<?> cl) {
Class<?> initCl = cl; Class<?> initCl = cl;
while (Serializable.class.isAssignableFrom(initCl)) { while (Serializable.class.isAssignableFrom(initCl)) {
if ((initCl = initCl.getSuperclass()) == null) { if ((initCl = initCl.getSuperclass()) == null) {
...@@ -1332,7 +1332,7 @@ public class ObjectStreamClass implements Serializable { ...@@ -1332,7 +1332,7 @@ public class ObjectStreamClass implements Serializable {
} }
} }
try { try {
Constructor cons = initCl.getDeclaredConstructor((Class<?>[]) null); Constructor<?> cons = initCl.getDeclaredConstructor((Class<?>[]) null);
int mods = cons.getModifiers(); int mods = cons.getModifiers();
if ((mods & Modifier.PRIVATE) != 0 || if ((mods & Modifier.PRIVATE) != 0 ||
((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 && ((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 &&
...@@ -1802,7 +1802,7 @@ public class ObjectStreamClass implements Serializable { ...@@ -1802,7 +1802,7 @@ public class ObjectStreamClass implements Serializable {
signature = getClassSignature(field.getType()); signature = getClassSignature(field.getType());
} }
public MemberSignature(Constructor cons) { public MemberSignature(Constructor<?> cons) {
member = cons; member = cons;
name = cons.getName(); name = cons.getName();
signature = getMethodSignature( signature = getMethodSignature(
......
...@@ -44,7 +44,7 @@ import java.util.Vector; ...@@ -44,7 +44,7 @@ import java.util.Vector;
*/ */
public public
class SequenceInputStream extends InputStream { class SequenceInputStream extends InputStream {
Enumeration e; Enumeration<? extends InputStream> e;
InputStream in; InputStream in;
/** /**
...@@ -85,7 +85,7 @@ class SequenceInputStream extends InputStream { ...@@ -85,7 +85,7 @@ class SequenceInputStream extends InputStream {
* @param s2 the second input stream to read. * @param s2 the second input stream to read.
*/ */
public SequenceInputStream(InputStream s1, InputStream s2) { public SequenceInputStream(InputStream s1, InputStream s2) {
Vector v = new Vector(2); Vector<InputStream> v = new Vector<>(2);
v.addElement(s1); v.addElement(s1);
v.addElement(s2); v.addElement(s2);
......
...@@ -258,7 +258,7 @@ public abstract class ClassLoader { ...@@ -258,7 +258,7 @@ public abstract class ClassLoader {
private final Set<ProtectionDomain> domains; private final Set<ProtectionDomain> domains;
// Invoked by the VM to record every loaded class with this loader. // Invoked by the VM to record every loaded class with this loader.
void addClass(Class c) { void addClass(Class<?> c) {
classes.addElement(c); classes.addElement(c);
} }
...@@ -402,7 +402,7 @@ public abstract class ClassLoader { ...@@ -402,7 +402,7 @@ public abstract class ClassLoader {
{ {
synchronized (getClassLoadingLock(name)) { synchronized (getClassLoadingLock(name)) {
// First, check if the class has already been loaded // First, check if the class has already been loaded
Class c = findLoadedClass(name); Class<?> c = findLoadedClass(name);
if (c == null) { if (c == null) {
long t0 = System.nanoTime(); long t0 = System.nanoTime();
try { try {
...@@ -468,7 +468,7 @@ public abstract class ClassLoader { ...@@ -468,7 +468,7 @@ public abstract class ClassLoader {
} }
// This method is invoked by the virtual machine to load a class. // This method is invoked by the virtual machine to load a class.
private Class loadClassInternal(String name) private Class<?> loadClassInternal(String name)
throws ClassNotFoundException throws ClassNotFoundException
{ {
// For backward compatibility, explicitly lock on 'this' when // For backward compatibility, explicitly lock on 'this' when
...@@ -483,7 +483,7 @@ public abstract class ClassLoader { ...@@ -483,7 +483,7 @@ public abstract class ClassLoader {
} }
// Invoked by the VM after loading class with this loader. // Invoked by the VM after loading class with this loader.
private void checkPackageAccess(Class cls, ProtectionDomain pd) { private void checkPackageAccess(Class<?> cls, ProtectionDomain pd) {
final SecurityManager sm = System.getSecurityManager(); final SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
final String name = cls.getName(); final String name = cls.getName();
...@@ -669,9 +669,9 @@ public abstract class ClassLoader { ...@@ -669,9 +669,9 @@ public abstract class ClassLoader {
return source; return source;
} }
private Class defineTransformedClass(String name, byte[] b, int off, int len, private Class<?> defineTransformedClass(String name, byte[] b, int off, int len,
ProtectionDomain pd, ProtectionDomain pd,
ClassFormatError cfe, String source) ClassFormatError cfe, String source)
throws ClassFormatError throws ClassFormatError
{ {
// Class format error - try to transform the bytecode and // Class format error - try to transform the bytecode and
...@@ -679,7 +679,7 @@ public abstract class ClassLoader { ...@@ -679,7 +679,7 @@ public abstract class ClassLoader {
// //
ClassFileTransformer[] transformers = ClassFileTransformer[] transformers =
ClassFileTransformer.getTransformers(); ClassFileTransformer.getTransformers();
Class c = null; Class<?> c = null;
if (transformers != null) { if (transformers != null) {
for (ClassFileTransformer transformer : transformers) { for (ClassFileTransformer transformer : transformers) {
...@@ -704,7 +704,7 @@ public abstract class ClassLoader { ...@@ -704,7 +704,7 @@ public abstract class ClassLoader {
return c; return c;
} }
private void postDefineClass(Class c, ProtectionDomain pd) private void postDefineClass(Class<?> c, ProtectionDomain pd)
{ {
if (pd.getCodeSource() != null) { if (pd.getCodeSource() != null) {
Certificate certs[] = pd.getCodeSource().getCertificates(); Certificate certs[] = pd.getCodeSource().getCertificates();
...@@ -784,7 +784,7 @@ public abstract class ClassLoader { ...@@ -784,7 +784,7 @@ public abstract class ClassLoader {
{ {
protectionDomain = preDefineClass(name, protectionDomain); protectionDomain = preDefineClass(name, protectionDomain);
Class c = null; Class<?> c = null;
String source = defineClassSourceLocation(protectionDomain); String source = defineClassSourceLocation(protectionDomain);
try { try {
...@@ -882,7 +882,7 @@ public abstract class ClassLoader { ...@@ -882,7 +882,7 @@ public abstract class ClassLoader {
protectionDomain = preDefineClass(name, protectionDomain); protectionDomain = preDefineClass(name, protectionDomain);
Class c = null; Class<?> c = null;
String source = defineClassSourceLocation(protectionDomain); String source = defineClassSourceLocation(protectionDomain);
try { try {
...@@ -899,15 +899,15 @@ public abstract class ClassLoader { ...@@ -899,15 +899,15 @@ public abstract class ClassLoader {
return c; return c;
} }
private native Class defineClass0(String name, byte[] b, int off, int len, private native Class<?> defineClass0(String name, byte[] b, int off, int len,
ProtectionDomain pd); ProtectionDomain pd);
private native Class defineClass1(String name, byte[] b, int off, int len, private native Class<?> defineClass1(String name, byte[] b, int off, int len,
ProtectionDomain pd, String source); ProtectionDomain pd, String source);
private native Class defineClass2(String name, java.nio.ByteBuffer b, private native Class<?> defineClass2(String name, java.nio.ByteBuffer b,
int off, int len, ProtectionDomain pd, int off, int len, ProtectionDomain pd,
String source); String source);
// true if the name is null or has the potential to be a valid binary name // true if the name is null or has the potential to be a valid binary name
private boolean checkName(String name) { private boolean checkName(String name) {
...@@ -1010,7 +1010,7 @@ public abstract class ClassLoader { ...@@ -1010,7 +1010,7 @@ public abstract class ClassLoader {
resolveClass0(c); resolveClass0(c);
} }
private native void resolveClass0(Class c); private native void resolveClass0(Class<?> c);
/** /**
* Finds a class with the specified <a href="#name">binary name</a>, * Finds a class with the specified <a href="#name">binary name</a>,
...@@ -1041,7 +1041,7 @@ public abstract class ClassLoader { ...@@ -1041,7 +1041,7 @@ public abstract class ClassLoader {
if (system == null) { if (system == null) {
if (!checkName(name)) if (!checkName(name))
throw new ClassNotFoundException(name); throw new ClassNotFoundException(name);
Class cls = findBootstrapClass(name); Class<?> cls = findBootstrapClass(name);
if (cls == null) { if (cls == null) {
throw new ClassNotFoundException(name); throw new ClassNotFoundException(name);
} }
...@@ -1054,7 +1054,7 @@ public abstract class ClassLoader { ...@@ -1054,7 +1054,7 @@ public abstract class ClassLoader {
* Returns a class loaded by the bootstrap class loader; * Returns a class loaded by the bootstrap class loader;
* or return null if not found. * or return null if not found.
*/ */
private Class findBootstrapClassOrNull(String name) private Class<?> findBootstrapClassOrNull(String name)
{ {
if (!checkName(name)) return null; if (!checkName(name)) return null;
...@@ -1062,7 +1062,7 @@ public abstract class ClassLoader { ...@@ -1062,7 +1062,7 @@ public abstract class ClassLoader {
} }
// return null if not found // return null if not found
private native Class findBootstrapClass(String name); private native Class<?> findBootstrapClass(String name);
/** /**
* Returns the class with the given <a href="#name">binary name</a> if this * Returns the class with the given <a href="#name">binary name</a> if this
...@@ -1084,7 +1084,7 @@ public abstract class ClassLoader { ...@@ -1084,7 +1084,7 @@ public abstract class ClassLoader {
return findLoadedClass0(name); return findLoadedClass0(name);
} }
private native final Class findLoadedClass0(String name); private native final Class<?> findLoadedClass0(String name);
/** /**
* Sets the signers of a class. This should be invoked after defining a * Sets the signers of a class. This should be invoked after defining a
...@@ -1528,7 +1528,7 @@ public abstract class ClassLoader { ...@@ -1528,7 +1528,7 @@ public abstract class ClassLoader {
// invocation and the desired invoker. // invocation and the desired invoker.
static ClassLoader getCallerClassLoader() { static ClassLoader getCallerClassLoader() {
// NOTE use of more generic Reflection.getCallerClass() // NOTE use of more generic Reflection.getCallerClass()
Class caller = Reflection.getCallerClass(3); Class<?> caller = Reflection.getCallerClass(3);
// This can be null if the VM is requesting it // This can be null if the VM is requesting it
if (caller == null) { if (caller == null) {
return null; return null;
...@@ -1722,7 +1722,7 @@ public abstract class ClassLoader { ...@@ -1722,7 +1722,7 @@ public abstract class ClassLoader {
private int jniVersion; private int jniVersion;
// the class from which the library is loaded, also indicates // the class from which the library is loaded, also indicates
// the loader this native library belongs. // the loader this native library belongs.
private Class fromClass; private Class<?> fromClass;
// the canonicalized name of the native library. // the canonicalized name of the native library.
String name; String name;
...@@ -1730,7 +1730,7 @@ public abstract class ClassLoader { ...@@ -1730,7 +1730,7 @@ public abstract class ClassLoader {
native long find(String name); native long find(String name);
native void unload(); native void unload();
public NativeLibrary(Class fromClass, String name) { public NativeLibrary(Class<?> fromClass, String name) {
this.name = name; this.name = name;
this.fromClass = fromClass; this.fromClass = fromClass;
} }
...@@ -1758,7 +1758,7 @@ public abstract class ClassLoader { ...@@ -1758,7 +1758,7 @@ public abstract class ClassLoader {
} }
// Invoked in the VM to determine the context class in // Invoked in the VM to determine the context class in
// JNI_Load/JNI_Unload // JNI_Load/JNI_Unload
static Class getFromClass() { static Class<?> getFromClass() {
return ClassLoader.nativeLibraryContext.peek().fromClass; return ClassLoader.nativeLibraryContext.peek().fromClass;
} }
} }
...@@ -1813,7 +1813,7 @@ public abstract class ClassLoader { ...@@ -1813,7 +1813,7 @@ public abstract class ClassLoader {
} }
// Invoked in the java.lang.Runtime class to implement load and loadLibrary. // Invoked in the java.lang.Runtime class to implement load and loadLibrary.
static void loadLibrary(Class fromClass, String name, static void loadLibrary(Class<?> fromClass, String name,
boolean isAbsolute) { boolean isAbsolute) {
ClassLoader loader = ClassLoader loader =
(fromClass == null) ? null : fromClass.getClassLoader(); (fromClass == null) ? null : fromClass.getClassLoader();
...@@ -1860,7 +1860,7 @@ public abstract class ClassLoader { ...@@ -1860,7 +1860,7 @@ public abstract class ClassLoader {
throw new UnsatisfiedLinkError("no " + name + " in java.library.path"); throw new UnsatisfiedLinkError("no " + name + " in java.library.path");
} }
private static boolean loadLibrary0(Class fromClass, final File file) { private static boolean loadLibrary0(Class<?> fromClass, final File file) {
boolean exists = AccessController.doPrivileged( boolean exists = AccessController.doPrivileged(
new PrivilegedAction<Object>() { new PrivilegedAction<Object>() {
public Object run() { public Object run() {
...@@ -2194,8 +2194,8 @@ class SystemClassLoaderAction ...@@ -2194,8 +2194,8 @@ class SystemClassLoaderAction
return parent; return parent;
} }
Constructor ctor = Class.forName(cls, true, parent) Constructor<?> ctor = Class.forName(cls, true, parent)
.getDeclaredConstructor(new Class[] { ClassLoader.class }); .getDeclaredConstructor(new Class<?>[] { ClassLoader.class });
ClassLoader sys = (ClassLoader) ctor.newInstance( ClassLoader sys = (ClassLoader) ctor.newInstance(
new Object[] { parent }); new Object[] { parent });
Thread.currentThread().setContextClassLoader(sys); Thread.currentThread().setContextClassLoader(sys);
......
...@@ -173,8 +173,8 @@ public abstract class Enum<E extends Enum<E>> ...@@ -173,8 +173,8 @@ public abstract class Enum<E extends Enum<E>>
* method is the order in which the constants are declared. * method is the order in which the constants are declared.
*/ */
public final int compareTo(E o) { public final int compareTo(E o) {
Enum other = (Enum)o; Enum<?> other = (Enum<?>)o;
Enum self = this; Enum<E> self = this;
if (self.getClass() != other.getClass() && // optimization if (self.getClass() != other.getClass() && // optimization
self.getDeclaringClass() != other.getDeclaringClass()) self.getDeclaringClass() != other.getDeclaringClass())
throw new ClassCastException(); throw new ClassCastException();
...@@ -193,10 +193,11 @@ public abstract class Enum<E extends Enum<E>> ...@@ -193,10 +193,11 @@ public abstract class Enum<E extends Enum<E>>
* @return the Class object corresponding to this enum constant's * @return the Class object corresponding to this enum constant's
* enum type * enum type
*/ */
@SuppressWarnings("unchecked")
public final Class<E> getDeclaringClass() { public final Class<E> getDeclaringClass() {
Class clazz = getClass(); Class<?> clazz = getClass();
Class zuper = clazz.getSuperclass(); Class<?> zuper = clazz.getSuperclass();
return (zuper == Enum.class) ? clazz : zuper; return (zuper == Enum.class) ? (Class<E>)clazz : (Class<E>)zuper;
} }
/** /**
......
...@@ -608,5 +608,5 @@ public class Package implements java.lang.reflect.AnnotatedElement { ...@@ -608,5 +608,5 @@ public class Package implements java.lang.reflect.AnnotatedElement {
private final String implVendor; private final String implVendor;
private final URL sealBase; private final URL sealBase;
private transient final ClassLoader loader; private transient final ClassLoader loader;
private transient Class packageInfo; private transient Class<?> packageInfo;
} }
...@@ -780,7 +780,7 @@ public class Runtime { ...@@ -780,7 +780,7 @@ public class Runtime {
load0(System.getCallerClass(), filename); load0(System.getCallerClass(), filename);
} }
synchronized void load0(Class fromClass, String filename) { synchronized void load0(Class<?> fromClass, String filename) {
SecurityManager security = System.getSecurityManager(); SecurityManager security = System.getSecurityManager();
if (security != null) { if (security != null) {
security.checkLink(filename); security.checkLink(filename);
...@@ -833,7 +833,7 @@ public class Runtime { ...@@ -833,7 +833,7 @@ public class Runtime {
loadLibrary0(System.getCallerClass(), libname); loadLibrary0(System.getCallerClass(), libname);
} }
synchronized void loadLibrary0(Class fromClass, String libname) { synchronized void loadLibrary0(Class<?> fromClass, String libname) {
SecurityManager security = System.getSecurityManager(); SecurityManager security = System.getSecurityManager();
if (security != null) { if (security != null) {
security.checkLink(libname); security.checkLink(libname);
......
...@@ -400,7 +400,7 @@ class SecurityManager { ...@@ -400,7 +400,7 @@ class SecurityManager {
*/ */
@Deprecated @Deprecated
protected Class<?> currentLoadedClass() { protected Class<?> currentLoadedClass() {
Class c = currentLoadedClass0(); Class<?> c = currentLoadedClass0();
if ((c != null) && hasAllPermission()) if ((c != null) && hasAllPermission())
c = null; c = null;
return c; return c;
...@@ -1715,7 +1715,7 @@ class SecurityManager { ...@@ -1715,7 +1715,7 @@ class SecurityManager {
checkPermission(new SecurityPermission(target)); checkPermission(new SecurityPermission(target));
} }
private native Class currentLoadedClass0(); private native Class<?> currentLoadedClass0();
/** /**
* Returns the thread group into which to instantiate any new * Returns the thread group into which to instantiate any new
......
...@@ -1171,13 +1171,13 @@ public final class System { ...@@ -1171,13 +1171,13 @@ public final class System {
private static void setJavaLangAccess() { private static void setJavaLangAccess() {
// Allow privileged classes outside of java.lang // Allow privileged classes outside of java.lang
sun.misc.SharedSecrets.setJavaLangAccess(new sun.misc.JavaLangAccess(){ sun.misc.SharedSecrets.setJavaLangAccess(new sun.misc.JavaLangAccess(){
public sun.reflect.ConstantPool getConstantPool(Class klass) { public sun.reflect.ConstantPool getConstantPool(Class<?> klass) {
return klass.getConstantPool(); return klass.getConstantPool();
} }
public void setAnnotationType(Class klass, AnnotationType type) { public void setAnnotationType(Class<?> klass, AnnotationType type) {
klass.setAnnotationType(type); klass.setAnnotationType(type);
} }
public AnnotationType getAnnotationType(Class klass) { public AnnotationType getAnnotationType(Class<?> klass) {
return klass.getAnnotationType(); return klass.getAnnotationType();
} }
public <E extends Enum<E>> public <E extends Enum<E>>
......
...@@ -1650,7 +1650,7 @@ class Thread implements Runnable { ...@@ -1650,7 +1650,7 @@ class Thread implements Runnable {
* security-sensitive non-final methods, or else the * security-sensitive non-final methods, or else the
* "enableContextClassLoaderOverride" RuntimePermission is checked. * "enableContextClassLoaderOverride" RuntimePermission is checked.
*/ */
private static boolean isCCLOverridden(Class cl) { private static boolean isCCLOverridden(Class<?> cl) {
if (cl == Thread.class) if (cl == Thread.class)
return false; return false;
...@@ -1670,21 +1670,21 @@ class Thread implements Runnable { ...@@ -1670,21 +1670,21 @@ class Thread implements Runnable {
* override security-sensitive non-final methods. Returns true if the * override security-sensitive non-final methods. Returns true if the
* subclass overrides any of the methods, false otherwise. * subclass overrides any of the methods, false otherwise.
*/ */
private static boolean auditSubclass(final Class subcl) { private static boolean auditSubclass(final Class<?> subcl) {
Boolean result = AccessController.doPrivileged( Boolean result = AccessController.doPrivileged(
new PrivilegedAction<Boolean>() { new PrivilegedAction<Boolean>() {
public Boolean run() { public Boolean run() {
for (Class cl = subcl; for (Class<?> cl = subcl;
cl != Thread.class; cl != Thread.class;
cl = cl.getSuperclass()) cl = cl.getSuperclass())
{ {
try { try {
cl.getDeclaredMethod("getContextClassLoader", new Class[0]); cl.getDeclaredMethod("getContextClassLoader", new Class<?>[0]);
return Boolean.TRUE; return Boolean.TRUE;
} catch (NoSuchMethodException ex) { } catch (NoSuchMethodException ex) {
} }
try { try {
Class[] params = {ClassLoader.class}; Class<?>[] params = {ClassLoader.class};
cl.getDeclaredMethod("setContextClassLoader", params); cl.getDeclaredMethod("setContextClassLoader", params);
return Boolean.TRUE; return Boolean.TRUE;
} catch (NoSuchMethodException ex) { } catch (NoSuchMethodException ex) {
......
...@@ -670,6 +670,7 @@ class ThreadGroup implements Thread.UncaughtExceptionHandler { ...@@ -670,6 +670,7 @@ class ThreadGroup implements Thread.UncaughtExceptionHandler {
* {@link Thread#suspend} for details. * {@link Thread#suspend} for details.
*/ */
@Deprecated @Deprecated
@SuppressWarnings("deprecation")
public final void suspend() { public final void suspend() {
if (stopOrSuspend(true)) if (stopOrSuspend(true))
Thread.currentThread().suspend(); Thread.currentThread().suspend();
...@@ -682,6 +683,7 @@ class ThreadGroup implements Thread.UncaughtExceptionHandler { ...@@ -682,6 +683,7 @@ class ThreadGroup implements Thread.UncaughtExceptionHandler {
* if (and only if) the current thread is found to be in this thread * if (and only if) the current thread is found to be in this thread
* group or one of its subgroups. * group or one of its subgroups.
*/ */
@SuppressWarnings("deprecation")
private boolean stopOrSuspend(boolean suspend) { private boolean stopOrSuspend(boolean suspend) {
boolean suicide = false; boolean suicide = false;
Thread us = Thread.currentThread(); Thread us = Thread.currentThread();
...@@ -731,6 +733,7 @@ class ThreadGroup implements Thread.UncaughtExceptionHandler { ...@@ -731,6 +733,7 @@ class ThreadGroup implements Thread.UncaughtExceptionHandler {
* deadlock-prone. See {@link Thread#suspend} for details. * deadlock-prone. See {@link Thread#suspend} for details.
*/ */
@Deprecated @Deprecated
@SuppressWarnings("deprecation")
public final void resume() { public final void resume() {
int ngroupsSnapshot; int ngroupsSnapshot;
ThreadGroup[] groupsSnapshot; ThreadGroup[] groupsSnapshot;
......
...@@ -156,6 +156,7 @@ public final class MarshalledObject<T> implements Serializable { ...@@ -156,6 +156,7 @@ public final class MarshalledObject<T> implements Serializable {
(locBytes == null ? null : new ByteArrayInputStream(locBytes)); (locBytes == null ? null : new ByteArrayInputStream(locBytes));
MarshalledObjectInputStream in = MarshalledObjectInputStream in =
new MarshalledObjectInputStream(bin, lin); new MarshalledObjectInputStream(bin, lin);
@SuppressWarnings("unchecked")
T obj = (T) in.readObject(); T obj = (T) in.readObject();
in.close(); in.close();
return obj; return obj;
...@@ -190,7 +191,7 @@ public final class MarshalledObject<T> implements Serializable { ...@@ -190,7 +191,7 @@ public final class MarshalledObject<T> implements Serializable {
return true; return true;
if (obj != null && obj instanceof MarshalledObject) { if (obj != null && obj instanceof MarshalledObject) {
MarshalledObject other = (MarshalledObject) obj; MarshalledObject<?> other = (MarshalledObject<?>) obj;
// if either is a ref to null, both must be // if either is a ref to null, both must be
if (objBytes == null || other.objBytes == null) if (objBytes == null || other.objBytes == null)
......
...@@ -118,7 +118,7 @@ public final class VMID implements java.io.Serializable { ...@@ -118,7 +118,7 @@ public final class VMID implements java.io.Serializable {
StringBuffer result = new StringBuffer(); StringBuffer result = new StringBuffer();
if (addr != null) if (addr != null)
for (int i = 0; i < addr.length; ++ i) { for (int i = 0; i < addr.length; ++ i) {
int x = (int) (addr[i] & 0xFF); int x = addr[i] & 0xFF;
result.append((x < 0x10 ? "0" : "") + result.append((x < 0x10 ? "0" : "") +
Integer.toString(x, 16)); Integer.toString(x, 16));
} }
......
...@@ -39,7 +39,7 @@ import java.util.*; ...@@ -39,7 +39,7 @@ import java.util.*;
public class LogStream extends PrintStream { public class LogStream extends PrintStream {
/** table mapping known log names to log stream objects */ /** table mapping known log names to log stream objects */
private static Hashtable known = new Hashtable(5); private static Map<String,LogStream> known = new HashMap<>(5);
/** default output stream for new logs */ /** default output stream for new logs */
private static PrintStream defaultStream = System.err; private static PrintStream defaultStream = System.err;
...@@ -90,7 +90,7 @@ public class LogStream extends PrintStream { ...@@ -90,7 +90,7 @@ public class LogStream extends PrintStream {
public static LogStream log(String name) { public static LogStream log(String name) {
LogStream stream; LogStream stream;
synchronized (known) { synchronized (known) {
stream = (LogStream)known.get(name); stream = known.get(name);
if (stream == null) { if (stream == null) {
stream = new LogStream(name, defaultStream); stream = new LogStream(name, defaultStream);
} }
......
...@@ -436,7 +436,7 @@ public abstract class RemoteObject implements Remote, java.io.Serializable { ...@@ -436,7 +436,7 @@ public abstract class RemoteObject implements Remote, java.io.Serializable {
*/ */
String internalRefClassName = String internalRefClassName =
RemoteRef.packagePrefix + "." + refClassName; RemoteRef.packagePrefix + "." + refClassName;
Class refClass = Class.forName(internalRefClassName); Class<?> refClass = Class.forName(internalRefClassName);
try { try {
ref = (RemoteRef) refClass.newInstance(); ref = (RemoteRef) refClass.newInstance();
......
...@@ -31,19 +31,19 @@ import sun.nio.ch.Interruptible; ...@@ -31,19 +31,19 @@ import sun.nio.ch.Interruptible;
public interface JavaLangAccess { public interface JavaLangAccess {
/** Return the constant pool for a class. */ /** Return the constant pool for a class. */
ConstantPool getConstantPool(Class klass); ConstantPool getConstantPool(Class<?> klass);
/** /**
* Set the AnnotationType instance corresponding to this class. * Set the AnnotationType instance corresponding to this class.
* (This method only applies to annotation types.) * (This method only applies to annotation types.)
*/ */
void setAnnotationType(Class klass, AnnotationType annotationType); void setAnnotationType(Class<?> klass, AnnotationType annotationType);
/** /**
* Get the AnnotationType instance corresponding to this class. * Get the AnnotationType instance corresponding to this class.
* (This method only applies to annotation types.) * (This method only applies to annotation types.)
*/ */
AnnotationType getAnnotationType(Class klass); AnnotationType getAnnotationType(Class<?> klass);
/** /**
* Returns the elements of an enum class or null if the * Returns the elements of an enum class or null if the
......
...@@ -295,7 +295,7 @@ public class Launcher { ...@@ -295,7 +295,7 @@ public class Launcher {
/** /**
* Override loadClass so we can checkPackageAccess. * Override loadClass so we can checkPackageAccess.
*/ */
public Class loadClass(String name, boolean resolve) public Class<?> loadClass(String name, boolean resolve)
throws ClassNotFoundException throws ClassNotFoundException
{ {
int i = name.lastIndexOf('.'); int i = name.lastIndexOf('.');
...@@ -473,7 +473,7 @@ public class Launcher { ...@@ -473,7 +473,7 @@ public class Launcher {
public URLStreamHandler createURLStreamHandler(String protocol) { public URLStreamHandler createURLStreamHandler(String protocol) {
String name = PREFIX + "." + protocol + ".Handler"; String name = PREFIX + "." + protocol + ".Handler";
try { try {
Class c = Class.forName(name); Class<?> c = Class.forName(name);
return (URLStreamHandler)c.newInstance(); return (URLStreamHandler)c.newInstance();
} catch (ReflectiveOperationException e) { } catch (ReflectiveOperationException e) {
throw new InternalError("could not load " + protocol + throw new InternalError("could not load " + protocol +
......
...@@ -81,7 +81,7 @@ public final class Unsafe { ...@@ -81,7 +81,7 @@ public final class Unsafe {
* access to the system properties. * access to the system properties.
*/ */
public static Unsafe getUnsafe() { public static Unsafe getUnsafe() {
Class cc = sun.reflect.Reflection.getCallerClass(2); Class<?> cc = sun.reflect.Reflection.getCallerClass(2);
if (cc.getClassLoader() != null) if (cc.getClassLoader() != null)
throw new SecurityException("Unsafe"); throw new SecurityException("Unsafe");
return theUnsafe; return theUnsafe;
...@@ -616,7 +616,7 @@ public final class Unsafe { ...@@ -616,7 +616,7 @@ public final class Unsafe {
* for a given class in one place. * for a given class in one place.
*/ */
@Deprecated @Deprecated
public Object staticFieldBase(Class c) { public Object staticFieldBase(Class<?> c) {
Field[] fields = c.getDeclaredFields(); Field[] fields = c.getDeclaredFields();
for (int i = 0; i < fields.length; i++) { for (int i = 0; i < fields.length; i++) {
if (Modifier.isStatic(fields[i].getModifiers())) { if (Modifier.isStatic(fields[i].getModifiers())) {
...@@ -682,7 +682,7 @@ public final class Unsafe { ...@@ -682,7 +682,7 @@ public final class Unsafe {
* needed in conjunction with obtaining the static field base of a * needed in conjunction with obtaining the static field base of a
* class. * class.
*/ */
public native void ensureClassInitialized(Class c); public native void ensureClassInitialized(Class<?> c);
/** /**
* Report the offset of the first element in the storage allocation of a * Report the offset of the first element in the storage allocation of a
...@@ -694,7 +694,7 @@ public final class Unsafe { ...@@ -694,7 +694,7 @@ public final class Unsafe {
* @see #getInt(Object, long) * @see #getInt(Object, long)
* @see #putInt(Object, long, int) * @see #putInt(Object, long, int)
*/ */
public native int arrayBaseOffset(Class arrayClass); public native int arrayBaseOffset(Class<?> arrayClass);
/** The value of {@code arrayBaseOffset(boolean[].class)} */ /** The value of {@code arrayBaseOffset(boolean[].class)} */
public static final int ARRAY_BOOLEAN_BASE_OFFSET public static final int ARRAY_BOOLEAN_BASE_OFFSET
...@@ -743,7 +743,7 @@ public final class Unsafe { ...@@ -743,7 +743,7 @@ public final class Unsafe {
* @see #getInt(Object, long) * @see #getInt(Object, long)
* @see #putInt(Object, long, int) * @see #putInt(Object, long, int)
*/ */
public native int arrayIndexScale(Class arrayClass); public native int arrayIndexScale(Class<?> arrayClass);
/** The value of {@code arrayIndexScale(boolean[].class)} */ /** The value of {@code arrayIndexScale(boolean[].class)} */
public static final int ARRAY_BOOLEAN_INDEX_SCALE public static final int ARRAY_BOOLEAN_INDEX_SCALE
...@@ -805,11 +805,11 @@ public final class Unsafe { ...@@ -805,11 +805,11 @@ public final class Unsafe {
* Tell the VM to define a class, without security checks. By default, the * Tell the VM to define a class, without security checks. By default, the
* class loader and protection domain come from the caller's class. * class loader and protection domain come from the caller's class.
*/ */
public native Class defineClass(String name, byte[] b, int off, int len, public native Class<?> defineClass(String name, byte[] b, int off, int len,
ClassLoader loader, ClassLoader loader,
ProtectionDomain protectionDomain); ProtectionDomain protectionDomain);
public native Class defineClass(String name, byte[] b, int off, int len); public native Class<?> defineClass(String name, byte[] b, int off, int len);
/** /**
* Define a class but do not make it known to the class loader or system dictionary. * Define a class but do not make it known to the class loader or system dictionary.
...@@ -827,12 +827,12 @@ public final class Unsafe { ...@@ -827,12 +827,12 @@ public final class Unsafe {
* @params data bytes of a class file * @params data bytes of a class file
* @params cpPatches where non-null entries exist, they replace corresponding CP entries in data * @params cpPatches where non-null entries exist, they replace corresponding CP entries in data
*/ */
public native Class defineAnonymousClass(Class hostClass, byte[] data, Object[] cpPatches); public native Class<?> defineAnonymousClass(Class<?> hostClass, byte[] data, Object[] cpPatches);
/** Allocate an instance but do not run any constructor. /** Allocate an instance but do not run any constructor.
Initializes the class if it has not yet been. */ Initializes the class if it has not yet been. */
public native Object allocateInstance(Class cls) public native Object allocateInstance(Class<?> cls)
throws InstantiationException; throws InstantiationException;
/** Lock the object. It must get unlocked via {@link #monitorExit}. */ /** Lock the object. It must get unlocked via {@link #monitorExit}. */
......
...@@ -48,6 +48,7 @@ public class VM { ...@@ -48,6 +48,7 @@ public class VM {
return suspended; return suspended;
} }
@SuppressWarnings("deprecation")
public static boolean allowThreadSuspension(ThreadGroup g, boolean b) { public static boolean allowThreadSuspension(ThreadGroup g, boolean b) {
return g.allowThreadSuspension(b); return g.allowThreadSuspension(b);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册