简体   繁体   English

我收到了 checkstyle 警告: WhitespaceAround: WhitespaceAround: '{' is not before with whitespace

[英]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.当我构建我的项目时,我收到了这个 checkstyle 警告: WhitespaceAround: WhitespaceAround: '{' 前面没有空格。 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.我在 If 条件下收到警告。

The Checkstyle configuration that you are using expects the { to have a space before it.您使用的 Checkstyle 配置要求{前面有一个空格。 Your code looks like this at the moment:您的代码目前看起来像这样:

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

Checkstyle wants it to look like this: Checkstyle 希望它看起来像这样:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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