Bug 13593 - Code Formatter formats synchronized incorrectly.
Summary: Code Formatter formats synchronized incorrectly.
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows NT
: P5 trivial (vote)
Target Milestone: 2.0 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-12 04:32 EDT by Bernard Choi CLA
Modified: 2002-04-16 09:24 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bernard Choi CLA 2002-04-12 04:32:13 EDT
Autoformatting produces the following. The second synchronized statement is 
indented too deep.

public static void main(String[] args) {

	Object o = null;
	synchronized (o) {
		// do something;
	}

		synchronized (o) {
			// do something else;
		}
}


The following was expected / preferred .

public static void main(String[] args) {
	Object o = null;

	synchronized (o) {
		// do something;
	}

	synchronized (o) {
		// do something else;
	}

}
Comment 1 Bernard Choi CLA 2002-04-12 04:36:35 EDT
using eclipse build 20020321
Comment 2 Bernard Choi CLA 2002-04-12 04:40:47 EDT
Further observations reveal that the code after the synchronized block is 
indented incorrently.

	public static void main(String[] args) {
		Object o = null;
		synchronized (o) {
			// do something;
		}
			System.out.println("next line");
			System.out.println("next line after");
	}

when expecting

	public static void main(String[] args) {
		Object o = null;
		synchronized (o) {
			// do something;
		}
		System.out.println("next line");
		System.out.println("next line after");
	}
Comment 3 Olivier Thomann CLA 2002-04-16 09:18:44 EDT
That looks like an old bug. I will try with latest integration build.
Comment 4 Olivier Thomann CLA 2002-04-16 09:23:11 EDT
With latest (0412) I got the expected results.
Closed.