DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6514>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6514

When redefining a datatype it should check if the class is the same

           Summary: When redefining a datatype it should check if the class
                    is the same
           Product: Ant
           Version: 1.5 alpha (nightly)
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Core
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


When redefining a datatype it should check if the class name in the new
definition is the same as the class name in the previous definition. Just the
same as when a task is redefined.

Here is a simple patch, where the changes are copyied from the code that defines
a task:

Index: src/main/org/apache/tools/ant/Project.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
retrieving revision 1.93
diff -c -r1.93 Project.java
*** src/main/org/apache/tools/ant/Project.java  2 Feb 2002 12:52:00 -0000      
1.93
--- src/main/org/apache/tools/ant/Project.java  18 Feb 2002 01:16:22 -0000
***************
*** 659,667 ****
       * @param typeClass full datatype classname     
       */
      public void addDataTypeDefinition(String typeName, Class typeClass) {
!         if (null != dataClassDefinitions.get(typeName)) {
!             log("Trying to override old definition of datatype "+typeName, 
!                 MSG_WARN);
          }
  
          String msg = " +User datatype: " + typeName + "     " +
typeClass.getName();
--- 659,675 ----
       * @param typeClass full datatype classname     
       */
      public void addDataTypeDefinition(String typeName, Class typeClass) {
!         Class old = (Class)dataClassDefinitions.get(typeName);
!         if (null != old) {
!             if (old.equals(typeClass)) {
!                 log("Ignoring override for datatype " + typeName 
!                     + ", it is already defined by the same class.", 
!                     MSG_VERBOSE);
!                 return;
!             } else {
!                 log("Trying to override old definition of datatype 
"+typeName, 
!                     MSG_WARN);
!             }
          }
  
          String msg = " +User datatype: " + typeName + "     " +
typeClass.getName();

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to