commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henri Yandell <bay...@generationjava.com>
Subject Re: [collections][patch] Remove redundant public modifiers from interface methods
Date Thu, 28 Feb 2002 19:14:50 GMT
After reflection:

I'm happy personally to try to move to the non-public style of coding, but
I have 2 major reservations:

1) I now realise why I see tons of code out there with package-level
methods and not public. Making all methods on a class public by default is
a "Good Thing"(tm).

2) It's quite a change from what I believe is the norm, and should be
defined in a coding standard for Commons. This however is a big whtie
elephant of an argument though, so I'm not sure that sch a thing could
happen.

I think that while removing the public is a good thing on paper, in
reality (and for Commons) it will be a bad thing. I'm -0 on it.

Hen

On Thu, 28 Feb 2002, Morgan Delagrange wrote:

> I'd prefer to not apply this patch.  I also like having the public modifier,
> and being able to copy blocks of interface source code into abstract
> classes.
>
> ----- Original Message -----
> From: "Henri Yandell" <bayard@generationjava.com>
> To: "Jakarta Commons Developers List" <commons-dev@jakarta.apache.org>
> Sent: Thursday, February 28, 2002 12:49 PM
> Subject: Re: [collections][patch] Remove redundant public modifiers from
> interface methods
>
>
> > How do you get jikes to warn about them? Is there a flag or something?
> >
> > I've always liked the public modifier, but I guess it is completely
> > redundant. I'll try to change my ways in the future.
> >
> > On Thu, 28 Feb 2002, Christopher Elkins wrote:
> >
> > > Hi, all.
> > >
> > > The patch attached below removes public modifiers from some interfaces.
> > > Besides being redundant and bad form, they cause lots of Jikes warnings.
> :-)
> > >
> > > Also, please note that I did _not_ add the DOS line-endings (the ^M's);
> they
> > > are already present in the original files.
> > >
> > > While I'm thinking about it, here is a list of all the files containing
> bad
> > > line-endings:
> > >
> > > AbstractBag.java
> > > Bag.java
> > > BeanMap.java
> > > Closure.java
> > > DefaultMapEntry.java
> > > HashBag.java
> > > IteratorEnumeration.java
> > > MapUtils.java
> > > MultiHashMap.java
> > > MultiMap.java
> > > Predicate.java
> > > SingletonIterator.java
> > > SoftRefHashMap.java
> > > SortedBag.java
> > > TransformIterator.java
> > > Transformer.java
> > > TreeBag.java
> > >
> > > It'd be nice if someone could fix those before the forthcoming 2.0
> release.
> > >
> > > (And in case anyone thinks that there's something wrong in my local CVS
> > > setup, I suggest you take a look at the nightly builds. ;-)
> > >
> > > --
> > > Christopher Elkins
> > >
> > >
> > >
> > > Index: src/java/org/apache/commons/collections/Bag.java
> > > ===================================================================
> > > RCS file:
> /home/cvspublic/jakarta-commons/collections/src/java/org/apache/commons/coll
> ections/Bag.java,v
> > > retrieving revision 1.3
> > > diff -u -r1.3 Bag.java
> > > --- src/java/org/apache/commons/collections/Bag.java 22 Feb 2002
> 04:39:53 -0000 1.3
> > > +++ src/java/org/apache/commons/collections/Bag.java 28 Feb 2002
> 18:25:34 -0000
> > > @@ -80,7 +80,7 @@
> > >      * object currently in the bag. If the object does not exist in the
> > >      * bag, return 0.
> > >      **/
> > > -   public int getCount(Object o);
> > > +   int getCount(Object o);
> > >
> > >     /**
> > >      * Add the given object to the bag and keep a count. If the object
> > > @@ -91,7 +91,7 @@
> > >      *         <code>uniqueSet</code>
> > >      * @see #getCount
> > >      **/
> > > -   public boolean add(Object o);
> > > +   boolean add(Object o);
> > >
> > >     /**
> > >      * Add <code>i</code> copies of the given object to the bag
and
> > > @@ -101,7 +101,7 @@
> > >      * @see #add(Object)
> > >      * @see #getCount
> > >      **/
> > > -   public boolean add(Object o, int i);
> > > +   boolean add(Object o, int i);
> > >
> > >     /**
> > >      * Remove all occurrences of the given object from the bag, and do
> > > @@ -109,7 +109,7 @@
> > >      * @see #remove(Object, int)
> > >      * @return <code>true</code> if this call changed the collection
> > >      **/
> > > -   public boolean remove(Object o);
> > > +   boolean remove(Object o);
> > >
> > >     /**
> > >      * Remove the given number of occurrences from the bag. If the bag
> > > @@ -119,20 +119,20 @@
> > >      * @see #remove(Object)
> > >      * @return <code>true</code> if this call changed the collection
> > >      **/
> > > -   public boolean remove(Object o, int i);
> > > +   boolean remove(Object o, int i);
> > >
> > >     /**
> > >      * The {@link Set} of unique members that represent all members in
> > >      * the bag. Uniqueness constraints are the same as those in {@link
> > >      * Set}.
> > >      **/
> > > -   public Set uniqueSet();
> > > +   Set uniqueSet();
> > >
> > >     /**
> > >      * Returns the total number of items in the bag across all types.
> > >      * @see #size
> > >      **/
> > > -   public int size();
> > > +   int size();
> > >
> > >     /**
> > >      * Returns <code>true</code> if the bag contains all elements
in
> > > @@ -141,7 +141,7 @@
> > >      * of a given object, calling {@link #getCount} on that object must
> > >      * be >= <code>n</code> for all <code>n</code>
in <code>C</code>.
> > >      **/
> > > -   public boolean containsAll(Collection c);
> > > +   boolean containsAll(Collection c);
> > >
> > >     /**
> > >      * Remove all elements represented in the given collection,
> > > @@ -151,7 +151,7 @@
> > >      * had at least <code>n</code> copies to begin with.
> > >      * @return <code>true</code> if this call changed the collection
> > >      **/
> > > -   public boolean removeAll(Collection c);
> > > +   boolean removeAll(Collection c);
> > >
> > >     /**
> > >      * Remove any members of the bag that are not in the given
> > > @@ -165,14 +165,14 @@
> > >      *
> > >      * @return <code>true</code> if this call changed the collection
> > >      **/
> > > -   public boolean retainAll(Collection c);
> > > +   boolean retainAll(Collection c);
> > >
> > >     /**
> > >      * Returns an {@link Iterator} over the entire set of members,
> > >      * including copies due to cardinality. This iterator is fail-fast
> > >      * and will not tolerate concurrent modifications.
> > >      **/
> > > -   public Iterator iterator();
> > > +   Iterator iterator();
> > >  }
> > >
> > >
> > > Index: src/java/org/apache/commons/collections/Closure.java
> > > ===================================================================
> > > RCS file:
> /home/cvspublic/jakarta-commons/collections/src/java/org/apache/commons/coll
> ections/Closure.java,v
> > > retrieving revision 1.2
> > > diff -u -r1.2 Closure.java
> > > --- src/java/org/apache/commons/collections/Closure.java 10 Feb 2002
> 08:07:42 -0000 1.2
> > > +++ src/java/org/apache/commons/collections/Closure.java 28 Feb 2002
> 18:25:34 -0000
> > > @@ -70,5 +70,5 @@
> > >
> > >      /** Performs some operation on the input object
> > >        */
> > > -    public void execute(Object input);
> > > +    void execute(Object input);
> > >  }
> > > Index: src/java/org/apache/commons/collections/MultiMap.java
> > > ===================================================================
> > > RCS file:
> /home/cvspublic/jakarta-commons/collections/src/java/org/apache/commons/coll
> ections/MultiMap.java,v
> > > retrieving revision 1.2
> > > diff -u -r1.2 MultiMap.java
> > > --- src/java/org/apache/commons/collections/MultiMap.java 10 Feb 2002
> 08:07:42 -0000 1.2
> > > +++ src/java/org/apache/commons/collections/MultiMap.java 28 Feb 2002
> 18:25:34 -0000
> > > @@ -75,6 +75,6 @@
> > >   */
> > >  public interface MultiMap extends Map {
> > >
> > > -    public Object remove( Object key, Object item );
> > > +    Object remove( Object key, Object item );
> > >
> > >  }
> > > Index: src/java/org/apache/commons/collections/Predicate.java
> > > ===================================================================
> > > RCS file:
> /home/cvspublic/jakarta-commons/collections/src/java/org/apache/commons/coll
> ections/Predicate.java,v
> > > retrieving revision 1.2
> > > diff -u -r1.2 Predicate.java
> > > --- src/java/org/apache/commons/collections/Predicate.java 10 Feb 2002
> 08:07:42 -0000 1.2
> > > +++ src/java/org/apache/commons/collections/Predicate.java 28 Feb 2002
> 18:25:34 -0000
> > > @@ -69,5 +69,5 @@
> > >
> > >      /** @return true if the input object matches this predicate, else
> returns false
> > >        */
> > > -    public boolean evaluate(Object input);
> > > +    boolean evaluate(Object input);
> > >  }
> > > Index: src/java/org/apache/commons/collections/SortedBag.java
> > > ===================================================================
> > > RCS file:
> /home/cvspublic/jakarta-commons/collections/src/java/org/apache/commons/coll
> ections/SortedBag.java,v
> > > retrieving revision 1.2
> > > diff -u -r1.2 SortedBag.java
> > > --- src/java/org/apache/commons/collections/SortedBag.java 10 Feb 2002
> 08:07:42 -0000 1.2
> > > +++ src/java/org/apache/commons/collections/SortedBag.java 28 Feb 2002
> 18:25:35 -0000
> > > @@ -74,15 +74,15 @@
> > >      * Returns the comparator associated with this sorted set, or null
> > >      * if it uses its elements' natural ordering.
> > >      **/
> > > -   public Comparator comparator();
> > > +   Comparator comparator();
> > >
> > >     /**
> > >      * Returns the first (lowest) member.
> > >      **/
> > > -   public Object first();
> > > +   Object first();
> > >
> > >     /**
> > >      * Returns the last (highest) member.
> > >      **/
> > > -   public Object last();
> > > +   Object last();
> > >  }
> > > Index: src/java/org/apache/commons/collections/Transformer.java
> > > ===================================================================
> > > RCS file:
> /home/cvspublic/jakarta-commons/collections/src/java/org/apache/commons/coll
> ections/Transformer.java,v
> > > retrieving revision 1.2
> > > diff -u -r1.2 Transformer.java
> > > --- src/java/org/apache/commons/collections/Transformer.java 10 Feb 2002
> 08:07:42 -0000 1.2
> > > +++ src/java/org/apache/commons/collections/Transformer.java 28 Feb 2002
> 18:25:35 -0000
> > > @@ -69,5 +69,5 @@
> > >      /** Transforms the input object (leaving it unchanged) into some
> output object.
> > >        * @return the transformation of the input object to the output
> object
> > >        */
> > > -    public Object transform(Object input);
> > > +    Object transform(Object input);
> > >  }
> > >
> > > --
> > > To unsubscribe, e-mail:
> <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> > > For additional commands, e-mail:
> <mailto:commons-dev-help@jakarta.apache.org>
> > >
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:commons-dev-help@jakarta.apache.org>
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message