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