Javadoc formatting issue with multiline code

255 views Asked by At

I have the following Javadoc which has multiline code:

     * <p>Usage example:
 * <code>
 *  ConfigurationProperty property = ConfigurationProperty.Builder
 *                                      .create()
 *                                      .withHotKey("testKey")
 *                                  .withRunnableContext("testContext")
 *                                  .withRunnableContextType("APPLICATION")
 *                                  .build();
 * </code>
 * 
 * The {@link ConfigurationProperty.Builder#withRunnableContextType(String type) method 
 * throws an {@link IllegalArgumentException} if the provided type is not supported in
 * {@link ConfigurationProperty#RUNNABLE_CONTEXT_TYPE}

My issue is that the code is not getting displayed with right indentation in the generated Javadoc. The following is what i see in the generated Javadoc without any indentation:

Immutable implementation of a ConfigurationProperty. This class is  
 immutable, and so is thread safe. An instance of the ConfigurationProperty
can be obtained by using the ConfigurationProperty.Builder 

Usage example: ConfigurationProperty property =    
ConfigurationProperty.Builder .create() .withHotKey("testKey")   
.withRunnableContext("testContext") .withRunnableContextType("APPLICATION")   
.build(); } The method throws an IllegalArgumentException if the provided 
type is not supported in ConfigurationProperty.RUNNABLE_CONTEXT_TYPE

If I replace code by pre tags, then just the first line of code displays. enter image description here Why is this so. How do I fix this? Any thoughts on how to correct this?

Please advise,

Thanks!

1

There are 1 answers

5
Pshemo On

Use <pre> instead of <code>.

enter image description here