1

Based on the answer: Multiple line code example in Javadoc comment I'd like to write following javadoc (on class level).

/**
 * Whatever txt1 ...
 * <pre>
 * {@code
 *  @Lob
 *  private byte[] foo;
 * }
 * </pre>
 * Whatever txt2 ...
 * 
 * @author $Author: $
 */
public class Foo {

However it renders like this (in eclipse preview):

Whatever txt1 ...


Author:
 $Author: $
@Lob
private byte[] foo;
 }

Whatever txt2 ...

Please note the messed up order of the author annotation

Any idea what is the appropriate format/how to properly escate @ sign?

As once going for:

/**
 * Whatever txt1 ...
 * <pre>
 * {@code
 *  Lob
 *  private byte[] foo;
 * }
 * </pre>
 * Whatever txt2 ...
 * 
 * @author $Author: $
 */
public class Foo {

it's rendered correctly:

Whatever txt1 ...

Lob
 private byte[] foo;

 Whatever txt2 ...
 Author:
 $Author: $
Community
  • 1
  • 1
Peter Butkovic
  • 11,143
  • 10
  • 57
  • 81
  • possible duplicate of [Multiple line code example in Javadoc comment](http://stackoverflow.com/questions/541920/multiple-line-code-example-in-javadoc-comment) – Wesley Bland Feb 13 '14 at 18:26

2 Answers2

1

OK, I've found answer elsewhere: https://stackoverflow.com/questions/2290757/how-can-you-escape-the-character-in-javadoc

the thing is to go for {@literal @}

So then:

/**
 * Whatever txt1 ...
 * <pre>
 * {@code
 *  {@literal @}Lob
 *  private byte[] foo;
 * }
 * </pre>
 * Whatever txt2 ...
 * 
 * @author $Author: $
 */
public class Foo {

renders correctly to:

Whatever txt1 ...


{@Lob
private byte[] foo;
}

Whatever txt2 ...
Author:
$Author: $
Peter Butkovic
  • 11,143
  • 10
  • 57
  • 81
1

because you refer to the multiline - code example - thread: The following answer in this thread has your example - escaping the "@" sign on "@Override" https://stackoverflow.com/a/13512524

Regards Christoph

Community
  • 1
  • 1