Bug 232488 - [formatter] Code formatter scrambles JavaDoc of Generics
Summary: [formatter] Code formatter scrambles JavaDoc of Generics
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.4 RC2   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-16 08:47 EDT by Thomas Schindl CLA
Modified: 2008-05-23 05:59 EDT (History)
6 users (show)

See Also:
jerome_lanneluc: review+
eric_jodet: review+


Attachments
Proposed patch (6.46 KB, patch)
2008-05-16 12:32 EDT, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schindl CLA 2008-05-16 08:47:00 EDT
Having a code like this in your class 

/**
 * 
 * @param <C> bla bla bla
 */
public abstract class MyWidget<C extends Control>
{

and hitting CTRL+SHIFT+F results in code like this:

/**
 * 
 * @param <
 *      C> bla bla bla
 */
public abstract class MyWidget<C extends Control>
{
Comment 1 Martin Aeschlimann CLA 2008-05-16 09:21:27 EDT
Which build?
Comment 2 Thomas Schindl CLA 2008-05-16 09:37:46 EDT
I20080502-0100
Comment 3 Damien Cassou CLA 2008-05-16 10:34:50 EDT
I confirm this bug. This is very annoying because JavaDoc does not recognize the parameter if a new-line is inserted in the tag. Moreover, this makes the documentation looks ugly.

This happens in Eclipse 3.4M7, don't know about previous versions.
Comment 4 Frederic Fusier CLA 2008-05-16 10:44:17 EDT
This will be partially fixed in RC1 (you can already get it in RC1 candidate build I20080515-2000)...

The output for RC1 will be:
/**
 * 
 * @param <C> bla bla bla
 */

instead of obviously bogus 3.4M7 formatting...

However, I keep this bug opened as, with Eclipse built-in settings, the real output should be (as it was in 3.3):
/**
 * 
 * @param <C>
 *            bla bla bla
 */

The problem comes from the fact that the scribe does not set the parser source
level, hence the Javadoc parser does not know that it should accept this generic
syntax...
Comment 5 Frederic Fusier CLA 2008-05-16 12:32:32 EDT
Created attachment 100674 [details]
Proposed patch
Comment 6 Frederic Fusier CLA 2008-05-16 12:35:54 EDT
Jerome, I think this fix could be a good candidate for RC2. There's no regression risk, the change is really small and with it the formatter will accept possible 1.5 syntax in Javadoc comment.
Comment 7 Jerome Lanneluc CLA 2008-05-19 12:26:30 EDT
Agreed that it is a good candidate for RC2
Comment 8 Jerome Lanneluc CLA 2008-05-20 05:18:02 EDT
Patch looks good: +1
Comment 9 Frederic Fusier CLA 2008-05-20 07:59:13 EDT
Eric, can you please review?
Comment 10 Eric Jodet CLA 2008-05-20 08:42:21 EDT
Patch looks good: +1
Comment 11 Frederic Fusier CLA 2008-05-20 09:13:01 EDT
Released for 3.4RC2 in HEAD stream.
Comment 12 Eric Jodet CLA 2008-05-23 05:59:49 EDT
verified for 3.4RC2 using build I20080523-0100