commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leosu...@apache.org
Subject cvs commit: jakarta-commons-sandbox/attributes/compiler/src/java/org/apache/commons/attributes/compiler AttributeCompiler.java
Date Sun, 04 Jul 2004 23:51:59 GMT
leosutic    2004/07/04 16:51:59

  Modified:    attributes/compiler/src/java/org/apache/commons/attributes/compiler
                        AttributeCompiler.java
  Log:
  Fixed bug where a parameter class names were encoded with a
  '.' instead of a '$' between outer and inner classes. This resulted in
  the method not being found in the repository, and all attributes
  associated with it being unreachable.
  
  Revision  Changes    Path
  1.15      +21 -2     jakarta-commons-sandbox/attributes/compiler/src/java/org/apache/commons/attributes/compiler/AttributeCompiler.java
  
  Index: AttributeCompiler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/attributes/compiler/src/java/org/apache/commons/attributes/compiler/AttributeCompiler.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- AttributeCompiler.java	21 Mar 2004 00:03:44 -0000	1.14
  +++ AttributeCompiler.java	4 Jul 2004 23:51:59 -0000	1.15
  @@ -206,11 +206,30 @@
           return false;
       }
       
  +    /**
  +     * Encodes a class name to the internal Java name.
  +     * For example, an inner class Outer.Inner will be
  +     * encoed as Outer$Inner.
  +     */
  +    private void getTransformedQualifiedName (XClass type, StringBuffer sb) {
  +        
  +        if (type.isInner ()) {
  +            String packageName = type.getContainingPackage ().getName ();
  +            sb.append (packageName);
  +            if (packageName.length () > 0) {
  +                sb.append (".");
  +            }
  +            sb.append (type.getName ().replace ('.','$'));
  +        } else {
  +            sb.append (type.getQualifiedName ());
  +        }
  +    }
  +    
       protected String getParameterTypes (Collection parameters) {
           StringBuffer sb = new StringBuffer ();
           for (Iterator params = parameters.iterator (); params.hasNext ();) {
               XParameter parameter = (XParameter) params.next ();
  -            sb.append (parameter.getType ().getQualifiedName ());
  +            getTransformedQualifiedName (parameter.getType (), sb);
               sb.append (parameter.getDimensionAsString ());
               
               if (params.hasNext ()) {
  @@ -449,7 +468,7 @@
        * only "check if it is defined with two @-signs".
        */
       protected boolean isAttribute (XTag tag) {
  -        return tag.getName ().charAt (0) == '@';
  +        return tag.getName ().length () > 0 && tag.getName ().charAt (0) ==
'@';
       }
       
       protected void start() throws BuildException {
  
  
  

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


Mime
View raw message