You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Tom Jordahl <to...@macromedia.com> on 2004/04/09 23:42:00 UTC

RE: cvs commit: ws-axis/java/src/org/apache/axis/wsdl/toJava Emit ter.java JavaGeneratorFactory.java

You *must* add a command line and ant task switch for this setting too.

Thanks.

--
Tom Jordahl


-----Original Message-----
From: gawor@apache.org [mailto:gawor@apache.org] 
Sent: Friday, April 09, 2004 2:37 PM
To: ws-axis-cvs@apache.org
Subject: cvs commit: ws-axis/java/src/org/apache/axis/wsdl/toJava
Emitter.java JavaGeneratorFactory.java

gawor       2004/04/09 11:37:05

  Modified:    java/src/org/apache/axis/wsdl/toJava Emitter.java
                        JavaGeneratorFactory.java
  Log:
  a way to disable name mangling in case of anonymous type collisions
  
  Revision  Changes    Path
  1.68      +18 -0
ws-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java
  
  Index: Emitter.java
  ===================================================================
  RCS file:
/home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- Emitter.java	8 Apr 2004 13:09:06 -0000	1.67
  +++ Emitter.java	9 Apr 2004 18:37:04 -0000	1.68
  @@ -89,6 +89,8 @@
       
       private boolean bBuildFileGeneration = false;
   
  +    private boolean typeCollisionProtection = true;
  +
       /** Field packageName */
       private String packageName = null;
   
  @@ -882,4 +884,20 @@
       public void generateAll(boolean all) {
           setAllWanted(all);
       }    // generateAll
  +    
  +    /**
  +     * Get the type collision protection setting
  +     * @return
  +     */
  +    public boolean isTypeCollisionProtection(){
  +        return this.typeCollisionProtection;
  +    }
  +    
  +    /**
  +     * Enable/disable type collision protection
  +     * @param value
  +     */
  +    public void setTypeCollisionProtection(boolean value){
  +        this.typeCollisionProtection = value;
  +    }
   }
  
  
  
  1.50      +16 -14
ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java
  
  Index: JavaGeneratorFactory.java
  ===================================================================
  RCS file:
/home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.
java,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- JavaGeneratorFactory.java	8 Apr 2004 13:09:06 -0000	1.49
  +++ JavaGeneratorFactory.java	9 Apr 2004 18:37:04 -0000	1.50
  @@ -608,21 +608,23 @@
                   typeQName = new QName(typeQName.getNamespaceURI(),
                           localName);
   
  -                // If there is already an existing type,
  -                // there will be a collision.
  -                // If there is an existing anon type,
  -                // there will be a  collision.
  -                // In both cases, mangle the name.
  -                symbolTable.getType(typeQName);
  -
  -                if (anonQNames.get(typeQName) != null) {
  -                    localName += "Type" + uniqueNum++;
  -                    typeQName =
  -                    new QName(typeQName.getNamespaceURI(),
  -                            localName);
  +                if (emitter.isTypeCollisionProtection()) {
  +                    // If there is already an existing type,
  +                    // there will be a collision.
  +                    // If there is an existing anon type,
  +                    // there will be a  collision.
  +                    // In both cases, mangle the name.
  +                    symbolTable.getType(typeQName);
  +                    
  +                    if (anonQNames.get(typeQName) != null) {
  +                        localName += "Type" + uniqueNum++;
  +                        typeQName =
  +                            new QName(typeQName.getNamespaceURI(),
  +                                      localName);
  +                    }
  +                    
  +                    anonQNames.put(typeQName, typeQName);
                   }
  -
  -                anonQNames.put(typeQName, typeQName);
   
                   // Now set the name with the constructed qname
                   tEntry.setName(emitter.getJavaName(typeQName));
  
  
  

RE: cvs commit: ws-axis/java/src/org/apache/axis/wsdl/toJava Emitter.java JavaGeneratorFactory.java

Posted by Jarek Gawor <ga...@mcs.anl.gov>.
The reason why I decided not to add a command line switch for this setting
was that it controls a piece of code that I believe is not quite right.
However, I wasn't 100% sure about it. I sent out an email about this issue a
week ago or so titled 'anonymous type collisions'. I did not want to add a
public command line switch for something that disables a potential bug
because if this turns out to be a valid bug than the command line switch
becomes useless. And I would rather fix the bug (if there is one) in the
first place. 
I actually already had the necessary modifications to WSDL2Java so if still
needed I can check them in (+ the ant task changes)

Jarek

> -----Original Message-----
> From: Tom Jordahl [mailto:tomj@macromedia.com]
> Sent: Friday, April 09, 2004 5:42 PM
> To: gawor@apache.org; axis-dev@ws.apache.org
> Subject: RE: cvs commit: 
> ws-axis/java/src/org/apache/axis/wsdl/toJava Emitter.java 
> JavaGeneratorFactory.java
> 
> 
> 
> You *must* add a command line and ant task switch for this
> setting too.
> 
> Thanks.
> 
> --
> Tom Jordahl
> 
> 
> -----Original Message-----
> From: gawor@apache.org [mailto:gawor@apache.org]
> Sent: Friday, April 09, 2004 2:37 PM
> To: ws-axis-cvs@apache.org
> Subject: cvs commit: ws-axis/java/src/org/apache/axis/wsdl/toJava
> Emitter.java JavaGeneratorFactory.java
> 
> gawor       2004/04/09 11:37:05
> 
>   Modified:    java/src/org/apache/axis/wsdl/toJava Emitter.java
>                         JavaGeneratorFactory.java
>   Log:
>   a way to disable name mangling in case of anonymous type collisions
>   
>   Revision  Changes    Path
>   1.68      +18 -0
> ws-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java
>   
>   Index: Emitter.java
>   ===================================================================
>   RCS file:
> /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java,v
>   retrieving revision 1.67
>   retrieving revision 1.68
>   diff -u -r1.67 -r1.68
>   --- Emitter.java	8 Apr 2004 13:09:06 -0000	1.67
>   +++ Emitter.java	9 Apr 2004 18:37:04 -0000	1.68
>   @@ -89,6 +89,8 @@
>        
>        private boolean bBuildFileGeneration = false;
>    
>   +    private boolean typeCollisionProtection = true;
>   +
>        /** Field packageName */
>        private String packageName = null;
>    
>   @@ -882,4 +884,20 @@
>        public void generateAll(boolean all) {
>            setAllWanted(all);
>        }    // generateAll
>   +    
>   +    /**
>   +     * Get the type collision protection setting
>   +     * @return
>   +     */
>   +    public boolean isTypeCollisionProtection(){
>   +        return this.typeCollisionProtection;
>   +    }
>   +    
>   +    /**
>   +     * Enable/disable type collision protection
>   +     * @param value
>   +     */
>   +    public void setTypeCollisionProtection(boolean value){
>   +        this.typeCollisionProtection = value;
>   +    }
>    }
>   
>   
>   
>   1.50      +16 -14
> ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java
>   
>   Index: JavaGeneratorFactory.java
>   ===================================================================
>   RCS file:
> /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaGen
> eratorFactory.
> java,v
>   retrieving revision 1.49
>   retrieving revision 1.50
>   diff -u -r1.49 -r1.50
>   --- JavaGeneratorFactory.java	8 Apr 2004 13:09:06 
> -0000	1.49
>   +++ JavaGeneratorFactory.java	9 Apr 2004 18:37:04 
> -0000	1.50
>   @@ -608,21 +608,23 @@
>                    typeQName = new QName(typeQName.getNamespaceURI(),
>                            localName);
>    
>   -                // If there is already an existing type,
>   -                // there will be a collision.
>   -                // If there is an existing anon type,
>   -                // there will be a  collision.
>   -                // In both cases, mangle the name.
>   -                symbolTable.getType(typeQName);
>   -
>   -                if (anonQNames.get(typeQName) != null) {
>   -                    localName += "Type" + uniqueNum++;
>   -                    typeQName =
>   -                    new QName(typeQName.getNamespaceURI(),
>   -                            localName);
>   +                if (emitter.isTypeCollisionProtection()) {
>   +                    // If there is already an existing type,
>   +                    // there will be a collision.
>   +                    // If there is an existing anon type,
>   +                    // there will be a  collision.
>   +                    // In both cases, mangle the name.
>   +                    symbolTable.getType(typeQName);
>   +                    
>   +                    if (anonQNames.get(typeQName) != null) {
>   +                        localName += "Type" + uniqueNum++;
>   +                        typeQName =
>   +                            new QName(typeQName.getNamespaceURI(),
>   +                                      localName);
>   +                    }
>   +                    
>   +                    anonQNames.put(typeQName, typeQName);
>                    }
>   -
>   -                anonQNames.put(typeQName, typeQName);
>    
>                    // Now set the name with the constructed qname
>                    tEntry.setName(emitter.getJavaName(typeQName));
>   
>   
>   
> 
>