简体   繁体   中英

I got checkstyle warning: WhitespaceAround: WhitespaceAround: '{' is not preceded with whitespace

When I build my project, So I got this checkstyle warning : WhitespaceAround: WhitespaceAround: '{' is not preceded with whitespace. Can you please help me to remove this warning.

public List<ObjectSyncStatus> createEntities(Long connectorId, EntityRequest entityRequest) {
    if (connectorId == null && entityRequest == null){
        return Collections.emptyList();
    }
    String entitiesUrl = connectorEndpoint + CONNECTOR_PATH + connectorId + "/entities";
    HttpMethod method = HttpMethod.POST;

    HttpEntity<EntityRequest> httpEntity = new HttpEntity<>(entityRequest);
    ResponseEntity<List> responseEntity = restTemplate.exchange(entitiesUrl, method, httpEntity, List.class);
    log.info(OPERATION_SUCCESSFUL, responseEntity);

    return mapper.mapAsList(responseEntity.getBody(), ObjectSyncStatus.class);
}

I got the warning in If condition.

The Checkstyle configuration that you are using expects the { to have a space before it. Your code looks like this at the moment:

if (connectorId == null && entityRequest == null){
    return Collections.emptyList();
}

Checkstyle wants it to look like this:

if (connectorId == null && entityRequest == null) {
    return Collections.emptyList();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM