我有以下checkstyle配置。
<module name="CustomImportOrder">
<property name="customImportOrderRules"
value="STATIC###STANDARD_JAVA_PACKAGE###SPECIAL_IMPORTS###THIRD_PARTY_PACKAGE###SAME_PACKAGE(3)"/>
<property name="specialImportsRegExp" value="^org\."/>
<property name="thirdPartyPackageRegExp" value="^com\."/>
<property name="sortImportsInGroupAlphabetically" value="true"/>
<property name="separateLineBetweenGroups" value="true"/>
</module>
然后我有以下导入列表
import java.io.IOException;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.lang3.Validate;
import com.google.common.collect.ImmutableMap;
import com.acompanyname.departmentname.commons.exceptions.DependencyFailureException;
import com.acompanyname.departmentname.commons.exceptions.DuplicateRecordException;
import com.acompanyname.departmentname.commons.exceptions.InvalidRequestException;
import com.acompanyname.departmentname.commons.exceptions.RecordNotFoundException;
import com.acompanyname.departmentname.financialservice.domain.Wallet;
import com.acompanyname.departmentname.financialservice.domain.WalletId;
import com.acompanyname.departmentname.financialservice.lambda.Converter;
import com.acompanyname.departmentname.financialservice.lambda.exceptions.DuplicateWalletException;
import com.amazonaws.AmazonClientException;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBQueryExpression;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBSaveExpression;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBScanExpression;
import com.amazonaws.services.dynamodbv2.datamodeling.PaginatedQueryList;
import com.amazonaws.services.dynamodbv2.datamodeling.PaginatedScanList;
import com.amazonaws.services.dynamodbv2.model.ConditionalCheckFailedException;
import com.amazonaws.services.dynamodbv2.model.ExpectedAttributeValue;
我经常收到错误Wrong lexicographical order for 'com.acompanyname.departmentname.commons.exceptions.DependencyFailureException'
导入。
我尝试过多种方法但仍然无法弄清楚如何修复此导入错误。我尝试将它们分组,重新订购,但我仍然很困惑。
答案 0 :(得分:1)
有关com.acompanyname.departmentname.commons.exceptions.DependencyFailureException
导入顺序的错误具有误导性。
实际上不符合您的配置的词典排序的导入是:
import com.google.common.collect.ImmutableMap;