Uploaded image for project: 'CCC Migration Project'
  1. CCC Migration Project
  2. CCC-8042860

Fix raw and unchecked warnings in java.beans

XMLWordPrintable

    • source
    • minimal
    • Usual API generification.
    • Java API
    • SE

      Summary

      Generify portions of java.beans.

      Problem

      The API in java.beans and its subpackages has numerous raw types still present in its API.

      Solution

      Generify the types (or in a few cases, suppress the warning).

      Specification

      --- old/src/share/classes/java/beans/beancontext/BeanContextServiceAvailableEvent.java  2014-05-29 18:59:24.000000000 -0700
      +++ new/src/share/classes/java/beans/beancontext/BeanContextServiceAvailableEvent.java  2014-05-29 18:59:24.000000000 -0700
      @@ -47,7 +47,7 @@
            * @param bcs The context in which the service has become available
            * @param sc A <code>Class</code> reference to the newly available service
            */
      -    public BeanContextServiceAvailableEvent(BeanContextServices bcs, Class sc) {
      +    public BeanContextServiceAvailableEvent(BeanContextServices bcs, Class<?> sc) {
               super((BeanContext)bcs);
      
               serviceClass = sc;
      @@ -65,13 +65,13 @@
            * Gets the service class that is the subject of this notification.
            * @return A <code>Class</code> reference to the newly available service
            */
      -    public Class getServiceClass() { return serviceClass; }
      +    public Class<?> getServiceClass() { return serviceClass; }
      
           /**
            * Gets the list of service dependent selectors.
            * @return the current selectors available from the service
            */
      -    public Iterator getCurrentServiceSelectors() {
      +    public Iterator<?> getCurrentServiceSelectors() {
               return ((BeanContextServices)getSource()).getCurrentServiceSelectors(serviceClass);
           }
      
      @@ -82,5 +82,5 @@
           /**
            * A <code>Class</code> reference to the newly available service
            */
      -    protected Class                      serviceClass;
      +    protected Class<?>                   serviceClass;
       }
      
      
      --- old/src/share/classes/java/beans/beancontext/BeanContextServiceProvider.java 2014-05-29 18:59:25.000000000 -0700
      +++ new/src/share/classes/java/beans/beancontext/BeanContextServiceProvider.java 2014-05-29 18:59:24.000000000 -0700
      @@ -70,7 +70,7 @@
           *
           * @return a reference to the requested service
           */
      -    Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector);
      +    Object getService(BeanContextServices bcs, Object requestor, Class<?> serviceClass, Object serviceSelector);
      
           /**
            * Invoked by <code>BeanContextServices</code>,
      @@ -100,5 +100,5 @@
            * @param serviceClass  the specified service
            * @return   the current service selectors for the specified serviceClass
            */
      -    Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass);
      +    Iterator<?> getCurrentServiceSelectors(BeanContextServices bcs, Class<?> serviceClass);
       }
      
      
      --- old/src/share/classes/java/beans/beancontext/BeanContextServiceRevokedEvent.java 2014-05-29 18:59:25.000000000 -0700
      +++ new/src/share/classes/java/beans/beancontext/BeanContextServiceRevokedEvent.java 2014-05-29 18:59:25.000000000 -0700
      @@ -46,7 +46,7 @@
            * @param sc the service that is being revoked
            * @param invalidate <code>true</code> for immediate revocation
            */
      -    public BeanContextServiceRevokedEvent(BeanContextServices bcs, Class sc, boolean invalidate) {
      +    public BeanContextServiceRevokedEvent(BeanContextServices bcs, Class<?> sc, boolean invalidate) {
               super((BeanContext)bcs);
      
               serviceClass    = sc;
      @@ -67,7 +67,7 @@
            * @return A <code>Class</code> reference to the
            * service that is being revoked
            */
      -    public Class getServiceClass() { return serviceClass; }
      +    public Class<?> getServiceClass() { return serviceClass; }
      
           /**
            * Checks this event to determine whether or not
      @@ -76,7 +76,7 @@
            * @return <code>true</code> if the service being revoked is of the
            * same class as the specified service
            */
      -    public boolean isServiceClass(Class service) {
      +    public boolean isServiceClass(Class<?> service) {
               return serviceClass.equals(service);
           }
      
      @@ -94,6 +94,6 @@
           /**
            * A <code>Class</code> reference to the service that is being revoked.
            */
      -    protected Class                      serviceClass;
      +    protected Class<?>                   serviceClass;
           private   boolean                    invalidateRefs;
       }
      
      --- old/src/share/classes/java/beans/beancontext/BeanContextServices.java 2014-05-29 18:59:26.000000000 -0700
      +++ new/src/share/classes/java/beans/beancontext/BeanContextServices.java 2014-05-29 18:59:26.000000000 -0700
      @@ -62,7 +62,7 @@
            * associated with the service
            * @return true if the service was successful added, false otherwise
            */
      -    boolean addService(Class serviceClass, BeanContextServiceProvider serviceProvider);
      +    boolean addService(Class<?> serviceClass, BeanContextServiceProvider serviceProvider);
      
           /**
            * BeanContextServiceProviders wishing to remove
      @@ -83,7 +83,7 @@
            * terminate service to all currently outstanding references
            * to the specified service.
            */
      -    void revokeService(Class serviceClass, BeanContextServiceProvider serviceProvider, boolean revokeCurrentServicesNow);
      +    void revokeService(Class<?> serviceClass, BeanContextServiceProvider serviceProvider, boolean revokeCurrentServicesNow);
      
           /**
            * Reports whether or not a given service is
      @@ -91,7 +91,7 @@
            * @param serviceClass the service in question
            * @return true if the service is available
            */
      -    boolean hasService(Class serviceClass);
      +    boolean hasService(Class<?> serviceClass);
      
           /**
            * A <code>BeanContextChild</code>, or any arbitrary object
      @@ -113,7 +113,7 @@
            * @return a reference to this context's named
            * Service as requested or <code>null</code>
            */
      -    Object getService(BeanContextChild child, Object requestor, Class serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException;
      +    Object getService(BeanContextChild child, Object requestor, Class<?> serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException;
      
           /**
            * Releases a <code>BeanContextChild</code>'s
      @@ -131,7 +131,7 @@
            * @return an <code>Iterator</code> consisting of the
            * currently available services
            */
      -    Iterator getCurrentServiceClasses();
      +    Iterator<?> getCurrentServiceClasses();
      
           /**
            * Gets the list of service dependent service parameters
      @@ -142,7 +142,7 @@
            * @return the currently available service selectors
            * for the named serviceClass
            */
      -    Iterator getCurrentServiceSelectors(Class serviceClass);
      +    Iterator<?> getCurrentServiceSelectors(Class<?> serviceClass);
      
           /**
            * Adds a <code>BeanContextServicesListener</code> to this BeanContext
      
      --- old/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java        2014-05-29 20:09:25.000000000 -0700
      +++ new/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java        2014-05-29 20:09:25.000000000 -0700
      
      @@ -597,7 +600,7 @@
               protected static class BCSSServiceProvider implements Serializable {
                   private static final long serialVersionUID = 861278251667444782L;
       
      -            BCSSServiceProvider(Class sc, BeanContextServiceProvider bcsp) {
      +            BCSSServiceProvider(Class<?> sc, BeanContextServiceProvider bcsp) {
                       super();
       
                       serviceProvider = bcsp;
      @@ -627,7 +630,7 @@
                * @return a service provider without overriding addService()
                */
       
      -        protected BCSSServiceProvider createBCSSServiceProvider(Class sc, BeanContextServiceProvider bcsp) {
      +        protected BCSSServiceProvider createBCSSServiceProvider(Class<?> sc, BeanContextServiceProvider bcsp) {
                   return new BCSSServiceProvider(sc, bcsp);
               }
      
      @@ -671,7 +674,7 @@
            * @param bcsp the service provider
            */
       
      -    public boolean addService(Class serviceClass, BeanContextServiceProvider bcsp) {
      +    public boolean addService(Class<?> serviceClass, BeanContextServiceProvider bcsp) {
               return addService(serviceClass, bcsp, true);
           }
       
      @@ -683,7 +686,7 @@
            * @return true if the service was successfully added
            */
       
      -    protected boolean addService(Class serviceClass, BeanContextServiceProvider bcsp, boolean fireEvent) {
      +    protected boolean addService(Class<?> serviceClass, BeanContextServiceProvider bcsp, boolean fireEvent) {
       
               if (serviceClass == null) throw new NullPointerException("serviceClass");
               if (bcsp         == null) throw new NullPointerException("bcsp");
      @@ -727,7 +730,7 @@
            * @param revokeCurrentServicesNow whether or not to revoke the service
            */
       
      -    public void revokeService(Class serviceClass, BeanContextServiceProvider bcsp, boolean revokeCurrentServicesNow) {
      +    public void revokeService(Class<?> serviceClass, BeanContextServiceProvider bcsp, boolean revokeCurrentServicesNow) {
       
               if (serviceClass == null) throw new NullPointerException("serviceClass");
               if (bcsp         == null) throw new NullPointerException("bcsp");
      @@ -758,7 +761,7 @@
            * has a service, which may be delegated
            */
       
      -    public synchronized boolean hasService(Class serviceClass) {
      +    public synchronized boolean hasService(Class<?> serviceClass) {
               if (serviceClass == null) throw new NullPointerException("serviceClass");
       
               synchronized(BeanContext.globalHierarchyLock) {
      @@ -791,7 +794,7 @@
                   nestingCtxt = bcs;
               }
       
      -        public Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector) {
      +        public Object getService(BeanContextServices bcs, Object requestor, Class<?> serviceClass, Object serviceSelector) {
                   Object service = null;
       
                   try {
      @@ -807,12 +810,12 @@
                   nestingCtxt.releaseService(bcs, requestor, service);
               }
       
      -        public Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass) {
      +        public Iterator<?> getCurrentServiceSelectors(BeanContextServices bcs, Class<?> serviceClass) {
                   return nestingCtxt.getCurrentServiceSelectors(serviceClass);
               }
      @@ -832,7 +835,7 @@
            * obtain a service which may be delegated
            */
       
      -     public Object getService(BeanContextChild child, Object requestor, Class serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException {
      +     public Object getService(BeanContextChild child, Object requestor, Class<?> serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException {
               if (child        == null) throw new NullPointerException("child");
               if (serviceClass == null) throw new NullPointerException("serviceClass");
               if (requestor    == null) throw new NullPointerException("requestor");
      @@ -918,7 +921,7 @@
            * @return an iterator for all the currently registered service classes.
            */
       
      -    public Iterator getCurrentServiceClasses() {
      +    public Iterator<Object> getCurrentServiceClasses() {
               return new BCSIterator(services.keySet().iterator());
           }
      @@ -927,9 +930,9 @@
            * (if any) available for the specified service.
            */
       
      -    public Iterator getCurrentServiceSelectors(Class serviceClass) {
      +    public Iterator<?> getCurrentServiceSelectors(Class<?> serviceClass) {
      @@ -1085,7 +1088,7 @@
            * Fires a <tt>BeanContextServiceEvent</tt> notifying of a new service.
            * @param serviceClass the service class
            */
      -    protected final void fireServiceAdded(Class serviceClass) {
      +    protected final void fireServiceAdded(Class<?> serviceClass) {
               BeanContextServiceAvailableEvent bcssae = new BeanContextServiceAvailableEvent(getBeanContextServicesPeer(), serviceClass);
       
               fireServiceAdded(bcssae);
      @@ -1129,7 +1132,7 @@
            * @param serviceClass the service class
            * @param revokeNow whether or not the event should be revoked now
            */
      -    protected final void fireServiceRevoked(Class serviceClass, boolean revokeNow) {
      +    protected final void fireServiceRevoked(Class<?> serviceClass, boolean revokeNow) {
               Object[]                       copy;
               BeanContextServiceRevokedEvent bcsre = new BeanContextServiceRevokedEvent(getBeanContextServicesPeer(), serviceClass, revokeNow);
       @@ -1236,7 +1239,7 @@
            * all accesses to the <code> protected transient HashMap services </code>
            * field should be synchronized on that object
            */
      -    protected transient HashMap                  services;
      +    protected transient HashMap<Object, BCSSServiceProvider>  services;
       
           /**
            * The number of instances of a serializable <tt>BeanContextServceProvider</tt>.
      @@ -1253,5 +1256,5 @@
           /**
            * List of <tt>BeanContextServicesListener</tt> objects.
            */
      -    protected transient ArrayList                bcsListeners;
      +    protected transient ArrayList<BeanContextServicesListener> bcsListeners;
      
      --- old/src/share/classes/java/beans/beancontext/BeanContextSupport.java        2014-05-29 20:09:26.000000000 -0700
      +++ new/src/share/classes/java/beans/beancontext/BeanContextSupport.java        2014-05-29 20:09:26.000000000 -0700
      @@ -254,7 +254,7 @@
            * currently nested in this <tt>BeanContext</tt>.
            * @return an <tt>Iterator</tt> of the nested children
            */
      -    public Iterator iterator() {
      +    public Iterator<Object> iterator() {
               synchronized(children) {
                   return new BCSIterator(children.keySet().iterator());
               }
      @@ -292,14 +292,14 @@
            * a noop remove() method.
            */
       
      -    protected static final class BCSIterator implements Iterator {
      -        BCSIterator(Iterator i) { super(); src = i; }
      +    protected static final class BCSIterator implements Iterator<Object> {
      +        BCSIterator(Iterator<?> i) { super(); src = i; }
       
               public boolean hasNext() { return src.hasNext(); }
      -        public Object  next()    { return src.next();    }
      +        public Object       next()    { return src.next();    }
               public void    remove()  { /* do nothing */      }
      @@ -841,7 +845,7 @@
            * of this <tt>BeanContext</tt>.
            * @return an iterator for all the current BCSChild values
            */
      -    protected Iterator bcsChildren() { synchronized(children) { return children.values().iterator();  } }
      +    protected Iterator<BCSChild> bcsChildren() { synchronized(children) { return children.values().iterator();  } }
       
           /**
            * called by writeObject after defaultWriteObject() but prior to
      @@ -896,7 +900,7 @@
            * @param coll the <tt>Collection</tt> to serialize
            * @throws IOException if serialization failed
            */
      -    protected final void serialize(ObjectOutputStream oos, Collection coll) throws IOException {
      +    protected final void serialize(ObjectOutputStream oos, Collection<?> coll) throws IOException {
               int      count   = 0;
               Object[] objects = coll.toArray();
      @@ -1359,7 +1364,7 @@
            * @param second the second object
            * @return true if equal, false if not
            */
      -    protected static final boolean classEquals(Class first, Class second) {
      +    protected static final boolean classEquals(Class<?> first, Class<?> second) {
               return first.equals(second) || first.getName().equals(second.getName());
           }
       
      @@ -1373,7 +1378,7 @@
            * all accesses to the <code> protected HashMap children </code> field
            * shall be synchronized on that object.
            */
      -    protected transient HashMap         children;
      +    protected transient HashMap<Object, BCSChild>         children;
       
           private             int             serializable  = 0; // children serializable
       
      @@ -1381,7 +1386,7 @@
            * all accesses to the <code> protected ArrayList bcmListeners </code> field
            * shall be synchronized on that object.
            */
      -    protected transient ArrayList       bcmListeners;
      +    protected transient ArrayList<BeanContextMembershipListener> bcmListeners;
       
           //

            darcy Joe Darcy
            darcy Joe Darcy
            Mike Duigou
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: