From 8b74b16c1d44228dc4ab9fce45f9545e2c6a796f Mon Sep 17 00:00:00 2001 From: Andrew John Hughes Date: Tue, 5 Mar 2013 02:06:59 +0000 Subject: Fix warnings in gnu.classpath.* code (mainly the JDWP implementation). 2013-03-04 Andrew John Hughes * gnu/classpath/Pair.java: (equals(Object)): Cast to Pair not Pair as we don't know that the objects held by the pair are of the same type. * gnu/classpath/ServiceProviderLoadingAction.java: (run()): Suppress warning as we check the loaded class is an instance of P. * gnu/classpath/jdwp/Jdwp.java: (_properties): Add type parameters. (notify(Event[])): Likewise. (_processConfigury(String)): Likewise. * gnu/classpath/jdwp/event/ClassPrepareEvent.java: (_class): Add type parameter. (ClassPrepareEvent(Thread,class,int)): Likewise. * gnu/classpath/jdwp/event/ClassUnloadEvent.java: (writeData(DataOutputStream)): Don't store result of getDefault() call as unused. Retain for side-effects. * gnu/classpath/jdwp/event/EventManager.java: (_requests): Add type parameters. (EventManager()): Likewise & use Byte.valueOf rather than new. (getEventRequests(Event)): Likewise and remove unneeded cast. (requestEvent(EventRequest)): Add type parameters, remove unneeded cast and use Integer.valueOf rather than new. (deleteRequest(byte,int)): Add type parameters, use valueOf methods instead of constructors and drop unneeded cast. (clearRequests(byte)): Add type parameters and use Byte.valueOf. (getRequest(byte,int)): Likewise and drop unused cast and use Integer.valueOf. (getRequests(byte)): Add type parameters and use Byte.valueOf. * gnu/classpath/jdwp/event/EventRequest.java: (_filters): Add type parameter. (EventRequest(byte,byte)): Likewise. (EventRequest(int,byte,byte)): Likewise. (addFilter(IEventFilter)): Likewise. (getFilters()): Likewise. (matches(Event)): Likewise and remove unneeded cast. * gnu/classpath/jdwp/event/ExceptionEvent.java: (_klass): Add type parameter. (ExceptionEvent(Throwable,Thread,Location,Location, Class,Object)): Likewise. * gnu/classpath/jdwp/event/filters/ClassMatchFilter.java: (matches(Event)): Add type parameter. * gnu/classpath/jdwp/event/filters/ClassOnlyFilter.java: (matches(Event)): Add type parameters. * gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java: (matches(Event)): Add type parameter. * gnu/classpath/jdwp/event/filters/FieldOnlyFilter.java: (FieldOnlyFilter(ReferenceTypeId,ReferenceTypeId)): Avoid throwing a NullPointerException by using new constructors for InvalidClassException and InvalidFieldException. * gnu/classpath/jdwp/exception/InvalidClassException.java: (InvalidClassException()): New constructor for when there is no ID (i.e. null was passed). * gnu/classpath/jdwp/exception/InvalidFieldException.java (InvalidFieldException()): New constructor for when there is no ID (i.e. null was passed). * gnu/classpath/jdwp/id/ClassLoaderId.java: (typeClass): Add type parameter. * gnu/classpath/jdwp/id/ClassObjectId.java, (typeClass): Add type parameter. (getClassObject()): Add type parameters. * gnu/classpath/jdwp/id/JdwpId.java: (_reference): Add type parameter. (getReference()): Likewise. (setReference(SoftReference)): Likewise. * gnu/classpath/jdwp/id/NullObjectId.java: (typeClass): Add type parameter. (NullObjectId()): Change type parameter to same used by superclass. * gnu/classpath/jdwp/id/ObjectId.java: (typeClass): Add type parameter. * gnu/classpath/jdwp/id/ReferenceTypeId.java: (getType()): Add type parameters. * gnu/classpath/jdwp/id/StringId.java, * gnu/classpath/jdwp/id/ThreadGroupId.java, * gnu/classpath/jdwp/id/ThreadId.java: (typeClass): Add type parameter. * gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java: (executeGetvalues(ByteBuffer,DataOutputStream)): Add type parameter. (executeSetValues(ByteBuffer,DataOutputStream)): Likewise. * gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java: (executeNewInstance(ByteBuffer,DataOutputStream)): Add type parameters. * gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java: (executeVisibleClasses(ByteBuffer,DataOutputStream)): Add type parameters. Hide warnings from VM layer for now. * gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java: (executeReflectedType(ByteBuffer,DataOutputStream)): Add type parameter. * gnu/classpath/jdwp/processor/ClassTypeCommandSet.java: (executeSuperclass(ByteBuffer,DataOutputStream)): Add type parameter. (executeSetValues(ByteBuffer,DataOutputStream)): Call readReferenceTypeId only for side effect of changing the ByteBuffer. Result not needed. (invokeMethod(ByteBuffer)): Add type parameter. * gnu/classpath/jdwp/processor/MethodCommandSet.java: (executeLineTable(ByteBuffer,DataOutputStream)): Add type parameter. (executeVariableTable(ByteBuffer,DataOutputStream)): Likewise. (executeByteCodes(ByteBuffer,DataOutputStream)): Likewise. * gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java: (executeReferenceType(ByteBuffer,DataOutputStream)): Add type parameter. (executeInvokeMethod(ByteBuffer,DataOutputStream)): Likewise. * gnu/classpath/jdwp/processor/PacketProcessor.java: Add type parameter to implemented interface. (run()): Change return type to match type parameter. * gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java: (executeClassLoader(ByteBuffer,DataOutputStream)): Add type parameter. (executeModifiers(ByteBuffer,DataOutputStream)): Likewise. (executeFields(ByteBuffer,DataOutputStream)): Likewise. (executeMethods(ByteBuffer,DataOutputStream)): Likewise. (executeGetValues(ByteBuffer,DataOutputStream)): Likewise. (executeSourceFile(ByteBuffer,DataOutputStream)): Likewise. (executeNestedTypes(ByteBuffer,DataOutputStream)): Add type parameters. (executeStatus(ByteBuffer,DataOutputStream)): Add type parameter. (executeInterfaces(ByteBuffer,DataOutputStream)): Add type parameters. (executeClassObject(ByteBuffer,DataOutputStream)): Add type parameter. * gnu/classpath/jdwp/processor/StackFrameCommandSet.java: (runCommand(ByteBuffer,DataOutputStream,byte)): Remove unused keepRunning variable. * gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java: (executeFrames(ByteBuffer,DataOutputStream)): Add type parameter, suppressing warnings from VM layer until fixed. Remove unnecessary cast. * gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java: (executeClassesBySignature(ByteBuffer,DataOutputStream)): Add type parameters, suppressing warnings from VM layer. (executeAllClasses(ByteBuffer,DataOutputStream)): Likewise. (executeRedefineClasses(ByteBuffer,DataOutputStream)): Add type parameter. * gnu/classpath/jdwp/transport/ITransport.java: (configure(HashMap)): Add type parameters. * gnu/classpath/jdwp/transport/JdwpConnection.java: (_commandQueue): Add type parameter. (JdwpConnection(ThreadGroup,ITransport)): Likewise. (getPacket()): Remove unnecessary cast. * gnu/classpath/jdwp/transport/JdwpPacket.java: (fromBytes(byte[])): Add type parameter. * gnu/classpath/jdwp/transport/SocketTransport.java: (configure(HashMap)): Add type parameters. Remove unnecessary cast. * gnu/classpath/jdwp/transport/TransportFactory.java: (clazz): Add type parameter. (TransportMethod(String,Class)): Likewise. (newInstance(HashMap)): Add type parameters. Remove unnecessary cast. * gnu/classpath/jdwp/util/Location.java: (Location(ByteBuffer)): Don't store return value of first bb.get() call as unneeded. Add type parameter. * gnu/classpath/jdwp/util/Signature.java: (computeClassSignature(Class)): Add type parameter. (_computeSignature(Class,Class[])): Likewise. (_addToSignature(CPStringBuilder,Class)): Likewise. * gnu/classpath/jdwp/value/Value.java: (getUntaggedObject(ByteBuffer,Class)): Add type parameter. * gnu/classpath/jdwp/value/ValueFactory.java: (createFromUntagged(ByteBuffer,Class)): Add type parameter. (getTagForClass(Class)): Likewise. (createFromObject(Object,Class)): Likewise. Signed-off-by: Andrew John Hughes --- ChangeLog | 179 +++++++++++++++++++++ gnu/classpath/Pair.java | 8 +- gnu/classpath/ServiceProviderLoadingAction.java | 11 +- gnu/classpath/jdwp/Jdwp.java | 10 +- gnu/classpath/jdwp/event/ClassPrepareEvent.java | 6 +- gnu/classpath/jdwp/event/ClassUnloadEvent.java | 4 +- gnu/classpath/jdwp/event/EventManager.java | 107 ++++++------ gnu/classpath/jdwp/event/EventRequest.java | 16 +- gnu/classpath/jdwp/event/ExceptionEvent.java | 6 +- .../jdwp/event/filters/ClassMatchFilter.java | 4 +- .../jdwp/event/filters/ClassOnlyFilter.java | 6 +- .../jdwp/event/filters/ExceptionOnlyFilter.java | 6 +- .../jdwp/event/filters/FieldOnlyFilter.java | 9 +- .../jdwp/exception/InvalidClassException.java | 13 +- .../jdwp/exception/InvalidFieldException.java | 12 +- gnu/classpath/jdwp/id/ClassLoaderId.java | 4 +- gnu/classpath/jdwp/id/ClassObjectId.java | 10 +- gnu/classpath/jdwp/id/JdwpId.java | 8 +- gnu/classpath/jdwp/id/NullObjectId.java | 6 +- gnu/classpath/jdwp/id/ObjectId.java | 4 +- gnu/classpath/jdwp/id/ReferenceTypeId.java | 6 +- gnu/classpath/jdwp/id/StringId.java | 4 +- gnu/classpath/jdwp/id/ThreadGroupId.java | 4 +- gnu/classpath/jdwp/id/ThreadId.java | 4 +- .../jdwp/processor/ArrayReferenceCommandSet.java | 6 +- .../jdwp/processor/ArrayTypeCommandSet.java | 6 +- .../processor/ClassLoaderReferenceCommandSet.java | 10 +- .../processor/ClassObjectReferenceCommandSet.java | 4 +- .../jdwp/processor/ClassTypeCommandSet.java | 13 +- gnu/classpath/jdwp/processor/MethodCommandSet.java | 8 +- .../jdwp/processor/ObjectReferenceCommandSet.java | 6 +- gnu/classpath/jdwp/processor/PacketProcessor.java | 6 +- .../jdwp/processor/ReferenceTypeCommandSet.java | 32 ++-- .../jdwp/processor/StackFrameCommandSet.java | 3 +- .../jdwp/processor/ThreadReferenceCommandSet.java | 9 +- .../jdwp/processor/VirtualMachineCommandSet.java | 24 +-- gnu/classpath/jdwp/transport/ITransport.java | 4 +- gnu/classpath/jdwp/transport/JdwpConnection.java | 8 +- gnu/classpath/jdwp/transport/JdwpPacket.java | 4 +- gnu/classpath/jdwp/transport/SocketTransport.java | 6 +- gnu/classpath/jdwp/transport/TransportFactory.java | 10 +- gnu/classpath/jdwp/util/Location.java | 6 +- gnu/classpath/jdwp/util/Signature.java | 10 +- gnu/classpath/jdwp/value/Value.java | 4 +- gnu/classpath/jdwp/value/ValueFactory.java | 8 +- 45 files changed, 422 insertions(+), 212 deletions(-) diff --git a/ChangeLog b/ChangeLog index d878e3822..b08c5afdc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,182 @@ +2013-03-04 Andrew John Hughes + + * gnu/classpath/Pair.java: + (equals(Object)): Cast to Pair not Pair + as we don't know that the objects held by the pair + are of the same type. + * gnu/classpath/ServiceProviderLoadingAction.java: + (run()): Suppress warning as we check the loaded + class is an instance of P. + * gnu/classpath/jdwp/Jdwp.java: + (_properties): Add type parameters. + (notify(Event[])): Likewise. + (_processConfigury(String)): Likewise. + * gnu/classpath/jdwp/event/ClassPrepareEvent.java: + (_class): Add type parameter. + (ClassPrepareEvent(Thread,class,int)): Likewise. + * gnu/classpath/jdwp/event/ClassUnloadEvent.java: + (writeData(DataOutputStream)): Don't store result + of getDefault() call as unused. Retain for + side-effects. + * gnu/classpath/jdwp/event/EventManager.java: + (_requests): Add type parameters. + (EventManager()): Likewise & use Byte.valueOf + rather than new. + (getEventRequests(Event)): Likewise and remove + unneeded cast. + (requestEvent(EventRequest)): Add type parameters, + remove unneeded cast and use Integer.valueOf + rather than new. + (deleteRequest(byte,int)): Add type parameters, + use valueOf methods instead of constructors + and drop unneeded cast. + (clearRequests(byte)): Add type parameters + and use Byte.valueOf. + (getRequest(byte,int)): Likewise and drop + unused cast and use Integer.valueOf. + (getRequests(byte)): Add type parameters + and use Byte.valueOf. + * gnu/classpath/jdwp/event/EventRequest.java: + (_filters): Add type parameter. + (EventRequest(byte,byte)): Likewise. + (EventRequest(int,byte,byte)): Likewise. + (addFilter(IEventFilter)): Likewise. + (getFilters()): Likewise. + (matches(Event)): Likewise and remove unneeded + cast. + * gnu/classpath/jdwp/event/ExceptionEvent.java: + (_klass): Add type parameter. + (ExceptionEvent(Throwable,Thread,Location,Location, + Class,Object)): Likewise. + * gnu/classpath/jdwp/event/filters/ClassMatchFilter.java: + (matches(Event)): Add type parameter. + * gnu/classpath/jdwp/event/filters/ClassOnlyFilter.java: + (matches(Event)): Add type parameters. + * gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java: + (matches(Event)): Add type parameter. + * gnu/classpath/jdwp/event/filters/FieldOnlyFilter.java: + (FieldOnlyFilter(ReferenceTypeId,ReferenceTypeId)): + Avoid throwing a NullPointerException by using new + constructors for InvalidClassException and + InvalidFieldException. + * gnu/classpath/jdwp/exception/InvalidClassException.java: + (InvalidClassException()): New constructor for when there is + no ID (i.e. null was passed). + * gnu/classpath/jdwp/exception/InvalidFieldException.java + (InvalidFieldException()): New constructor for when there is + no ID (i.e. null was passed). + * gnu/classpath/jdwp/id/ClassLoaderId.java: + (typeClass): Add type parameter. + * gnu/classpath/jdwp/id/ClassObjectId.java, + (typeClass): Add type parameter. + (getClassObject()): Add type parameters. + * gnu/classpath/jdwp/id/JdwpId.java: + (_reference): Add type parameter. + (getReference()): Likewise. + (setReference(SoftReference)): Likewise. + * gnu/classpath/jdwp/id/NullObjectId.java: + (typeClass): Add type parameter. + (NullObjectId()): Change type parameter to same + used by superclass. + * gnu/classpath/jdwp/id/ObjectId.java: + (typeClass): Add type parameter. + * gnu/classpath/jdwp/id/ReferenceTypeId.java: + (getType()): Add type parameters. + * gnu/classpath/jdwp/id/StringId.java, + * gnu/classpath/jdwp/id/ThreadGroupId.java, + * gnu/classpath/jdwp/id/ThreadId.java: + (typeClass): Add type parameter. + * gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java: + (executeGetvalues(ByteBuffer,DataOutputStream)): + Add type parameter. + (executeSetValues(ByteBuffer,DataOutputStream)): Likewise. + * gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java: + (executeNewInstance(ByteBuffer,DataOutputStream)): Add type + parameters. + * gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java: + (executeVisibleClasses(ByteBuffer,DataOutputStream)): + Add type parameters. Hide warnings from VM layer for now. + * gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java: + (executeReflectedType(ByteBuffer,DataOutputStream)): Add + type parameter. + * gnu/classpath/jdwp/processor/ClassTypeCommandSet.java: + (executeSuperclass(ByteBuffer,DataOutputStream)): Add + type parameter. + (executeSetValues(ByteBuffer,DataOutputStream)): + Call readReferenceTypeId only for side effect of changing + the ByteBuffer. Result not needed. + (invokeMethod(ByteBuffer)): Add type parameter. + * gnu/classpath/jdwp/processor/MethodCommandSet.java: + (executeLineTable(ByteBuffer,DataOutputStream)): Add type + parameter. + (executeVariableTable(ByteBuffer,DataOutputStream)): Likewise. + (executeByteCodes(ByteBuffer,DataOutputStream)): Likewise. + * gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java: + (executeReferenceType(ByteBuffer,DataOutputStream)): Add type + parameter. + (executeInvokeMethod(ByteBuffer,DataOutputStream)): Likewise. + * gnu/classpath/jdwp/processor/PacketProcessor.java: + Add type parameter to implemented interface. + (run()): Change return type to match type parameter. + * gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java: + (executeClassLoader(ByteBuffer,DataOutputStream)): Add type + parameter. + (executeModifiers(ByteBuffer,DataOutputStream)): Likewise. + (executeFields(ByteBuffer,DataOutputStream)): Likewise. + (executeMethods(ByteBuffer,DataOutputStream)): Likewise. + (executeGetValues(ByteBuffer,DataOutputStream)): Likewise. + (executeSourceFile(ByteBuffer,DataOutputStream)): Likewise. + (executeNestedTypes(ByteBuffer,DataOutputStream)): Add type + parameters. + (executeStatus(ByteBuffer,DataOutputStream)): Add type parameter. + (executeInterfaces(ByteBuffer,DataOutputStream)): Add type + parameters. + (executeClassObject(ByteBuffer,DataOutputStream)): Add type parameter. + * gnu/classpath/jdwp/processor/StackFrameCommandSet.java: + (runCommand(ByteBuffer,DataOutputStream,byte)): Remove + unused keepRunning variable. + * gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java: + (executeFrames(ByteBuffer,DataOutputStream)): Add type parameter, + suppressing warnings from VM layer until fixed. Remove + unnecessary cast. + * gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java: + (executeClassesBySignature(ByteBuffer,DataOutputStream)): + Add type parameters, suppressing warnings from VM layer. + (executeAllClasses(ByteBuffer,DataOutputStream)): Likewise. + (executeRedefineClasses(ByteBuffer,DataOutputStream)): + Add type parameter. + * gnu/classpath/jdwp/transport/ITransport.java: + (configure(HashMap)): Add type parameters. + * gnu/classpath/jdwp/transport/JdwpConnection.java: + (_commandQueue): Add type parameter. + (JdwpConnection(ThreadGroup,ITransport)): Likewise. + (getPacket()): Remove unnecessary cast. + * gnu/classpath/jdwp/transport/JdwpPacket.java: + (fromBytes(byte[])): Add type parameter. + * gnu/classpath/jdwp/transport/SocketTransport.java: + (configure(HashMap)): Add type parameters. Remove + unnecessary cast. + * gnu/classpath/jdwp/transport/TransportFactory.java: + (clazz): Add type parameter. + (TransportMethod(String,Class)): Likewise. + (newInstance(HashMap)): Add type parameters. Remove + unnecessary cast. + * gnu/classpath/jdwp/util/Location.java: + (Location(ByteBuffer)): Don't store return value of + first bb.get() call as unneeded. Add type parameter. + * gnu/classpath/jdwp/util/Signature.java: + (computeClassSignature(Class)): Add type parameter. + (_computeSignature(Class,Class[])): Likewise. + (_addToSignature(CPStringBuilder,Class)): Likewise. + * gnu/classpath/jdwp/value/Value.java: + (getUntaggedObject(ByteBuffer,Class)): Add type + parameter. + * gnu/classpath/jdwp/value/ValueFactory.java: + (createFromUntagged(ByteBuffer,Class)): Add type + parameter. + (getTagForClass(Class)): Likewise. + (createFromObject(Object,Class)): Likewise. + 2013-02-26 Andrew John Hughes * gnu/classpath/ServiceFactory.java: diff --git a/gnu/classpath/Pair.java b/gnu/classpath/Pair.java index f7a07a29c..767a0ff3f 100644 --- a/gnu/classpath/Pair.java +++ b/gnu/classpath/Pair.java @@ -1,5 +1,5 @@ /* Pair.java -- A heterogenous pair of objects. - Copyright (C) 2006 + Copyright (C) 2006, 2013 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -101,9 +101,9 @@ public class Pair { if (obj instanceof Pair) { - Pair p = (Pair) obj; - A lp = p.getLeft(); - B rp = p.getRight(); + Pair p = (Pair) obj; + Object lp = p.getLeft(); + Object rp = p.getRight(); return (lp == null ? left == null : lp.equals(left)) && (rp == null ? right == null : rp.equals(right)); } diff --git a/gnu/classpath/ServiceProviderLoadingAction.java b/gnu/classpath/ServiceProviderLoadingAction.java index 78a11cd50..87e662bf0 100644 --- a/gnu/classpath/ServiceProviderLoadingAction.java +++ b/gnu/classpath/ServiceProviderLoadingAction.java @@ -1,5 +1,5 @@ /* ServiceProviderLoadingAction.java -- Action for loading plug-in services. - Copyright (C) 2004 Free Software Foundation + Copyright (C) 2004, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -133,11 +133,10 @@ final class ServiceProviderLoadingAction

public P run() throws Exception { - Class

loadedClass; - P serviceProvider; - - loadedClass = (Class

) loader.loadClass(providerName); - serviceProvider = loadedClass.newInstance(); + // This is safe as we check the class is of the correct type + @SuppressWarnings("unchecked") + Class

loadedClass = (Class

) loader.loadClass(providerName); + P serviceProvider = loadedClass.newInstance(); // Ensure that the loaded provider is actually implementing // the service provider interface. diff --git a/gnu/classpath/jdwp/Jdwp.java b/gnu/classpath/jdwp/Jdwp.java index e90a2c762..932c0ecc5 100644 --- a/gnu/classpath/jdwp/Jdwp.java +++ b/gnu/classpath/jdwp/Jdwp.java @@ -1,5 +1,5 @@ /* Jdwp.java -- Virtual machine to JDWP back-end programming interface - Copyright (C) 2005, 2006, 2007 Free Software Foundation + Copyright (C) 2005, 2006, 2007, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -79,7 +79,7 @@ public class Jdwp private Thread _ppThread; // JDWP configuration properties - private HashMap _properties; + private HashMap _properties; // The suspend property of the configure string // (-Xrunjdwp:..suspend=) @@ -253,8 +253,8 @@ public class Jdwp { byte suspendPolicy = JdwpConstants.SuspendPolicy.NONE; EventManager em = EventManager.getDefault(); - ArrayList allEvents = new ArrayList (); - ArrayList allRequests = new ArrayList (); + ArrayList allEvents = new ArrayList(); + ArrayList allRequests = new ArrayList(); for (int i = 0; i < events.length; ++i) { EventRequest[] r = em.getEventRequests(events[i]); @@ -403,7 +403,7 @@ public class Jdwp { // Loop through configuration arguments looking for a // transport name - _properties = new HashMap (); + _properties = new HashMap(); String[] options = configString.split (","); for (int i = 0; i < options.length; ++i) { diff --git a/gnu/classpath/jdwp/event/ClassPrepareEvent.java b/gnu/classpath/jdwp/event/ClassPrepareEvent.java index f21f8e7c0..b3d421c2a 100644 --- a/gnu/classpath/jdwp/event/ClassPrepareEvent.java +++ b/gnu/classpath/jdwp/event/ClassPrepareEvent.java @@ -1,6 +1,6 @@ /* ClassPrepareEvent.java -- An event specifying that a class has been prepared by the virtual machine - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -65,7 +65,7 @@ public class ClassPrepareEvent private Thread _thread; // The class that was prepared - private Class _class; + private Class _class; // Prepare flags private int _status; @@ -101,7 +101,7 @@ public class ClassPrepareEvent * @param clazz class which was prepared * @param flags prepare status flags */ - public ClassPrepareEvent (Thread thread, Class clazz, int flags) + public ClassPrepareEvent (Thread thread, Class clazz, int flags) { super (JdwpConstants.EventKind.CLASS_PREPARE); _thread = thread; diff --git a/gnu/classpath/jdwp/event/ClassUnloadEvent.java b/gnu/classpath/jdwp/event/ClassUnloadEvent.java index a35d3b9bd..d7e564d92 100644 --- a/gnu/classpath/jdwp/event/ClassUnloadEvent.java +++ b/gnu/classpath/jdwp/event/ClassUnloadEvent.java @@ -1,5 +1,5 @@ /* ClassUnloadEvent.java -- event generated when a class is unloaded - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2013 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -88,7 +88,7 @@ public class ClassUnloadEvent protected void _writeData(DataOutputStream outStream) throws IOException { - VMIdManager idm = VMIdManager.getDefault(); + VMIdManager.getDefault(); JdwpString.writeString(outStream, _signature); } diff --git a/gnu/classpath/jdwp/event/EventManager.java b/gnu/classpath/jdwp/event/EventManager.java index 3f34a5ee9..e1c821bbf 100644 --- a/gnu/classpath/jdwp/event/EventManager.java +++ b/gnu/classpath/jdwp/event/EventManager.java @@ -1,5 +1,5 @@ /* EventManager.java -- event management and notification infrastructure - Copyright (C) 2005, 2006, 2007 Free Software Foundation + Copyright (C) 2005, 2006, 2007, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -74,7 +74,7 @@ public class EventManager private static EventManager _instance = null; // maps event (EVENT_*) to lists of EventRequests - private Hashtable _requests = null; + private Hashtable> _requests = null; /** * Returns an instance of the event manager @@ -92,41 +92,41 @@ public class EventManager // Private constructs a new EventManager private EventManager () { - _requests = new Hashtable (); + _requests = new Hashtable>(); // Add lists for all the event types - _requests.put (new Byte (EventRequest.EVENT_SINGLE_STEP), - new Hashtable ()); - _requests.put (new Byte (EventRequest.EVENT_BREAKPOINT), - new Hashtable ()); - _requests.put (new Byte (EventRequest.EVENT_FRAME_POP), - new Hashtable ()); - _requests.put (new Byte (EventRequest.EVENT_EXCEPTION), - new Hashtable ()); - _requests.put (new Byte (EventRequest.EVENT_USER_DEFINED), - new Hashtable ()); - _requests.put (new Byte (EventRequest.EVENT_THREAD_START), - new Hashtable ()); - _requests.put (new Byte (EventRequest.EVENT_THREAD_END), - new Hashtable ()); - _requests.put (new Byte (EventRequest.EVENT_CLASS_PREPARE), - new Hashtable ()); - _requests.put (new Byte (EventRequest.EVENT_CLASS_UNLOAD), - new Hashtable ()); - _requests.put (new Byte (EventRequest.EVENT_CLASS_LOAD), - new Hashtable ()); - _requests.put (new Byte (EventRequest.EVENT_FIELD_ACCESS), - new Hashtable ()); - _requests.put (new Byte (EventRequest.EVENT_FIELD_MODIFY), - new Hashtable ()); - _requests.put (new Byte (EventRequest.EVENT_METHOD_ENTRY), - new Hashtable ()); - _requests.put (new Byte (EventRequest.EVENT_METHOD_EXIT), - new Hashtable ()); - _requests.put (new Byte (EventRequest.EVENT_VM_INIT), - new Hashtable ()); - _requests.put (new Byte (EventRequest.EVENT_VM_DEATH), - new Hashtable ()); + _requests.put (Byte.valueOf(EventRequest.EVENT_SINGLE_STEP), + new Hashtable()); + _requests.put (Byte.valueOf(EventRequest.EVENT_BREAKPOINT), + new Hashtable()); + _requests.put (Byte.valueOf(EventRequest.EVENT_FRAME_POP), + new Hashtable()); + _requests.put (Byte.valueOf(EventRequest.EVENT_EXCEPTION), + new Hashtable()); + _requests.put (Byte.valueOf(EventRequest.EVENT_USER_DEFINED), + new Hashtable()); + _requests.put (Byte.valueOf(EventRequest.EVENT_THREAD_START), + new Hashtable()); + _requests.put (Byte.valueOf(EventRequest.EVENT_THREAD_END), + new Hashtable()); + _requests.put (Byte.valueOf(EventRequest.EVENT_CLASS_PREPARE), + new Hashtable()); + _requests.put (Byte.valueOf(EventRequest.EVENT_CLASS_UNLOAD), + new Hashtable()); + _requests.put (Byte.valueOf(EventRequest.EVENT_CLASS_LOAD), + new Hashtable()); + _requests.put (Byte.valueOf(EventRequest.EVENT_FIELD_ACCESS), + new Hashtable()); + _requests.put (Byte.valueOf(EventRequest.EVENT_FIELD_MODIFY), + new Hashtable()); + _requests.put (Byte.valueOf(EventRequest.EVENT_METHOD_ENTRY), + new Hashtable()); + _requests.put (Byte.valueOf(EventRequest.EVENT_METHOD_EXIT), + new Hashtable()); + _requests.put (Byte.valueOf(EventRequest.EVENT_VM_INIT), + new Hashtable()); + _requests.put (Byte.valueOf(EventRequest.EVENT_VM_DEATH), + new Hashtable()); // Add auto-generated event notifications // only two: VM_INIT, VM_DEATH @@ -157,10 +157,10 @@ public class EventManager */ public EventRequest[] getEventRequests(Event event) { - ArrayList interestedEvents = new ArrayList(); - Hashtable requests; - Byte kind = new Byte(event.getEventKind()); - requests = (Hashtable) _requests.get(kind); + ArrayList interestedEvents = new ArrayList(); + Hashtable requests; + Byte kind = Byte.valueOf(event.getEventKind()); + requests = _requests.get(kind); if (requests == null) { // Did not get a valid event type @@ -169,10 +169,10 @@ public class EventManager // Loop through the requests. Must look at ALL requests in order // to evaluate all filters (think count filter). - Iterator rIter = requests.values().iterator(); + Iterator rIter = requests.values().iterator(); while (rIter.hasNext()) { - EventRequest request = (EventRequest) rIter.next(); + EventRequest request = rIter.next(); if (request.matches(event)) interestedEvents.add(request); } @@ -200,9 +200,9 @@ public class EventManager throws JdwpException { // Add request to request list - Hashtable requests; + Hashtable requests; Byte kind = new Byte (request.getEventKind ()); - requests = (Hashtable) _requests.get (kind); + requests = _requests.get (kind); if (requests == null) { // Did not get a valid event type @@ -211,7 +211,7 @@ public class EventManager // Register the event with the VM VMVirtualMachine.registerEvent (request); - requests.put (new Integer (request.getId ()), request); + requests.put (Integer.valueOf (request.getId ()), request); } /** @@ -225,16 +225,16 @@ public class EventManager public void deleteRequest (byte kind, int id) throws JdwpException { - Hashtable requests; - requests = (Hashtable) _requests.get (new Byte (kind)); + Hashtable requests; + requests = _requests.get (Byte.valueOf (kind)); if (requests == null) { // Did not get a valid event type throw new IllegalArgumentException ("invalid event kind: " + kind); } - Integer iid = new Integer (id); - EventRequest request = (EventRequest) requests.get (iid); + Integer iid = Integer.valueOf (id); + EventRequest request = requests.get (iid); if (request != null) { VMVirtualMachine.unregisterEvent (request); @@ -252,7 +252,7 @@ public class EventManager public void clearRequests (byte kind) throws JdwpException { - Hashtable requests = (Hashtable) _requests.get (new Byte (kind)); + Hashtable requests = _requests.get (Byte.valueOf(kind)); if (requests == null) { // Did not get a valid event type @@ -274,14 +274,14 @@ public class EventManager */ public EventRequest getRequest (byte kind, int id) { - Hashtable requests = (Hashtable) _requests.get (new Byte (kind)); + Hashtable requests = _requests.get(Byte.valueOf(kind)); if (requests == null) { // Did not get a valid event type throw new IllegalArgumentException ("invalid event kind: " + kind); } - return (EventRequest) requests.get (new Integer (id)); + return requests.get (Integer.valueOf(id)); } /** @@ -291,9 +291,10 @@ public class EventManager * @returns a Collection of all the registered requests * @throws IllegalArgumentException for invalid event kind */ - public Collection getRequests (byte kind) + public Collection getRequests (byte kind) { - Hashtable requests = (Hashtable) _requests.get (new Byte (kind)); + Hashtable requests = + _requests.get (Byte.valueOf (kind)); if (requests == null) { // Did not get a valid event type diff --git a/gnu/classpath/jdwp/event/EventRequest.java b/gnu/classpath/jdwp/event/EventRequest.java index 891da229b..d5b560d04 100644 --- a/gnu/classpath/jdwp/event/EventRequest.java +++ b/gnu/classpath/jdwp/event/EventRequest.java @@ -1,5 +1,5 @@ /* EventRequest.java -- an event request from the debugger - Copyright (C) 2005, 2006 Free Software Foundation + Copyright (C) 2005, 2006, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -185,7 +185,7 @@ public class EventRequest private static Object _idLock = new Object (); // A list of filters - private LinkedList _filters; + private LinkedList _filters; // The ID of this request private int _id; @@ -204,7 +204,7 @@ public class EventRequest */ public EventRequest (byte kind, byte suspendPolicy) { - _filters = new LinkedList (); + _filters = new LinkedList(); synchronized (_idLock) { _id = ++_last_id; @@ -222,7 +222,7 @@ public class EventRequest */ public EventRequest (int id, byte kind, byte suspendPolicy) { - _filters = new LinkedList (); + _filters = new LinkedList(); _kind = kind; _suspendPolicy = suspendPolicy; } @@ -240,7 +240,7 @@ public class EventRequest // Check validity of filter for this request boolean valid = true; - Class clazz = filter.getClass (); + Class clazz = filter.getClass (); if (clazz == ClassExcludeFilter.class) { if (_kind == EVENT_THREAD_START @@ -321,7 +321,7 @@ public class EventRequest /** * Returns the filters attached to this request */ - public Collection getFilters () + public Collection getFilters () { return _filters; } @@ -370,10 +370,10 @@ public class EventRequest // Loop through filters; all must match // Note that we must allow EVERY filter to evaluate. This way // things like CountFilter will work. - Iterator iter = _filters.iterator (); + Iterator iter = _filters.iterator (); while (iter.hasNext ()) { - IEventFilter filter = (IEventFilter) iter.next (); + IEventFilter filter = iter.next (); if (!filter.matches (theEvent)) matches = false; } diff --git a/gnu/classpath/jdwp/event/ExceptionEvent.java b/gnu/classpath/jdwp/event/ExceptionEvent.java index e63f5df12..ff36c47b5 100644 --- a/gnu/classpath/jdwp/event/ExceptionEvent.java +++ b/gnu/classpath/jdwp/event/ExceptionEvent.java @@ -1,5 +1,5 @@ /* ExceptionEvent.java -- an event specifying an exception has been thrown - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2013 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -72,7 +72,7 @@ public class ExceptionEvent private Location _catchLocation; //the class where the exeption was thrown - private Class _klass; + private Class _klass; /** * Constructs a new ExceptionEvent where the exception was @@ -85,7 +85,7 @@ public class ExceptionEvent * @param instance the instance that threw the exception */ public ExceptionEvent(Throwable exception, Thread thread, Location location, - Location catchLocation, Class clazz, Object instance) + Location catchLocation, Class clazz, Object instance) { super(JdwpConstants.EventKind.EXCEPTION); _exception = exception; diff --git a/gnu/classpath/jdwp/event/filters/ClassMatchFilter.java b/gnu/classpath/jdwp/event/filters/ClassMatchFilter.java index edb84d7ef..e366a36d3 100644 --- a/gnu/classpath/jdwp/event/filters/ClassMatchFilter.java +++ b/gnu/classpath/jdwp/event/filters/ClassMatchFilter.java @@ -1,5 +1,5 @@ /* ClassMatchFilter.java -- filter on class name (inclusive) - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -93,7 +93,7 @@ public class ClassMatchFilter Object type = event.getParameter (Event.EVENT_CLASS); if (type != null) { - Class eventClass = (Class) type; + Class eventClass = (Class) type; String name = eventClass.getName (); if (_pattern.startsWith ("*")) diff --git a/gnu/classpath/jdwp/event/filters/ClassOnlyFilter.java b/gnu/classpath/jdwp/event/filters/ClassOnlyFilter.java index d912cb5ef..52567af69 100644 --- a/gnu/classpath/jdwp/event/filters/ClassOnlyFilter.java +++ b/gnu/classpath/jdwp/event/filters/ClassOnlyFilter.java @@ -1,5 +1,5 @@ /* ClassOnlyFilter.java -- filter on specific class - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -92,8 +92,8 @@ public class ClassOnlyFilter { try { - Class clazz = _id.getType (); - Class eventClass = (Class) type; + Class clazz = _id.getType (); + Class eventClass = (Class) type; if (clazz.isAssignableFrom (eventClass)) return true; } diff --git a/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java b/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java index d4687fa4e..3924630a0 100644 --- a/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java +++ b/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java @@ -1,5 +1,5 @@ /* ExceptionOnlyFilter.java -- filter for excetions by caught/uncaught and type - Copyright (C) 2005, 2006 Free Software Foundation + Copyright (C) 2005, 2006, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -103,8 +103,8 @@ public class ExceptionOnlyFilter { try { - Class klass - = (Class) event.getParameter(Event.EVENT_EXCEPTION_CLASS); + Class klass + = (Class) event.getParameter(Event.EVENT_EXCEPTION_CLASS); classMatch = klass == _refId.getType(); } catch (InvalidClassException ex) diff --git a/gnu/classpath/jdwp/event/filters/FieldOnlyFilter.java b/gnu/classpath/jdwp/event/filters/FieldOnlyFilter.java index 47a804101..4fd561026 100644 --- a/gnu/classpath/jdwp/event/filters/FieldOnlyFilter.java +++ b/gnu/classpath/jdwp/event/filters/FieldOnlyFilter.java @@ -1,5 +1,5 @@ /* FieldOnlyFilter.java -- filter on field - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -69,11 +69,14 @@ public class FieldOnlyFilter public FieldOnlyFilter (ReferenceTypeId refId, /*Field*/ReferenceTypeId fid) throws InvalidClassException, InvalidFieldException { - if (refId == null || refId.getReference().get () == null) + if (refId == null) + throw new InvalidClassException(); + + if (refId.getReference().get () == null) throw new InvalidClassException (refId.getId ()); if (fid == null) - throw new InvalidFieldException (fid.getId ()); + throw new InvalidFieldException (); _refId = refId; _fieldId = fid; diff --git a/gnu/classpath/jdwp/exception/InvalidClassException.java b/gnu/classpath/jdwp/exception/InvalidClassException.java index de15000a4..234a8a1d1 100644 --- a/gnu/classpath/jdwp/exception/InvalidClassException.java +++ b/gnu/classpath/jdwp/exception/InvalidClassException.java @@ -1,5 +1,5 @@ /* InvalidClassException.java -- invalid/unknown class reference id exception - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -50,6 +50,17 @@ import gnu.classpath.jdwp.JdwpConstants; public class InvalidClassException extends JdwpException { + + /** + * Constructs a new exception thrown due to + * a null class ID. + */ + public InvalidClassException () + { + super (JdwpConstants.Error.INVALID_CLASS, + "invalid class id (null)"); + } + public InvalidClassException (long id) { super (JdwpConstants.Error.INVALID_CLASS, diff --git a/gnu/classpath/jdwp/exception/InvalidFieldException.java b/gnu/classpath/jdwp/exception/InvalidFieldException.java index 47470ab8c..a7ceb3510 100644 --- a/gnu/classpath/jdwp/exception/InvalidFieldException.java +++ b/gnu/classpath/jdwp/exception/InvalidFieldException.java @@ -1,5 +1,5 @@ /* InvalidFieldException.java -- an invalid field id exception - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -50,6 +50,16 @@ import gnu.classpath.jdwp.JdwpConstants; public class InvalidFieldException extends JdwpException { + /** + * Constructs a new exception thrown due to + * a null field ID. + */ + public InvalidFieldException () + { + super (JdwpConstants.Error.INVALID_FIELDID, + "invalid field id (null)"); + } + public InvalidFieldException (long id) { super (JdwpConstants.Error.INVALID_FIELDID, diff --git a/gnu/classpath/jdwp/id/ClassLoaderId.java b/gnu/classpath/jdwp/id/ClassLoaderId.java index 37c4c3655..7a7d669dc 100644 --- a/gnu/classpath/jdwp/id/ClassLoaderId.java +++ b/gnu/classpath/jdwp/id/ClassLoaderId.java @@ -1,5 +1,5 @@ /* ClassLoaderId.java -- class loader IDs - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -53,7 +53,7 @@ public class ClassLoaderId /** * The object class that this id represents */ - public static final Class typeClass = ClassLoader.class; + public static final Class typeClass = ClassLoader.class; /** * Constructs a new ClassLoaderId diff --git a/gnu/classpath/jdwp/id/ClassObjectId.java b/gnu/classpath/jdwp/id/ClassObjectId.java index 3e1642212..a28b9bcd4 100644 --- a/gnu/classpath/jdwp/id/ClassObjectId.java +++ b/gnu/classpath/jdwp/id/ClassObjectId.java @@ -1,5 +1,5 @@ /* ClassObjectId.java -- class object IDs - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -53,7 +53,9 @@ public class ClassObjectId /** * The object class that this id represents */ - public static final Class typeClass = Class.class; + // Seems to produce a bogus warning + @SuppressWarnings("unchecked") + public static final Class typeClass = Class.class; /** * Constructs a new ClassObjectId @@ -69,10 +71,10 @@ public class ClassObjectId * @throws InvalidClassException if Class is garbage collected, * or otherwise invalid */ - public Class getClassObject () + public Class getClassObject () throws InvalidClassException { - Class cl = (Class) _reference.get (); + Class cl = (Class) _reference.get (); if (cl == null) throw new InvalidClassException (getId ()); diff --git a/gnu/classpath/jdwp/id/JdwpId.java b/gnu/classpath/jdwp/id/JdwpId.java index 6caaa3a01..4ac1d2053 100644 --- a/gnu/classpath/jdwp/id/JdwpId.java +++ b/gnu/classpath/jdwp/id/JdwpId.java @@ -1,5 +1,5 @@ /* JdwpId.java -- base class for all object ID types - Copyright (C) 2005, 2006 Free Software Foundation + Copyright (C) 2005, 2006, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -70,7 +70,7 @@ public abstract class JdwpId /** * The object/class represented by this Id */ - protected SoftReference _reference; + protected SoftReference _reference; /** * Constructs an empty JdwpId @@ -101,7 +101,7 @@ public abstract class JdwpId * * @returns a refernce to the object or class */ - public SoftReference getReference () + public SoftReference getReference () { return _reference; } @@ -111,7 +111,7 @@ public abstract class JdwpId * * @param ref a refernce to the object or class */ - public void setReference (SoftReference ref) + public void setReference (SoftReference ref) { _reference = ref; } diff --git a/gnu/classpath/jdwp/id/NullObjectId.java b/gnu/classpath/jdwp/id/NullObjectId.java index 5dc9753b7..7000f4924 100644 --- a/gnu/classpath/jdwp/id/NullObjectId.java +++ b/gnu/classpath/jdwp/id/NullObjectId.java @@ -1,5 +1,5 @@ /* NullObjectId.java -- special objectId for null values - Copyright (C) 2007 Free Software Foundation + Copyright (C) 2007, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -56,7 +56,7 @@ public class NullObjectId /** * The object class that this id represents */ - public static final Class typeClass = NullObject.class; + public static final Class typeClass = NullObject.class; /** * Constructs a new NullObjectId @@ -65,7 +65,7 @@ public class NullObjectId { super(); setId((long) 0); - _reference = new SoftReference(new NullObject()); + _reference = new SoftReference(new NullObject()); try { disableCollection(); diff --git a/gnu/classpath/jdwp/id/ObjectId.java b/gnu/classpath/jdwp/id/ObjectId.java index a4a37fd13..76d9e006f 100644 --- a/gnu/classpath/jdwp/id/ObjectId.java +++ b/gnu/classpath/jdwp/id/ObjectId.java @@ -1,5 +1,5 @@ /* ObjectId.java -- object IDs - Copyright (C) 2005, 2006 Free Software Foundation + Copyright (C) 2005, 2006, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -58,7 +58,7 @@ public class ObjectId /** * The object class that this id represents */ - public static final Class typeClass = Object.class; + public static final Class typeClass = Object.class; // Handle to disable garbage collection private Object _handle; diff --git a/gnu/classpath/jdwp/id/ReferenceTypeId.java b/gnu/classpath/jdwp/id/ReferenceTypeId.java index b82acf34a..73df00c11 100644 --- a/gnu/classpath/jdwp/id/ReferenceTypeId.java +++ b/gnu/classpath/jdwp/id/ReferenceTypeId.java @@ -1,5 +1,5 @@ /* ReferenceTypeId.java -- a base class for all reference type IDs - Copyright (C) 2005, 2006 Free Software Foundation + Copyright (C) 2005, 2006, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -67,10 +67,10 @@ public class ReferenceTypeId * @returns the class * @throws InvalidClassException if the class is not valid */ - public Class getType () + public Class getType () throws InvalidClassException { - Class clazz = (Class) _reference.get (); + Class clazz = (Class) _reference.get (); if (clazz == null) throw new InvalidClassException (_id); diff --git a/gnu/classpath/jdwp/id/StringId.java b/gnu/classpath/jdwp/id/StringId.java index 1ba8f6d4d..894b5bc74 100644 --- a/gnu/classpath/jdwp/id/StringId.java +++ b/gnu/classpath/jdwp/id/StringId.java @@ -1,5 +1,5 @@ /* StringId.java -- string IDs - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -53,7 +53,7 @@ public class StringId /** * The object class that this id represents */ - public static final Class typeClass = String.class; + public static final Class typeClass = String.class; /** * Constructs a new StringId diff --git a/gnu/classpath/jdwp/id/ThreadGroupId.java b/gnu/classpath/jdwp/id/ThreadGroupId.java index f4d9d803d..1bb6a3bd0 100644 --- a/gnu/classpath/jdwp/id/ThreadGroupId.java +++ b/gnu/classpath/jdwp/id/ThreadGroupId.java @@ -1,5 +1,5 @@ /* ThreadGroupId.java -- thread group IDs - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -53,7 +53,7 @@ public class ThreadGroupId /** * The object class that this id represents */ - public static final Class typeClass = ThreadGroup.class; + public static final Class typeClass = ThreadGroup.class; /** * Constructs a new ThreadGroupId diff --git a/gnu/classpath/jdwp/id/ThreadId.java b/gnu/classpath/jdwp/id/ThreadId.java index 207d6b0a1..a4c5753a4 100644 --- a/gnu/classpath/jdwp/id/ThreadId.java +++ b/gnu/classpath/jdwp/id/ThreadId.java @@ -1,5 +1,5 @@ /* ThreadId.java -- thread IDs - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -53,7 +53,7 @@ public class ThreadId /** * The object class that this id represents */ - public static final Class typeClass = Thread.class; + public static final Class typeClass = Thread.class; /** * Constructs a new ThreadId diff --git a/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java b/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java index 93c9d73e3..be606ad3c 100644 --- a/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java +++ b/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java @@ -1,6 +1,6 @@ /* ArrayReferenceCommandSet.java -- class to implement the Array Reference Command Set - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -110,7 +110,7 @@ public class ArrayReferenceCommandSet int length = bb.getInt(); // We need to write out the byte signifying the type of array first - Class clazz = array.getClass().getComponentType(); + Class clazz = array.getClass().getComponentType(); // Uugh, this is a little ugly but it's the only time we deal with // arrayregions @@ -166,7 +166,7 @@ public class ArrayReferenceCommandSet Object array = oid.getObject(); int first = bb.getInt(); int length = bb.getInt(); - Class type = array.getClass().getComponentType(); + Class type = array.getClass().getComponentType(); for (int i = first; i < first + length; i++) { Object value = Value.getUntaggedObject(bb, type); diff --git a/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java b/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java index 899bf2997..3aa4088f8 100644 --- a/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java +++ b/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java @@ -1,5 +1,5 @@ /* ArrayTypeCommandSet.java -- class to implement the ArrayType Command Set - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -90,8 +90,8 @@ public class ArrayTypeCommandSet throws JdwpException, IOException { ReferenceTypeId refId = idMan.readReferenceTypeId(bb); - Class arrayType = refId.getType(); - Class componentType = arrayType.getComponentType(); + Class arrayType = refId.getType(); + Class componentType = arrayType.getComponentType(); int length = bb.getInt(); Object newArray = Array.newInstance(componentType, length); diff --git a/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java b/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java index 295410f6c..48e05a4a4 100644 --- a/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java +++ b/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java @@ -1,6 +1,6 @@ /* ClassLoaderReferenceCommandSet.java -- class to implement the ClassLoaderReference Command Set - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -95,11 +95,13 @@ public class ClassLoaderReferenceCommandSet { ObjectId oId = idMan.readObjectId(bb); ClassLoader cl = (ClassLoader) oId.getObject(); - ArrayList loadRequests = VMVirtualMachine.getLoadRequests(cl); + // VMWARN: Suppress warning until VM layer is upgraded to generics + @SuppressWarnings("unchecked") + ArrayList> loadRequests = VMVirtualMachine.getLoadRequests(cl); os.writeInt(loadRequests.size()); - for (Iterator iter = loadRequests.iterator(); iter.hasNext();) + for (Iterator> iter = loadRequests.iterator(); iter.hasNext();) { - Class clazz = (Class)iter.next(); + Class clazz = iter.next(); ReferenceTypeId refId = idMan.getReferenceTypeId(clazz); refId.writeTagged(os); } diff --git a/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java b/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java index b32dbc2e5..6006d72fa 100644 --- a/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java +++ b/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java @@ -1,6 +1,6 @@ /* ClassObjectReferenceCommandSet.java -- class to implement the ClassObjectReference Command Set - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -87,7 +87,7 @@ public class ClassObjectReferenceCommandSet throws JdwpException, IOException { ObjectId oid = idMan.readObjectId(bb); - Class clazz = (Class) oid.getObject(); + Class clazz = (Class) oid.getObject(); // The difference between a ClassObjectId and a ReferenceTypeId is one is // stored as an ObjectId and the other as a ReferenceTypeId. diff --git a/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java b/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java index ec496bfe9..46f128ec7 100644 --- a/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java +++ b/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java @@ -1,6 +1,6 @@ /* ClassTypeCommandSet.java -- class to implement the ClassType Command Set - Copyright (C) 2005, 2007 Free Software Foundation + Copyright (C) 2005, 2007, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -105,8 +105,8 @@ public class ClassTypeCommandSet throws JdwpException, IOException { ReferenceTypeId refId = idMan.readReferenceTypeId(bb); - Class clazz = refId.getType(); - Class superClazz = clazz.getSuperclass(); + Class clazz = refId.getType(); + Class superClazz = clazz.getSuperclass(); if (superClazz == null) { os.writeLong(0L); @@ -119,10 +119,7 @@ public class ClassTypeCommandSet private void executeSetValues(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ReferenceTypeId refId = idMan.readReferenceTypeId(bb); - - // We don't actually seem to need this... - Class clazz = refId.getType(); + idMan.readReferenceTypeId(bb); int numValues = bb.getInt(); @@ -183,7 +180,7 @@ public class ClassTypeCommandSet throws JdwpException, IOException { ReferenceTypeId refId = idMan.readReferenceTypeId(bb); - Class clazz = refId.getType(); + Class clazz = refId.getType(); ObjectId tId = idMan.readObjectId(bb); Thread thread = (Thread) tId.getObject(); diff --git a/gnu/classpath/jdwp/processor/MethodCommandSet.java b/gnu/classpath/jdwp/processor/MethodCommandSet.java index 043be7cf0..a48663f8e 100644 --- a/gnu/classpath/jdwp/processor/MethodCommandSet.java +++ b/gnu/classpath/jdwp/processor/MethodCommandSet.java @@ -1,5 +1,5 @@ /* MethodCommandSet.java -- class to implement the Method Command Set - Copyright (C) 2005, 2006, 2007 Free Software Foundation + Copyright (C) 2005, 2006, 2007, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -101,7 +101,7 @@ public class MethodCommandSet throws JdwpException, IOException { ReferenceTypeId refId = idMan.readReferenceTypeId(bb); - Class clazz = refId.getType(); + Class clazz = refId.getType(); VMMethod method = VMMethod.readId(clazz, bb); LineTable lt = method.getLineTable(); @@ -112,7 +112,7 @@ public class MethodCommandSet throws JdwpException, IOException { ReferenceTypeId refId = idMan.readReferenceTypeId(bb); - Class clazz = refId.getType(); + Class clazz = refId.getType(); VMMethod method = VMMethod.readId(clazz, bb); VariableTable vt = method.getVariableTable(); @@ -129,7 +129,7 @@ public class MethodCommandSet } ReferenceTypeId id = idMan.readReferenceTypeId(bb); - Class klass = id.getType(); + Class klass = id.getType(); VMMethod method = VMMethod.readId(klass, bb); byte[] bytecode = VMVirtualMachine.getBytecodes(method); os.writeInt(bytecode.length); diff --git a/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java b/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java index f6bf8a656..fb22f7740 100644 --- a/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java +++ b/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java @@ -1,6 +1,6 @@ /* ObjectReferenceCommandSet.java -- class to implement the ObjectReference Command Set - Copyright (C) 2005, 2007 Free Software Foundation + Copyright (C) 2005, 2007, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -117,7 +117,7 @@ public class ObjectReferenceCommandSet { ObjectId oid = idMan.readObjectId(bb); Object obj = oid.getObject(); - Class clazz = obj.getClass(); + Class clazz = obj.getClass(); ReferenceTypeId refId = idMan.getReferenceTypeId(clazz); refId.writeTagged(os); } @@ -211,7 +211,7 @@ public class ObjectReferenceCommandSet Thread thread = (Thread) tid.getObject(); ReferenceTypeId rid = idMan.readReferenceTypeId(bb); - Class clazz = rid.getType(); + Class clazz = rid.getType(); VMMethod method = VMMethod.readId(clazz, bb); diff --git a/gnu/classpath/jdwp/processor/PacketProcessor.java b/gnu/classpath/jdwp/processor/PacketProcessor.java index c4818aed8..785297c10 100644 --- a/gnu/classpath/jdwp/processor/PacketProcessor.java +++ b/gnu/classpath/jdwp/processor/PacketProcessor.java @@ -1,6 +1,6 @@ /* PacketProcessor.java -- a thread which processes command packets from the debugger - Copyright (C) 2005, 2006 Free Software Foundation + Copyright (C) 2005, 2006, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -63,7 +63,7 @@ import java.security.PrivilegedAction; * @author Keith Seitz (keiths@redhat.com) */ public class PacketProcessor - implements PrivilegedAction + implements PrivilegedAction { // The connection to the debugger private JdwpConnection _connection; @@ -135,7 +135,7 @@ public class PacketProcessor * Main run routine for this thread. Will loop getting packets * from the connection and processing them. */ - public Object run () + public Void run () { // Notify initialization thread (gnu.classpath.jdwp.Jdwp) that // the PacketProcessor thread is ready. diff --git a/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java b/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java index 3489588df..ba4227fbe 100644 --- a/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java +++ b/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java @@ -1,6 +1,6 @@ /* ReferenceTypeCommandSet.java -- class to implement the ReferenceType Command Set - Copyright (C) 2005, 2006, 2007 Free Software Foundation + Copyright (C) 2005, 2006, 2007, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -146,7 +146,7 @@ public class ReferenceTypeCommandSet { ReferenceTypeId refId = idMan.readReferenceTypeId(bb); - Class clazz = refId.getType(); + Class clazz = refId.getType(); ClassLoader loader = clazz.getClassLoader(); ObjectId oid = idMan.getObjectId(loader); oid.write(os); @@ -157,7 +157,7 @@ public class ReferenceTypeCommandSet { ReferenceTypeId refId = idMan.readReferenceTypeId(bb); - Class clazz = refId.getType(); + Class clazz = refId.getType(); os.writeInt(clazz.getModifiers()); } @@ -165,7 +165,7 @@ public class ReferenceTypeCommandSet throws JdwpException, IOException { ReferenceTypeId refId = idMan.readReferenceTypeId(bb); - Class clazz = refId.getType(); + Class clazz = refId.getType(); Field[] fields = clazz.getFields(); os.writeInt(fields.length); @@ -183,7 +183,7 @@ public class ReferenceTypeCommandSet throws JdwpException, IOException { ReferenceTypeId refId = idMan.readReferenceTypeId(bb); - Class clazz = refId.getType(); + Class clazz = refId.getType(); VMMethod[] methods = VMVirtualMachine.getAllClassMethods(clazz); os.writeInt (methods.length); @@ -201,7 +201,7 @@ public class ReferenceTypeCommandSet throws JdwpException, IOException { ReferenceTypeId refId = idMan.readReferenceTypeId(bb); - Class clazz = refId.getType(); + Class clazz = refId.getType(); int numFields = bb.getInt(); os.writeInt(numFields); // Looks pointless but this is the protocol @@ -209,7 +209,7 @@ public class ReferenceTypeCommandSet { ObjectId fieldId = idMan.readObjectId(bb); Field field = (Field) (fieldId.getObject()); - Class fieldClazz = field.getDeclaringClass(); + Class fieldClazz = field.getDeclaringClass(); // We don't actually need the clazz to get the field but we might as // well check that the debugger got it right @@ -243,7 +243,7 @@ public class ReferenceTypeCommandSet throws JdwpException, IOException { ReferenceTypeId refId = idMan.readReferenceTypeId(bb); - Class clazz = refId.getType(); + Class clazz = refId.getType(); // We'll need to go into the jvm for this unless there's an easier way String sourceFileName = VMVirtualMachine.getSourceFile(clazz); @@ -255,12 +255,12 @@ public class ReferenceTypeCommandSet throws JdwpException, IOException { ReferenceTypeId refId = idMan.readReferenceTypeId(bb); - Class clazz = refId.getType(); - Class[] declaredClazzes = clazz.getDeclaredClasses(); + Class clazz = refId.getType(); + Class[] declaredClazzes = clazz.getDeclaredClasses(); os.writeInt(declaredClazzes.length); for (int i = 0; i < declaredClazzes.length; i++) { - Class decClazz = declaredClazzes[i]; + Class decClazz = declaredClazzes[i]; ReferenceTypeId clazzId = idMan.getReferenceTypeId(decClazz); clazzId.writeTagged(os); } @@ -270,7 +270,7 @@ public class ReferenceTypeCommandSet throws JdwpException, IOException { ReferenceTypeId refId = idMan.readReferenceTypeId(bb); - Class clazz = refId.getType(); + Class clazz = refId.getType(); // I don't think there's any other way to get this int status = VMVirtualMachine.getClassStatus(clazz); @@ -281,12 +281,12 @@ public class ReferenceTypeCommandSet throws JdwpException, IOException { ReferenceTypeId refId = idMan.readReferenceTypeId(bb); - Class clazz = refId.getType(); - Class[] interfaces = clazz.getInterfaces(); + Class clazz = refId.getType(); + Class[] interfaces = clazz.getInterfaces(); os.writeInt(interfaces.length); for (int i = 0; i < interfaces.length; i++) { - Class interfaceClass = interfaces[i]; + Class interfaceClass = interfaces[i]; ReferenceTypeId intId = idMan.getReferenceTypeId(interfaceClass); intId.write(os); } @@ -296,7 +296,7 @@ public class ReferenceTypeCommandSet throws JdwpException, IOException { ReferenceTypeId refId = idMan.readReferenceTypeId(bb); - Class clazz = refId.getType(); + Class clazz = refId.getType(); ObjectId clazzObjectId = idMan.getObjectId(clazz); clazzObjectId.write(os); } diff --git a/gnu/classpath/jdwp/processor/StackFrameCommandSet.java b/gnu/classpath/jdwp/processor/StackFrameCommandSet.java index 2b82e05ff..115e6018e 100644 --- a/gnu/classpath/jdwp/processor/StackFrameCommandSet.java +++ b/gnu/classpath/jdwp/processor/StackFrameCommandSet.java @@ -1,5 +1,5 @@ /* StackFrameCommandSet.java -- class to implement the StackFrame Command Set - Copyright (C) 2005, 2007 Free Software Foundation + Copyright (C) 2005, 2007, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -65,7 +65,6 @@ public class StackFrameCommandSet public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command) throws JdwpException { - boolean keepRunning = true; try { switch (command) diff --git a/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java b/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java index 2bbff44de..cc657dc5d 100644 --- a/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java +++ b/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java @@ -1,5 +1,5 @@ /* ThreadReferenceCommandSet.java -- class to implement the ThreadReference - Command Set Copyright (C) 2005, 2007 Free Software Foundation + Command Set Copyright (C) 2005, 2007, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -176,11 +176,14 @@ public class ThreadReferenceCommandSet int startFrame = bb.getInt(); int length = bb.getInt(); - ArrayList frames = VMVirtualMachine.getFrames(thread, startFrame, length); + // VMWARN: Suppress warning until VM layer is upgraded to generics + @SuppressWarnings("unchecked") + ArrayList frames = + VMVirtualMachine.getFrames(thread, startFrame, length); os.writeInt(frames.size()); for (int i = 0; i < frames.size(); i++) { - VMFrame frame = (VMFrame) frames.get(i); + VMFrame frame = frames.get(i); os.writeLong(frame.getId()); Location loc = frame.getLocation(); loc.write(os); diff --git a/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java b/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java index c476a04e9..ef0323568 100644 --- a/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java +++ b/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java @@ -1,6 +1,6 @@ /* VirtualMachineCommandSet.java -- class to implement the VirtualMachine Command Set - Copyright (C) 2005, 2006, 2007 Free Software Foundation + Copyright (C) 2005, 2006, 2007, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -177,15 +177,17 @@ public class VirtualMachineCommandSet throws JdwpException, IOException { String sig = JdwpString.readString(bb); - ArrayList allMatchingClasses = new ArrayList(); + ArrayList> allMatchingClasses = new ArrayList>(); // This will be an Iterator over all loaded Classes - Collection classes = VMVirtualMachine.getAllLoadedClasses(); - Iterator iter = classes.iterator (); + // VMWARN: Suppress warning until VM layer is upgraded to generics + @SuppressWarnings("unchecked") + Collection> classes = VMVirtualMachine.getAllLoadedClasses(); + Iterator> iter = classes.iterator (); while (iter.hasNext()) { - Class clazz = (Class) iter.next(); + Class clazz = iter.next(); String clazzSig = Signature.computeClassSignature(clazz); if (clazzSig.equals(sig)) allMatchingClasses.add(clazz); @@ -194,7 +196,7 @@ public class VirtualMachineCommandSet os.writeInt(allMatchingClasses.size()); for (int i = 0; i < allMatchingClasses.size(); i++) { - Class clazz = (Class) allMatchingClasses.get(i); + Class clazz = allMatchingClasses.get(i); ReferenceTypeId id = idMan.getReferenceTypeId(clazz); id.writeTagged(os); int status = VMVirtualMachine.getClassStatus(clazz); @@ -205,13 +207,15 @@ public class VirtualMachineCommandSet private void executeAllClasses(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - Collection classes = VMVirtualMachine.getAllLoadedClasses(); + // VMWARN: Suppress warning until VM layer is upgraded to generics + @SuppressWarnings("unchecked") + Collection> classes = VMVirtualMachine.getAllLoadedClasses(); os.writeInt(classes.size ()); - Iterator iter = classes.iterator (); + Iterator> iter = classes.iterator (); while (iter.hasNext()) { - Class clazz = (Class) iter.next(); + Class clazz = iter.next(); ReferenceTypeId id = idMan.getReferenceTypeId(clazz); id.writeTagged(os); String sig = Signature.computeClassSignature(clazz); @@ -419,7 +423,7 @@ public class VirtualMachineCommandSet } int classes = bb.getInt(); - Class[] types = new Class[classes]; + Class[] types = new Class[classes]; byte[][] bytecodes = new byte[classes][]; for (int i = 0; i < classes; ++i) { diff --git a/gnu/classpath/jdwp/transport/ITransport.java b/gnu/classpath/jdwp/transport/ITransport.java index cf5542560..0280e8dc3 100644 --- a/gnu/classpath/jdwp/transport/ITransport.java +++ b/gnu/classpath/jdwp/transport/ITransport.java @@ -1,5 +1,5 @@ /* ITransport.java -- An interface defining JDWP transports - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -58,7 +58,7 @@ public interface ITransport * @param properties properties of the transport configuration * @throws TransportException on configury error */ - public void configure (HashMap properties) + public void configure (HashMap properties) throws TransportException; /** diff --git a/gnu/classpath/jdwp/transport/JdwpConnection.java b/gnu/classpath/jdwp/transport/JdwpConnection.java index 3c91f048e..76b946a55 100644 --- a/gnu/classpath/jdwp/transport/JdwpConnection.java +++ b/gnu/classpath/jdwp/transport/JdwpConnection.java @@ -1,5 +1,5 @@ /* JdwpConnection.java -- A JDWP-speaking connection - Copyright (C) 2005, 2006, 2007 Free Software Foundation + Copyright (C) 2005, 2006, 2007, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -74,7 +74,7 @@ public class JdwpConnection private ITransport _transport; // Command queue - private ArrayList _commandQueue; + private ArrayList _commandQueue; // Shutdown flag private boolean _shutdown; @@ -100,7 +100,7 @@ public class JdwpConnection { super (group, "JDWP connection thread"); _transport = transport; - _commandQueue = new ArrayList (); + _commandQueue = new ArrayList(); _shutdown = false; _bytes = new ByteArrayOutputStream (); _doStream = new DataOutputStream (_bytes); @@ -250,7 +250,7 @@ public class JdwpConnection } } - return (JdwpPacket) _commandQueue.remove (0); + return _commandQueue.remove (0); } } diff --git a/gnu/classpath/jdwp/transport/JdwpPacket.java b/gnu/classpath/jdwp/transport/JdwpPacket.java index b967d9bc5..cb4925b4f 100644 --- a/gnu/classpath/jdwp/transport/JdwpPacket.java +++ b/gnu/classpath/jdwp/transport/JdwpPacket.java @@ -1,5 +1,5 @@ /* JdwpPacket.java -- Base class for JDWP command and reply packets - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -199,7 +199,7 @@ public abstract class JdwpPacket | (bytes[i++] & 0xff) << 8 | (bytes[i++] & 0xff)); flags = bytes[i++]; - Class clazz = null; + Class clazz = null; if (flags == 0) clazz = JdwpCommandPacket.class; else if ((flags & JDWP_FLAG_REPLY) != 0) diff --git a/gnu/classpath/jdwp/transport/SocketTransport.java b/gnu/classpath/jdwp/transport/SocketTransport.java index 4872ba176..598fed4f8 100644 --- a/gnu/classpath/jdwp/transport/SocketTransport.java +++ b/gnu/classpath/jdwp/transport/SocketTransport.java @@ -1,5 +1,5 @@ /* SocketTransport.java -- a socket transport - Copyright (C) 2005, 2007 Free Software Foundation + Copyright (C) 2005, 2007, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -89,11 +89,11 @@ class SocketTransport * @param properties the properties of the JDWP session * @throws TransportException for any configury errors */ - public void configure(HashMap properties) + public void configure(HashMap properties) throws TransportException { // Get server [form: "y" or "n"] - String p = (String) properties.get(_PROPERTY_SERVER); + String p = properties.get(_PROPERTY_SERVER); if (p != null) { if (p.toLowerCase().equals("y")) diff --git a/gnu/classpath/jdwp/transport/TransportFactory.java b/gnu/classpath/jdwp/transport/TransportFactory.java index 681967b77..71ddfe336 100644 --- a/gnu/classpath/jdwp/transport/TransportFactory.java +++ b/gnu/classpath/jdwp/transport/TransportFactory.java @@ -1,5 +1,5 @@ /* TransportFactory.java -- Factory for transports - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -56,8 +56,8 @@ public class TransportFactory private static class TransportMethod { String name; - Class clazz; - public TransportMethod (String name, Class clazz) + Class clazz; + public TransportMethod (String name, Class clazz) { this.name = name; this.clazz = clazz; @@ -79,12 +79,12 @@ public class TransportFactory * @returns the created and configured transport * @throws TransportException for invalid configurations */ - public static ITransport newInstance (HashMap properties) + public static ITransport newInstance (HashMap properties) throws TransportException { String name = null; if (properties != null) - name = (String) properties.get (_TRANSPORT_PROPERTY); + name = properties.get (_TRANSPORT_PROPERTY); if (name == null) throw new TransportException ("no transport specified"); diff --git a/gnu/classpath/jdwp/util/Location.java b/gnu/classpath/jdwp/util/Location.java index 6d8c2e7b9..56050bf1d 100644 --- a/gnu/classpath/jdwp/util/Location.java +++ b/gnu/classpath/jdwp/util/Location.java @@ -1,5 +1,5 @@ /* Location.java -- class to read/write JDWP locations - Copyright (C) 2005, 2006, 2007 Free Software Foundation + Copyright (C) 2005, 2006, 2007, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -80,10 +80,10 @@ public class Location public Location(ByteBuffer bb) throws IOException, JdwpException { - byte tag = bb.get(); + bb.get(); ClassReferenceTypeId classId = (ClassReferenceTypeId) VMIdManager.getDefault().readReferenceTypeId(bb); - Class klass = classId.getType(); + Class klass = classId.getType(); method = VMMethod.readId(klass, bb); index = bb.getLong(); } diff --git a/gnu/classpath/jdwp/util/Signature.java b/gnu/classpath/jdwp/util/Signature.java index 3d192e897..3eba93239 100644 --- a/gnu/classpath/jdwp/util/Signature.java +++ b/gnu/classpath/jdwp/util/Signature.java @@ -1,5 +1,5 @@ /* Signature.java -- utility class to compute class and method signatures - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -59,7 +59,7 @@ public class Signature * @param theClass the class for which to compute the signature * @return the class's type signature */ - public static String computeClassSignature (Class theClass) + public static String computeClassSignature (Class theClass) { CPStringBuilder sb = new CPStringBuilder (); _addToSignature (sb, theClass); @@ -92,8 +92,8 @@ public class Signature method.getParameterTypes ()); } - private static String _computeSignature (Class returnType, - Class[] paramTypes) + private static String _computeSignature (Class returnType, + Class[] paramTypes) { CPStringBuilder sb = new CPStringBuilder ("("); if (paramTypes != null) @@ -106,7 +106,7 @@ public class Signature return sb.toString(); } - private static void _addToSignature (CPStringBuilder sb, Class k) + private static void _addToSignature (CPStringBuilder sb, Class k) { // For some reason there's no easy way to get the signature of a // class. diff --git a/gnu/classpath/jdwp/value/Value.java b/gnu/classpath/jdwp/value/Value.java index 39f1c9cce..6db14494c 100644 --- a/gnu/classpath/jdwp/value/Value.java +++ b/gnu/classpath/jdwp/value/Value.java @@ -1,5 +1,5 @@ /* Value.java -- base class of JDWP values - Copyright (C) 2007 Free Software Foundation + Copyright (C) 2007, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -130,7 +130,7 @@ public abstract class Value * @throws JdwpInternalErrorException * @throws InvalidObjectException */ - public static Object getUntaggedObject(ByteBuffer bb, Class type) + public static Object getUntaggedObject(ByteBuffer bb, Class type) throws JdwpInternalErrorException, InvalidObjectException, InvalidClassException { Value val = ValueFactory.createFromUntagged(bb, type); diff --git a/gnu/classpath/jdwp/value/ValueFactory.java b/gnu/classpath/jdwp/value/ValueFactory.java index ee7ddfae1..ecb8dd436 100644 --- a/gnu/classpath/jdwp/value/ValueFactory.java +++ b/gnu/classpath/jdwp/value/ValueFactory.java @@ -1,5 +1,5 @@ /* ValueFactory.java -- factory to create JDWP Values - Copyright (C) 2007 Free Software Foundation + Copyright (C) 2007, 2013 Free Software Foundation This file is part of GNU Classpath. @@ -80,7 +80,7 @@ public class ValueFactory * @throws JdwpInternalErrorException * @throws InvalidObjectException */ - public static Value createFromUntagged(ByteBuffer bb, Class type) + public static Value createFromUntagged(ByteBuffer bb, Class type) throws JdwpInternalErrorException, InvalidObjectException, InvalidClassException { byte tag = getTagForClass(type); @@ -164,7 +164,7 @@ public class ValueFactory * @throws JdwpInternalErrorException * @throws InvalidObjectException */ - private static byte getTagForClass(Class klass) + private static byte getTagForClass(Class klass) throws JdwpInternalErrorException { byte tag; @@ -209,7 +209,7 @@ public class ValueFactory * @param type the Class type of the object * @return a new Value representing this object */ - public static Value createFromObject(Object value, Class type) + public static Value createFromObject(Object value, Class type) { Value val = null; -- cgit v1.2.1