From 8821938b11c8b2c7fe99caa7bd7e6f8bf83f717f Mon Sep 17 00:00:00 2001 From: jjh Date: Fri, 9 Dec 2011 12:56:22 -0800 Subject: [PATCH] 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 --- .../tools/jdwpgen/ArrayRegionTypeNode.java | 2 +- .../src/build/tools/jdwpgen/OutNode.java | 2 +- .../sun/jdi/AbsentInformationException.java | 1 + .../com/sun/jdi/ClassNotLoadedException.java | 1 + .../sun/jdi/ClassNotPreparedException.java | 1 + .../jdi/IncompatibleThreadStateException.java | 1 + .../jdi/InconsistentDebugInfoException.java | 1 + .../com/sun/jdi/InternalException.java | 1 + .../sun/jdi/InvalidCodeIndexException.java | 1 + .../sun/jdi/InvalidLineNumberException.java | 1 + .../sun/jdi/InvalidStackFrameException.java | 1 + .../com/sun/jdi/InvalidTypeException.java | 1 + .../com/sun/jdi/InvocationException.java | 1 + .../classes/com/sun/jdi/JDIPermission.java | 2 +- .../com/sun/jdi/NativeMethodException.java | 1 + .../com/sun/jdi/ObjectCollectedException.java | 1 + .../sun/jdi/VMCannotBeModifiedException.java | 1 + .../com/sun/jdi/VMDisconnectedException.java | 1 + .../com/sun/jdi/VMMismatchException.java | 1 + .../com/sun/jdi/VMOutOfMemoryException.java | 1 + .../IllegalConnectorArgumentsException.java | 1 + .../connect/TransportTimeoutException.java | 2 +- .../com/sun/jdi/connect/VMStartException.java | 1 + .../spi/ClosedConnectionException.java | 2 +- .../request/DuplicateRequestException.java | 1 + .../request/InvalidRequestStateException.java | 1 + .../com/sun/tools/jdi/ArrayReferenceImpl.java | 4 +- .../com/sun/tools/jdi/ArrayTypeImpl.java | 8 +- .../com/sun/tools/jdi/BooleanValueImpl.java | 4 +- .../com/sun/tools/jdi/CharValueImpl.java | 2 +- .../tools/jdi/ClassLoaderReferenceImpl.java | 6 +- .../com/sun/tools/jdi/ClassTypeImpl.java | 6 +- .../com/sun/tools/jdi/ConcreteMethodImpl.java | 12 +- .../com/sun/tools/jdi/ConnectorImpl.java | 16 +- .../com/sun/tools/jdi/DoubleValueImpl.java | 2 +- .../tools/jdi/EventRequestManagerImpl.java | 51 +- .../com/sun/tools/jdi/EventSetImpl.java | 6 +- .../com/sun/tools/jdi/FloatValueImpl.java | 2 +- .../tools/jdi/GenericAttachingConnector.java | 2 +- .../com/sun/tools/jdi/IntegerValueImpl.java | 2 +- .../com/sun/tools/jdi/InterfaceTypeImpl.java | 4 +- .../sun/tools/jdi/InternalEventHandler.java | 4 +- .../com/sun/tools/jdi/JDWPException.java | 2 +- .../com/sun/tools/jdi/LinkedHashMap.java | 904 ------------------ .../com/sun/tools/jdi/LongValueImpl.java | 2 +- .../classes/com/sun/tools/jdi/MethodImpl.java | 2 +- .../classes/com/sun/tools/jdi/MirrorImpl.java | 8 +- .../sun/tools/jdi/ObjectReferenceImpl.java | 8 +- .../tools/jdi/ProcessAttachingConnector.java | 2 +- .../sun/tools/jdi/RawCommandLineLauncher.java | 2 +- .../com/sun/tools/jdi/ReferenceTypeImpl.java | 29 +- .../com/sun/tools/jdi/ShortValueImpl.java | 2 +- .../sun/tools/jdi/SunCommandLineLauncher.java | 2 +- .../classes/com/sun/tools/jdi/TargetVM.java | 10 +- .../com/sun/tools/jdi/ThreadAction.java | 1 + .../tools/jdi/ThreadGroupReferenceImpl.java | 2 +- .../sun/tools/jdi/ThreadReferenceImpl.java | 28 +- .../classes/com/sun/tools/jdi/VMAction.java | 2 + .../classes/com/sun/tools/jdi/VMState.java | 18 +- .../com/sun/tools/jdi/VirtualMachineImpl.java | 16 +- 60 files changed, 159 insertions(+), 1043 deletions(-) delete mode 100644 src/share/classes/com/sun/tools/jdi/LinkedHashMap.java diff --git a/make/tools/src/build/tools/jdwpgen/ArrayRegionTypeNode.java b/make/tools/src/build/tools/jdwpgen/ArrayRegionTypeNode.java index bc4d7bae1..04afd0212 100644 --- a/make/tools/src/build/tools/jdwpgen/ArrayRegionTypeNode.java +++ b/make/tools/src/build/tools/jdwpgen/ArrayRegionTypeNode.java @@ -35,7 +35,7 @@ class ArrayRegionTypeNode extends AbstractSimpleTypeNode { } String javaType() { - return "List"; + return "List"; } public void genJavaWrite(PrintWriter writer, int depth, diff --git a/make/tools/src/build/tools/jdwpgen/OutNode.java b/make/tools/src/build/tools/jdwpgen/OutNode.java index 1a0b426ae..a4c673a44 100644 --- a/make/tools/src/build/tools/jdwpgen/OutNode.java +++ b/make/tools/src/build/tools/jdwpgen/OutNode.java @@ -89,7 +89,7 @@ class OutNode extends AbstractTypeListNode { if (Main.genDebug) { indent(writer, depth+1); writer.println( - "if ((vm.traceFlags & vm.TRACE_SENDS) != 0) {"); + "if ((vm.traceFlags & VirtualMachineImpl.TRACE_SENDS) != 0) {"); indent(writer, depth+2); writer.print( "vm.printTrace(\"Sending Command(id=\" + ps.pkt.id + \") "); diff --git a/src/share/classes/com/sun/jdi/AbsentInformationException.java b/src/share/classes/com/sun/jdi/AbsentInformationException.java index f5ef5b876..cc296a0b8 100644 --- a/src/share/classes/com/sun/jdi/AbsentInformationException.java +++ b/src/share/classes/com/sun/jdi/AbsentInformationException.java @@ -33,6 +33,7 @@ package com.sun.jdi; */ public class AbsentInformationException extends Exception { + private static final long serialVersionUID = 4988939309582416373L; public AbsentInformationException() { super(); diff --git a/src/share/classes/com/sun/jdi/ClassNotLoadedException.java b/src/share/classes/com/sun/jdi/ClassNotLoadedException.java index b139b3f06..5b2cebfc9 100644 --- a/src/share/classes/com/sun/jdi/ClassNotLoadedException.java +++ b/src/share/classes/com/sun/jdi/ClassNotLoadedException.java @@ -69,6 +69,7 @@ package com.sun.jdi; */ public class ClassNotLoadedException extends Exception { + private static final long serialVersionUID = -6242978768444298722L; private String className; public ClassNotLoadedException(String className) { diff --git a/src/share/classes/com/sun/jdi/ClassNotPreparedException.java b/src/share/classes/com/sun/jdi/ClassNotPreparedException.java index cbee2bcd2..1455d8e8c 100644 --- a/src/share/classes/com/sun/jdi/ClassNotPreparedException.java +++ b/src/share/classes/com/sun/jdi/ClassNotPreparedException.java @@ -33,6 +33,7 @@ package com.sun.jdi; * @since 1.3 */ public class ClassNotPreparedException extends RuntimeException { + private static final long serialVersionUID = -6120698967144079642L; public ClassNotPreparedException() { super(); diff --git a/src/share/classes/com/sun/jdi/IncompatibleThreadStateException.java b/src/share/classes/com/sun/jdi/IncompatibleThreadStateException.java index 894762c96..af9cac9ad 100644 --- a/src/share/classes/com/sun/jdi/IncompatibleThreadStateException.java +++ b/src/share/classes/com/sun/jdi/IncompatibleThreadStateException.java @@ -34,6 +34,7 @@ package com.sun.jdi; */ public class IncompatibleThreadStateException extends Exception { + private static final long serialVersionUID = 6199174323414551389L; public IncompatibleThreadStateException() { super(); diff --git a/src/share/classes/com/sun/jdi/InconsistentDebugInfoException.java b/src/share/classes/com/sun/jdi/InconsistentDebugInfoException.java index 022895ffe..f03e3ba14 100644 --- a/src/share/classes/com/sun/jdi/InconsistentDebugInfoException.java +++ b/src/share/classes/com/sun/jdi/InconsistentDebugInfoException.java @@ -35,6 +35,7 @@ package com.sun.jdi; * @since 1.3 */ public class InconsistentDebugInfoException extends RuntimeException { + private static final long serialVersionUID = 7964236415376861808L; public InconsistentDebugInfoException() { super(); } diff --git a/src/share/classes/com/sun/jdi/InternalException.java b/src/share/classes/com/sun/jdi/InternalException.java index 071d35fcb..c263c9870 100644 --- a/src/share/classes/com/sun/jdi/InternalException.java +++ b/src/share/classes/com/sun/jdi/InternalException.java @@ -33,6 +33,7 @@ package com.sun.jdi; * @since 1.3 */ public class InternalException extends RuntimeException { + private static final long serialVersionUID = -9171606393104480607L; private int errorCode; public InternalException() { diff --git a/src/share/classes/com/sun/jdi/InvalidCodeIndexException.java b/src/share/classes/com/sun/jdi/InvalidCodeIndexException.java index 5bdb17802..5959af4c3 100644 --- a/src/share/classes/com/sun/jdi/InvalidCodeIndexException.java +++ b/src/share/classes/com/sun/jdi/InvalidCodeIndexException.java @@ -36,6 +36,7 @@ package com.sun.jdi; */ @Deprecated public class InvalidCodeIndexException extends RuntimeException { + private static final long serialVersionUID = 7416010225133747805L; public InvalidCodeIndexException() { super(); } diff --git a/src/share/classes/com/sun/jdi/InvalidLineNumberException.java b/src/share/classes/com/sun/jdi/InvalidLineNumberException.java index 279fcc017..9e8a476e6 100644 --- a/src/share/classes/com/sun/jdi/InvalidLineNumberException.java +++ b/src/share/classes/com/sun/jdi/InvalidLineNumberException.java @@ -36,6 +36,7 @@ package com.sun.jdi; */ @Deprecated public class InvalidLineNumberException extends RuntimeException { + private static final long serialVersionUID = 4048709912372692875L; public InvalidLineNumberException() { super(); } diff --git a/src/share/classes/com/sun/jdi/InvalidStackFrameException.java b/src/share/classes/com/sun/jdi/InvalidStackFrameException.java index 86f68c8cb..f552e93d9 100644 --- a/src/share/classes/com/sun/jdi/InvalidStackFrameException.java +++ b/src/share/classes/com/sun/jdi/InvalidStackFrameException.java @@ -33,6 +33,7 @@ package com.sun.jdi; * @since 1.3 */ public class InvalidStackFrameException extends RuntimeException { + private static final long serialVersionUID = -1919378296505827922L; public InvalidStackFrameException() { super(); } diff --git a/src/share/classes/com/sun/jdi/InvalidTypeException.java b/src/share/classes/com/sun/jdi/InvalidTypeException.java index c6cfb295d..9797e208b 100644 --- a/src/share/classes/com/sun/jdi/InvalidTypeException.java +++ b/src/share/classes/com/sun/jdi/InvalidTypeException.java @@ -34,6 +34,7 @@ package com.sun.jdi; */ public class InvalidTypeException extends Exception { + private static final long serialVersionUID = 2256667231949650806L; public InvalidTypeException() { super(); diff --git a/src/share/classes/com/sun/jdi/InvocationException.java b/src/share/classes/com/sun/jdi/InvocationException.java index 2130e5318..176f982e9 100644 --- a/src/share/classes/com/sun/jdi/InvocationException.java +++ b/src/share/classes/com/sun/jdi/InvocationException.java @@ -34,6 +34,7 @@ package com.sun.jdi; */ public class InvocationException extends Exception { + private static final long serialVersionUID = 6066780907971918568L; ObjectReference exception; public InvocationException(ObjectReference exception) diff --git a/src/share/classes/com/sun/jdi/JDIPermission.java b/src/share/classes/com/sun/jdi/JDIPermission.java index d915b3d70..2d1174da2 100644 --- a/src/share/classes/com/sun/jdi/JDIPermission.java +++ b/src/share/classes/com/sun/jdi/JDIPermission.java @@ -79,7 +79,7 @@ package com.sun.jdi; */ public final class JDIPermission extends java.security.BasicPermission { - + private static final long serialVersionUID = -6988461416938786271L; /** * The JDIPermission class represents access rights to the * VirtualMachineManager diff --git a/src/share/classes/com/sun/jdi/NativeMethodException.java b/src/share/classes/com/sun/jdi/NativeMethodException.java index b25f47d5b..c1dabad3a 100644 --- a/src/share/classes/com/sun/jdi/NativeMethodException.java +++ b/src/share/classes/com/sun/jdi/NativeMethodException.java @@ -34,6 +34,7 @@ package com.sun.jdi; */ public class NativeMethodException extends RuntimeException { + private static final long serialVersionUID = 3924951669039469992L; public NativeMethodException() { super(); } diff --git a/src/share/classes/com/sun/jdi/ObjectCollectedException.java b/src/share/classes/com/sun/jdi/ObjectCollectedException.java index e31a87cc7..f26f53d93 100644 --- a/src/share/classes/com/sun/jdi/ObjectCollectedException.java +++ b/src/share/classes/com/sun/jdi/ObjectCollectedException.java @@ -33,6 +33,7 @@ package com.sun.jdi; * @since 1.3 */ public class ObjectCollectedException extends RuntimeException { + private static final long serialVersionUID = -1928428056197269588L; public ObjectCollectedException() { super(); } diff --git a/src/share/classes/com/sun/jdi/VMCannotBeModifiedException.java b/src/share/classes/com/sun/jdi/VMCannotBeModifiedException.java index 855c36b7d..d70c55e39 100644 --- a/src/share/classes/com/sun/jdi/VMCannotBeModifiedException.java +++ b/src/share/classes/com/sun/jdi/VMCannotBeModifiedException.java @@ -33,6 +33,7 @@ package com.sun.jdi; * @since 1.5 */ public class VMCannotBeModifiedException extends UnsupportedOperationException { + private static final long serialVersionUID = -4063879815130164009L; public VMCannotBeModifiedException() { super(); } diff --git a/src/share/classes/com/sun/jdi/VMDisconnectedException.java b/src/share/classes/com/sun/jdi/VMDisconnectedException.java index 402599576..8622e7f35 100644 --- a/src/share/classes/com/sun/jdi/VMDisconnectedException.java +++ b/src/share/classes/com/sun/jdi/VMDisconnectedException.java @@ -35,6 +35,7 @@ package com.sun.jdi; */ public class VMDisconnectedException extends RuntimeException { + private static final long serialVersionUID = 2892975269768351637L; public VMDisconnectedException() { super(); } diff --git a/src/share/classes/com/sun/jdi/VMMismatchException.java b/src/share/classes/com/sun/jdi/VMMismatchException.java index cfa7fd694..f3b557568 100644 --- a/src/share/classes/com/sun/jdi/VMMismatchException.java +++ b/src/share/classes/com/sun/jdi/VMMismatchException.java @@ -34,6 +34,7 @@ package com.sun.jdi; * @since 1.3 */ public class VMMismatchException extends RuntimeException { + private static final long serialVersionUID = 289169358790459564L; public VMMismatchException() { super(); } diff --git a/src/share/classes/com/sun/jdi/VMOutOfMemoryException.java b/src/share/classes/com/sun/jdi/VMOutOfMemoryException.java index 0908aa1d4..74f07b4d7 100644 --- a/src/share/classes/com/sun/jdi/VMOutOfMemoryException.java +++ b/src/share/classes/com/sun/jdi/VMOutOfMemoryException.java @@ -33,6 +33,7 @@ package com.sun.jdi; * @since 1.3 */ public class VMOutOfMemoryException extends RuntimeException { + private static final long serialVersionUID = 71504228548910686L; public VMOutOfMemoryException() { super(); } diff --git a/src/share/classes/com/sun/jdi/connect/IllegalConnectorArgumentsException.java b/src/share/classes/com/sun/jdi/connect/IllegalConnectorArgumentsException.java index f8c693d42..004a68564 100644 --- a/src/share/classes/com/sun/jdi/connect/IllegalConnectorArgumentsException.java +++ b/src/share/classes/com/sun/jdi/connect/IllegalConnectorArgumentsException.java @@ -38,6 +38,7 @@ import java.util.Collections; */ public class IllegalConnectorArgumentsException extends Exception { + private static final long serialVersionUID = -3042212603611350941L; List names; /** diff --git a/src/share/classes/com/sun/jdi/connect/TransportTimeoutException.java b/src/share/classes/com/sun/jdi/connect/TransportTimeoutException.java index 759b44f3d..423c9ccf3 100644 --- a/src/share/classes/com/sun/jdi/connect/TransportTimeoutException.java +++ b/src/share/classes/com/sun/jdi/connect/TransportTimeoutException.java @@ -55,7 +55,7 @@ package com.sun.jdi.connect; * @since 1.5 */ public class TransportTimeoutException extends java.io.IOException { - + private static final long serialVersionUID = 4107035242623365074L; /** * Constructs a TransportTimeoutException with no detail * message. diff --git a/src/share/classes/com/sun/jdi/connect/VMStartException.java b/src/share/classes/com/sun/jdi/connect/VMStartException.java index 9eb6fc5e4..93919ff04 100644 --- a/src/share/classes/com/sun/jdi/connect/VMStartException.java +++ b/src/share/classes/com/sun/jdi/connect/VMStartException.java @@ -36,6 +36,7 @@ package com.sun.jdi.connect; */ public class VMStartException extends Exception { + private static final long serialVersionUID = 6408644824640801020L; Process process; public VMStartException(Process process) { diff --git a/src/share/classes/com/sun/jdi/connect/spi/ClosedConnectionException.java b/src/share/classes/com/sun/jdi/connect/spi/ClosedConnectionException.java index 36d8a08a9..e16754774 100644 --- a/src/share/classes/com/sun/jdi/connect/spi/ClosedConnectionException.java +++ b/src/share/classes/com/sun/jdi/connect/spi/ClosedConnectionException.java @@ -46,7 +46,7 @@ package com.sun.jdi.connect.spi; * @since 1.5 */ public class ClosedConnectionException extends java.io.IOException { - + private static final long serialVersionUID = 3877032124297204774L; /** * Constructs a ClosedConnectionException with no detail * message. diff --git a/src/share/classes/com/sun/jdi/request/DuplicateRequestException.java b/src/share/classes/com/sun/jdi/request/DuplicateRequestException.java index 56c8d58e3..731f15d89 100644 --- a/src/share/classes/com/sun/jdi/request/DuplicateRequestException.java +++ b/src/share/classes/com/sun/jdi/request/DuplicateRequestException.java @@ -33,6 +33,7 @@ package com.sun.jdi.request; */ public class DuplicateRequestException extends RuntimeException { + private static final long serialVersionUID = -3719784920313411060L; public DuplicateRequestException() { super(); diff --git a/src/share/classes/com/sun/jdi/request/InvalidRequestStateException.java b/src/share/classes/com/sun/jdi/request/InvalidRequestStateException.java index 674980b5b..b44462066 100644 --- a/src/share/classes/com/sun/jdi/request/InvalidRequestStateException.java +++ b/src/share/classes/com/sun/jdi/request/InvalidRequestStateException.java @@ -36,6 +36,7 @@ package com.sun.jdi.request; * @since 1.3 */ public class InvalidRequestStateException extends RuntimeException { + private static final long serialVersionUID = -3774632428543322148L; public InvalidRequestStateException() { super(); diff --git a/src/share/classes/com/sun/tools/jdi/ArrayReferenceImpl.java b/src/share/classes/com/sun/tools/jdi/ArrayReferenceImpl.java index afeb49be7..5d1ff516d 100644 --- a/src/share/classes/com/sun/tools/jdi/ArrayReferenceImpl.java +++ b/src/share/classes/com/sun/tools/jdi/ArrayReferenceImpl.java @@ -70,8 +70,8 @@ public class ArrayReferenceImpl extends ObjectReferenceImpl } public Value getValue(int index) { - List list = getValues(index, 1); - return (Value)list.get(0); + List list = getValues(index, 1); + return list.get(0); } public List getValues() { diff --git a/src/share/classes/com/sun/tools/jdi/ArrayTypeImpl.java b/src/share/classes/com/sun/tools/jdi/ArrayTypeImpl.java index a10cc0575..b31e8236b 100644 --- a/src/share/classes/com/sun/tools/jdi/ArrayTypeImpl.java +++ b/src/share/classes/com/sun/tools/jdi/ArrayTypeImpl.java @@ -61,7 +61,7 @@ public class ArrayTypeImpl extends ReferenceTypeImpl return findType(componentSignature()); } - void addVisibleMethods(Map map) { + void addVisibleMethods(Map map) { // arrays don't have methods } @@ -83,10 +83,10 @@ public class ArrayTypeImpl extends ReferenceTypeImpl if (PacketStream.isObjectTag(tag)) { // It's a reference type JNITypeParser parser = new JNITypeParser(componentSignature()); - List list = vm.classesByName(parser.typeName()); - Iterator iter = list.iterator(); + List list = vm.classesByName(parser.typeName()); + Iterator iter = list.iterator(); while (iter.hasNext()) { - ReferenceType type = (ReferenceType)iter.next(); + ReferenceType type = iter.next(); ClassLoaderReference cl = type.classLoader(); if ((cl == null)? (classLoader() == null) : diff --git a/src/share/classes/com/sun/tools/jdi/BooleanValueImpl.java b/src/share/classes/com/sun/tools/jdi/BooleanValueImpl.java index b2975baca..c5aaed463 100644 --- a/src/share/classes/com/sun/tools/jdi/BooleanValueImpl.java +++ b/src/share/classes/com/sun/tools/jdi/BooleanValueImpl.java @@ -78,7 +78,7 @@ public class BooleanValueImpl extends PrimitiveValueImpl } public int intValue() { - return(int)((value)?1:0); + return (value)?1:0; } public long longValue() { @@ -90,7 +90,7 @@ public class BooleanValueImpl extends PrimitiveValueImpl } public double doubleValue() { - return(double)((value)?1.0:0.0); + return (value)?1.0:0.0; } public String toString() { diff --git a/src/share/classes/com/sun/tools/jdi/CharValueImpl.java b/src/share/classes/com/sun/tools/jdi/CharValueImpl.java index b29e1cb20..d71a220eb 100644 --- a/src/share/classes/com/sun/tools/jdi/CharValueImpl.java +++ b/src/share/classes/com/sun/tools/jdi/CharValueImpl.java @@ -75,7 +75,7 @@ public class CharValueImpl extends PrimitiveValueImpl } public char charValue() { - return(char)value; + return value; } public short shortValue() { diff --git a/src/share/classes/com/sun/tools/jdi/ClassLoaderReferenceImpl.java b/src/share/classes/com/sun/tools/jdi/ClassLoaderReferenceImpl.java index 8023f1f80..ebac996da 100644 --- a/src/share/classes/com/sun/tools/jdi/ClassLoaderReferenceImpl.java +++ b/src/share/classes/com/sun/tools/jdi/ClassLoaderReferenceImpl.java @@ -80,7 +80,7 @@ public class ClassLoaderReferenceImpl extends ObjectReferenceImpl classes = Collections.unmodifiableList(classes); if (local != null) { local.visibleClasses = classes; - if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) { vm.printTrace(description() + " temporarily caching visible classes (count = " + classes.size() + ")"); @@ -95,9 +95,9 @@ public class ClassLoaderReferenceImpl extends ObjectReferenceImpl Type findType(String signature) throws ClassNotLoadedException { List types = visibleClasses(); - Iterator iter = types.iterator(); + Iterator iter = types.iterator(); while (iter.hasNext()) { - ReferenceType type = (ReferenceType)iter.next(); + ReferenceType type = iter.next(); if (type.signature().equals(signature)) { return type; } diff --git a/src/share/classes/com/sun/tools/jdi/ClassTypeImpl.java b/src/share/classes/com/sun/tools/jdi/ClassTypeImpl.java index 8644957e0..cbb4e7a74 100644 --- a/src/share/classes/com/sun/tools/jdi/ClassTypeImpl.java +++ b/src/share/classes/com/sun/tools/jdi/ClassTypeImpl.java @@ -76,7 +76,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl List immediate = interfaces(); list.addAll(interfaces()); - Iterator iter = immediate.iterator(); + Iterator iter = immediate.iterator(); while (iter.hasNext()) { InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); interfaze.addSuperinterfaces(list); @@ -389,7 +389,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl * overwrite them in the hash table */ - Iterator iter = interfaces().iterator(); + Iterator iter = interfaces().iterator(); while (iter.hasNext()) { InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); interfaze.addVisibleMethods(methodMap); @@ -411,7 +411,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl return true; } else { List interfaces = interfaces(); - Iterator iter = interfaces.iterator(); + Iterator iter = interfaces.iterator(); while (iter.hasNext()) { InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); if (interfaze.isAssignableTo(type)) { diff --git a/src/share/classes/com/sun/tools/jdi/ConcreteMethodImpl.java b/src/share/classes/com/sun/tools/jdi/ConcreteMethodImpl.java index 435255b9e..f2e9233cd 100644 --- a/src/share/classes/com/sun/tools/jdi/ConcreteMethodImpl.java +++ b/src/share/classes/com/sun/tools/jdi/ConcreteMethodImpl.java @@ -192,7 +192,7 @@ public class ConcreteMethodImpl extends MethodImpl { return super.codeIndexToLineInfo(stratum, codeIndex); } - Iterator iter = lineLocations.iterator(); + Iterator iter = lineLocations.iterator(); /* * Treat code before the beginning of the first line table * entry as part of the first line. javac will generate @@ -221,9 +221,9 @@ public class ConcreteMethodImpl extends MethodImpl { List variables = getVariables(); List retList = new ArrayList(2); - Iterator iter = variables.iterator(); + Iterator iter = variables.iterator(); while(iter.hasNext()) { - LocalVariable variable = (LocalVariable)iter.next(); + LocalVariable variable = iter.next(); if (variable.name().equals(name)) { retList.add(variable); } @@ -235,9 +235,9 @@ public class ConcreteMethodImpl extends MethodImpl { List variables = getVariables(); List retList = new ArrayList(variables.size()); - Iterator iter = variables.iterator(); + Iterator iter = variables.iterator(); while(iter.hasNext()) { - LocalVariable variable = (LocalVariable)iter.next(); + LocalVariable variable = iter.next(); if (variable.isArgument()) { retList.add(variable); } @@ -291,7 +291,7 @@ public class ConcreteMethodImpl extends MethodImpl { SDE.LineStratum lastLineStratum = null; SDE.Stratum baseStratum = declaringType.stratum(SDE.BASE_STRATUM_NAME); - Iterator it = getBaseLocations().lineLocations.iterator(); + Iterator it = getBaseLocations().lineLocations.iterator(); while(it.hasNext()) { LocationImpl loc = (LocationImpl)it.next(); int baseLineNumber = loc.lineNumber(baseStratum); diff --git a/src/share/classes/com/sun/tools/jdi/ConnectorImpl.java b/src/share/classes/com/sun/tools/jdi/ConnectorImpl.java index 3b594b90f..e777a6cba 100644 --- a/src/share/classes/com/sun/tools/jdi/ConnectorImpl.java +++ b/src/share/classes/com/sun/tools/jdi/ConnectorImpl.java @@ -47,9 +47,9 @@ abstract class ConnectorImpl implements Connector { public Map defaultArguments() { Map defaults = new java.util.LinkedHashMap(); - Collection values = defaultArguments.values(); + Collection values = defaultArguments.values(); - Iterator iter = values.iterator(); + Iterator iter = values.iterator(); while (iter.hasNext()) { ArgumentImpl argument = (ArgumentImpl)iter.next(); defaults.put(argument.name(), (Argument)argument.clone()); @@ -96,7 +96,7 @@ abstract class ConnectorImpl implements Connector { mustSpecify, list)); } - ArgumentImpl argument(String name, Map arguments) + ArgumentImpl argument(String name, Map arguments) throws IllegalConnectorArgumentsException { ArgumentImpl argument = (ArgumentImpl)arguments.get(name); @@ -130,7 +130,7 @@ abstract class ConnectorImpl implements Connector { public String toString() { String string = name() + " (defaults: "; - Iterator iter = defaultArguments().values().iterator(); + Iterator iter = defaultArguments().values().iterator(); boolean first = true; while (iter.hasNext()) { ArgumentImpl argument = (ArgumentImpl)iter.next(); @@ -222,7 +222,7 @@ abstract class ConnectorImpl implements Connector { class BooleanArgumentImpl extends ConnectorImpl.ArgumentImpl implements Connector.BooleanArgument { - + private static final long serialVersionUID = 1624542968639361316L; BooleanArgumentImpl(String name, String label, String description, boolean value, boolean mustSpecify) { @@ -277,7 +277,7 @@ abstract class ConnectorImpl implements Connector { class IntegerArgumentImpl extends ConnectorImpl.ArgumentImpl implements Connector.IntegerArgument { - + private static final long serialVersionUID = 763286081923797770L; private final int min; private final int max; @@ -378,7 +378,7 @@ abstract class ConnectorImpl implements Connector { class StringArgumentImpl extends ConnectorImpl.ArgumentImpl implements Connector.StringArgument { - + private static final long serialVersionUID = 7500484902692107464L; StringArgumentImpl(String name, String label, String description, String value, boolean mustSpecify) { @@ -396,7 +396,7 @@ abstract class ConnectorImpl implements Connector { class SelectedArgumentImpl extends ConnectorImpl.ArgumentImpl implements Connector.SelectedArgument { - + private static final long serialVersionUID = -5689584530908382517L; private final List choices; SelectedArgumentImpl(String name, String label, String description, diff --git a/src/share/classes/com/sun/tools/jdi/DoubleValueImpl.java b/src/share/classes/com/sun/tools/jdi/DoubleValueImpl.java index 5f6d38738..ef98b8d82 100644 --- a/src/share/classes/com/sun/tools/jdi/DoubleValueImpl.java +++ b/src/share/classes/com/sun/tools/jdi/DoubleValueImpl.java @@ -101,7 +101,7 @@ public class DoubleValueImpl extends PrimitiveValueImpl } public double doubleValue() { - return(double)value; + return value; } byte checkedByteValue() throws InvalidTypeException { diff --git a/src/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java b/src/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java index d9f27f6bd..60ace7f0f 100644 --- a/src/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java +++ b/src/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java @@ -43,7 +43,7 @@ import java.util.*; class EventRequestManagerImpl extends MirrorImpl implements EventRequestManager { - List[] requestLists; + List[] requestLists; private static int methodExitEventCmd = 0; static int JDWPtoJDISuspendPolicy(byte jdwpPolicy) { @@ -91,7 +91,7 @@ class EventRequestManagerImpl extends MirrorImpl * access/modification should be protected by synchronizing on * the enclosing instance of EventRequestImpl. */ - List filters = new ArrayList(); + List filters = new ArrayList<>(); boolean isEnabled = false; boolean deleted = false; @@ -195,7 +195,6 @@ class EventRequestManagerImpl extends MirrorImpl */ synchronized void set() { JDWP.EventRequest.Set.Modifier[] mods = - (JDWP.EventRequest.Set.Modifier[]) filters.toArray( new JDWP.EventRequest.Set.Modifier[filters.size()]); try { @@ -582,10 +581,10 @@ class EventRequestManagerImpl extends MirrorImpl /* * Make sure this isn't a duplicate */ - List requests = stepRequests(); - Iterator iter = requests.iterator(); + List requests = stepRequests(); + Iterator iter = requests.iterator(); while (iter.hasNext()) { - StepRequest request = (StepRequest)iter.next(); + StepRequest request = iter.next(); if ((request != this) && request.isEnabled() && request.thread().equals(thread)) { @@ -735,7 +734,7 @@ class EventRequestManagerImpl extends MirrorImpl } requestLists = new List[highest+1]; for (int i=0; i <= highest; i++) { - requestLists[i] = new ArrayList(); + requestLists[i] = new ArrayList<>(); } } @@ -852,7 +851,7 @@ class EventRequestManagerImpl extends MirrorImpl public void deleteEventRequests(List eventRequests) { validateMirrors(eventRequests); // copy the eventRequests to avoid ConcurrentModificationException - Iterator iter = (new ArrayList(eventRequests)).iterator(); + Iterator iter = (new ArrayList<>(eventRequests)).iterator(); while (iter.hasNext()) { ((EventRequestImpl)iter.next()).delete(); } @@ -869,76 +868,76 @@ class EventRequestManagerImpl extends MirrorImpl } public List stepRequests() { - return unmodifiableRequestList(JDWP.EventKind.SINGLE_STEP); + return (List)unmodifiableRequestList(JDWP.EventKind.SINGLE_STEP); } public List classPrepareRequests() { - return unmodifiableRequestList(JDWP.EventKind.CLASS_PREPARE); + return (List)unmodifiableRequestList(JDWP.EventKind.CLASS_PREPARE); } public List classUnloadRequests() { - return unmodifiableRequestList(JDWP.EventKind.CLASS_UNLOAD); + return (List)unmodifiableRequestList(JDWP.EventKind.CLASS_UNLOAD); } public List threadStartRequests() { - return unmodifiableRequestList(JDWP.EventKind.THREAD_START); + return (List)unmodifiableRequestList(JDWP.EventKind.THREAD_START); } public List threadDeathRequests() { - return unmodifiableRequestList(JDWP.EventKind.THREAD_DEATH); + return (List)unmodifiableRequestList(JDWP.EventKind.THREAD_DEATH); } public List exceptionRequests() { - return unmodifiableRequestList(JDWP.EventKind.EXCEPTION); + return (List)unmodifiableRequestList(JDWP.EventKind.EXCEPTION); } public List breakpointRequests() { - return unmodifiableRequestList(JDWP.EventKind.BREAKPOINT); + return (List)unmodifiableRequestList(JDWP.EventKind.BREAKPOINT); } public List accessWatchpointRequests() { - return unmodifiableRequestList(JDWP.EventKind.FIELD_ACCESS); + return (List)unmodifiableRequestList(JDWP.EventKind.FIELD_ACCESS); } public List modificationWatchpointRequests() { - return unmodifiableRequestList(JDWP.EventKind.FIELD_MODIFICATION); + return (List)unmodifiableRequestList(JDWP.EventKind.FIELD_MODIFICATION); } public List methodEntryRequests() { - return unmodifiableRequestList(JDWP.EventKind.METHOD_ENTRY); + return (List)unmodifiableRequestList(JDWP.EventKind.METHOD_ENTRY); } public List methodExitRequests() { - return unmodifiableRequestList( + return (List)unmodifiableRequestList( EventRequestManagerImpl.methodExitEventCmd); } public List monitorContendedEnterRequests() { - return unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTER); + return (List)unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTER); } public List monitorContendedEnteredRequests() { - return unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTERED); + return (List)unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTERED); } public List monitorWaitRequests() { - return unmodifiableRequestList(JDWP.EventKind.MONITOR_WAIT); + return (List)unmodifiableRequestList(JDWP.EventKind.MONITOR_WAIT); } public List monitorWaitedRequests() { - return unmodifiableRequestList(JDWP.EventKind.MONITOR_WAITED); + return (List)unmodifiableRequestList(JDWP.EventKind.MONITOR_WAITED); } public List vmDeathRequests() { - return unmodifiableRequestList(JDWP.EventKind.VM_DEATH); + return (List)unmodifiableRequestList(JDWP.EventKind.VM_DEATH); } - List unmodifiableRequestList(int eventCmd) { + List unmodifiableRequestList(int eventCmd) { return Collections.unmodifiableList(requestList(eventCmd)); } EventRequest request(int eventCmd, int requestId) { - List rl = requestList(eventCmd); + List rl = requestList(eventCmd); for (int i = rl.size() - 1; i >= 0; i--) { EventRequestImpl er = (EventRequestImpl)rl.get(i); if (er.id == requestId) { diff --git a/src/share/classes/com/sun/tools/jdi/EventSetImpl.java b/src/share/classes/com/sun/tools/jdi/EventSetImpl.java index ad3d7e4c5..caead97f9 100644 --- a/src/share/classes/com/sun/tools/jdi/EventSetImpl.java +++ b/src/share/classes/com/sun/tools/jdi/EventSetImpl.java @@ -47,7 +47,7 @@ enum EventDestination {UNKNOWN_EVENT, INTERNAL_EVENT, CLIENT_EVENT}; * that is on the queues are all for client requests. */ public class EventSetImpl extends ArrayList implements EventSet { - + private static final long serialVersionUID = -4857338819787924570L; private VirtualMachineImpl vm; // we implement Mirror private Packet pkt; private byte suspendPolicy; @@ -607,7 +607,7 @@ public class EventSetImpl extends ArrayList implements EventSet { PacketStream ps = new PacketStream(vm, pkt); JDWP.Event.Composite compEvt = new JDWP.Event.Composite(vm, ps); suspendPolicy = compEvt.suspendPolicy; - if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) { switch(suspendPolicy) { case JDWP.SuspendPolicy.ALL: vm.printTrace("EventSet: SUSPEND_ALL"); @@ -626,7 +626,7 @@ public class EventSetImpl extends ArrayList implements EventSet { ThreadReference fix6485605 = null; for (int i = 0; i < compEvt.events.length; i++) { EventImpl evt = createEvent(compEvt.events[i]); - if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) { try { vm.printTrace("Event: " + evt); } catch (VMDisconnectedException ee) { diff --git a/src/share/classes/com/sun/tools/jdi/FloatValueImpl.java b/src/share/classes/com/sun/tools/jdi/FloatValueImpl.java index cf100d2e2..182e4fb3a 100644 --- a/src/share/classes/com/sun/tools/jdi/FloatValueImpl.java +++ b/src/share/classes/com/sun/tools/jdi/FloatValueImpl.java @@ -97,7 +97,7 @@ public class FloatValueImpl extends PrimitiveValueImpl } public float floatValue() { - return(float)value; + return value; } public double doubleValue() { diff --git a/src/share/classes/com/sun/tools/jdi/GenericAttachingConnector.java b/src/share/classes/com/sun/tools/jdi/GenericAttachingConnector.java index 39d087ef5..6b86eb3f1 100644 --- a/src/share/classes/com/sun/tools/jdi/GenericAttachingConnector.java +++ b/src/share/classes/com/sun/tools/jdi/GenericAttachingConnector.java @@ -105,7 +105,7 @@ public class GenericAttachingConnector /** * 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 args) throws IOException, IllegalConnectorArgumentsException { String ts = argument(ARG_TIMEOUT, args).value(); diff --git a/src/share/classes/com/sun/tools/jdi/IntegerValueImpl.java b/src/share/classes/com/sun/tools/jdi/IntegerValueImpl.java index c4551032c..5de8a5708 100644 --- a/src/share/classes/com/sun/tools/jdi/IntegerValueImpl.java +++ b/src/share/classes/com/sun/tools/jdi/IntegerValueImpl.java @@ -83,7 +83,7 @@ public class IntegerValueImpl extends PrimitiveValueImpl } public int intValue() { - return(int)value; + return value; } public long longValue() { diff --git a/src/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java b/src/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java index 2de46373c..a408c7718 100644 --- a/src/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java +++ b/src/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java @@ -128,9 +128,9 @@ public class InterfaceTypeImpl extends ReferenceTypeImpl * list being built. */ List immediate = new ArrayList(superinterfaces()); - Iterator iter = immediate.iterator(); + Iterator iter = immediate.iterator(); while (iter.hasNext()) { - InterfaceType interfaze = (InterfaceType)iter.next(); + InterfaceType interfaze = iter.next(); if (list.contains(interfaze)) { iter.remove(); } diff --git a/src/share/classes/com/sun/tools/jdi/InternalEventHandler.java b/src/share/classes/com/sun/tools/jdi/InternalEventHandler.java index d8b02fb12..f554fc94a 100644 --- a/src/share/classes/com/sun/tools/jdi/InternalEventHandler.java +++ b/src/share/classes/com/sun/tools/jdi/InternalEventHandler.java @@ -59,7 +59,7 @@ public class InternalEventHandler implements Runnable ClassUnloadEvent cuEvent = (ClassUnloadEvent)event; vm.removeReferenceType(cuEvent.classSignature()); - if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) { vm.printTrace("Handled Unload Event for " + cuEvent.classSignature()); } @@ -68,7 +68,7 @@ public class InternalEventHandler implements Runnable ((ReferenceTypeImpl)cpEvent.referenceType()) .markPrepared(); - if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) { vm.printTrace("Handled Prepare Event for " + cpEvent.referenceType().name()); } diff --git a/src/share/classes/com/sun/tools/jdi/JDWPException.java b/src/share/classes/com/sun/tools/jdi/JDWPException.java index 125689c6c..3d0cc4d22 100644 --- a/src/share/classes/com/sun/tools/jdi/JDWPException.java +++ b/src/share/classes/com/sun/tools/jdi/JDWPException.java @@ -27,7 +27,7 @@ package com.sun.tools.jdi; import com.sun.jdi.*; class JDWPException extends Exception { - + private static final long serialVersionUID = -6321344442751299874L; short errorCode; JDWPException(short errorCode) { diff --git a/src/share/classes/com/sun/tools/jdi/LinkedHashMap.java b/src/share/classes/com/sun/tools/jdi/LinkedHashMap.java deleted file mode 100644 index fb055ee25..000000000 --- a/src/share/classes/com/sun/tools/jdi/LinkedHashMap.java +++ /dev/null @@ -1,904 +0,0 @@ -/* - * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.tools.jdi; - -import java.io.*; -import java.util.*; - -/** - * Hash table based implementation of the Map interface. This implementation - * provides all of the optional Map operations, and permits null values and - * the null key. (HashMap is roughly equivalent to Hashtable, except that it - * is unsynchronized and permits nulls.) In addition, elements in the map are - * ordered and doubly linked together. - *

- * This implementation provides constant-time performance for the basic - * operations (get and put), assuming the the hash function disperses the - * elements properly among the buckets. Iteration over Collection views - * requires time proportional to its size (the number of key-value mappings) - * and returns elements in the order they are linked. In a HashMap the - * iteration would require time proportional to the capacity of the map - * plus the map size. - *

- * An instance of LinkedHashMap has two parameters that affect its efficiency: - * its capacity and its load factor. The load factor should be - * between 0.0 and 1.0. When the number of mappings in the LinkedHashMap exceeds - * the product of the load factor and the current capacity, the capacity is - * increased by calling the rehash method which requires time proportional - * to the number of key-value mappings in the map. Larger load factors - * use memory more efficiently, at the expense of larger expected time per - * lookup. - *

- * If many mappings are to be stored in a LinkedHashMap, creating it with a - * sufficiently large capacity will allow the mappings to be stored more - * efficiently than letting it perform automatic rehashing as needed to grow - * the table. - *

- * Note that this implementation is not synchronized. If - * multiple threads access a LinkedHashMap concurrently, and at least one of the - * threads modifies the LinkedHashMap structurally, it must be - * synchronized externally. (A structural modification is any operation that - * adds or deletes one or more mappings; merely changing the value associated - * with a key that is already contained in the Table is not a structural - * modification.) This is typically accomplished by synchronizing on some - * object that naturally encapsulates the LinkedHashMap. If no such object - * exists, the LinkedHashMap should be "wrapped" using the - * Collections.synchronizedSet method. This is best done at creation time, to - * prevent accidental unsynchronized access to the LinkedHashMap: - *

- *      Map m = Collections.synchronizedMap(new LinkedHashMap(...));
- * 
- *

- * The Iterators returned by the iterator methods of the Collections returned - * by all of LinkedHashMap's "collection view methods" are fail-fast: - * if the LinkedHashMap is structurally modified at any time after the Iterator - * is created, in any way except through the Iterator's own remove or add - * methods, the Iterator will throw a ConcurrentModificationException. Thus, - * in the face of concurrent modification, the Iterator fails quickly and - * cleanly, rather than risking arbitrary, non-deterministic behavior at an - * undetermined time in the future. - * - * @author Josh Bloch - * @author Arthur van Hoff - * @author Zhenghua Li - * @see Object#hashCode() - * @see java.util.Collection - * @see java.util.Map - * @see java.util.TreeMap - * @see java.util.Hashtable - * @see java.util.HashMap - */ - -import java.io.Serializable; - -public class LinkedHashMap extends AbstractMap implements Map, Serializable { - /** - * The hash table data. - */ - private transient Entry table[]; - - /** - * The head of the double linked list. - */ - private transient Entry header; - - /** - * The total number of mappings in the hash table. - */ - private transient int count; - - /** - * Rehashes the table when count exceeds this threshold. - */ - private int threshold; - - /** - * The load factor for the LinkedHashMap. - */ - private float loadFactor; - - /** - * The number of times this LinkedHashMap has been structurally modified - * Structural modifications are those that change the number of mappings in - * the LinkedHashMap or otherwise modify its internal structure (e.g., - * rehash). This field is used to make iterators on Collection-views of - * the LinkedHashMap fail-fast. (See ConcurrentModificationException). - */ - private transient int modCount = 0; - - /** - * Constructs a new, empty LinkedHashMap with the specified initial - * capacity and the specified load factor. - * - * @param initialCapacity the initial capacity of the LinkedHashMap. - * @param loadFactor a number between 0.0 and 1.0. - * @exception IllegalArgumentException if the initial capacity is less - * than or equal to zero, or if the load factor is less than - * or equal to zero. - */ - public LinkedHashMap(int initialCapacity, float loadFactor) { - if (initialCapacity < 0) - throw new IllegalArgumentException("Illegal Initial Capacity: "+ - initialCapacity); - if ((loadFactor > 1) || (loadFactor <= 0)) - throw new IllegalArgumentException("Illegal Load factor: "+ - loadFactor); - if (initialCapacity==0) - initialCapacity = 1; - this.loadFactor = loadFactor; - table = new Entry[initialCapacity]; - threshold = (int)(initialCapacity * loadFactor); - header = new Entry(-1, null, null, null); - header.before = header.after = header; - } - - /** - * Constructs a new, empty LinkedHashMap with the specified initial capacity - * and default load factor. - * - * @param initialCapacity the initial capacity of the LinkedHashMap. - */ - public LinkedHashMap(int initialCapacity) { - this(initialCapacity, 0.75f); - } - - /** - * Constructs a new, empty LinkedHashMap with a default capacity and load - * factor. - */ - public LinkedHashMap() { - this(101, 0.75f); - } - - /** - * Constructs a new LinkedHashMap with the same mappings as the given - * Map. The LinkedHashMap is created with a capacity of thrice the number - * of mappings in the given Map or 11 (whichever is greater), and a - * default load factor. - */ - public LinkedHashMap(Map t) { - this(Math.max(3*t.size(), 11), 0.75f); - putAll(t); - } - - /** - * Returns the number of key-value mappings in this Map. - */ - public int size() { - return count; - } - - /** - * Returns true if this Map contains no key-value mappings. - */ - public boolean isEmpty() { - return count == 0; - } - - /** - * Returns true if this LinkedHashMap maps one or more keys to the specified - * value. - * - * @param value value whose presence in this Map is to be tested. - */ - public boolean containsValue(Object value) { - if (value==null) { - for (Entry e = header.after; e != header; e = e.after) - if (e.value==null) - return true; - } else { - for (Entry e = header.after; e != header; e = e.after) - if (value.equals(e.value)) - return true; - } - return false; - } - - /** - * Returns true if this LinkedHashMap contains a mapping for the specified - * key. - * - * @param key key whose presence in this Map is to be tested. - */ - public boolean containsKey(Object key) { - Entry tab[] = table; - if (key != null) { - int hash = key.hashCode(); - int index = (hash & 0x7FFFFFFF) % tab.length; - for (Entry e = tab[index]; e != null; e = e.next) - if (e.hash==hash && e.key.equals(key)) - return true; - } else { - for (Entry e = tab[0]; e != null; e = e.next) - if (e.key==null) - return true; - } - - return false; - } - - /** - * Returns the value to which this LinkedHashMap maps the specified key. - * Returns null if the LinkedHashMap contains no mapping for this key. - * A return value of null does not necessarily indicate that the - * LinkedHashMap contains no mapping for the key; it's also possible that - * the LinkedHashMap explicitly maps the key to null. The containsKey - * operation may be used to distinguish these two cases. - * - * @param key key whose associated value is to be returned. - */ - public Object get(Object key) { - Entry e = getEntry(key); - return e==null ? null : e.value; - } - - /** - * Returns the entry associated with the specified key in the LinkedHashMap. - * Returns null if the LinkedHashMap contains no mapping for this key. - */ - private Entry getEntry(Object key) { - Entry tab[] = table; - - if (key != null) { - int hash = key.hashCode(); - int index = (hash & 0x7FFFFFFF) % tab.length; - for (Entry e = tab[index]; e != null; e = e.next) - if ((e.hash == hash) && e.key.equals(key)) - return e; - } else { - for (Entry e = tab[0]; e != null; e = e.next) - if (e.key==null) - return e; - } - - return null; - } - - /** - * Rehashes the contents of the LinkedHashMap into a LinkedHashMap with a - * larger capacity. This method is called automatically when the - * number of keys in the LinkedHashMap exceeds this LinkedHashMap's capacity - * and load factor. - */ - private void rehash() { - int oldCapacity = table.length; - Entry oldMap[] = table; - - int newCapacity = oldCapacity * 2 + 1; - Entry newMap[] = new Entry[newCapacity]; - - modCount++; - threshold = (int)(newCapacity * loadFactor); - table = newMap; - - for (Entry e = header.after; e != header; e = e.after) { - int index = (e.hash & 0x7FFFFFFF) % newCapacity; - e.next = newMap[index]; - newMap[index] = e; - } - } - - /** - * Remove an entry from the linked list. - */ - private void listRemove(Entry entry) { - if (entry == null) { - return; - } - entry.before.after = entry.after; - entry.after.before = entry.before; - } - - /** - * Add the specified entry before the specified existing entry to - * the linked list. - */ - private void listAddBefore(Entry entry, Entry existEntry) { - entry.after = existEntry; - entry.before = existEntry.before; - entry.before.after = entry; - entry.after.before = entry; - } - - /** - * Returns the position of the mapping for the specified key - * in the ordered map. - * - * @param key the specified key. - * @return index of the key mapping. - */ - public int indexOf(Object key) { - int i = 0; - if (key == null) { - for (Entry e = header.after; e != header; e = e.after, i++) - if (e.key == null) - return i; - } else { - for (Entry e = header.after; e != header; e = e.after, i++) - if(key.equals(e.key)) - return i; - } - return -1; - } - - /** - * Associates the specified value with the specified key in this - * LinkedHashMap. If the LinkedHashMap previously contained a mapping for - * this key, the old value is replaced and the position of this mapping - * entry in the double linked list remains the same. Otherwise, a new - * mapping entry is created and inserted into the list before the specified - * existing mapping entry. The method returns the previous value associated - * with the specified key, or null if there was no mapping for key. A null - * return can also indicate that the LinkedHashMap previously associated - * null with the specified key. - */ - private Object putAhead(Object key, Object value, Entry existEntry) { - // Makes sure the key is not already in the LinkedHashMap. - Entry tab[] = table; - int hash = 0; - int index = 0; - - if (key != null) { - hash = key.hashCode(); - index = (hash & 0x7FFFFFFF) % tab.length; - for (Entry e = tab[index] ; e != null ; e = e.next) { - if ((e.hash == hash) && e.key.equals(key)) { - Object old = e.value; - e.value = value; - return old; - } - } - } else { - for (Entry e = tab[0] ; e != null ; e = e.next) { - if (e.key == null) { - Object old = e.value; - e.value = value; - return old; - } - } - } - - modCount++; - if (count >= threshold) { - // Rehash the table if the threshold is exceeded - rehash(); - tab = table; - index = (hash & 0x7FFFFFFF) % tab.length; - } - - // Creates the new entry. - Entry e = new Entry(hash, key, value, tab[index]); - tab[index] = e; - listAddBefore(e, existEntry); - count++; - return null; - } - - /** - * Associates the specified value with the specified key in this - * LinkedHashMap and position the mapping at the specified index. - * If the LinkedHashMap previously contained a mapping for this key, - * the old value is replaced and the position of this mapping entry - * in the double linked list remains the same. Otherwise, a new mapping - * entry is created and inserted into the list at the specified - * position. - * - * @param index the position to put the key-value mapping. - * @param key key with which the specified value is to be associated. - * @param value value to be associated with the specified key. - * @return previous value associated with specified key, or null if there - * was no mapping for key. A null return can also indicate that - * the LinkedHashMap previously associated null with the specified - * key. - */ - public Object put(int index, Object key, Object value) { - if (index < 0 || index > count) - throw new IndexOutOfBoundsException(); - Entry e = header.after; - if (index == count) - return putAhead(key, value, header); //fast approach for append - else { - for (int i = 0; i < index; i++) - e = e.after; - return putAhead(key, value, e); - } - } - - - /** - * Associates the specified value with the specified key in this - * LinkedHashMap. If the LinkedHashMap previously contained a mapping for - * this key, the old value is replaced. The mapping entry is also appended - * to the end of the ordered linked list. - * - * @param key key with which the specified value is to be associated. - * @param value value to be associated with the specified key. - * @return previous value associated with specified key, or null if there - * was no mapping for key. A null return can also indicate that - * the LinkedHashMap previously associated null with the specified - * key. - */ - public Object put(Object key, Object value) { - return putAhead(key, value, header); - } - - /** - * Removes the mapping for this key from this LinkedHashMap if present. - * The mapping would also be removed from the double linked list. - * - * @param key key whose mapping is to be removed from the Map. - * @return previous value associated with specified key, or null if there - * was no mapping for key. A null return can also indicate that - * the LinkedHashMap previously associated null with the specified - * key. - */ - public Object remove(Object key) { - Entry tab[] = table; - - if (key != null) { - int hash = key.hashCode(); - int index = (hash & 0x7FFFFFFF) % tab.length; - - for (Entry e = tab[index], prev = null; e != null; - prev = e, e = e.next) { - if ((e.hash == hash) && e.key.equals(key)) { - modCount++; - if (prev != null) - prev.next = e.next; - else - tab[index] = e.next; - - count--; - Object oldValue = e.value; - e.value = null; - - listRemove(e); - return oldValue; - } - } - } else { - for (Entry e = tab[0], prev = null; e != null; - prev = e, e = e.next) { - if (e.key == null) { - modCount++; - if (prev != null) - prev.next = e.next; - else - tab[0] = e.next; - - count--; - Object oldValue = e.value; - e.value = null; - - listRemove(e); - return oldValue; - } - } - } - - return null; - } - - /** - * Copies all of the mappings from the specified Map to this LinkedHashMap - * These mappings will replace any mappings that this LinkedHashMap had for - * any of the keys currently in the specified Map. - * - * @param t Mappings to be stored in this Map. - */ - public void putAll(Map t) { - Iterator i = t.entrySet().iterator(); - while (i.hasNext()) { - Map.Entry e = (Map.Entry) i.next(); - put(e.getKey(), e.getValue()); - } - } - - /** - * Removes all mappings from this LinkedHashMap. - */ - public void clear() { - Entry tab[] = table; - modCount++; - for (int index = tab.length; --index >= 0; ) - tab[index] = null; - count = 0; - header.before = header.after = header; - } - - /** - * Returns a shallow copy of this LinkedHashMap. The keys and values - * themselves are not cloned. - */ - public Object clone() { - return new LinkedHashMap(this); - } - - // Views - - private transient Set keySet = null; - private transient Set entries = null; - private transient Collection values = null; - - /** - * Returns a Set view of the keys contained in this LinkedHashMap. The Set - * is backed by the LinkedHashMap, so changes to the LinkedHashMap are - * reflected in the Set, and vice-versa. The Set supports element removal, - * which removes the corresponding mapping from the LinkedHashMap, via the - * Iterator.remove, Set.remove, removeAll retainAll, and clear operations. - * It does not support the add or addAll operations. - */ - public Set keySet() { - if (keySet == null) { - keySet = new AbstractSet() { - public Iterator iterator() { - return new HashIterator(KEYS); - } - public int size() { - return count; - } - public boolean contains(Object o) { - return containsKey(o); - } - public boolean remove(Object o) { - return LinkedHashMap.this.remove(o) != null; - } - public void clear() { - LinkedHashMap.this.clear(); - } - }; - } - return keySet; - } - - /** - * Returns a Collection view of the values contained in this LinkedHashMap. - * The Collection is backed by the LinkedHashMap, so changes to the - * LinkedHashMap are reflected in the Collection, and vice-versa. The - * Collection supports element removal, which removes the corresponding - * mapping from the LinkedHashMap, via the Iterator.remove, - * Collection.remove, removeAll, retainAll and clear operations. It does - * not support the add or addAll operations. - */ - public Collection values() { - if (values==null) { - values = new AbstractCollection() { - public Iterator iterator() { - return new HashIterator(VALUES); - } - public int size() { - return count; - } - public boolean contains(Object o) { - return containsValue(o); - } - public void clear() { - LinkedHashMap.this.clear(); - } - }; - } - return values; - } - - /** - * Returns a Collection view of the mappings contained in this - * LinkedHashMap. Each element in the returned collection is a Map.Entry. - * The Collection is backed by the LinkedHashMap, so changes to the - * LinkedHashMap are reflected in the Collection, and vice-versa. The - * Collection supports element removal, which removes the corresponding - * mapping from the LinkedHashMap, via the Iterator.remove, - * Collection.remove, removeAll, retainAll and clear operations. It does - * not support the add or addAll operations. - * - * @see java.util.Map.Entry - */ - public Set entrySet() { - if (entries==null) { - entries = new AbstractSet() { - public Iterator iterator() { - return new HashIterator(ENTRIES); - } - - public boolean contains(Object o) { - if (!(o instanceof Map.Entry)) - return false; - Map.Entry entry = (Map.Entry)o; - Object key = entry.getKey(); - Entry tab[] = table; - int hash = (key==null ? 0 : key.hashCode()); - int index = (hash & 0x7FFFFFFF) % tab.length; - - for (Entry e = tab[index]; e != null; e = e.next) - if (e.hash==hash && e.equals(entry)) - return true; - return false; - } - - public boolean remove(Object o) { - if (!(o instanceof Map.Entry)) - return false; - Map.Entry entry = (Map.Entry)o; - Object key = entry.getKey(); - Entry tab[] = table; - int hash = (key==null ? 0 : key.hashCode()); - int index = (hash & 0x7FFFFFFF) % tab.length; - - for (Entry e = tab[index], prev = null; e != null; - prev = e, e = e.next) { - if (e.hash==hash && e.equals(entry)) { - modCount++; - if (prev != null) - prev.next = e.next; - else - tab[index] = e.next; - - count--; - e.value = null; - listRemove(e); - return true; - } - } - return false; - } - - public int size() { - return count; - } - - public void clear() { - LinkedHashMap.this.clear(); - } - }; - } - - return entries; - } - - /** - * Compares the specified Object with this Map for equality. - * Returns true if the given object is also a LinkedHashMap and the two - * Maps represent the same mappings in the same order. More formally, - * two Maps t1 and t2 represent the same mappings - * if t1.keySet().equals(t2.keySet()) and for every - * key k in t1.keySet(), - * (t1.get(k)==null ? t2.get(k)==null : t1.get(k).equals(t2.get(k))) - * . - *

- * This implementation first checks if the specified Object is this Map; - * if so it returns true. Then, it checks if the specified Object is - * a Map whose size is identical to the size of this Set; if not, it - * it returns false. If so, it iterates over this Map and the specified - * Map's entrySet() Collection, and checks that the specified Map contains - * each mapping that this Map contains at the same position. If the - * specified Map fails to contain such a mapping in the right order, false - * is returned. If the iteration completes, true is returned. - * - * @param o Object to be compared for equality with this Map. - * @return true if the specified Object is equal to this Map. - * - */ - public boolean equals(Object o) { - if (o == this) - return true; - - if (!(o instanceof LinkedHashMap)) - return false; - LinkedHashMap t = (LinkedHashMap) o; - if (t.size() != size()) - return false; - - Iterator i1 = entrySet().iterator(); - Iterator i2 = t.entrySet().iterator(); - - while (i1.hasNext()) { - Entry e1 = (Entry) i1.next(); - Entry e2 = (Entry) i2.next(); - - Object key1 = e1.getKey(); - Object value1 = e1.getValue(); - Object key2 = e2.getKey(); - Object value2 = e2.getValue(); - - if ((key1 == null ? key2 == null : key1.equals(key2)) && - (value1 == null ? value2 == null : value1.equals(value2))) { - continue; - } else { - return false; - } - } - return true; - } - - /** - * LinkedHashMap collision list entry. - */ - private static class Entry implements Map.Entry { - int hash; - Object key; - Object value; - Entry next; - - // These fields comprise the doubly linked list that is used for - // iteration. - Entry before, after; - - Entry(int hash, Object key, Object value, Entry next) { - this.hash = hash; - this.key = key; - this.value = value; - this.next = next; - } - - // Map.Entry Ops - - public Object getKey() { - return key; - } - - public Object getValue() { - return value; - } - - public Object setValue(Object value) { - Object oldValue = this.value; - this.value = value; - return oldValue; - } - - public boolean equals(Object o) { - if (!(o instanceof Map.Entry)) - return false; - Map.Entry e = (Map.Entry)o; - - return (key==null ? e.getKey()==null : key.equals(e.getKey())) && - (value==null ? e.getValue()==null : value.equals(e.getValue())); - } - - public int hashCode() { - return hash ^ (value==null ? 0 : value.hashCode()); - } - - public String toString() { - return key+"="+value; - } - } - - // Types of Iterators - private static final int KEYS = 0; - private static final int VALUES = 1; - private static final int ENTRIES = 2; - - private class HashIterator implements Iterator { - private Entry[] table = LinkedHashMap.this.table; - private Entry entry = null; - private Entry lastReturned = null; - private int type; - - /** - * The modCount value that the iterator believes that the backing - * List should have. If this expectation is violated, the iterator - * has detected concurrent modification. - */ - private int expectedModCount = modCount; - - HashIterator(int type) { - this.type = type; - this.entry = LinkedHashMap.this.header.after; - } - - public boolean hasNext() { - return entry != header; - } - - public Object next() { - if (modCount != expectedModCount) - throw new ConcurrentModificationException(); - if (entry == LinkedHashMap.this.header) - throw new NoSuchElementException(); - - Entry e = lastReturned = entry; - entry = e.after; - return type == KEYS ? e.key : (type == VALUES ? e.value : e); - } - - public void remove() { - if (lastReturned == null) - throw new IllegalStateException(); - if (modCount != expectedModCount) - throw new ConcurrentModificationException(); - - Entry[] tab = LinkedHashMap.this.table; - int index = (lastReturned.hash & 0x7FFFFFFF) % tab.length; - - for (Entry e = tab[index], prev = null; e != null; - prev = e, e = e.next) { - if (e == lastReturned) { - modCount++; - expectedModCount++; - if (prev == null) - tab[index] = e.next; - else - prev.next = e.next; - count--; - listRemove(e); - lastReturned = null; - return; - } - } - throw new ConcurrentModificationException(); - } - } - - /** - * Save the state of the LinkedHashMap to a stream (i.e., serialize it). - * The objects will be written out in the order they are linked - * in the list. - */ - private void writeObject(java.io.ObjectOutputStream s) - throws IOException - { - // Write out the threshold, loadfactor, and any hidden stuff - s.defaultWriteObject(); - - // Write out number of buckets - s.writeInt(table.length); - - // Write out size (number of Mappings) - s.writeInt(count); - - // Write out keys and values (alternating) - for (Entry e = header.after; e != header; e = e.after) { - s.writeObject(e.key); - s.writeObject(e.value); - } - } - - /** - * Reconstitute the LinkedHashMap from a stream (i.e., deserialize it). - */ - private void readObject(java.io.ObjectInputStream s) - throws IOException, ClassNotFoundException - { - // Read in the threshold, loadfactor, and any hidden stuff - s.defaultReadObject(); - - // Read in number of buckets and allocate the bucket array; - int numBuckets = s.readInt(); - table = new Entry[numBuckets]; - header = new Entry(-1, null, null, null); - header.before = header; - header.after = header; - - // Read in size (number of Mappings) - int size = s.readInt(); - - // Read the keys and values, and put the mappings in the LinkedHashMap - for (int i=0; i signatures = parser.argumentSignatures(); if (signatures.size() != argSize) { throw new IllegalArgumentException("Invalid argument count: expected " + diff --git a/src/share/classes/com/sun/tools/jdi/MirrorImpl.java b/src/share/classes/com/sun/tools/jdi/MirrorImpl.java index 9a68f23f1..f3942c080 100644 --- a/src/share/classes/com/sun/tools/jdi/MirrorImpl.java +++ b/src/share/classes/com/sun/tools/jdi/MirrorImpl.java @@ -83,8 +83,8 @@ abstract class MirrorImpl extends Object implements Mirror { * Throw NullPointerException on null mirrors. * Throw VMMismatchException on wrong VM. */ - void validateMirrors(Collection mirrors) { - Iterator iter = mirrors.iterator(); + void validateMirrors(Collection mirrors) { + Iterator iter = mirrors.iterator(); while (iter.hasNext()) { MirrorImpl mirror = (MirrorImpl)iter.next(); if (!vm.equals(mirror.vm)) { @@ -96,8 +96,8 @@ abstract class MirrorImpl extends Object implements Mirror { * Allow null mirrors. * Throw VMMismatchException on wrong VM. */ - void validateMirrorsOrNulls(Collection mirrors) { - Iterator iter = mirrors.iterator(); + void validateMirrorsOrNulls(Collection mirrors) { + Iterator iter = mirrors.iterator(); while (iter.hasNext()) { MirrorImpl mirror = (MirrorImpl)iter.next(); if ((mirror != null) && !vm.equals(mirror.vm)) { diff --git a/src/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java b/src/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java index 1c2a8cbaf..b93d898f1 100644 --- a/src/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java +++ b/src/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java @@ -110,7 +110,7 @@ public class ObjectReferenceImpl extends ValueImpl public boolean vmNotSuspended(VMAction action) { // make sure that cache and listener management are synchronized 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()); } disableCache(); @@ -163,8 +163,8 @@ public class ObjectReferenceImpl extends ValueImpl public Value getValue(Field sig) { List list = new ArrayList(1); list.add(sig); - Map map = getValues(list); - return(Value)map.get(sig); + Map map = getValues(list); + return map.get(sig); } public Map getValues(List theFields) { @@ -487,7 +487,7 @@ public class ObjectReferenceImpl extends ValueImpl info = JDWP.ObjectReference.MonitorInfo.process(vm, this); if (local != null) { local.monitorInfo = info; - if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) { vm.printTrace("ObjectReference " + uniqueID() + " temporarily caching monitor info"); } diff --git a/src/share/classes/com/sun/tools/jdi/ProcessAttachingConnector.java b/src/share/classes/com/sun/tools/jdi/ProcessAttachingConnector.java index 6b5d05588..03f7b4778 100644 --- a/src/share/classes/com/sun/tools/jdi/ProcessAttachingConnector.java +++ b/src/share/classes/com/sun/tools/jdi/ProcessAttachingConnector.java @@ -127,7 +127,7 @@ public class ProcessAttachingConnector } else { if (lib.equals("dt_shmem")) { try { - Class c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService"); + Class c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService"); ts = (TransportService)c.newInstance(); } catch (Exception x) { } } diff --git a/src/share/classes/com/sun/tools/jdi/RawCommandLineLauncher.java b/src/share/classes/com/sun/tools/jdi/RawCommandLineLauncher.java index 133193c01..cef298df3 100644 --- a/src/share/classes/com/sun/tools/jdi/RawCommandLineLauncher.java +++ b/src/share/classes/com/sun/tools/jdi/RawCommandLineLauncher.java @@ -53,7 +53,7 @@ public class RawCommandLineLauncher extends AbstractLauncher implements Launchin super(); try { - Class c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService"); + Class c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService"); transportService = (TransportService)c.newInstance(); transport = new Transport() { public String name() { diff --git a/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java b/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java index ec0909076..35543cae7 100644 --- a/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java +++ b/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java @@ -99,7 +99,7 @@ implements ReferenceType { // Fetch all methods for the class, check performance impact // Needs no synchronization now, since methods() returns // unmodifiable local data - Iterator it = methods().iterator(); + Iterator it = methods().iterator(); while (it.hasNext()) { MethodImpl method = (MethodImpl)it.next(); if (method.ref() == ref) { @@ -113,7 +113,7 @@ implements ReferenceType { // Fetch all fields for the class, check performance impact // Needs no synchronization now, since fields() returns // unmodifiable local data - Iterator it = fields().iterator(); + Iteratorit = fields().iterator(); while (it.hasNext()) { FieldImpl field = (FieldImpl)it.next(); if (field.ref() == ref) { @@ -385,7 +385,7 @@ implements ReferenceType { /* Add inherited, visible fields */ List types = inheritedTypes(); - Iterator iter = types.iterator(); + Iterator iter = types.iterator(); while (iter.hasNext()) { /* * TO DO: Be defensive and check for cyclic interface inheritance @@ -419,7 +419,7 @@ implements ReferenceType { /* Add inherited fields */ List types = inheritedTypes(); - Iterator iter = types.iterator(); + Iterator iter = types.iterator(); while (iter.hasNext()) { ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next(); type.addAllFields(fieldList, typeSet); @@ -434,13 +434,10 @@ implements ReferenceType { } public Field fieldByName(String fieldName) { - java.util.List searchList; - Field f; - - searchList = visibleFields(); + List searchList = visibleFields(); for (int i=0; i nestedTypes() { - List all = vm.allClasses(); + List all = vm.allClasses(); List nested = new ArrayList(); String outername = name(); int outerlen = outername.length(); - Iterator iter = all.iterator(); + Iterator iter = all.iterator(); while (iter.hasNext()) { - ReferenceType refType = (ReferenceType)iter.next(); + ReferenceType refType = iter.next(); String name = refType.name(); int len = name.length(); /* The separator is historically '$' but could also be '#' */ @@ -598,8 +595,8 @@ implements ReferenceType { public Value getValue(Field sig) { List list = new ArrayList(1); list.add(sig); - Map map = getValues(list); - return(Value)map.get(sig); + Map map = getValues(list); + return map.get(sig); } @@ -847,7 +844,7 @@ implements ReferenceType { SDE.Stratum stratum = stratum(stratumID); List list = new ArrayList(); // location list - for (Iterator iter = methods().iterator(); iter.hasNext(); ) { + for (Iterator iter = methods().iterator(); iter.hasNext(); ) { MethodImpl method = (MethodImpl)iter.next(); try { list.addAll( @@ -887,7 +884,7 @@ implements ReferenceType { List list = new ArrayList(); - Iterator iter = methods.iterator(); + Iterator iter = methods.iterator(); while(iter.hasNext()) { MethodImpl method = (MethodImpl)iter.next(); // eliminate native and abstract to eliminate diff --git a/src/share/classes/com/sun/tools/jdi/ShortValueImpl.java b/src/share/classes/com/sun/tools/jdi/ShortValueImpl.java index 7ed631dc1..ea9ec0b2b 100644 --- a/src/share/classes/com/sun/tools/jdi/ShortValueImpl.java +++ b/src/share/classes/com/sun/tools/jdi/ShortValueImpl.java @@ -79,7 +79,7 @@ public class ShortValueImpl extends PrimitiveValueImpl } public short shortValue() { - return(short)value; + return value; } public int intValue() { diff --git a/src/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java b/src/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java index 8b16fc691..40ff2223a 100644 --- a/src/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java +++ b/src/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java @@ -64,7 +64,7 @@ public class SunCommandLineLauncher extends AbstractLauncher implements Launchin * transport or the socket transport */ try { - Class c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService"); + Class c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService"); transportService = (TransportService)c.newInstance(); transport = new Transport() { public String name() { diff --git a/src/share/classes/com/sun/tools/jdi/TargetVM.java b/src/share/classes/com/sun/tools/jdi/TargetVM.java index 2853e0155..0feac8536 100644 --- a/src/share/classes/com/sun/tools/jdi/TargetVM.java +++ b/src/share/classes/com/sun/tools/jdi/TargetVM.java @@ -178,7 +178,7 @@ public class TargetVM implements Runnable { // Closing a queue causes a VMDisconnectEvent to // be put onto the queue. synchronized(eventQueues) { - Iterator iter = eventQueues.iterator(); + Iterator iter = eventQueues.iterator(); while (iter.hasNext()) { ((EventQueueImpl)iter.next()).close(); } @@ -187,9 +187,9 @@ public class TargetVM implements Runnable { // indirectly throw VMDisconnectedException to // command requesters. synchronized(waitingQueue) { - Iterator iter = waitingQueue.values().iterator(); + Iterator iter = waitingQueue.values().iterator(); while (iter.hasNext()) { - Packet packet = (Packet)iter.next(); + Packet packet = iter.next(); synchronized(packet) { packet.notify(); } @@ -252,7 +252,7 @@ public class TargetVM implements Runnable { void notifyDequeueEventSet() { int maxQueueSize = 0; synchronized(eventQueues) { - Iterator iter = eventQueues.iterator(); + Iterator iter = eventQueues.iterator(); while (iter.hasNext()) { EventQueueImpl queue = (EventQueueImpl)iter.next(); maxQueueSize = Math.max(maxQueueSize, queue.size()); @@ -265,7 +265,7 @@ public class TargetVM implements Runnable { int maxQueueSize = 0; synchronized(eventQueues) { - Iterator iter = eventQueues.iterator(); + Iterator iter = eventQueues.iterator(); while (iter.hasNext()) { EventQueueImpl queue = (EventQueueImpl)iter.next(); queue.enqueue(eventSet); diff --git a/src/share/classes/com/sun/tools/jdi/ThreadAction.java b/src/share/classes/com/sun/tools/jdi/ThreadAction.java index 53943410c..818714285 100644 --- a/src/share/classes/com/sun/tools/jdi/ThreadAction.java +++ b/src/share/classes/com/sun/tools/jdi/ThreadAction.java @@ -33,6 +33,7 @@ import java.util.EventObject; * with JDI events. */ class ThreadAction extends EventObject { + private static final long serialVersionUID = 5690763191100515283L; // Event ids /*static final int THREAD_SUSPENDED = 1;*/ static final int THREAD_RESUMABLE = 2; diff --git a/src/share/classes/com/sun/tools/jdi/ThreadGroupReferenceImpl.java b/src/share/classes/com/sun/tools/jdi/ThreadGroupReferenceImpl.java index 3d5d20365..5cc79f746 100644 --- a/src/share/classes/com/sun/tools/jdi/ThreadGroupReferenceImpl.java +++ b/src/share/classes/com/sun/tools/jdi/ThreadGroupReferenceImpl.java @@ -118,7 +118,7 @@ public class ThreadGroupReferenceImpl extends ObjectReferenceImpl .process(vm, this); if (local != null) { local.kids = kids; - if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) { vm.printTrace(description() + " temporarily caching children "); } diff --git a/src/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java b/src/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java index f694afc2a..d76f60c2c 100644 --- a/src/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java +++ b/src/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java @@ -240,7 +240,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl public void stop(ObjectReference throwable) throws InvalidTypeException { validateMirror(throwable); // Verify that the given object is a Throwable instance - List list = vm.classesByName("java.lang.Throwable"); + List list = vm.classesByName("java.lang.Throwable"); ClassTypeImpl throwableClass = (ClassTypeImpl)list.get(0); if ((throwable == null) || !throwableClass.isAssignableFrom(throwable)) { @@ -296,10 +296,10 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl try { StackFrame frame = frame(0); Location location = frame.location(); - List requests = vm.eventRequestManager().breakpointRequests(); - Iterator iter = requests.iterator(); + List requests = vm.eventRequestManager().breakpointRequests(); + Iterator iter = requests.iterator(); while (iter.hasNext()) { - BreakpointRequest request = (BreakpointRequest)iter.next(); + BreakpointRequest request = iter.next(); if (location.equals(request.location())) { return true; } @@ -352,8 +352,8 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl } public StackFrame frame(int index) throws IncompatibleThreadStateException { - List list = privateFrames(index, 1); - return (StackFrame)list.get(0); + List list = privateFrames(index, 1); + return list.get(0); } /** @@ -447,7 +447,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl snapshot.ownedMonitors = Arrays.asList( (ObjectReference[])JDWP.ThreadReference.OwnedMonitors. process(vm, this).owned); - if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) { vm.printTrace(description() + " temporarily caching owned monitors"+ " (count = " + snapshot.ownedMonitors.size() + ")"); @@ -475,7 +475,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl process(vm, this).monitor; snapshot.triedCurrentContended = true; if ((snapshot.contendedMonitor != null) && - ((vm.traceFlags & vm.TRACE_OBJREFS) != 0)) { + ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0)) { vm.printTrace(description() + " temporarily caching contended monitor"+ " (id = " + snapshot.contendedMonitor.uniqueID() + ")"); @@ -509,7 +509,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl snapshot.ownedMonitorsInfo.add(mon); } - if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) { vm.printTrace(description() + " temporarily caching owned monitors"+ " (count = " + snapshot.ownedMonitorsInfo.size() + ")"); @@ -601,9 +601,9 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl void removeListener(ThreadListener listener) { synchronized (vm.state()) { - Iterator iter = listeners.iterator(); + Iterator> iter = listeners.iterator(); while (iter.hasNext()) { - WeakReference ref = (WeakReference)iter.next(); + WeakReference ref = iter.next(); if (listener.equals(ref.get())) { iter.remove(); break; @@ -619,10 +619,10 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl */ private void processThreadAction(ThreadAction action) { synchronized (vm.state()) { - Iterator iter = listeners.iterator(); + Iterator> iter = listeners.iterator(); while (iter.hasNext()) { - WeakReference ref = (WeakReference)iter.next(); - ThreadListener listener = (ThreadListener)ref.get(); + WeakReference ref = iter.next(); + ThreadListener listener = ref.get(); if (listener != null) { switch (action.id()) { case ThreadAction.THREAD_RESUMABLE: diff --git a/src/share/classes/com/sun/tools/jdi/VMAction.java b/src/share/classes/com/sun/tools/jdi/VMAction.java index 7b9dc049a..91d69725c 100644 --- a/src/share/classes/com/sun/tools/jdi/VMAction.java +++ b/src/share/classes/com/sun/tools/jdi/VMAction.java @@ -33,6 +33,8 @@ import java.util.EventObject; * with JDI events. */ class VMAction extends EventObject { + private static final long serialVersionUID = -1701944679310296090L; + // Event ids static final int VM_SUSPENDED = 1; static final int VM_NOT_SUSPENDED = 2; diff --git a/src/share/classes/com/sun/tools/jdi/VMState.java b/src/share/classes/com/sun/tools/jdi/VMState.java index de49e8a68..76c6804d4 100644 --- a/src/share/classes/com/sun/tools/jdi/VMState.java +++ b/src/share/classes/com/sun/tools/jdi/VMState.java @@ -34,7 +34,7 @@ class VMState { private final VirtualMachineImpl vm; // Listeners - private final List listeners = new ArrayList(); // synchronized (this) + private final List> listeners = new ArrayList>(); // synchronized (this) private boolean notifyingListeners = false; // synchronized (this) /* @@ -129,7 +129,7 @@ class VMState { */ synchronized void thaw(ThreadReference resumingThread) { if (cache != null) { - if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) { vm.printTrace("Clearing VM suspended cache"); } disableCache(); @@ -142,10 +142,10 @@ class VMState { // Prevent recursion notifyingListeners = true; - Iterator iter = listeners.iterator(); + Iterator> iter = listeners.iterator(); while (iter.hasNext()) { - WeakReference ref = (WeakReference)iter.next(); - VMListener listener = (VMListener)ref.get(); + WeakReference ref = iter.next(); + VMListener listener = ref.get(); if (listener != null) { boolean keep = true; switch (action.id()) { @@ -178,9 +178,9 @@ class VMState { } synchronized void removeListener(VMListener listener) { - Iterator iter = listeners.iterator(); + Iterator> iter = listeners.iterator(); while (iter.hasNext()) { - WeakReference ref = (WeakReference)iter.next(); + WeakReference ref = iter.next(); if (listener.equals(ref.get())) { iter.remove(); break; @@ -202,7 +202,7 @@ class VMState { process(vm).threads); if (local != null) { local.threads = threads; - if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) { vm.printTrace("Caching all threads (count = " + threads.size() + ") while VM suspended"); } @@ -229,7 +229,7 @@ class VMState { process(vm).groups); if (local != null) { local.groups = groups; - if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) { vm.printTrace( "Caching top level thread groups (count = " + groups.size() + ") while VM suspended"); diff --git a/src/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java b/src/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java index 7367b938a..6cde25ee8 100644 --- a/src/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java +++ b/src/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java @@ -300,9 +300,9 @@ class VirtualMachineImpl extends MirrorImpl if (!canRedefineClasses()) { throw new UnsupportedOperationException(); } - Iterator it = classToBytes.entrySet().iterator(); + Iterator it = classToBytes.entrySet().iterator(); 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(); validateMirror(refType); defs[i] = new JDWP.VirtualMachine.RedefineClasses @@ -801,7 +801,7 @@ class VirtualMachineImpl extends MirrorImpl * we can't differentiate here, we first remove all * matching classes from our cache... */ - Iterator iter = typesBySignature.iterator(); + Iterator iter = typesBySignature.iterator(); int matches = 0; while (iter.hasNext()) { ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next(); @@ -833,7 +833,7 @@ class VirtualMachineImpl extends MirrorImpl if (typesByID == null) { return new ArrayList(0); } - Iterator iter = typesBySignature.iterator(); + Iterator iter = typesBySignature.iterator(); List list = new ArrayList(); while (iter.hasNext()) { ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next(); @@ -1041,10 +1041,10 @@ class VirtualMachineImpl extends MirrorImpl } Type findBootType(String signature) throws ClassNotLoadedException { - List types = allClasses(); - Iterator iter = types.iterator(); + List types = allClasses(); + Iterator iter = types.iterator(); while (iter.hasNext()) { - ReferenceType type = (ReferenceType)iter.next(); + ReferenceType type = iter.next(); if ((type.classLoader() == null) && (type.signature().equals(signature))) { return type; @@ -1227,7 +1227,7 @@ class VirtualMachineImpl extends MirrorImpl } private void processQueue() { - Reference ref; + Reference ref; //if ((traceFlags & TRACE_OBJREFS) != 0) { // printTrace("Checking for softly reachable objects"); //} -- GitLab