1

I'm wondering if it's possible to tie the text of a doc comment of a method to a String value in code. For example:

String myHelloMethodDocComment = "This is a doc comment. \n @param arg1";

{Some sort of magic, maybe here maybe somewhere else}
public void printHello(String world){
    System.out.print("Hello " + world);
}

public static void main(String args[]){
    printHello("world");
}

In this example, should I generate a javadoc or mouse over the line printHello("world") in main using an editor that supports them, I would ideally want to see

"This is a doc comment.

param arg1"

In the mouse-over window.

Is this possible, maybe using something in the new Java 8 doctree api that I just haven't found?

Josh Kitchens
  • 1,080
  • 11
  • 18
  • 1
    Maybe a duplicate of [How can I reference the value of a final static field in the class javadoc?](http://stackoverflow.com/questions/7868991/how-can-i-reference-the-value-of-a-final-static-field-in-the-class-javadoc) – resueman Jan 15 '16 at 18:59
  • Thanks. That wasn't exactly what I was going for but it's close enough for my needs. Using {@value} I can't have the string value being read as if it were a doc comment itself, so you can't use any annotations. Perhaps there's another way of doing it that would allow for that. – Josh Kitchens Jan 15 '16 at 19:17

0 Answers0