jdk/src/share/classes/java/lang/reflect/Parameter.java
changeset 17177 59a964c1d518
parent 16743 b0b34102bb4c
child 17450 0f704861915e
equal deleted inserted replaced
17176:d7ee1e315fe7 17177:59a964c1d518
   146     public int getModifiers() {
   146     public int getModifiers() {
   147         return modifiers;
   147         return modifiers;
   148     }
   148     }
   149 
   149 
   150     /**
   150     /**
   151      * Returns the name of the parameter.  The names of the parameters
   151      * Returns the name of the parameter.  If the parameter's name is
   152      * of a single executable must all the be distinct.  When names
   152      * defined in a class file, then that name will be returned by
   153      * from the originating source are available, they are returned.
   153      * this method.  Otherwise, this method will synthesize a name of
   154      * Otherwise, an implementation of this method is free to create a
   154      * the form argN, where N is the index of the parameter.
   155      * name of this parameter, subject to the unquiness requirments.
       
   156      */
   155      */
   157     public String getName() {
   156     public String getName() {
   158         // As per the spec, if a parameter has no name, return argX,
   157         // Note: empty strings as paramete names are now outlawed.
   159         // where x is the index.
   158         // The .equals("") is for compatibility with current JVM
   160         //
   159         // behavior.  It may be removed at some point.
   161         // Note: spec updates now outlaw empty strings as parameter
       
   162         // names.  The .equals("") is for compatibility with current
       
   163         // JVM behavior.  It may be removed at some point.
       
   164         if(name == null || name.equals(""))
   160         if(name == null || name.equals(""))
   165             return "arg" + index;
   161             return "arg" + index;
   166         else
   162         else
   167             return name;
   163             return name;
   168     }
   164     }
   309             Annotation[] ann = getDeclaredAnnotations();
   305             Annotation[] ann = getDeclaredAnnotations();
   310             for(int i = 0; i < ann.length; i++)
   306             for(int i = 0; i < ann.length; i++)
   311                 declaredAnnotations.put(ann[i].annotationType(), ann[i]);
   307                 declaredAnnotations.put(ann[i].annotationType(), ann[i]);
   312         }
   308         }
   313         return declaredAnnotations;
   309         return declaredAnnotations;
   314     }
   310    }
   315 
   311 
   316 }
   312 }