Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 479575

Summary: Javadoc view does not correctly handle {@code ...} correctly
Product: [Eclipse Project] JDT Reporter: Simon Archer <sja.eclipse>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: jarthana
Version: 4.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug
Attachments:
Description Flags
Screenshot. none

Description Simon Archer CLA 2015-10-12 11:01:27 EDT
Created attachment 257214 [details]
Screenshot.

Using:
  Eclipse IDE for Eclipse Committers
  Version: Mars Release (4.5.0)
  Build id: 20150621-1200

When using the Javadoc view to preview Javadoc source, it does not correctly handle {@code ...} elements. For example:

/**
 * <pre> {@code
 * IStopwatch watch = new Stopwatch();
 * IFunction<Integer, Integer> function = new IFunction<Integer, Integer>() {
 *    public Integer apply(Integer value) {
 *       int total = 0;
 *       for (int i = 0; i < value; i++) {
 *         total += i;
 *       }
 *       return total;
 *    }
 * };
 * int total = watch.apply(function, 10);
 * System.out.println("Total=" + total);
 * double duration = watch.getDuration();
 * System.out.println(duration);
 * }
 * </pre>
 */	
Gets rendered in the view as:

 IStopwatch watch = new Stopwatch();
 IFunction function = new IFunction() {
    public Integer apply(Integer value) {
       int total = 0;
       for (int i = 0; i < value; i++) {
         total += i;
       }
       return total;
    }
 };
 int total = watch.apply(function, 10);
 System.out.println("Total=" + total);
 double duration = watch.getDuration();
 System.out.println(duration);
 }

There are a few things to note:

1. The IFunction generic declarations are missing from the second line.
2. The closing brace of the {@code ...} element is rendered as the last line.

See the attached screenshot.
Comment 1 Simon Archer CLA 2015-10-12 14:11:19 EDT
Using:
  Eclipse SDK
  Version: Neon (4.6)
  Build id: I20150916-2000

Tried and reproduced with Eclipse 4.6M2.
Comment 2 Jay Arthanareeswaran CLA 2015-10-13 01:38:04 EDT
I am not really sure if the remove the trailing brace. As for the missing type arguments, looks like they are missing the escape characters.

Moving to UI.
Comment 3 Jay Arthanareeswaran CLA 2015-10-13 01:45:08 EDT
(In reply to Jay Arthanareeswaran from comment #2)
> I am not really sure if the remove the trailing brace.

This is a problem too. Basically we seem to wrap the 'code' right after the first line, thus leaving out the closing brace.
Comment 4 Eclipse Genie CLA 2019-09-21 14:42:42 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.