You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Christopher Elkins <ch...@scardini.com> on 2002/02/28 19:41:14 UTC

[collections][patch] Remove redundant public modifiers from interface methods

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/collections/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/collections/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/collections/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/collections/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/collections/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/collections/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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [collections][patch] Remove redundant public modifiers from interface methods

Posted by Martin Cooper <ma...@tumbleweed.com>.
----- Original Message -----
From: "Daniel Rall" <dl...@finemaltcoding.com>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Thursday, February 28, 2002 11:58 AM
Subject: Re: [collections][patch] Remove redundant public modifiers from
interface methods


> Christopher Elkins <ch...@scardini.com> writes:
>
> > potentially masks warnings that are actually important
>
> What Chris states here is how I feel about it as well.  I prefer to
> set my compiler to be as strict as possible, as the warnings it spouts
> are generally a good thing so I like to pay attention to them.

+1

--
Martin Cooper


>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [collections][patch] Remove redundant public modifiers from interface methods

Posted by Daniel Rall <dl...@finemaltcoding.com>.
Christopher Elkins <ch...@scardini.com> writes:

> potentially masks warnings that are actually important

What Chris states here is how I feel about it as well.  I prefer to
set my compiler to be as strict as possible, as the warnings it spouts
are generally a good thing so I like to pay attention to them.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [collections][patch] Remove redundant public modifiers from interface methods

Posted by "Michael A. Smith" <mi...@iammichael.org>.
On Thu, 28 Feb 2002, Michael A. Smith wrote:
> This is actually true for the "abstract" modifier as well (at a previous 
> employer, all interfaces had "public abstract"):

And what I meant to say in relation to that, is that I bugged them to 
remove both the public and abstract modifiers because it generated 
thousands of pedantic errors in jikes (lots of interfaces and lots of 
methods).

regards,
michael


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [collections][patch] Remove redundant public modifiers from interface methods

Posted by Henri Yandell <ba...@generationjava.com>.

On Thu, 28 Feb 2002, Michael A. Smith wrote:

> "It is permitted, but strongly discouraged as a matter of style, to
> redundantly specify the public modifier for interface methods."

It sounds like something that the Java Code Conventions document should be
stressing too. Maybe send a comment to Scott Hommel [shommel@eng.sun.com]
(listed in the code conventions).

I seem to recall that the Avalon project has its own coding standard, is
this something they address?




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [collections][patch] Remove redundant public modifiers from interface methods

Posted by "Michael A. Smith" <mi...@iammichael.org>.
On Thu, 28 Feb 2002, Christopher Elkins wrote:
> > I've always liked the public modifier, but I guess it is completely
> > redundant. I'll try to change my ways in the future.
> 
> Yeah, there's nothing technically _wrong_ it. (The JLS doesn't explicitly
> say as such.) However, it tends to pollute the build output (in Jikes, anyway)
> and potentially masks warnings that are actually important. :-)

Actually, while the JLS doesn't say its "wrong" (otherwise the compiler 
wouldn't accept it), it is highly discouraged.  To quote the relevent 
section of the java language specification (section 9.4):

"It is permitted, but strongly discouraged as a matter of style, to
redundantly specify the public modifier for interface methods."

This is actually true for the "abstract" modifier as well (at a previous 
employer, all interfaces had "public abstract"):

"For compatibility with older versions of the Java platform, it is
permitted but discouraged, as a matter of style, to redundantly specify
the abstract modifier for methods declared in interfaces."

reference:
http://java.sun.com/docs/books/jls/second_edition/html/interfaces.doc.html#78651

regards,
michael



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [collections][patch] Remove redundant public modifiers from interface methods

Posted by Christopher Elkins <ch...@scardini.com>.
On Thu, Feb 28, 2002 at 01:49:40PM -0500, Henri Yandell wrote:
> How do you get jikes to warn about them? Is there a flag or something?

if compiling by hand:
  jikes +P ...

if using Ant:
  set build.compiler.pedantic=true (and build.compiler=jikes, of course)

> I've always liked the public modifier, but I guess it is completely
> redundant. I'll try to change my ways in the future.

Yeah, there's nothing technically _wrong_ it. (The JLS doesn't explicitly
say as such.) However, it tends to pollute the build output (in Jikes, anyway)
and potentially masks warnings that are actually important. :-)

-- 
Christopher Elkins

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [collections][patch] Remove redundant public modifiers from interface methods

Posted by Daniel Rall <dl...@finemaltcoding.com>.
Henri Yandell <ba...@generationjava.com> writes:

> How do you get jikes to warn about them? Is there a flag or something?

>From the Jikes man page:

       +P     Pedantic compilation - issues lots of warnings

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [collections][patch] Remove redundant public modifiers from interface methods

Posted by Daniel Rall <dl...@finemaltcoding.com>.
I would prefer that the redundant modifiers be removed -- all members
of a Java interface are implicitly public.

Here's a couple of links to discussion on the subject:

http://oss.software.ibm.com/pipermail/jikes/1999-October/001292.html
http://oss.software.ibm.com/pipermail/jikes-dev/2000-April/000732.html

The JLS states that public modifiers on interface method decls are
"permitted but discouraged".  I'm fairly certain that Jikes only
issues these warnings when compiling with the pedantic flag turned on.

Dan


"Morgan Delagrange" <md...@yahoo.com> writes:

> 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" <ba...@generationjava.com>
> To: "Jakarta Commons Developers List" <co...@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:
> <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> > >
>> >
>>
>>
>> --
>> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [collections] Some source files contain bad line-endings (was Re: [patch] Remove redundant public modifiers from interface methods)

Posted by James Strachan <ja...@yahoo.co.uk>.
From: "James Strachan" <ja...@yahoo.co.uk>
> ----- Original Message -----
> From: "Morgan Delagrange" <md...@yahoo.com>
> > Certainly, that's fine.  I've already fixed the line endings on quite a
> few
> > classes, and I continue to fix them whenever I have to make significant
> > modifications to a class.  Not to point fingers but James' checkins seem
> to
> > exhibit this problem often.  Sorry James.  ;)
>
> Yes I hold my hands up there - sorry everyone - I'll try figure out how to
> stop that happening again.

I'm just wondering what I'm doing wrong from a line-ending perspective.

I'm using Win2000 (I know I'm sorry), along with cygwin for cvs+ssh and
Forte as my editor. I thought CVS was meant to swizzle the line endings from
win <-> unix as checkin/checkouts happened?

Any ideas would be greatly appreciated...

James


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [collections] Some source files contain bad line-endings (was Re: [patch] Remove redundant public modifiers from interface methods)

Posted by James Strachan <ja...@yahoo.co.uk>.
----- Original Message -----
From: "Morgan Delagrange" <md...@yahoo.com>
> Certainly, that's fine.  I've already fixed the line endings on quite a
few
> classes, and I continue to fix them whenever I have to make significant
> modifications to a class.  Not to point fingers but James' checkins seem
to
> exhibit this problem often.  Sorry James.  ;)

Yes I hold my hands up there - sorry everyone - I'll try figure out how to
stop that happening again.

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [collections] Some source files contain bad line-endings (was Re: [patch] Remove redundant public modifiers from interface methods)

Posted by Morgan Delagrange <md...@yahoo.com>.
----- Original Message -----
From: "Christopher Elkins" <ch...@scardini.com>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Thursday, February 28, 2002 1:07 PM
Subject: [collections] Some source files contain bad line-endings (was Re:
[patch] Remove redundant public modifiers from interface methods)


> On Thu, Feb 28, 2002 at 12:58:47PM -0600, 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.
>
> That's certainly your prerogative. However, I hope that doesn't preclude
> fixing the line-ending problems described later in my email:
>

Certainly, that's fine.  I've already fixed the line endings on quite a few
classes, and I continue to fix them whenever I have to make significant
modifications to a class.  Not to point fingers but James' checkins seem to
exhibit this problem often.  Sorry James.  ;)

-  Morgan


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


[collections] Some source files contain bad line-endings (was Re: [patch] Remove redundant public modifiers from interface methods)

Posted by Christopher Elkins <ch...@scardini.com>.
On Thu, Feb 28, 2002 at 12:58:47PM -0600, 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.

That's certainly your prerogative. However, I hope that doesn't preclude
fixing the line-ending problems described later in my email:

> > On Thu, 28 Feb 2002, Christopher Elkins wrote:
> > >
> > > 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

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [collections][patch] Remove redundant public modifiers from interface methods

Posted by Henri Yandell <ba...@generationjava.com>.
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" <ba...@generationjava.com>
> To: "Jakarta Commons Developers List" <co...@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:
> <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> > >
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [collections][patch] Remove redundant public modifiers from interface methods

Posted by Morgan Delagrange <md...@yahoo.com>.
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" <ba...@generationjava.com>
To: "Jakarta Commons Developers List" <co...@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:
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >
> >
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [collections][patch] Remove redundant public modifiers from interface methods

Posted by Henri Yandell <ba...@generationjava.com>.
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/collections/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/collections/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/collections/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/collections/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/collections/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/collections/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:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>