当我创建一个加载时,我的程序给出了以下错误;
D:\views\UniqueAcctStorageRuleNameValidator.java:34: illegal start of type
List<String> listOfAcctStorageRuleNameAsArray =
new ArrayList<>(listOfAcctStorageRuleName.size());
这是代码;
public class FKAcctStorageRuleNameValidator extends AbstractAnnotationCheck<FKAcctStorageRuleName>{
private static final long serialVersionUID = 1L;
private SpecbookValidatorManager specBookValidator;
@Override
public boolean isSatisfied(Object validatedObject, Object valueToValidate,
OValContext context, Validator validator) throws OValException {
if (valueToValidate == null) return true;
specBookValidator = SpecbookValidatorManagerImpl.getInstance();
List<SpecbookAcctStorageRule> listOfAcctStorageRuleName = specBookValidator.getAcctStorageRuleList();
List<String> listOfAcctStorageRuleNameAsArray = new ArrayList<>(listOfAcctStorageRuleName.size());
for (SpecbookAcctStorageRule specbookAcctStorageRule : listOfAcctStorageRuleName) {
listOfAcctStorageRuleNameAsArray.add(specbookAcctStorageRule.getName());
}
return ListUtil.containsIgnoreCase((String) valueToValidate, listOfAcctStorageRuleNameAsArray);
}
}
答案 0 :(得分:3)
您可能正在使用JDK低于7的版本。它不知道the diamond <>
是什么。
更改为以下内容将解决问题:
new ArrayList<String>(listOfAcctStorageRuleName.size());
当然,您可以自由下载较新的Java版本,以使用以前版本中不允许的所有便捷功能。