提交 8821938b 编写于 作者: J jjh

7117053: Fix build warnings in com/sun/tools/jdi/*

Summary: Warnings fixed.  Also reviewed by serguei.spitsyn@oracle.com, who is not yet an openjdk reviewer
Reviewed-by: ksrini
上级 75ee28e4
...@@ -35,7 +35,7 @@ class ArrayRegionTypeNode extends AbstractSimpleTypeNode { ...@@ -35,7 +35,7 @@ class ArrayRegionTypeNode extends AbstractSimpleTypeNode {
} }
String javaType() { String javaType() {
return "List"; return "List<?>";
} }
public void genJavaWrite(PrintWriter writer, int depth, public void genJavaWrite(PrintWriter writer, int depth,
......
...@@ -89,7 +89,7 @@ class OutNode extends AbstractTypeListNode { ...@@ -89,7 +89,7 @@ class OutNode extends AbstractTypeListNode {
if (Main.genDebug) { if (Main.genDebug) {
indent(writer, depth+1); indent(writer, depth+1);
writer.println( writer.println(
"if ((vm.traceFlags & vm.TRACE_SENDS) != 0) {"); "if ((vm.traceFlags & VirtualMachineImpl.TRACE_SENDS) != 0) {");
indent(writer, depth+2); indent(writer, depth+2);
writer.print( writer.print(
"vm.printTrace(\"Sending Command(id=\" + ps.pkt.id + \") "); "vm.printTrace(\"Sending Command(id=\" + ps.pkt.id + \") ");
......
...@@ -33,6 +33,7 @@ package com.sun.jdi; ...@@ -33,6 +33,7 @@ package com.sun.jdi;
*/ */
public class AbsentInformationException extends Exception public class AbsentInformationException extends Exception
{ {
private static final long serialVersionUID = 4988939309582416373L;
public AbsentInformationException() public AbsentInformationException()
{ {
super(); super();
......
...@@ -69,6 +69,7 @@ package com.sun.jdi; ...@@ -69,6 +69,7 @@ package com.sun.jdi;
*/ */
public class ClassNotLoadedException extends Exception public class ClassNotLoadedException extends Exception
{ {
private static final long serialVersionUID = -6242978768444298722L;
private String className; private String className;
public ClassNotLoadedException(String className) { public ClassNotLoadedException(String className) {
......
...@@ -33,6 +33,7 @@ package com.sun.jdi; ...@@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.3 * @since 1.3
*/ */
public class ClassNotPreparedException extends RuntimeException { public class ClassNotPreparedException extends RuntimeException {
private static final long serialVersionUID = -6120698967144079642L;
public ClassNotPreparedException() public ClassNotPreparedException()
{ {
super(); super();
......
...@@ -34,6 +34,7 @@ package com.sun.jdi; ...@@ -34,6 +34,7 @@ package com.sun.jdi;
*/ */
public class IncompatibleThreadStateException extends Exception public class IncompatibleThreadStateException extends Exception
{ {
private static final long serialVersionUID = 6199174323414551389L;
public IncompatibleThreadStateException() public IncompatibleThreadStateException()
{ {
super(); super();
......
...@@ -35,6 +35,7 @@ package com.sun.jdi; ...@@ -35,6 +35,7 @@ package com.sun.jdi;
* @since 1.3 * @since 1.3
*/ */
public class InconsistentDebugInfoException extends RuntimeException { public class InconsistentDebugInfoException extends RuntimeException {
private static final long serialVersionUID = 7964236415376861808L;
public InconsistentDebugInfoException() { public InconsistentDebugInfoException() {
super(); super();
} }
......
...@@ -33,6 +33,7 @@ package com.sun.jdi; ...@@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.3 * @since 1.3
*/ */
public class InternalException extends RuntimeException { public class InternalException extends RuntimeException {
private static final long serialVersionUID = -9171606393104480607L;
private int errorCode; private int errorCode;
public InternalException() { public InternalException() {
......
...@@ -36,6 +36,7 @@ package com.sun.jdi; ...@@ -36,6 +36,7 @@ package com.sun.jdi;
*/ */
@Deprecated @Deprecated
public class InvalidCodeIndexException extends RuntimeException { public class InvalidCodeIndexException extends RuntimeException {
private static final long serialVersionUID = 7416010225133747805L;
public InvalidCodeIndexException() { public InvalidCodeIndexException() {
super(); super();
} }
......
...@@ -36,6 +36,7 @@ package com.sun.jdi; ...@@ -36,6 +36,7 @@ package com.sun.jdi;
*/ */
@Deprecated @Deprecated
public class InvalidLineNumberException extends RuntimeException { public class InvalidLineNumberException extends RuntimeException {
private static final long serialVersionUID = 4048709912372692875L;
public InvalidLineNumberException() { public InvalidLineNumberException() {
super(); super();
} }
......
...@@ -33,6 +33,7 @@ package com.sun.jdi; ...@@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.3 * @since 1.3
*/ */
public class InvalidStackFrameException extends RuntimeException { public class InvalidStackFrameException extends RuntimeException {
private static final long serialVersionUID = -1919378296505827922L;
public InvalidStackFrameException() { public InvalidStackFrameException() {
super(); super();
} }
......
...@@ -34,6 +34,7 @@ package com.sun.jdi; ...@@ -34,6 +34,7 @@ package com.sun.jdi;
*/ */
public class InvalidTypeException extends Exception public class InvalidTypeException extends Exception
{ {
private static final long serialVersionUID = 2256667231949650806L;
public InvalidTypeException() public InvalidTypeException()
{ {
super(); super();
......
...@@ -34,6 +34,7 @@ package com.sun.jdi; ...@@ -34,6 +34,7 @@ package com.sun.jdi;
*/ */
public class InvocationException extends Exception public class InvocationException extends Exception
{ {
private static final long serialVersionUID = 6066780907971918568L;
ObjectReference exception; ObjectReference exception;
public InvocationException(ObjectReference exception) public InvocationException(ObjectReference exception)
......
...@@ -79,7 +79,7 @@ package com.sun.jdi; ...@@ -79,7 +79,7 @@ package com.sun.jdi;
*/ */
public final class JDIPermission extends java.security.BasicPermission { public final class JDIPermission extends java.security.BasicPermission {
private static final long serialVersionUID = -6988461416938786271L;
/** /**
* The <code>JDIPermission</code> class represents access rights to the * The <code>JDIPermission</code> class represents access rights to the
* <code>VirtualMachineManager</code> * <code>VirtualMachineManager</code>
......
...@@ -34,6 +34,7 @@ package com.sun.jdi; ...@@ -34,6 +34,7 @@ package com.sun.jdi;
*/ */
public class NativeMethodException extends RuntimeException { public class NativeMethodException extends RuntimeException {
private static final long serialVersionUID = 3924951669039469992L;
public NativeMethodException() { public NativeMethodException() {
super(); super();
} }
......
...@@ -33,6 +33,7 @@ package com.sun.jdi; ...@@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.3 * @since 1.3
*/ */
public class ObjectCollectedException extends RuntimeException { public class ObjectCollectedException extends RuntimeException {
private static final long serialVersionUID = -1928428056197269588L;
public ObjectCollectedException() { public ObjectCollectedException() {
super(); super();
} }
......
...@@ -33,6 +33,7 @@ package com.sun.jdi; ...@@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.5 * @since 1.5
*/ */
public class VMCannotBeModifiedException extends UnsupportedOperationException { public class VMCannotBeModifiedException extends UnsupportedOperationException {
private static final long serialVersionUID = -4063879815130164009L;
public VMCannotBeModifiedException() { public VMCannotBeModifiedException() {
super(); super();
} }
......
...@@ -35,6 +35,7 @@ package com.sun.jdi; ...@@ -35,6 +35,7 @@ package com.sun.jdi;
*/ */
public class VMDisconnectedException extends RuntimeException { public class VMDisconnectedException extends RuntimeException {
private static final long serialVersionUID = 2892975269768351637L;
public VMDisconnectedException() { public VMDisconnectedException() {
super(); super();
} }
......
...@@ -34,6 +34,7 @@ package com.sun.jdi; ...@@ -34,6 +34,7 @@ package com.sun.jdi;
* @since 1.3 * @since 1.3
*/ */
public class VMMismatchException extends RuntimeException { public class VMMismatchException extends RuntimeException {
private static final long serialVersionUID = 289169358790459564L;
public VMMismatchException() { public VMMismatchException() {
super(); super();
} }
......
...@@ -33,6 +33,7 @@ package com.sun.jdi; ...@@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.3 * @since 1.3
*/ */
public class VMOutOfMemoryException extends RuntimeException { public class VMOutOfMemoryException extends RuntimeException {
private static final long serialVersionUID = 71504228548910686L;
public VMOutOfMemoryException() { public VMOutOfMemoryException() {
super(); super();
} }
......
...@@ -38,6 +38,7 @@ import java.util.Collections; ...@@ -38,6 +38,7 @@ import java.util.Collections;
*/ */
public class IllegalConnectorArgumentsException extends Exception public class IllegalConnectorArgumentsException extends Exception
{ {
private static final long serialVersionUID = -3042212603611350941L;
List<String> names; List<String> names;
/** /**
......
...@@ -55,7 +55,7 @@ package com.sun.jdi.connect; ...@@ -55,7 +55,7 @@ package com.sun.jdi.connect;
* @since 1.5 * @since 1.5
*/ */
public class TransportTimeoutException extends java.io.IOException { public class TransportTimeoutException extends java.io.IOException {
private static final long serialVersionUID = 4107035242623365074L;
/** /**
* Constructs a <tt>TransportTimeoutException</tt> with no detail * Constructs a <tt>TransportTimeoutException</tt> with no detail
* message. * message.
......
...@@ -36,6 +36,7 @@ package com.sun.jdi.connect; ...@@ -36,6 +36,7 @@ package com.sun.jdi.connect;
*/ */
public class VMStartException extends Exception public class VMStartException extends Exception
{ {
private static final long serialVersionUID = 6408644824640801020L;
Process process; Process process;
public VMStartException(Process process) { public VMStartException(Process process) {
......
...@@ -46,7 +46,7 @@ package com.sun.jdi.connect.spi; ...@@ -46,7 +46,7 @@ package com.sun.jdi.connect.spi;
* @since 1.5 * @since 1.5
*/ */
public class ClosedConnectionException extends java.io.IOException { public class ClosedConnectionException extends java.io.IOException {
private static final long serialVersionUID = 3877032124297204774L;
/** /**
* Constructs a <tt>ClosedConnectionException</tt> with no detail * Constructs a <tt>ClosedConnectionException</tt> with no detail
* message. * message.
......
...@@ -33,6 +33,7 @@ package com.sun.jdi.request; ...@@ -33,6 +33,7 @@ package com.sun.jdi.request;
*/ */
public class DuplicateRequestException extends RuntimeException public class DuplicateRequestException extends RuntimeException
{ {
private static final long serialVersionUID = -3719784920313411060L;
public DuplicateRequestException() public DuplicateRequestException()
{ {
super(); super();
......
...@@ -36,6 +36,7 @@ package com.sun.jdi.request; ...@@ -36,6 +36,7 @@ package com.sun.jdi.request;
* @since 1.3 * @since 1.3
*/ */
public class InvalidRequestStateException extends RuntimeException { public class InvalidRequestStateException extends RuntimeException {
private static final long serialVersionUID = -3774632428543322148L;
public InvalidRequestStateException() public InvalidRequestStateException()
{ {
super(); super();
......
...@@ -70,8 +70,8 @@ public class ArrayReferenceImpl extends ObjectReferenceImpl ...@@ -70,8 +70,8 @@ public class ArrayReferenceImpl extends ObjectReferenceImpl
} }
public Value getValue(int index) { public Value getValue(int index) {
List list = getValues(index, 1); List<Value> list = getValues(index, 1);
return (Value)list.get(0); return list.get(0);
} }
public List<Value> getValues() { public List<Value> getValues() {
......
...@@ -61,7 +61,7 @@ public class ArrayTypeImpl extends ReferenceTypeImpl ...@@ -61,7 +61,7 @@ public class ArrayTypeImpl extends ReferenceTypeImpl
return findType(componentSignature()); return findType(componentSignature());
} }
void addVisibleMethods(Map map) { void addVisibleMethods(Map<String, Method> map) {
// arrays don't have methods // arrays don't have methods
} }
...@@ -83,10 +83,10 @@ public class ArrayTypeImpl extends ReferenceTypeImpl ...@@ -83,10 +83,10 @@ public class ArrayTypeImpl extends ReferenceTypeImpl
if (PacketStream.isObjectTag(tag)) { if (PacketStream.isObjectTag(tag)) {
// It's a reference type // It's a reference type
JNITypeParser parser = new JNITypeParser(componentSignature()); JNITypeParser parser = new JNITypeParser(componentSignature());
List list = vm.classesByName(parser.typeName()); List<ReferenceType> list = vm.classesByName(parser.typeName());
Iterator iter = list.iterator(); Iterator<ReferenceType> iter = list.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
ReferenceType type = (ReferenceType)iter.next(); ReferenceType type = iter.next();
ClassLoaderReference cl = type.classLoader(); ClassLoaderReference cl = type.classLoader();
if ((cl == null)? if ((cl == null)?
(classLoader() == null) : (classLoader() == null) :
......
...@@ -78,7 +78,7 @@ public class BooleanValueImpl extends PrimitiveValueImpl ...@@ -78,7 +78,7 @@ public class BooleanValueImpl extends PrimitiveValueImpl
} }
public int intValue() { public int intValue() {
return(int)((value)?1:0); return (value)?1:0;
} }
public long longValue() { public long longValue() {
...@@ -90,7 +90,7 @@ public class BooleanValueImpl extends PrimitiveValueImpl ...@@ -90,7 +90,7 @@ public class BooleanValueImpl extends PrimitiveValueImpl
} }
public double doubleValue() { public double doubleValue() {
return(double)((value)?1.0:0.0); return (value)?1.0:0.0;
} }
public String toString() { public String toString() {
......
...@@ -75,7 +75,7 @@ public class CharValueImpl extends PrimitiveValueImpl ...@@ -75,7 +75,7 @@ public class CharValueImpl extends PrimitiveValueImpl
} }
public char charValue() { public char charValue() {
return(char)value; return value;
} }
public short shortValue() { public short shortValue() {
......
...@@ -80,7 +80,7 @@ public class ClassLoaderReferenceImpl extends ObjectReferenceImpl ...@@ -80,7 +80,7 @@ public class ClassLoaderReferenceImpl extends ObjectReferenceImpl
classes = Collections.unmodifiableList(classes); classes = Collections.unmodifiableList(classes);
if (local != null) { if (local != null) {
local.visibleClasses = classes; local.visibleClasses = classes;
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace(description() + vm.printTrace(description() +
" temporarily caching visible classes (count = " + " temporarily caching visible classes (count = " +
classes.size() + ")"); classes.size() + ")");
...@@ -95,9 +95,9 @@ public class ClassLoaderReferenceImpl extends ObjectReferenceImpl ...@@ -95,9 +95,9 @@ public class ClassLoaderReferenceImpl extends ObjectReferenceImpl
Type findType(String signature) throws ClassNotLoadedException { Type findType(String signature) throws ClassNotLoadedException {
List<ReferenceType> types = visibleClasses(); List<ReferenceType> types = visibleClasses();
Iterator iter = types.iterator(); Iterator<ReferenceType> iter = types.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
ReferenceType type = (ReferenceType)iter.next(); ReferenceType type = iter.next();
if (type.signature().equals(signature)) { if (type.signature().equals(signature)) {
return type; return type;
} }
......
...@@ -76,7 +76,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl ...@@ -76,7 +76,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl
List<InterfaceType> immediate = interfaces(); List<InterfaceType> immediate = interfaces();
list.addAll(interfaces()); list.addAll(interfaces());
Iterator iter = immediate.iterator(); Iterator<InterfaceType> iter = immediate.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
interfaze.addSuperinterfaces(list); interfaze.addSuperinterfaces(list);
...@@ -389,7 +389,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl ...@@ -389,7 +389,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl
* overwrite them in the hash table * overwrite them in the hash table
*/ */
Iterator iter = interfaces().iterator(); Iterator<InterfaceType> iter = interfaces().iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
interfaze.addVisibleMethods(methodMap); interfaze.addVisibleMethods(methodMap);
...@@ -411,7 +411,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl ...@@ -411,7 +411,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl
return true; return true;
} else { } else {
List<InterfaceType> interfaces = interfaces(); List<InterfaceType> interfaces = interfaces();
Iterator iter = interfaces.iterator(); Iterator<InterfaceType> iter = interfaces.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
if (interfaze.isAssignableTo(type)) { if (interfaze.isAssignableTo(type)) {
......
...@@ -192,7 +192,7 @@ public class ConcreteMethodImpl extends MethodImpl { ...@@ -192,7 +192,7 @@ public class ConcreteMethodImpl extends MethodImpl {
return super.codeIndexToLineInfo(stratum, codeIndex); return super.codeIndexToLineInfo(stratum, codeIndex);
} }
Iterator iter = lineLocations.iterator(); Iterator<Location> iter = lineLocations.iterator();
/* /*
* Treat code before the beginning of the first line table * Treat code before the beginning of the first line table
* entry as part of the first line. javac will generate * entry as part of the first line. javac will generate
...@@ -221,9 +221,9 @@ public class ConcreteMethodImpl extends MethodImpl { ...@@ -221,9 +221,9 @@ public class ConcreteMethodImpl extends MethodImpl {
List<LocalVariable> variables = getVariables(); List<LocalVariable> variables = getVariables();
List<LocalVariable> retList = new ArrayList<LocalVariable>(2); List<LocalVariable> retList = new ArrayList<LocalVariable>(2);
Iterator iter = variables.iterator(); Iterator<LocalVariable> iter = variables.iterator();
while(iter.hasNext()) { while(iter.hasNext()) {
LocalVariable variable = (LocalVariable)iter.next(); LocalVariable variable = iter.next();
if (variable.name().equals(name)) { if (variable.name().equals(name)) {
retList.add(variable); retList.add(variable);
} }
...@@ -235,9 +235,9 @@ public class ConcreteMethodImpl extends MethodImpl { ...@@ -235,9 +235,9 @@ public class ConcreteMethodImpl extends MethodImpl {
List<LocalVariable> variables = getVariables(); List<LocalVariable> variables = getVariables();
List<LocalVariable> retList = new ArrayList<LocalVariable>(variables.size()); List<LocalVariable> retList = new ArrayList<LocalVariable>(variables.size());
Iterator iter = variables.iterator(); Iterator<LocalVariable> iter = variables.iterator();
while(iter.hasNext()) { while(iter.hasNext()) {
LocalVariable variable = (LocalVariable)iter.next(); LocalVariable variable = iter.next();
if (variable.isArgument()) { if (variable.isArgument()) {
retList.add(variable); retList.add(variable);
} }
...@@ -291,7 +291,7 @@ public class ConcreteMethodImpl extends MethodImpl { ...@@ -291,7 +291,7 @@ public class ConcreteMethodImpl extends MethodImpl {
SDE.LineStratum lastLineStratum = null; SDE.LineStratum lastLineStratum = null;
SDE.Stratum baseStratum = SDE.Stratum baseStratum =
declaringType.stratum(SDE.BASE_STRATUM_NAME); declaringType.stratum(SDE.BASE_STRATUM_NAME);
Iterator it = getBaseLocations().lineLocations.iterator(); Iterator<Location> it = getBaseLocations().lineLocations.iterator();
while(it.hasNext()) { while(it.hasNext()) {
LocationImpl loc = (LocationImpl)it.next(); LocationImpl loc = (LocationImpl)it.next();
int baseLineNumber = loc.lineNumber(baseStratum); int baseLineNumber = loc.lineNumber(baseStratum);
......
...@@ -47,9 +47,9 @@ abstract class ConnectorImpl implements Connector { ...@@ -47,9 +47,9 @@ abstract class ConnectorImpl implements Connector {
public Map<String,Argument> defaultArguments() { public Map<String,Argument> defaultArguments() {
Map<String,Argument> defaults = new java.util.LinkedHashMap<String,Argument>(); Map<String,Argument> defaults = new java.util.LinkedHashMap<String,Argument>();
Collection values = defaultArguments.values(); Collection<Argument> values = defaultArguments.values();
Iterator iter = values.iterator(); Iterator<Argument> iter = values.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
ArgumentImpl argument = (ArgumentImpl)iter.next(); ArgumentImpl argument = (ArgumentImpl)iter.next();
defaults.put(argument.name(), (Argument)argument.clone()); defaults.put(argument.name(), (Argument)argument.clone());
...@@ -96,7 +96,7 @@ abstract class ConnectorImpl implements Connector { ...@@ -96,7 +96,7 @@ abstract class ConnectorImpl implements Connector {
mustSpecify, list)); mustSpecify, list));
} }
ArgumentImpl argument(String name, Map arguments) ArgumentImpl argument(String name, Map<String, ? extends Argument> arguments)
throws IllegalConnectorArgumentsException { throws IllegalConnectorArgumentsException {
ArgumentImpl argument = (ArgumentImpl)arguments.get(name); ArgumentImpl argument = (ArgumentImpl)arguments.get(name);
...@@ -130,7 +130,7 @@ abstract class ConnectorImpl implements Connector { ...@@ -130,7 +130,7 @@ abstract class ConnectorImpl implements Connector {
public String toString() { public String toString() {
String string = name() + " (defaults: "; String string = name() + " (defaults: ";
Iterator iter = defaultArguments().values().iterator(); Iterator<Argument> iter = defaultArguments().values().iterator();
boolean first = true; boolean first = true;
while (iter.hasNext()) { while (iter.hasNext()) {
ArgumentImpl argument = (ArgumentImpl)iter.next(); ArgumentImpl argument = (ArgumentImpl)iter.next();
...@@ -222,7 +222,7 @@ abstract class ConnectorImpl implements Connector { ...@@ -222,7 +222,7 @@ abstract class ConnectorImpl implements Connector {
class BooleanArgumentImpl extends ConnectorImpl.ArgumentImpl class BooleanArgumentImpl extends ConnectorImpl.ArgumentImpl
implements Connector.BooleanArgument { implements Connector.BooleanArgument {
private static final long serialVersionUID = 1624542968639361316L;
BooleanArgumentImpl(String name, String label, String description, BooleanArgumentImpl(String name, String label, String description,
boolean value, boolean value,
boolean mustSpecify) { boolean mustSpecify) {
...@@ -277,7 +277,7 @@ abstract class ConnectorImpl implements Connector { ...@@ -277,7 +277,7 @@ abstract class ConnectorImpl implements Connector {
class IntegerArgumentImpl extends ConnectorImpl.ArgumentImpl class IntegerArgumentImpl extends ConnectorImpl.ArgumentImpl
implements Connector.IntegerArgument { implements Connector.IntegerArgument {
private static final long serialVersionUID = 763286081923797770L;
private final int min; private final int min;
private final int max; private final int max;
...@@ -378,7 +378,7 @@ abstract class ConnectorImpl implements Connector { ...@@ -378,7 +378,7 @@ abstract class ConnectorImpl implements Connector {
class StringArgumentImpl extends ConnectorImpl.ArgumentImpl class StringArgumentImpl extends ConnectorImpl.ArgumentImpl
implements Connector.StringArgument { implements Connector.StringArgument {
private static final long serialVersionUID = 7500484902692107464L;
StringArgumentImpl(String name, String label, String description, StringArgumentImpl(String name, String label, String description,
String value, String value,
boolean mustSpecify) { boolean mustSpecify) {
...@@ -396,7 +396,7 @@ abstract class ConnectorImpl implements Connector { ...@@ -396,7 +396,7 @@ abstract class ConnectorImpl implements Connector {
class SelectedArgumentImpl extends ConnectorImpl.ArgumentImpl class SelectedArgumentImpl extends ConnectorImpl.ArgumentImpl
implements Connector.SelectedArgument { implements Connector.SelectedArgument {
private static final long serialVersionUID = -5689584530908382517L;
private final List<String> choices; private final List<String> choices;
SelectedArgumentImpl(String name, String label, String description, SelectedArgumentImpl(String name, String label, String description,
......
...@@ -101,7 +101,7 @@ public class DoubleValueImpl extends PrimitiveValueImpl ...@@ -101,7 +101,7 @@ public class DoubleValueImpl extends PrimitiveValueImpl
} }
public double doubleValue() { public double doubleValue() {
return(double)value; return value;
} }
byte checkedByteValue() throws InvalidTypeException { byte checkedByteValue() throws InvalidTypeException {
......
...@@ -43,7 +43,7 @@ import java.util.*; ...@@ -43,7 +43,7 @@ import java.util.*;
class EventRequestManagerImpl extends MirrorImpl class EventRequestManagerImpl extends MirrorImpl
implements EventRequestManager implements EventRequestManager
{ {
List[] requestLists; List<? extends EventRequest>[] requestLists;
private static int methodExitEventCmd = 0; private static int methodExitEventCmd = 0;
static int JDWPtoJDISuspendPolicy(byte jdwpPolicy) { static int JDWPtoJDISuspendPolicy(byte jdwpPolicy) {
...@@ -91,7 +91,7 @@ class EventRequestManagerImpl extends MirrorImpl ...@@ -91,7 +91,7 @@ class EventRequestManagerImpl extends MirrorImpl
* access/modification should be protected by synchronizing on * access/modification should be protected by synchronizing on
* the enclosing instance of EventRequestImpl. * the enclosing instance of EventRequestImpl.
*/ */
List filters = new ArrayList(); List<Object> filters = new ArrayList<>();
boolean isEnabled = false; boolean isEnabled = false;
boolean deleted = false; boolean deleted = false;
...@@ -195,7 +195,6 @@ class EventRequestManagerImpl extends MirrorImpl ...@@ -195,7 +195,6 @@ class EventRequestManagerImpl extends MirrorImpl
*/ */
synchronized void set() { synchronized void set() {
JDWP.EventRequest.Set.Modifier[] mods = JDWP.EventRequest.Set.Modifier[] mods =
(JDWP.EventRequest.Set.Modifier[])
filters.toArray( filters.toArray(
new JDWP.EventRequest.Set.Modifier[filters.size()]); new JDWP.EventRequest.Set.Modifier[filters.size()]);
try { try {
...@@ -582,10 +581,10 @@ class EventRequestManagerImpl extends MirrorImpl ...@@ -582,10 +581,10 @@ class EventRequestManagerImpl extends MirrorImpl
/* /*
* Make sure this isn't a duplicate * Make sure this isn't a duplicate
*/ */
List requests = stepRequests(); List<StepRequest> requests = stepRequests();
Iterator iter = requests.iterator(); Iterator<StepRequest> iter = requests.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
StepRequest request = (StepRequest)iter.next(); StepRequest request = iter.next();
if ((request != this) && if ((request != this) &&
request.isEnabled() && request.isEnabled() &&
request.thread().equals(thread)) { request.thread().equals(thread)) {
...@@ -735,7 +734,7 @@ class EventRequestManagerImpl extends MirrorImpl ...@@ -735,7 +734,7 @@ class EventRequestManagerImpl extends MirrorImpl
} }
requestLists = new List[highest+1]; requestLists = new List[highest+1];
for (int i=0; i <= highest; i++) { for (int i=0; i <= highest; i++) {
requestLists[i] = new ArrayList(); requestLists[i] = new ArrayList<>();
} }
} }
...@@ -852,7 +851,7 @@ class EventRequestManagerImpl extends MirrorImpl ...@@ -852,7 +851,7 @@ class EventRequestManagerImpl extends MirrorImpl
public void deleteEventRequests(List<? extends EventRequest> eventRequests) { public void deleteEventRequests(List<? extends EventRequest> eventRequests) {
validateMirrors(eventRequests); validateMirrors(eventRequests);
// copy the eventRequests to avoid ConcurrentModificationException // copy the eventRequests to avoid ConcurrentModificationException
Iterator iter = (new ArrayList(eventRequests)).iterator(); Iterator<? extends EventRequest> iter = (new ArrayList<>(eventRequests)).iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
((EventRequestImpl)iter.next()).delete(); ((EventRequestImpl)iter.next()).delete();
} }
...@@ -869,76 +868,76 @@ class EventRequestManagerImpl extends MirrorImpl ...@@ -869,76 +868,76 @@ class EventRequestManagerImpl extends MirrorImpl
} }
public List<StepRequest> stepRequests() { public List<StepRequest> stepRequests() {
return unmodifiableRequestList(JDWP.EventKind.SINGLE_STEP); return (List<StepRequest>)unmodifiableRequestList(JDWP.EventKind.SINGLE_STEP);
} }
public List<ClassPrepareRequest> classPrepareRequests() { public List<ClassPrepareRequest> classPrepareRequests() {
return unmodifiableRequestList(JDWP.EventKind.CLASS_PREPARE); return (List<ClassPrepareRequest>)unmodifiableRequestList(JDWP.EventKind.CLASS_PREPARE);
} }
public List<ClassUnloadRequest> classUnloadRequests() { public List<ClassUnloadRequest> classUnloadRequests() {
return unmodifiableRequestList(JDWP.EventKind.CLASS_UNLOAD); return (List<ClassUnloadRequest>)unmodifiableRequestList(JDWP.EventKind.CLASS_UNLOAD);
} }
public List<ThreadStartRequest> threadStartRequests() { public List<ThreadStartRequest> threadStartRequests() {
return unmodifiableRequestList(JDWP.EventKind.THREAD_START); return (List<ThreadStartRequest>)unmodifiableRequestList(JDWP.EventKind.THREAD_START);
} }
public List<ThreadDeathRequest> threadDeathRequests() { public List<ThreadDeathRequest> threadDeathRequests() {
return unmodifiableRequestList(JDWP.EventKind.THREAD_DEATH); return (List<ThreadDeathRequest>)unmodifiableRequestList(JDWP.EventKind.THREAD_DEATH);
} }
public List<ExceptionRequest> exceptionRequests() { public List<ExceptionRequest> exceptionRequests() {
return unmodifiableRequestList(JDWP.EventKind.EXCEPTION); return (List<ExceptionRequest>)unmodifiableRequestList(JDWP.EventKind.EXCEPTION);
} }
public List<BreakpointRequest> breakpointRequests() { public List<BreakpointRequest> breakpointRequests() {
return unmodifiableRequestList(JDWP.EventKind.BREAKPOINT); return (List<BreakpointRequest>)unmodifiableRequestList(JDWP.EventKind.BREAKPOINT);
} }
public List<AccessWatchpointRequest> accessWatchpointRequests() { public List<AccessWatchpointRequest> accessWatchpointRequests() {
return unmodifiableRequestList(JDWP.EventKind.FIELD_ACCESS); return (List<AccessWatchpointRequest>)unmodifiableRequestList(JDWP.EventKind.FIELD_ACCESS);
} }
public List<ModificationWatchpointRequest> modificationWatchpointRequests() { public List<ModificationWatchpointRequest> modificationWatchpointRequests() {
return unmodifiableRequestList(JDWP.EventKind.FIELD_MODIFICATION); return (List<ModificationWatchpointRequest>)unmodifiableRequestList(JDWP.EventKind.FIELD_MODIFICATION);
} }
public List<MethodEntryRequest> methodEntryRequests() { public List<MethodEntryRequest> methodEntryRequests() {
return unmodifiableRequestList(JDWP.EventKind.METHOD_ENTRY); return (List<MethodEntryRequest>)unmodifiableRequestList(JDWP.EventKind.METHOD_ENTRY);
} }
public List<MethodExitRequest> methodExitRequests() { public List<MethodExitRequest> methodExitRequests() {
return unmodifiableRequestList( return (List<MethodExitRequest>)unmodifiableRequestList(
EventRequestManagerImpl.methodExitEventCmd); EventRequestManagerImpl.methodExitEventCmd);
} }
public List<MonitorContendedEnterRequest> monitorContendedEnterRequests() { public List<MonitorContendedEnterRequest> monitorContendedEnterRequests() {
return unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTER); return (List<MonitorContendedEnterRequest>)unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTER);
} }
public List<MonitorContendedEnteredRequest> monitorContendedEnteredRequests() { public List<MonitorContendedEnteredRequest> monitorContendedEnteredRequests() {
return unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTERED); return (List<MonitorContendedEnteredRequest>)unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTERED);
} }
public List<MonitorWaitRequest> monitorWaitRequests() { public List<MonitorWaitRequest> monitorWaitRequests() {
return unmodifiableRequestList(JDWP.EventKind.MONITOR_WAIT); return (List<MonitorWaitRequest>)unmodifiableRequestList(JDWP.EventKind.MONITOR_WAIT);
} }
public List<MonitorWaitedRequest> monitorWaitedRequests() { public List<MonitorWaitedRequest> monitorWaitedRequests() {
return unmodifiableRequestList(JDWP.EventKind.MONITOR_WAITED); return (List<MonitorWaitedRequest>)unmodifiableRequestList(JDWP.EventKind.MONITOR_WAITED);
} }
public List<VMDeathRequest> vmDeathRequests() { public List<VMDeathRequest> vmDeathRequests() {
return unmodifiableRequestList(JDWP.EventKind.VM_DEATH); return (List<VMDeathRequest>)unmodifiableRequestList(JDWP.EventKind.VM_DEATH);
} }
List unmodifiableRequestList(int eventCmd) { List<? extends EventRequest> unmodifiableRequestList(int eventCmd) {
return Collections.unmodifiableList(requestList(eventCmd)); return Collections.unmodifiableList(requestList(eventCmd));
} }
EventRequest request(int eventCmd, int requestId) { EventRequest request(int eventCmd, int requestId) {
List rl = requestList(eventCmd); List<? extends EventRequest> rl = requestList(eventCmd);
for (int i = rl.size() - 1; i >= 0; i--) { for (int i = rl.size() - 1; i >= 0; i--) {
EventRequestImpl er = (EventRequestImpl)rl.get(i); EventRequestImpl er = (EventRequestImpl)rl.get(i);
if (er.id == requestId) { if (er.id == requestId) {
......
...@@ -47,7 +47,7 @@ enum EventDestination {UNKNOWN_EVENT, INTERNAL_EVENT, CLIENT_EVENT}; ...@@ -47,7 +47,7 @@ enum EventDestination {UNKNOWN_EVENT, INTERNAL_EVENT, CLIENT_EVENT};
* that is on the queues are all for client requests. * that is on the queues are all for client requests.
*/ */
public class EventSetImpl extends ArrayList<Event> implements EventSet { public class EventSetImpl extends ArrayList<Event> implements EventSet {
private static final long serialVersionUID = -4857338819787924570L;
private VirtualMachineImpl vm; // we implement Mirror private VirtualMachineImpl vm; // we implement Mirror
private Packet pkt; private Packet pkt;
private byte suspendPolicy; private byte suspendPolicy;
...@@ -607,7 +607,7 @@ public class EventSetImpl extends ArrayList<Event> implements EventSet { ...@@ -607,7 +607,7 @@ public class EventSetImpl extends ArrayList<Event> implements EventSet {
PacketStream ps = new PacketStream(vm, pkt); PacketStream ps = new PacketStream(vm, pkt);
JDWP.Event.Composite compEvt = new JDWP.Event.Composite(vm, ps); JDWP.Event.Composite compEvt = new JDWP.Event.Composite(vm, ps);
suspendPolicy = compEvt.suspendPolicy; suspendPolicy = compEvt.suspendPolicy;
if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) {
switch(suspendPolicy) { switch(suspendPolicy) {
case JDWP.SuspendPolicy.ALL: case JDWP.SuspendPolicy.ALL:
vm.printTrace("EventSet: SUSPEND_ALL"); vm.printTrace("EventSet: SUSPEND_ALL");
...@@ -626,7 +626,7 @@ public class EventSetImpl extends ArrayList<Event> implements EventSet { ...@@ -626,7 +626,7 @@ public class EventSetImpl extends ArrayList<Event> implements EventSet {
ThreadReference fix6485605 = null; ThreadReference fix6485605 = null;
for (int i = 0; i < compEvt.events.length; i++) { for (int i = 0; i < compEvt.events.length; i++) {
EventImpl evt = createEvent(compEvt.events[i]); EventImpl evt = createEvent(compEvt.events[i]);
if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) {
try { try {
vm.printTrace("Event: " + evt); vm.printTrace("Event: " + evt);
} catch (VMDisconnectedException ee) { } catch (VMDisconnectedException ee) {
......
...@@ -97,7 +97,7 @@ public class FloatValueImpl extends PrimitiveValueImpl ...@@ -97,7 +97,7 @@ public class FloatValueImpl extends PrimitiveValueImpl
} }
public float floatValue() { public float floatValue() {
return(float)value; return value;
} }
public double doubleValue() { public double doubleValue() {
......
...@@ -105,7 +105,7 @@ public class GenericAttachingConnector ...@@ -105,7 +105,7 @@ public class GenericAttachingConnector
/** /**
* Attach to a target VM using the specified address and Connector arguments. * Attach to a target VM using the specified address and Connector arguments.
*/ */
public VirtualMachine attach(String address, Map args) public VirtualMachine attach(String address, Map<String, ? extends Connector.Argument> args)
throws IOException, IllegalConnectorArgumentsException throws IOException, IllegalConnectorArgumentsException
{ {
String ts = argument(ARG_TIMEOUT, args).value(); String ts = argument(ARG_TIMEOUT, args).value();
......
...@@ -83,7 +83,7 @@ public class IntegerValueImpl extends PrimitiveValueImpl ...@@ -83,7 +83,7 @@ public class IntegerValueImpl extends PrimitiveValueImpl
} }
public int intValue() { public int intValue() {
return(int)value; return value;
} }
public long longValue() { public long longValue() {
......
...@@ -128,9 +128,9 @@ public class InterfaceTypeImpl extends ReferenceTypeImpl ...@@ -128,9 +128,9 @@ public class InterfaceTypeImpl extends ReferenceTypeImpl
* list being built. * list being built.
*/ */
List<InterfaceType> immediate = new ArrayList<InterfaceType>(superinterfaces()); List<InterfaceType> immediate = new ArrayList<InterfaceType>(superinterfaces());
Iterator iter = immediate.iterator(); Iterator<InterfaceType> iter = immediate.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
InterfaceType interfaze = (InterfaceType)iter.next(); InterfaceType interfaze = iter.next();
if (list.contains(interfaze)) { if (list.contains(interfaze)) {
iter.remove(); iter.remove();
} }
......
...@@ -59,7 +59,7 @@ public class InternalEventHandler implements Runnable ...@@ -59,7 +59,7 @@ public class InternalEventHandler implements Runnable
ClassUnloadEvent cuEvent = (ClassUnloadEvent)event; ClassUnloadEvent cuEvent = (ClassUnloadEvent)event;
vm.removeReferenceType(cuEvent.classSignature()); vm.removeReferenceType(cuEvent.classSignature());
if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) {
vm.printTrace("Handled Unload Event for " + vm.printTrace("Handled Unload Event for " +
cuEvent.classSignature()); cuEvent.classSignature());
} }
...@@ -68,7 +68,7 @@ public class InternalEventHandler implements Runnable ...@@ -68,7 +68,7 @@ public class InternalEventHandler implements Runnable
((ReferenceTypeImpl)cpEvent.referenceType()) ((ReferenceTypeImpl)cpEvent.referenceType())
.markPrepared(); .markPrepared();
if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) {
vm.printTrace("Handled Prepare Event for " + vm.printTrace("Handled Prepare Event for " +
cpEvent.referenceType().name()); cpEvent.referenceType().name());
} }
......
...@@ -27,7 +27,7 @@ package com.sun.tools.jdi; ...@@ -27,7 +27,7 @@ package com.sun.tools.jdi;
import com.sun.jdi.*; import com.sun.jdi.*;
class JDWPException extends Exception { class JDWPException extends Exception {
private static final long serialVersionUID = -6321344442751299874L;
short errorCode; short errorCode;
JDWPException(short errorCode) { JDWPException(short errorCode) {
......
...@@ -93,7 +93,7 @@ public class LongValueImpl extends PrimitiveValueImpl ...@@ -93,7 +93,7 @@ public class LongValueImpl extends PrimitiveValueImpl
} }
public long longValue() { public long longValue() {
return(long)value; return value;
} }
public float floatValue() { public float floatValue() {
......
...@@ -362,7 +362,7 @@ public abstract class MethodImpl extends TypeComponentImpl ...@@ -362,7 +362,7 @@ public abstract class MethodImpl extends TypeComponentImpl
int argSize = arguments.size(); int argSize = arguments.size();
JNITypeParser parser = new JNITypeParser(signature()); JNITypeParser parser = new JNITypeParser(signature());
List signatures = parser.argumentSignatures(); List<String> signatures = parser.argumentSignatures();
if (signatures.size() != argSize) { if (signatures.size() != argSize) {
throw new IllegalArgumentException("Invalid argument count: expected " + throw new IllegalArgumentException("Invalid argument count: expected " +
......
...@@ -83,8 +83,8 @@ abstract class MirrorImpl extends Object implements Mirror { ...@@ -83,8 +83,8 @@ abstract class MirrorImpl extends Object implements Mirror {
* Throw NullPointerException on null mirrors. * Throw NullPointerException on null mirrors.
* Throw VMMismatchException on wrong VM. * Throw VMMismatchException on wrong VM.
*/ */
void validateMirrors(Collection mirrors) { void validateMirrors(Collection<? extends Mirror> mirrors) {
Iterator iter = mirrors.iterator(); Iterator<? extends Mirror> iter = mirrors.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
MirrorImpl mirror = (MirrorImpl)iter.next(); MirrorImpl mirror = (MirrorImpl)iter.next();
if (!vm.equals(mirror.vm)) { if (!vm.equals(mirror.vm)) {
...@@ -96,8 +96,8 @@ abstract class MirrorImpl extends Object implements Mirror { ...@@ -96,8 +96,8 @@ abstract class MirrorImpl extends Object implements Mirror {
* Allow null mirrors. * Allow null mirrors.
* Throw VMMismatchException on wrong VM. * Throw VMMismatchException on wrong VM.
*/ */
void validateMirrorsOrNulls(Collection mirrors) { void validateMirrorsOrNulls(Collection<? extends Mirror> mirrors) {
Iterator iter = mirrors.iterator(); Iterator<? extends Mirror> iter = mirrors.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
MirrorImpl mirror = (MirrorImpl)iter.next(); MirrorImpl mirror = (MirrorImpl)iter.next();
if ((mirror != null) && !vm.equals(mirror.vm)) { if ((mirror != null) && !vm.equals(mirror.vm)) {
......
...@@ -110,7 +110,7 @@ public class ObjectReferenceImpl extends ValueImpl ...@@ -110,7 +110,7 @@ public class ObjectReferenceImpl extends ValueImpl
public boolean vmNotSuspended(VMAction action) { public boolean vmNotSuspended(VMAction action) {
// make sure that cache and listener management are synchronized // make sure that cache and listener management are synchronized
synchronized (vm.state()) { synchronized (vm.state()) {
if (cache != null && (vm.traceFlags & vm.TRACE_OBJREFS) != 0) { if (cache != null && (vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace("Clearing temporary cache for " + description()); vm.printTrace("Clearing temporary cache for " + description());
} }
disableCache(); disableCache();
...@@ -163,8 +163,8 @@ public class ObjectReferenceImpl extends ValueImpl ...@@ -163,8 +163,8 @@ public class ObjectReferenceImpl extends ValueImpl
public Value getValue(Field sig) { public Value getValue(Field sig) {
List<Field> list = new ArrayList<Field>(1); List<Field> list = new ArrayList<Field>(1);
list.add(sig); list.add(sig);
Map map = getValues(list); Map<Field, Value> map = getValues(list);
return(Value)map.get(sig); return map.get(sig);
} }
public Map<Field,Value> getValues(List<? extends Field> theFields) { public Map<Field,Value> getValues(List<? extends Field> theFields) {
...@@ -487,7 +487,7 @@ public class ObjectReferenceImpl extends ValueImpl ...@@ -487,7 +487,7 @@ public class ObjectReferenceImpl extends ValueImpl
info = JDWP.ObjectReference.MonitorInfo.process(vm, this); info = JDWP.ObjectReference.MonitorInfo.process(vm, this);
if (local != null) { if (local != null) {
local.monitorInfo = info; local.monitorInfo = info;
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace("ObjectReference " + uniqueID() + vm.printTrace("ObjectReference " + uniqueID() +
" temporarily caching monitor info"); " temporarily caching monitor info");
} }
......
...@@ -127,7 +127,7 @@ public class ProcessAttachingConnector ...@@ -127,7 +127,7 @@ public class ProcessAttachingConnector
} else { } else {
if (lib.equals("dt_shmem")) { if (lib.equals("dt_shmem")) {
try { try {
Class c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService"); Class<?> c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService");
ts = (TransportService)c.newInstance(); ts = (TransportService)c.newInstance();
} catch (Exception x) { } } catch (Exception x) { }
} }
......
...@@ -53,7 +53,7 @@ public class RawCommandLineLauncher extends AbstractLauncher implements Launchin ...@@ -53,7 +53,7 @@ public class RawCommandLineLauncher extends AbstractLauncher implements Launchin
super(); super();
try { try {
Class c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService"); Class<?> c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService");
transportService = (TransportService)c.newInstance(); transportService = (TransportService)c.newInstance();
transport = new Transport() { transport = new Transport() {
public String name() { public String name() {
......
...@@ -99,7 +99,7 @@ implements ReferenceType { ...@@ -99,7 +99,7 @@ implements ReferenceType {
// Fetch all methods for the class, check performance impact // Fetch all methods for the class, check performance impact
// Needs no synchronization now, since methods() returns // Needs no synchronization now, since methods() returns
// unmodifiable local data // unmodifiable local data
Iterator it = methods().iterator(); Iterator<Method> it = methods().iterator();
while (it.hasNext()) { while (it.hasNext()) {
MethodImpl method = (MethodImpl)it.next(); MethodImpl method = (MethodImpl)it.next();
if (method.ref() == ref) { if (method.ref() == ref) {
...@@ -113,7 +113,7 @@ implements ReferenceType { ...@@ -113,7 +113,7 @@ implements ReferenceType {
// Fetch all fields for the class, check performance impact // Fetch all fields for the class, check performance impact
// Needs no synchronization now, since fields() returns // Needs no synchronization now, since fields() returns
// unmodifiable local data // unmodifiable local data
Iterator it = fields().iterator(); Iterator<Field>it = fields().iterator();
while (it.hasNext()) { while (it.hasNext()) {
FieldImpl field = (FieldImpl)it.next(); FieldImpl field = (FieldImpl)it.next();
if (field.ref() == ref) { if (field.ref() == ref) {
...@@ -385,7 +385,7 @@ implements ReferenceType { ...@@ -385,7 +385,7 @@ implements ReferenceType {
/* Add inherited, visible fields */ /* Add inherited, visible fields */
List<? extends ReferenceType> types = inheritedTypes(); List<? extends ReferenceType> types = inheritedTypes();
Iterator iter = types.iterator(); Iterator<? extends ReferenceType> iter = types.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
/* /*
* TO DO: Be defensive and check for cyclic interface inheritance * TO DO: Be defensive and check for cyclic interface inheritance
...@@ -419,7 +419,7 @@ implements ReferenceType { ...@@ -419,7 +419,7 @@ implements ReferenceType {
/* Add inherited fields */ /* Add inherited fields */
List<? extends ReferenceType> types = inheritedTypes(); List<? extends ReferenceType> types = inheritedTypes();
Iterator iter = types.iterator(); Iterator<? extends ReferenceType> iter = types.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next(); ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next();
type.addAllFields(fieldList, typeSet); type.addAllFields(fieldList, typeSet);
...@@ -434,13 +434,10 @@ implements ReferenceType { ...@@ -434,13 +434,10 @@ implements ReferenceType {
} }
public Field fieldByName(String fieldName) { public Field fieldByName(String fieldName) {
java.util.List searchList; List<Field> searchList = visibleFields();
Field f;
searchList = visibleFields();
for (int i=0; i<searchList.size(); i++) { for (int i=0; i<searchList.size(); i++) {
f = (Field)searchList.get(i); Field f = searchList.get(i);
if (f.name().equals(fieldName)) { if (f.name().equals(fieldName)) {
return f; return f;
...@@ -575,13 +572,13 @@ implements ReferenceType { ...@@ -575,13 +572,13 @@ implements ReferenceType {
} }
public List<ReferenceType> nestedTypes() { public List<ReferenceType> nestedTypes() {
List all = vm.allClasses(); List<ReferenceType> all = vm.allClasses();
List<ReferenceType> nested = new ArrayList<ReferenceType>(); List<ReferenceType> nested = new ArrayList<ReferenceType>();
String outername = name(); String outername = name();
int outerlen = outername.length(); int outerlen = outername.length();
Iterator iter = all.iterator(); Iterator<ReferenceType> iter = all.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
ReferenceType refType = (ReferenceType)iter.next(); ReferenceType refType = iter.next();
String name = refType.name(); String name = refType.name();
int len = name.length(); int len = name.length();
/* The separator is historically '$' but could also be '#' */ /* The separator is historically '$' but could also be '#' */
...@@ -598,8 +595,8 @@ implements ReferenceType { ...@@ -598,8 +595,8 @@ implements ReferenceType {
public Value getValue(Field sig) { public Value getValue(Field sig) {
List<Field> list = new ArrayList<Field>(1); List<Field> list = new ArrayList<Field>(1);
list.add(sig); list.add(sig);
Map map = getValues(list); Map<Field, Value> map = getValues(list);
return(Value)map.get(sig); return map.get(sig);
} }
...@@ -847,7 +844,7 @@ implements ReferenceType { ...@@ -847,7 +844,7 @@ implements ReferenceType {
SDE.Stratum stratum = stratum(stratumID); SDE.Stratum stratum = stratum(stratumID);
List<Location> list = new ArrayList<Location>(); // location list List<Location> list = new ArrayList<Location>(); // location list
for (Iterator iter = methods().iterator(); iter.hasNext(); ) { for (Iterator<Method> iter = methods().iterator(); iter.hasNext(); ) {
MethodImpl method = (MethodImpl)iter.next(); MethodImpl method = (MethodImpl)iter.next();
try { try {
list.addAll( list.addAll(
...@@ -887,7 +884,7 @@ implements ReferenceType { ...@@ -887,7 +884,7 @@ implements ReferenceType {
List<Location> list = new ArrayList<Location>(); List<Location> list = new ArrayList<Location>();
Iterator iter = methods.iterator(); Iterator<Method> iter = methods.iterator();
while(iter.hasNext()) { while(iter.hasNext()) {
MethodImpl method = (MethodImpl)iter.next(); MethodImpl method = (MethodImpl)iter.next();
// eliminate native and abstract to eliminate // eliminate native and abstract to eliminate
......
...@@ -79,7 +79,7 @@ public class ShortValueImpl extends PrimitiveValueImpl ...@@ -79,7 +79,7 @@ public class ShortValueImpl extends PrimitiveValueImpl
} }
public short shortValue() { public short shortValue() {
return(short)value; return value;
} }
public int intValue() { public int intValue() {
......
...@@ -64,7 +64,7 @@ public class SunCommandLineLauncher extends AbstractLauncher implements Launchin ...@@ -64,7 +64,7 @@ public class SunCommandLineLauncher extends AbstractLauncher implements Launchin
* transport or the socket transport * transport or the socket transport
*/ */
try { try {
Class c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService"); Class<?> c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService");
transportService = (TransportService)c.newInstance(); transportService = (TransportService)c.newInstance();
transport = new Transport() { transport = new Transport() {
public String name() { public String name() {
......
...@@ -178,7 +178,7 @@ public class TargetVM implements Runnable { ...@@ -178,7 +178,7 @@ public class TargetVM implements Runnable {
// Closing a queue causes a VMDisconnectEvent to // Closing a queue causes a VMDisconnectEvent to
// be put onto the queue. // be put onto the queue.
synchronized(eventQueues) { synchronized(eventQueues) {
Iterator iter = eventQueues.iterator(); Iterator<EventQueue> iter = eventQueues.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
((EventQueueImpl)iter.next()).close(); ((EventQueueImpl)iter.next()).close();
} }
...@@ -187,9 +187,9 @@ public class TargetVM implements Runnable { ...@@ -187,9 +187,9 @@ public class TargetVM implements Runnable {
// indirectly throw VMDisconnectedException to // indirectly throw VMDisconnectedException to
// command requesters. // command requesters.
synchronized(waitingQueue) { synchronized(waitingQueue) {
Iterator iter = waitingQueue.values().iterator(); Iterator<Packet> iter = waitingQueue.values().iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
Packet packet = (Packet)iter.next(); Packet packet = iter.next();
synchronized(packet) { synchronized(packet) {
packet.notify(); packet.notify();
} }
...@@ -252,7 +252,7 @@ public class TargetVM implements Runnable { ...@@ -252,7 +252,7 @@ public class TargetVM implements Runnable {
void notifyDequeueEventSet() { void notifyDequeueEventSet() {
int maxQueueSize = 0; int maxQueueSize = 0;
synchronized(eventQueues) { synchronized(eventQueues) {
Iterator iter = eventQueues.iterator(); Iterator<EventQueue> iter = eventQueues.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
EventQueueImpl queue = (EventQueueImpl)iter.next(); EventQueueImpl queue = (EventQueueImpl)iter.next();
maxQueueSize = Math.max(maxQueueSize, queue.size()); maxQueueSize = Math.max(maxQueueSize, queue.size());
...@@ -265,7 +265,7 @@ public class TargetVM implements Runnable { ...@@ -265,7 +265,7 @@ public class TargetVM implements Runnable {
int maxQueueSize = 0; int maxQueueSize = 0;
synchronized(eventQueues) { synchronized(eventQueues) {
Iterator iter = eventQueues.iterator(); Iterator<EventQueue> iter = eventQueues.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
EventQueueImpl queue = (EventQueueImpl)iter.next(); EventQueueImpl queue = (EventQueueImpl)iter.next();
queue.enqueue(eventSet); queue.enqueue(eventSet);
......
...@@ -33,6 +33,7 @@ import java.util.EventObject; ...@@ -33,6 +33,7 @@ import java.util.EventObject;
* with JDI events. * with JDI events.
*/ */
class ThreadAction extends EventObject { class ThreadAction extends EventObject {
private static final long serialVersionUID = 5690763191100515283L;
// Event ids // Event ids
/*static final int THREAD_SUSPENDED = 1;*/ /*static final int THREAD_SUSPENDED = 1;*/
static final int THREAD_RESUMABLE = 2; static final int THREAD_RESUMABLE = 2;
......
...@@ -118,7 +118,7 @@ public class ThreadGroupReferenceImpl extends ObjectReferenceImpl ...@@ -118,7 +118,7 @@ public class ThreadGroupReferenceImpl extends ObjectReferenceImpl
.process(vm, this); .process(vm, this);
if (local != null) { if (local != null) {
local.kids = kids; local.kids = kids;
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace(description() + vm.printTrace(description() +
" temporarily caching children "); " temporarily caching children ");
} }
......
...@@ -240,7 +240,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl ...@@ -240,7 +240,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
public void stop(ObjectReference throwable) throws InvalidTypeException { public void stop(ObjectReference throwable) throws InvalidTypeException {
validateMirror(throwable); validateMirror(throwable);
// Verify that the given object is a Throwable instance // Verify that the given object is a Throwable instance
List list = vm.classesByName("java.lang.Throwable"); List<ReferenceType> list = vm.classesByName("java.lang.Throwable");
ClassTypeImpl throwableClass = (ClassTypeImpl)list.get(0); ClassTypeImpl throwableClass = (ClassTypeImpl)list.get(0);
if ((throwable == null) || if ((throwable == null) ||
!throwableClass.isAssignableFrom(throwable)) { !throwableClass.isAssignableFrom(throwable)) {
...@@ -296,10 +296,10 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl ...@@ -296,10 +296,10 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
try { try {
StackFrame frame = frame(0); StackFrame frame = frame(0);
Location location = frame.location(); Location location = frame.location();
List requests = vm.eventRequestManager().breakpointRequests(); List<BreakpointRequest> requests = vm.eventRequestManager().breakpointRequests();
Iterator iter = requests.iterator(); Iterator<BreakpointRequest> iter = requests.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
BreakpointRequest request = (BreakpointRequest)iter.next(); BreakpointRequest request = iter.next();
if (location.equals(request.location())) { if (location.equals(request.location())) {
return true; return true;
} }
...@@ -352,8 +352,8 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl ...@@ -352,8 +352,8 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
} }
public StackFrame frame(int index) throws IncompatibleThreadStateException { public StackFrame frame(int index) throws IncompatibleThreadStateException {
List list = privateFrames(index, 1); List<StackFrame> list = privateFrames(index, 1);
return (StackFrame)list.get(0); return list.get(0);
} }
/** /**
...@@ -447,7 +447,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl ...@@ -447,7 +447,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
snapshot.ownedMonitors = Arrays.asList( snapshot.ownedMonitors = Arrays.asList(
(ObjectReference[])JDWP.ThreadReference.OwnedMonitors. (ObjectReference[])JDWP.ThreadReference.OwnedMonitors.
process(vm, this).owned); process(vm, this).owned);
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace(description() + vm.printTrace(description() +
" temporarily caching owned monitors"+ " temporarily caching owned monitors"+
" (count = " + snapshot.ownedMonitors.size() + ")"); " (count = " + snapshot.ownedMonitors.size() + ")");
...@@ -475,7 +475,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl ...@@ -475,7 +475,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
process(vm, this).monitor; process(vm, this).monitor;
snapshot.triedCurrentContended = true; snapshot.triedCurrentContended = true;
if ((snapshot.contendedMonitor != null) && if ((snapshot.contendedMonitor != null) &&
((vm.traceFlags & vm.TRACE_OBJREFS) != 0)) { ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0)) {
vm.printTrace(description() + vm.printTrace(description() +
" temporarily caching contended monitor"+ " temporarily caching contended monitor"+
" (id = " + snapshot.contendedMonitor.uniqueID() + ")"); " (id = " + snapshot.contendedMonitor.uniqueID() + ")");
...@@ -509,7 +509,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl ...@@ -509,7 +509,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
snapshot.ownedMonitorsInfo.add(mon); snapshot.ownedMonitorsInfo.add(mon);
} }
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace(description() + vm.printTrace(description() +
" temporarily caching owned monitors"+ " temporarily caching owned monitors"+
" (count = " + snapshot.ownedMonitorsInfo.size() + ")"); " (count = " + snapshot.ownedMonitorsInfo.size() + ")");
...@@ -601,9 +601,9 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl ...@@ -601,9 +601,9 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
void removeListener(ThreadListener listener) { void removeListener(ThreadListener listener) {
synchronized (vm.state()) { synchronized (vm.state()) {
Iterator iter = listeners.iterator(); Iterator<WeakReference<ThreadListener>> iter = listeners.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
WeakReference ref = (WeakReference)iter.next(); WeakReference<ThreadListener> ref = iter.next();
if (listener.equals(ref.get())) { if (listener.equals(ref.get())) {
iter.remove(); iter.remove();
break; break;
...@@ -619,10 +619,10 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl ...@@ -619,10 +619,10 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
*/ */
private void processThreadAction(ThreadAction action) { private void processThreadAction(ThreadAction action) {
synchronized (vm.state()) { synchronized (vm.state()) {
Iterator iter = listeners.iterator(); Iterator<WeakReference<ThreadListener>> iter = listeners.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
WeakReference ref = (WeakReference)iter.next(); WeakReference<ThreadListener> ref = iter.next();
ThreadListener listener = (ThreadListener)ref.get(); ThreadListener listener = ref.get();
if (listener != null) { if (listener != null) {
switch (action.id()) { switch (action.id()) {
case ThreadAction.THREAD_RESUMABLE: case ThreadAction.THREAD_RESUMABLE:
......
...@@ -33,6 +33,8 @@ import java.util.EventObject; ...@@ -33,6 +33,8 @@ import java.util.EventObject;
* with JDI events. * with JDI events.
*/ */
class VMAction extends EventObject { class VMAction extends EventObject {
private static final long serialVersionUID = -1701944679310296090L;
// Event ids // Event ids
static final int VM_SUSPENDED = 1; static final int VM_SUSPENDED = 1;
static final int VM_NOT_SUSPENDED = 2; static final int VM_NOT_SUSPENDED = 2;
......
...@@ -34,7 +34,7 @@ class VMState { ...@@ -34,7 +34,7 @@ class VMState {
private final VirtualMachineImpl vm; private final VirtualMachineImpl vm;
// Listeners // Listeners
private final List<WeakReference> listeners = new ArrayList<WeakReference>(); // synchronized (this) private final List<WeakReference<VMListener>> listeners = new ArrayList<WeakReference<VMListener>>(); // synchronized (this)
private boolean notifyingListeners = false; // synchronized (this) private boolean notifyingListeners = false; // synchronized (this)
/* /*
...@@ -129,7 +129,7 @@ class VMState { ...@@ -129,7 +129,7 @@ class VMState {
*/ */
synchronized void thaw(ThreadReference resumingThread) { synchronized void thaw(ThreadReference resumingThread) {
if (cache != null) { if (cache != null) {
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace("Clearing VM suspended cache"); vm.printTrace("Clearing VM suspended cache");
} }
disableCache(); disableCache();
...@@ -142,10 +142,10 @@ class VMState { ...@@ -142,10 +142,10 @@ class VMState {
// Prevent recursion // Prevent recursion
notifyingListeners = true; notifyingListeners = true;
Iterator iter = listeners.iterator(); Iterator<WeakReference<VMListener>> iter = listeners.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
WeakReference ref = (WeakReference)iter.next(); WeakReference<VMListener> ref = iter.next();
VMListener listener = (VMListener)ref.get(); VMListener listener = ref.get();
if (listener != null) { if (listener != null) {
boolean keep = true; boolean keep = true;
switch (action.id()) { switch (action.id()) {
...@@ -178,9 +178,9 @@ class VMState { ...@@ -178,9 +178,9 @@ class VMState {
} }
synchronized void removeListener(VMListener listener) { synchronized void removeListener(VMListener listener) {
Iterator iter = listeners.iterator(); Iterator<WeakReference<VMListener>> iter = listeners.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
WeakReference ref = (WeakReference)iter.next(); WeakReference<VMListener> ref = iter.next();
if (listener.equals(ref.get())) { if (listener.equals(ref.get())) {
iter.remove(); iter.remove();
break; break;
...@@ -202,7 +202,7 @@ class VMState { ...@@ -202,7 +202,7 @@ class VMState {
process(vm).threads); process(vm).threads);
if (local != null) { if (local != null) {
local.threads = threads; local.threads = threads;
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace("Caching all threads (count = " + vm.printTrace("Caching all threads (count = " +
threads.size() + ") while VM suspended"); threads.size() + ") while VM suspended");
} }
...@@ -229,7 +229,7 @@ class VMState { ...@@ -229,7 +229,7 @@ class VMState {
process(vm).groups); process(vm).groups);
if (local != null) { if (local != null) {
local.groups = groups; local.groups = groups;
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace( vm.printTrace(
"Caching top level thread groups (count = " + "Caching top level thread groups (count = " +
groups.size() + ") while VM suspended"); groups.size() + ") while VM suspended");
......
...@@ -300,9 +300,9 @@ class VirtualMachineImpl extends MirrorImpl ...@@ -300,9 +300,9 @@ class VirtualMachineImpl extends MirrorImpl
if (!canRedefineClasses()) { if (!canRedefineClasses()) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
Iterator it = classToBytes.entrySet().iterator(); Iterator<?> it = classToBytes.entrySet().iterator();
for (int i = 0; it.hasNext(); i++) { for (int i = 0; it.hasNext(); i++) {
Map.Entry entry = (Map.Entry)it.next(); Map.Entry<?,?> entry = (Map.Entry)it.next();
ReferenceTypeImpl refType = (ReferenceTypeImpl)entry.getKey(); ReferenceTypeImpl refType = (ReferenceTypeImpl)entry.getKey();
validateMirror(refType); validateMirror(refType);
defs[i] = new JDWP.VirtualMachine.RedefineClasses defs[i] = new JDWP.VirtualMachine.RedefineClasses
...@@ -801,7 +801,7 @@ class VirtualMachineImpl extends MirrorImpl ...@@ -801,7 +801,7 @@ class VirtualMachineImpl extends MirrorImpl
* we can't differentiate here, we first remove all * we can't differentiate here, we first remove all
* matching classes from our cache... * matching classes from our cache...
*/ */
Iterator iter = typesBySignature.iterator(); Iterator<ReferenceType> iter = typesBySignature.iterator();
int matches = 0; int matches = 0;
while (iter.hasNext()) { while (iter.hasNext()) {
ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next(); ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next();
...@@ -833,7 +833,7 @@ class VirtualMachineImpl extends MirrorImpl ...@@ -833,7 +833,7 @@ class VirtualMachineImpl extends MirrorImpl
if (typesByID == null) { if (typesByID == null) {
return new ArrayList<ReferenceType>(0); return new ArrayList<ReferenceType>(0);
} }
Iterator iter = typesBySignature.iterator(); Iterator<ReferenceType> iter = typesBySignature.iterator();
List<ReferenceType> list = new ArrayList<ReferenceType>(); List<ReferenceType> list = new ArrayList<ReferenceType>();
while (iter.hasNext()) { while (iter.hasNext()) {
ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next(); ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next();
...@@ -1041,10 +1041,10 @@ class VirtualMachineImpl extends MirrorImpl ...@@ -1041,10 +1041,10 @@ class VirtualMachineImpl extends MirrorImpl
} }
Type findBootType(String signature) throws ClassNotLoadedException { Type findBootType(String signature) throws ClassNotLoadedException {
List types = allClasses(); List<ReferenceType> types = allClasses();
Iterator iter = types.iterator(); Iterator<ReferenceType> iter = types.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
ReferenceType type = (ReferenceType)iter.next(); ReferenceType type = iter.next();
if ((type.classLoader() == null) && if ((type.classLoader() == null) &&
(type.signature().equals(signature))) { (type.signature().equals(signature))) {
return type; return type;
...@@ -1227,7 +1227,7 @@ class VirtualMachineImpl extends MirrorImpl ...@@ -1227,7 +1227,7 @@ class VirtualMachineImpl extends MirrorImpl
} }
private void processQueue() { private void processQueue() {
Reference ref; Reference<?> ref;
//if ((traceFlags & TRACE_OBJREFS) != 0) { //if ((traceFlags & TRACE_OBJREFS) != 0) {
// printTrace("Checking for softly reachable objects"); // printTrace("Checking for softly reachable objects");
//} //}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册