3 Replies Latest reply: Nov 27, 2008 4:43 AM by thomas.behr RSS

    @see method signature with parameterized arguments

    843810
      I'm getting illegal character warnings, when I try to use the @see tag to reference methods whose signatures include arguments that are parameterized.

      if I have a method like,
      public void printMyStrings(List<String> stringList);
      I've attempted using
      @see #printMyStrings(List<String>)
      How can I write a @see tag to reference this method. I realize that I could specify the argument as the List interface rather than List<String>, but I'd rather not if it's avoidable. I've also tried escaping the less-than and greater-than symbols with '\' which doesn't seem to work either.

      Thank you
        • 1. Re: @see method signature with parameterized arguments
          thomas.behr
          paulwooten wrote:
          How can I write a @see tag to reference this method.
          This way:
          /**
           * @see #printMyStrings(java.util.List)
           */
          paulwooten wrote:I realize that I could specify the argument as the List interface rather than List<String>, but I'd rather not if it's avoidable.
          Why? If all you want is to have the type parameter appear in the generated hyperlink text, then use a second label argument.
          /**
           * @see #printMyStrings(java.util.List) printMyStrings(List<String>)
           */
          I don't know how to make the forum software to print &lt;String&gt; instead of <String> when posting code, but you should escape the angle brackets in the label as usual for HTML.
          • 2. Re: @see method signature with parameterized arguments
            843810
            I guess I was under the understanding that in order for
            /**
             * @see #printMyStrings(java.util.List)
            */
            to link to the method, I would need to change the method's signature from
            void printMyStrings(java.util.List<String>)
            to
            void printMyStrings(java.util.List)
            ,

            which is what I wanted to avoid doing (changing the argument to a less specific reference in the method's signature).

            Thanks for your help
            • 3. Re: @see method signature with parameterized arguments
              thomas.behr
              paulwooten wrote:
              I guess I was under the understanding that in order for
              /**
              * @see #printMyStrings(java.util.List)
              */
              to link to the method, I would need to change the method's signature from
              void printMyStrings(java.util.List<String>)
              to
              void printMyStrings(java.util.List)
              ,

              which is what I wanted to avoid doing (changing the argument to a less specific reference in the method's signature).
              Ah, ok. No, you need not change your method signature. ;-)
              paulwooten wrote:
              Thanks for your help
              You're welcome.