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

Bug 480010

Summary: Code formatter does not handle spaces properly in method declarations with nested parenthesis
Product: [Eclipse Project] JDT Reporter: Cody Carroll <cmichaelcarroll>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: minor    
Priority: P3 CC: mateusz.matela
Version: 4.5.1   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
core prefs none

Description Cody Carroll CLA 2015-10-16 20:09:39 EDT
Created attachment 257318 [details]
core prefs

It looks like the formatter detects the first closing paren in a method declaration as the final closing paren.
In our project, we want to add spaces after the opening and before the closing parens of method declarations, but not for any annotations. The desired output of the formatter is something like this:

	@GET
	@Path("bracket")
	@Produces(MediaType.APPLICATION_JSON)
	public Response getBracket( //
			final @NotNull @QueryParam("platform") String platform, //
			final @NotNull @QueryParam("appVersion") String appVersion, //
			final @NotNull @QueryParam("appId") String appId, //
			final @Context HttpServletRequest request ) {
		return responseWithCachingHeaders( out, cacheTime );
	}

But the actual result is:

	@GET
	@Path("bracket")
	@Produces(MediaType.APPLICATION_JSON)
	public Response getBracket( //
			final @NotNull @QueryParam("platform" ) String platform, //
			final @NotNull @QueryParam("appVersion") String appVersion, //
			final @NotNull @QueryParam("appId") String appId, //
			final @Context HttpServletRequest request) {
		return responseWithCachingHeaders( out, cacheTime );
	}

The formatter has inserted a space after "platform", and removed the one before the closing paren.
Comment 1 Stephan Herrmann CLA 2015-10-17 08:36:39 EDT
*** Bug 480011 has been marked as a duplicate of this bug. ***
Comment 2 Mateusz Matela CLA 2015-10-17 09:45:18 EDT

*** This bug has been marked as a duplicate of bug 475746 ***