ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs MacroDef.java
Date Mon, 17 May 2004 13:30:17 GMT
peterreilly    2004/05/17 06:30:17

  Modified:    src/main/org/apache/tools/ant/taskdefs MacroDef.java
  Log:
  Fix use of hashcode in MacroDef
  Logger code uses the macrodef as a key in a map before it is fully
  configured so the hashcode had changed while the object was
  in the map
  PR: 28993
  Obtained from: Jesse Glick
  
  Revision  Changes    Path
  1.25      +8 -15     ant/src/main/org/apache/tools/ant/taskdefs/MacroDef.java
  
  Index: MacroDef.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/MacroDef.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- MacroDef.java	9 Mar 2004 16:48:06 -0000	1.24
  +++ MacroDef.java	17 May 2004 13:30:17 -0000	1.25
  @@ -596,13 +596,17 @@
       }
   
       /**
  -     * equality method for macrodef, ignores project and
  +     * similar equality method for macrodef, ignores project and
        * runtime info.
        *
        * @param obj an <code>Object</code> value
        * @return a <code>boolean</code> value
        */
  -    public boolean equals(Object obj) {
  +    public boolean similar(Object obj) {
  +        if (obj == this) {
  +            return true;
  +        }
  +
           if (obj == null) {
               return false;
           }
  @@ -650,17 +654,6 @@
       }
   
       /**
  -     * @return a hash code value for this object.
  -     */
  -    public int hashCode() {
  -        return objectHashCode(name)
  -            + objectHashCode(getURI())
  -            + objectHashCode(nestedSequential)
  -            + objectHashCode(attributes)
  -            + objectHashCode(elements);
  -    }
  -
  -    /**
        * extends AntTypeDefinition, on create
        * of the object, the template macro definition
        * is given.
  @@ -704,7 +697,7 @@
                   return false;
               }
               MyAntTypeDefinition otherDef = (MyAntTypeDefinition) other;
  -            return macroDef.equals(otherDef.macroDef);
  +            return macroDef.similar(otherDef.macroDef);
           }
   
           /**
  @@ -720,7 +713,7 @@
                   return false;
               }
               MyAntTypeDefinition otherDef = (MyAntTypeDefinition) other;
  -            return macroDef.equals(otherDef.macroDef);
  +            return macroDef.similar(otherDef.macroDef);
           }
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message