Formatting Help: Java Method's

HI all,

I'm trying to spot what formatting setting I need to change to format my Java code as I'd like but not having much luck. Can anyone help?

So to start with, I have a right margin of 120 characters, my tab size & indentation is set to 2 spaces, my continuation indent is set to 4 spaces.  I have the following bit of code that looks as I'd expect:

@RequestMapping(value = CONFIGURATIONS_ROOT, method = GET)
public HttpEntity<ConfigurationsListResource> listAllApplicaitonInstances(@PageableDefault(page = DEFAULT_START,
    size = DEFAULT_HITS_PER_PAGE) Pageable pageable) {
  Page<ApplicationInstance> applicationInstances = configurationsRepository.findAll(pageable);

The method opening spills nicely over two lines & is indented appropriately.  But sometimes the method call spills over into two lines but isn't indented:

@RequestMapping(value = APPLICATIONS_ROOT, method = PUT, consumes = APPLICATION_XML_VALUE)
public HttpEntity<?> updateApplication(@RequestBody String applicationXML, @RequestHeader(HttpHeaders.REFERER)
String referrer) {
  checkArgument(!isNullOrEmpty(applicationXML), "Request body should not be blank");

In the case of this method, I'd expect the line starting "String referrer" to be indented 4 spaces but it isn't.  Any clues on the best item to change? Is this possibly a bug I should raise?

Cheers for any help. I'll keep trying different settings in the meantime :)


Comment actions Permalink

Please submit an issue at with the sample project to reproduce. Make sure your code style is also stored with the project.


Please sign in to leave a comment.