ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant ProjectTest.java
Date Mon, 20 Jan 2003 12:44:24 GMT
bodewig     2003/01/20 04:44:24

  Modified:    src/main/org/apache/tools/ant Project.java
               src/main/org/apache/tools/ant/util LazyHashtable.java
               src/testcases/org/apache/tools/ant ProjectTest.java
  Log:
  Properly support containsKey in LazyHashtable.
  
  Fix the wrong semantics of AntTaskTable#contains.
  
  Revision  Changes    Path
  1.124     +4 -4      jakarta-ant/src/main/org/apache/tools/ant/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
  retrieving revision 1.123
  retrieving revision 1.124
  diff -u -r1.123 -r1.124
  --- Project.java	28 Dec 2002 21:14:31 -0000	1.123
  +++ Project.java	20 Jan 2003 12:44:24 -0000	1.124
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -2105,8 +2105,8 @@
               return taskClass;
           }
   
  -        public boolean contains( Object key ) {
  -            return get( key ) != null;
  +        public boolean containsKey(Object key) {
  +            return get(key) != null;
           }
   
       }
  
  
  
  1.3       +12 -3     jakarta-ant/src/main/org/apache/tools/ant/util/LazyHashtable.java
  
  Index: LazyHashtable.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/util/LazyHashtable.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LazyHashtable.java	17 Jan 2003 14:34:55 -0000	1.2
  +++ LazyHashtable.java	20 Jan 2003 12:44:24 -0000	1.3
  @@ -61,6 +61,8 @@
    *
    * All operations that need access to the full list of objects
    * will call initAll() first. Get and put are cheap.
  + *
  + * @since Ant 1.6
    */
   public class LazyHashtable extends Hashtable {
       protected boolean initAllDone=false;
  @@ -96,12 +98,19 @@
   
       public boolean contains( Object value ) {
           initAll();
  -        return super.contains(value );
  +        return super.contains(value);
       }
   
  -    public boolean containsValue( Object value ) {
  +    public boolean containsKey(Object value) {
           initAll();
  -        return super.contains( value );
  +        return super.containsKey(value);
  +    }
  +
  +    /**
  +     * Delegates to {@link #contains contains}.
  +     */
  +    public boolean containsValue( Object value ) {
  +        return contains(value);
       }
   
       public Enumeration keys() {
  
  
  
  1.14      +9 -1      jakarta-ant/src/testcases/org/apache/tools/ant/ProjectTest.java
  
  Index: ProjectTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/ProjectTest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ProjectTest.java	23 Apr 2002 10:30:12 -0000	1.13
  +++ ProjectTest.java	20 Jan 2003 12:44:24 -0000	1.14
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -230,6 +230,14 @@
           InputHandler pfih = new PropertyFileInputHandler();
           p.setInputHandler(pfih);
           assertSame(pfih, p.getInputHandler());
  +    }
  +
  +    public void testTaskDefinitionContainsKey() {
  +        assertTrue(p.getTaskDefinitions().containsKey("echo"));
  +    }
  +
  +    public void testTaskDefinitionContains() {
  +        assertTrue(p.getTaskDefinitions().contains(org.apache.tools.ant.taskdefs.Echo.class));
       }
   
       private class DummyTaskPrivate extends Task {
  
  
  

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


Mime
View raw message