Bug 238920 - [formatter] Code Formatter removes javadoc status if @category present
Summary: [formatter] Code Formatter removes javadoc status if @category present
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.4.1   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-29 18:43 EDT by Ross Judson CLA
Modified: 2008-08-28 12:38 EDT (History)
3 users (show)

See Also:


Attachments
Proposed patch (3.37 KB, patch)
2008-07-02 12:44 EDT, Frederic Fusier CLA
no flags Details | Diff
Proposed patch for R3_4_maintenance stream (3.40 KB, patch)
2008-07-03 05:55 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 Ross Judson CLA 2008-06-29 18:43:59 EDT
Build ID: I20080617-2000

Steps To Reproduce:
1. Place an @category _identifier_ annotation in javadoc, which allows the Outline view to see it and categorize elements in its tree. Do not use "public", etc, as a category identifier; use something like "preferred".
2. Format the source file.
3. Note that the javadoc nature of the comments has been removed (/** becomes /*). Note that the outline view no longer shows categories. 


More information:
The core formatter code has special case code for category, but appears to simply delete the tag rather than leave it alone.
Comment 1 Frederic Fusier CLA 2008-06-30 06:06:29 EDT
Please provide a simple test case to reproduce, thanks
Comment 2 Frederic Fusier CLA 2008-06-30 06:49:32 EDT
I got some troubles to reproduce, but I think I get it now...

The following simple test case works properly:
public class Test {
	/**
	 * @category test
	 */
	void foo() {
	}
}


But as soon as I add some other text:
public class Test {
	/**
	 * Test for bug 238920
	 * @category test
	 */
	void foo() {
	}
}

Then the tag vanishes during the formatting:
public class Test {
	/**
	 * Test for bug 238920
	 * 
	 */
	void foo() {
	}
}

I'll investigate...
Comment 3 Ross Judson CLA 2008-06-30 09:49:47 EDT
That's it exactly. Check your first test case as well...for me

/**
 * @category test
 */
void foo() {
}

changes to

/*
 * @category test
 */
void foo() {
}

Note that the javadoc style comment (/**) has been changed to non-javadoc (/*). Maybe your build does not do this.

There is a TODO in the source code near this area that detects the @category, refers to the future, and may be dropping it silently. I need to get a debugging setup for Eclipse together so I can just give you a patch next time.

Thanks for your quick attention to this. Categorizing methods is something desperately needed by Eclipse generally...smalltalk had protocols. 
Comment 4 Frederic Fusier CLA 2008-07-02 12:44:37 EDT
Created attachment 106330 [details]
Proposed patch

The FormatterCommentParser needed to create the tag while parsing the @category tag!
Comment 5 Frederic Fusier CLA 2008-07-02 12:46:19 EDT
Released for 3.5M1.

Jerome, could you validate the backport to 3.4.1?
Comment 6 Jerome Lanneluc CLA 2008-07-03 04:45:15 EDT
This is a major regression comparing to 3.3.2. 
+1 for 3.4.1
Comment 7 Frederic Fusier CLA 2008-07-03 04:52:23 EDT
Reopen to fix it in R3_4_maintenance stream...
Comment 8 Frederic Fusier CLA 2008-07-03 05:55:40 EDT
Created attachment 106410 [details]
Proposed patch for R3_4_maintenance stream
Comment 9 Frederic Fusier CLA 2008-07-03 05:56:04 EDT
Released for 3.4.1
Comment 10 Olivier Thomann CLA 2008-08-06 12:27:38 EDT
Verified for 3.5M1 using I20080805-1307
Comment 11 Olivier Thomann CLA 2008-08-06 13:29:32 EDT
Reopen to close as RESOLVED/FIXED. Will be closed as VERIFIED during 3.4.1
verification pass.
Comment 12 Olivier Thomann CLA 2008-08-06 13:29:52 EDT
Fixed.
Comment 13 Olivier Thomann CLA 2008-08-28 12:38:06 EDT
Verified for 3.4.1 using M20080827-2000