Bug 267658

Summary: [formatter] Javadoc comments may be still formatted as block comments
Product: [Eclipse Project] JDT Reporter: Frederic Fusier <frederic_fusier>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: david_audel
Version: 3.5   
Target Milestone: 3.5 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed patch none

Description Frederic Fusier CLA 2009-03-09 11:44:19 EDT
While verifying bug 265898, David highlight a problem with the initial test case when options are set as follow:
[ ] Enable Javadoc comment formatting
[X] Enable block comment formatting
[X] Enable line comment formatting
[X] Enable header comment formatting

The formatter output is:
/**
 * 
 * @hibernate.subclass discriminator-value="address"
 */
public class AddressAssetVersion extends AbstractAssetVersion {

}

Observe the new line added inside the javadoc comment... It seems that the Javadoc comment is formatted although the option is not set!
Comment 1 Frederic Fusier CLA 2009-03-09 11:54:56 EDT
Although it looks like, this is not a regression introduced by the fix for bug 254998 but was rather something wrong in the new comment formatter implemented in 3.4...

In fact the javadoc comment is formatted but as a block comment! The new line added is the normal formatter behavior when a tag is encountered at the beginning of a line in a block comment...

Fixing bug 254998 has just changed the formatter behavior as with 3.4.2.

E.g. using the following options:
[ ] Enable Javadoc comment formatting
[X] Enable block comment formatting
[ ] Enable line comment formatting
[ ] Enable header comment formatting

the following test case:
public class Test {
/**
 * @test bug
 */
int field;
}

was formatted in 3.4.2 as:
public class Test {
	/*
	 * *
	 * 
	 * @test bug
	 */
	int field;
}
Comment 2 Frederic Fusier CLA 2009-03-09 12:12:03 EDT
Created attachment 128049 [details]
Proposed patch
Comment 3 Frederic Fusier CLA 2009-03-10 04:55:39 EDT
Released for 3.5M6 in HEAD stream.
Comment 4 David Audel CLA 2009-03-11 07:56:11 EDT
Verified for 3.5M6 using I20090311-0100