jakartaee / messaging

Jakarta Messaging
https://eclipse.org/ee4j/messaging
Other
39 stars 32 forks source link

add generics to methods currently returning raw types #108

Open glassfishrobot opened 11 years ago

glassfishrobot commented 11 years ago

There are several methods that return raw java.util.Enumeration. Adding a type parameter would return the potential for misuse, produce cleaner and safer code and give a better development experience since you don't need to look up the the JavaDoc, the IDE automatically inserts the right type.

The affected methods are:

glassfishrobot commented 6 years ago
glassfishrobot commented 11 years ago

@glassfishrobot Commented Reported by braghest

glassfishrobot commented 11 years ago

@glassfishrobot Commented @nigeldeakin said: I think this is a good proposal (thanks). I don't think it would break backwards compatibility (i.e. existing application code wouldn't need to be changed).

However now JMS 2.0 has reached the public draft stage we need to avoid adding new features if at all possible and as this feature is unrelated to any of the changes in JMS 2.0, and can be added to the next version without introducing any compatibility problems, I propose we defer adding it to the API until JMS 2.1.

(The exception to this is javax.jms.Message#getPropertyNames(), which is new in JMS 2.0 and we are separately considering changing to return a Set ).

Tagging accordingly.

glassfishrobot commented 8 years ago

@glassfishrobot Commented braghest said: Here is a patch

Index: jms2.1/src/main/java/javax/jms/ConnectionMetaData.java
===================================================================
--- jms2.1/src/main/java/javax/jms/ConnectionMetaData.java  (revision 345)
+++ jms2.1/src/main/java/javax/jms/ConnectionMetaData.java  (working copy)
@@ -143,6 +143,6 @@
       *         metadata due to some internal error.
       */

-    Enumeration
+    Enumeration<String>
     getJMSXPropertyNames() throws JMSException;
 }
Index: jms2.1/src/main/java/javax/jms/MapMessage.java
===================================================================
--- jms2.1/src/main/java/javax/jms/MapMessage.java  (revision 345)
+++ jms2.1/src/main/java/javax/jms/MapMessage.java  (working copy)
@@ -299,7 +299,7 @@
       *         due to some internal error.
       */

-    Enumeration
+    Enumeration<String>
     getMapNames() throws JMSException;

Index: jms2.1/src/main/java/javax/jms/Message.java
===================================================================
--- jms2.1/src/main/java/javax/jms/Message.java (revision 345)
+++ jms2.1/src/main/java/javax/jms/Message.java (working copy)
@@ -1379,7 +1379,7 @@
       *          names due to some internal error.
       */ 

-    Enumeration
+    Enumeration<String>
     getPropertyNames() throws JMSException;

@@ -1691,5 +1691,5 @@
     *if the JMS provider fails to return a value due to some
     *internal error.
     */
-   boolean isBodyAssignableTo(Class c) throws JMSException;    
+   boolean isBodyAssignableTo(Class<?> c) throws JMSException;    
 }
Index: jms2.1/src/main/java/javax/jms/QueueBrowser.java
===================================================================
--- jms2.1/src/main/java/javax/jms/QueueBrowser.java    (revision 345)
+++ jms2.1/src/main/java/javax/jms/QueueBrowser.java    (working copy)
@@ -111,7 +111,7 @@
       *         due to some internal error.
       */

-    Enumeration 
+    Enumeration<String> 
     getEnumeration() throws JMSException;
glassfishrobot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA JMS_SPEC-108