关于我的代码的类型错误的非法开始
illegal start of type error about my code
当我创建负载时,我的程序出现以下错误;
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);
}
}
可能你用的是JDK低于7的版本,不知道the diamond <>
是什么
更改为以下将解决问题:
new ArrayList<String>(listOfAcctStorageRuleName.size());
当然,您可以免费下载更新的Java版本,以使用以前版本中不允许使用的所有便利功能。
当我创建负载时,我的程序出现以下错误;
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);
}
}
可能你用的是JDK低于7的版本,不知道the diamond <>
是什么
更改为以下将解决问题:
new ArrayList<String>(listOfAcctStorageRuleName.size());
当然,您可以免费下载更新的Java版本,以使用以前版本中不允许使用的所有便利功能。