mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 19:44:41 +02:00
8044865: Fix raw and unchecked lint warnings in management-related code
Reviewed-by: darcy, sla, egahlin, dfuchs
This commit is contained in:
parent
855f7c421e
commit
df614caef8
22 changed files with 46 additions and 47 deletions
|
@ -562,7 +562,7 @@ public class Introspector {
|
||||||
}
|
}
|
||||||
if (readMethod != null) {
|
if (readMethod != null) {
|
||||||
ReflectUtil.checkPackageAccess(readMethod.getDeclaringClass());
|
ReflectUtil.checkPackageAccess(readMethod.getDeclaringClass());
|
||||||
return MethodUtil.invoke(readMethod, complex, new Class[0]);
|
return MethodUtil.invoke(readMethod, complex, new Class<?>[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new AttributeNotFoundException(
|
throw new AttributeNotFoundException(
|
||||||
|
|
|
@ -757,7 +757,7 @@ public class MBeanInstantiator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ensureClassAccess(Class clazz)
|
private static void ensureClassAccess(Class<?> clazz)
|
||||||
throws IllegalAccessException
|
throws IllegalAccessException
|
||||||
{
|
{
|
||||||
int mod = clazz.getModifiers();
|
int mod = clazz.getModifiers();
|
||||||
|
|
|
@ -58,7 +58,7 @@ public abstract class ClientNotifForwarder {
|
||||||
|
|
||||||
private final AccessControlContext acc;
|
private final AccessControlContext acc;
|
||||||
|
|
||||||
public ClientNotifForwarder(Map env) {
|
public ClientNotifForwarder(Map<String, ?> env) {
|
||||||
this(null, env);
|
this(null, env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -310,10 +310,10 @@ public class MBeanServerFileAccessController
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (s == null) return; /* security has not been enabled */
|
if (s == null) return; /* security has not been enabled */
|
||||||
final Set principals = s.getPrincipals();
|
final Set<Principal> principals = s.getPrincipals();
|
||||||
String newPropertyValue = null;
|
String newPropertyValue = null;
|
||||||
for (Iterator i = principals.iterator(); i.hasNext(); ) {
|
for (Iterator<Principal> i = principals.iterator(); i.hasNext(); ) {
|
||||||
final Principal p = (Principal) i.next();
|
final Principal p = i.next();
|
||||||
Access access = accessMap.get(p.getName());
|
Access access = accessMap.get(p.getName());
|
||||||
if (access != null) {
|
if (access != null) {
|
||||||
boolean ok;
|
boolean ok;
|
||||||
|
|
|
@ -535,7 +535,7 @@ final class SnmpRequestTree {
|
||||||
|
|
||||||
// Save old vectors
|
// Save old vectors
|
||||||
SnmpOid[] olde = entryoids;
|
SnmpOid[] olde = entryoids;
|
||||||
Vector[] oldl = entrylists;
|
Vector<SnmpVarBind>[] oldl = entrylists;
|
||||||
boolean[] oldn = isentrynew;
|
boolean[] oldn = isentrynew;
|
||||||
SnmpVarBind[] oldr = rowstatus;
|
SnmpVarBind[] oldr = rowstatus;
|
||||||
|
|
||||||
|
|
|
@ -1215,7 +1215,7 @@ public class RequiredModelMBean
|
||||||
ReflectUtil.checkPackageAccess(className);
|
ReflectUtil.checkPackageAccess(className);
|
||||||
final ClassLoader targetClassLoader =
|
final ClassLoader targetClassLoader =
|
||||||
rmmbClass.getClassLoader();
|
rmmbClass.getClassLoader();
|
||||||
Class clz = Class.forName(className, false,
|
Class<?> clz = Class.forName(className, false,
|
||||||
targetClassLoader);
|
targetClassLoader);
|
||||||
if (!rmmbClass.isAssignableFrom(clz))
|
if (!rmmbClass.isAssignableFrom(clz))
|
||||||
return null;
|
return null;
|
||||||
|
@ -1673,12 +1673,12 @@ public class RequiredModelMBean
|
||||||
// inequality may come from type subclassing
|
// inequality may come from type subclassing
|
||||||
boolean subtype;
|
boolean subtype;
|
||||||
try {
|
try {
|
||||||
final Class respClass = response.getClass();
|
final Class<?> respClass = response.getClass();
|
||||||
final Exception[] caughException = new Exception[1];
|
final Exception[] caughException = new Exception[1];
|
||||||
|
|
||||||
AccessControlContext stack = AccessController.getContext();
|
AccessControlContext stack = AccessController.getContext();
|
||||||
|
|
||||||
Class c = javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Class<?>>() {
|
Class<?> c = javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Class<?>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<?> run() {
|
public Class<?> run() {
|
||||||
|
@ -2855,7 +2855,7 @@ public class RequiredModelMBean
|
||||||
AccessControlContext stack = AccessController.getContext();
|
AccessControlContext stack = AccessController.getContext();
|
||||||
final ClassNotFoundException[] caughtException = new ClassNotFoundException[1];
|
final ClassNotFoundException[] caughtException = new ClassNotFoundException[1];
|
||||||
|
|
||||||
Class c = javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Class<?>>() {
|
Class<?> c = javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Class<?>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<?> run() {
|
public Class<?> run() {
|
||||||
|
|
|
@ -2011,13 +2011,13 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
|
||||||
if (nullSubjectConnRef == null
|
if (nullSubjectConnRef == null
|
||||||
|| (conn = nullSubjectConnRef.get()) == null) {
|
|| (conn = nullSubjectConnRef.get()) == null) {
|
||||||
conn = new RemoteMBeanServerConnection(null);
|
conn = new RemoteMBeanServerConnection(null);
|
||||||
nullSubjectConnRef = new WeakReference(conn);
|
nullSubjectConnRef = new WeakReference<MBeanServerConnection>(conn);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
WeakReference<MBeanServerConnection> wr = rmbscMap.get(delegationSubject);
|
WeakReference<MBeanServerConnection> wr = rmbscMap.get(delegationSubject);
|
||||||
if (wr == null || (conn = wr.get()) == null) {
|
if (wr == null || (conn = wr.get()) == null) {
|
||||||
conn = new RemoteMBeanServerConnection(delegationSubject);
|
conn = new RemoteMBeanServerConnection(delegationSubject);
|
||||||
rmbscMap.put(delegationSubject, new WeakReference(conn));
|
rmbscMap.put(delegationSubject, new WeakReference<MBeanServerConnection>(conn));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return conn;
|
return conn;
|
||||||
|
@ -2115,7 +2115,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
|
||||||
PrivilegedExceptionAction<Constructor<?>> action =
|
PrivilegedExceptionAction<Constructor<?>> action =
|
||||||
new PrivilegedExceptionAction<Constructor<?>>() {
|
new PrivilegedExceptionAction<Constructor<?>>() {
|
||||||
public Constructor<?> run() throws Exception {
|
public Constructor<?> run() throws Exception {
|
||||||
Class thisClass = RMIConnector.class;
|
Class<RMIConnector> thisClass = RMIConnector.class;
|
||||||
ClassLoader thisLoader = thisClass.getClassLoader();
|
ClassLoader thisLoader = thisClass.getClassLoader();
|
||||||
ProtectionDomain thisProtectionDomain =
|
ProtectionDomain thisProtectionDomain =
|
||||||
thisClass.getProtectionDomain();
|
thisClass.getProtectionDomain();
|
||||||
|
@ -2354,7 +2354,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
|
||||||
PrivilegedExceptionAction<Class<?>> action =
|
PrivilegedExceptionAction<Class<?>> action =
|
||||||
new PrivilegedExceptionAction<Class<?>>() {
|
new PrivilegedExceptionAction<Class<?>>() {
|
||||||
public Class<?> run() throws Exception {
|
public Class<?> run() throws Exception {
|
||||||
Class thisClass = RMIConnector.class;
|
Class<RMIConnector> thisClass = RMIConnector.class;
|
||||||
ClassLoader thisLoader = thisClass.getClassLoader();
|
ClassLoader thisLoader = thisClass.getClassLoader();
|
||||||
ProtectionDomain thisProtectionDomain =
|
ProtectionDomain thisProtectionDomain =
|
||||||
thisClass.getProtectionDomain();
|
thisClass.getProtectionDomain();
|
||||||
|
|
|
@ -954,7 +954,7 @@ public class ProxyClient implements JConsoleContext {
|
||||||
final InvocationHandler ih = new SnapshotInvocationHandler(mbsc);
|
final InvocationHandler ih = new SnapshotInvocationHandler(mbsc);
|
||||||
return (SnapshotMBeanServerConnection) Proxy.newProxyInstance(
|
return (SnapshotMBeanServerConnection) Proxy.newProxyInstance(
|
||||||
Snapshot.class.getClassLoader(),
|
Snapshot.class.getClassLoader(),
|
||||||
new Class[] {SnapshotMBeanServerConnection.class},
|
new Class<?>[] {SnapshotMBeanServerConnection.class},
|
||||||
ih);
|
ih);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ import javax.swing.*;
|
||||||
* them.
|
* them.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class TimeComboBox extends JComboBox implements ItemListener, PropertyChangeListener {
|
public class TimeComboBox extends JComboBox<String> implements ItemListener, PropertyChangeListener {
|
||||||
private ArrayList<Plotter> plotters = new ArrayList<Plotter>();
|
private ArrayList<Plotter> plotters = new ArrayList<Plotter>();
|
||||||
|
|
||||||
public TimeComboBox(Plotter... plotterArray) {
|
public TimeComboBox(Plotter... plotterArray) {
|
||||||
|
|
|
@ -32,7 +32,6 @@ import javax.management.*;
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class OperationEntry extends JPanel {
|
public class OperationEntry extends JPanel {
|
||||||
private MBeanOperationInfo operation;
|
private MBeanOperationInfo operation;
|
||||||
private JComboBox sigs;
|
|
||||||
private XTextField inputs[];
|
private XTextField inputs[];
|
||||||
|
|
||||||
public OperationEntry (MBeanOperationInfo operation,
|
public OperationEntry (MBeanOperationInfo operation,
|
||||||
|
|
|
@ -146,7 +146,7 @@ public class TableSorter extends DefaultTableModel implements MouseListener {
|
||||||
// update row heights in XMBeanAttributes (required by expandable cells)
|
// update row heights in XMBeanAttributes (required by expandable cells)
|
||||||
if (attrs != null) {
|
if (attrs != null) {
|
||||||
for (int i = 0; i < getRowCount(); i++) {
|
for (int i = 0; i < getRowCount(); i++) {
|
||||||
Vector data = (Vector) dataVector.elementAt(i);
|
Vector<?> data = (Vector) dataVector.elementAt(i);
|
||||||
attrs.updateRowHeight(data.elementAt(1), i);
|
attrs.updateRowHeight(data.elementAt(1), i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,17 +217,17 @@ public class TableSorter extends DefaultTableModel implements MouseListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector getRow(int row) {
|
private Vector<?> getRow(int row) {
|
||||||
return (Vector) dataVector.elementAt(row);
|
return (Vector) dataVector.elementAt(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private void setRow(Vector data, int row) {
|
private void setRow(Vector<?> data, int row) {
|
||||||
dataVector.setElementAt(data,row);
|
dataVector.setElementAt(data,row);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void swap(int i, int j, int column) {
|
private void swap(int i, int j, int column) {
|
||||||
Vector data = getRow(i);
|
Vector<?> data = getRow(i);
|
||||||
setRow(getRow(j),i);
|
setRow(getRow(j),i);
|
||||||
setRow(data,j);
|
setRow(data,j);
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ public class JMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
// invoke the main method with the arguments
|
// invoke the main method with the arguments
|
||||||
Class[] argTypes = { String[].class } ;
|
Class<?>[] argTypes = { String[].class } ;
|
||||||
Method m = c.getDeclaredMethod("main", argTypes);
|
Method m = c.getDeclaredMethod("main", argTypes);
|
||||||
|
|
||||||
Object[] invokeArgs = { args };
|
Object[] invokeArgs = { args };
|
||||||
|
|
|
@ -133,7 +133,7 @@ public class JStack {
|
||||||
args = prepend("-l", args);
|
args = prepend("-l", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
Class[] argTypes = { String[].class };
|
Class<?>[] argTypes = { String[].class };
|
||||||
Method m = cl.getDeclaredMethod("main", argTypes);
|
Method m = cl.getDeclaredMethod("main", argTypes);
|
||||||
|
|
||||||
Object[] invokeArgs = { args };
|
Object[] invokeArgs = { args };
|
||||||
|
|
|
@ -110,7 +110,7 @@ public abstract class Alignment {
|
||||||
*
|
*
|
||||||
* @return Set of Key Words for this enumeration.
|
* @return Set of Key Words for this enumeration.
|
||||||
*/
|
*/
|
||||||
public static Set keySet() {
|
public static Set<String> keySet() {
|
||||||
return map.keySet();
|
return map.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -143,8 +143,8 @@ public class ColumnFormat extends OptionFormat {
|
||||||
+ ";format=" + format + ";width=" + width
|
+ ";format=" + format + ";width=" + width
|
||||||
+ ";scale=" + scale.toString() + ";align=" + align.toString());
|
+ ";scale=" + scale.toString() + ";align=" + align.toString());
|
||||||
|
|
||||||
for (Iterator i = children.iterator(); i.hasNext(); /* empty */) {
|
for (Iterator<OptionFormat> i = children.iterator(); i.hasNext(); /* empty */) {
|
||||||
OptionFormat of = (OptionFormat)i.next();
|
OptionFormat of = i.next();
|
||||||
of.printFormat(indentLevel+1);
|
of.printFormat(indentLevel+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,8 +116,8 @@ public class Jstat {
|
||||||
Collections.sort(logged, arguments.comparator());
|
Collections.sort(logged, arguments.comparator());
|
||||||
List<Monitor> constants = new ArrayList<Monitor>();
|
List<Monitor> constants = new ArrayList<Monitor>();
|
||||||
|
|
||||||
for (Iterator i = logged.iterator(); i.hasNext(); /* empty */) {
|
for (Iterator<Monitor> i = logged.iterator(); i.hasNext(); /* empty */) {
|
||||||
Monitor m = (Monitor)i.next();
|
Monitor m = i.next();
|
||||||
if (!(m.isSupported() || arguments.showUnsupported())) {
|
if (!(m.isSupported() || arguments.showUnsupported())) {
|
||||||
i.remove();
|
i.remove();
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -105,7 +105,7 @@ public abstract class Operator {
|
||||||
* @param s an string to match against Operator objects.
|
* @param s an string to match against Operator objects.
|
||||||
* @return The Operator object matching the given string.
|
* @return The Operator object matching the given string.
|
||||||
*/
|
*/
|
||||||
protected static Set keySet() {
|
protected static Set<?> keySet() {
|
||||||
return map.keySet();
|
return map.keySet();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,13 +77,13 @@ public class OptionFormat {
|
||||||
|
|
||||||
public void apply(Closure c) throws MonitorException {
|
public void apply(Closure c) throws MonitorException {
|
||||||
|
|
||||||
for (Iterator i = children.iterator(); i.hasNext(); /* empty */) {
|
for (Iterator<OptionFormat> i = children.iterator(); i.hasNext(); /* empty */) {
|
||||||
OptionFormat o = (OptionFormat)i.next();
|
OptionFormat o = i.next();
|
||||||
c.visit(o, i.hasNext());
|
c.visit(o, i.hasNext());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Iterator i = children.iterator(); i.hasNext(); /* empty */) {
|
for (Iterator <OptionFormat>i = children.iterator(); i.hasNext(); /* empty */) {
|
||||||
OptionFormat o = (OptionFormat)i.next();
|
OptionFormat o = i.next();
|
||||||
o.apply(c);
|
o.apply(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,8 +63,8 @@ public class Parser {
|
||||||
|
|
||||||
private static final String START = OPTION;
|
private static final String START = OPTION;
|
||||||
|
|
||||||
private static final Set scaleKeyWords = Scale.keySet();
|
private static final Set<String> scaleKeyWords = Scale.keySet();
|
||||||
private static final Set alignKeyWords = Alignment.keySet();
|
private static final Set<String> alignKeyWords = Alignment.keySet();
|
||||||
private static String[] otherKeyWords = {
|
private static String[] otherKeyWords = {
|
||||||
OPTION, COLUMN, DATA, HEADER, WIDTH, FORMAT, ALIGN, SCALE
|
OPTION, COLUMN, DATA, HEADER, WIDTH, FORMAT, ALIGN, SCALE
|
||||||
};
|
};
|
||||||
|
@ -141,7 +141,7 @@ public class Parser {
|
||||||
* token is assumed to be of type TT_WORD, and the set is assumed
|
* token is assumed to be of type TT_WORD, and the set is assumed
|
||||||
* to contain String objects.
|
* to contain String objects.
|
||||||
*/
|
*/
|
||||||
private Token matchOne(Set keyWords) throws ParserException, IOException {
|
private Token matchOne(Set<String> keyWords) throws ParserException, IOException {
|
||||||
if ((lookahead.ttype == StreamTokenizer.TT_WORD)
|
if ((lookahead.ttype == StreamTokenizer.TT_WORD)
|
||||||
&& keyWords.contains(lookahead.sval)) {
|
&& keyWords.contains(lookahead.sval)) {
|
||||||
Token t = lookahead;
|
Token t = lookahead;
|
||||||
|
|
|
@ -35,11 +35,11 @@ import sun.jvmstat.monitor.*;
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
public class RawOutputFormatter implements OutputFormatter {
|
public class RawOutputFormatter implements OutputFormatter {
|
||||||
private List logged;
|
private List<Monitor> logged;
|
||||||
private String header;
|
private String header;
|
||||||
private boolean printStrings;
|
private boolean printStrings;
|
||||||
|
|
||||||
public RawOutputFormatter(List logged, boolean printStrings) {
|
public RawOutputFormatter(List<Monitor> logged, boolean printStrings) {
|
||||||
this.logged = logged;
|
this.logged = logged;
|
||||||
this.printStrings = printStrings;
|
this.printStrings = printStrings;
|
||||||
}
|
}
|
||||||
|
@ -48,8 +48,8 @@ public class RawOutputFormatter implements OutputFormatter {
|
||||||
if (header == null) {
|
if (header == null) {
|
||||||
// build the header string and prune out any unwanted monitors
|
// build the header string and prune out any unwanted monitors
|
||||||
StringBuilder headerBuilder = new StringBuilder();
|
StringBuilder headerBuilder = new StringBuilder();
|
||||||
for (Iterator i = logged.iterator(); i.hasNext(); /* empty */ ) {
|
for (Iterator<Monitor> i = logged.iterator(); i.hasNext(); /* empty */ ) {
|
||||||
Monitor m = (Monitor)i.next();
|
Monitor m = i.next();
|
||||||
headerBuilder.append(m.getName() + " ");
|
headerBuilder.append(m.getName() + " ");
|
||||||
}
|
}
|
||||||
header = headerBuilder.toString();
|
header = headerBuilder.toString();
|
||||||
|
@ -60,8 +60,8 @@ public class RawOutputFormatter implements OutputFormatter {
|
||||||
public String getRow() throws MonitorException {
|
public String getRow() throws MonitorException {
|
||||||
StringBuilder row = new StringBuilder();
|
StringBuilder row = new StringBuilder();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (Iterator i = logged.iterator(); i.hasNext(); /* empty */ ) {
|
for (Iterator<Monitor> i = logged.iterator(); i.hasNext(); /* empty */ ) {
|
||||||
Monitor m = (Monitor)i.next();
|
Monitor m = i.next();
|
||||||
if (count++ > 0) {
|
if (count++ > 0) {
|
||||||
row.append(" ");
|
row.append(" ");
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ public class Scale {
|
||||||
* @param s an string to match against Scale objects.
|
* @param s an string to match against Scale objects.
|
||||||
* @return The Scale object matching the given string.
|
* @return The Scale object matching the given string.
|
||||||
*/
|
*/
|
||||||
protected static Set keySet() {
|
protected static Set<String> keySet() {
|
||||||
return map.keySet();
|
return map.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,14 +62,14 @@ public class SyntaxException extends ParserException {
|
||||||
+ ", Found " + found.toMessage();
|
+ ", Found " + found.toMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SyntaxException(int lineno, Set expected, Token found) {
|
public SyntaxException(int lineno, Set<String> expected, Token found) {
|
||||||
StringBuilder msg = new StringBuilder();
|
StringBuilder msg = new StringBuilder();
|
||||||
|
|
||||||
msg.append("Syntax error at line " + lineno + ": Expected one of \'");
|
msg.append("Syntax error at line " + lineno + ": Expected one of \'");
|
||||||
|
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (Iterator i = expected.iterator(); i.hasNext(); /* empty */) {
|
for (Iterator<String> i = expected.iterator(); i.hasNext(); /* empty */) {
|
||||||
String keyWord = (String)i.next();
|
String keyWord = i.next();
|
||||||
if (first) {
|
if (first) {
|
||||||
msg.append(keyWord);
|
msg.append(keyWord);
|
||||||
first = false;
|
first = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue