NoraUI - "Cannot infer Type argument" 在自定义步骤中使用 Result.Warning<> 时出错
NoraUI - "Cannot infer Type argument" error using Result.Warning<> in a custom step
我需要在我的一个场景中发出警告,但我不会停止出现此错误:"Cannot infer type arguments for Result.Warning<>"
我实际上尝试以与我之前提出失败相同的方式提出警告:
new Result.Warning<>(targetKey, Messages.format(TaroMessages.WARNING_RESOURCES_VALUE_DIFFERENCE_AFTER_REAFFECTATION, existing_value, new_value), true, oscarAccesClientPage.getCallBack());
我在内部使用它的自定义步骤如下:我正在尝试检查元素列表并检查它们的现有值是否与之前保存的值相同。
protected void checkXyResourcesValue(Integer xyIterator, List<WebElement> elements, String keyParameter) throws TechnicalException, FailureException {
try {
Integer resIterator = 1;
for(WebElement element : elements) {
String targetKey = "XY" + xyIterator + "RES" + resIterator + keyParameter;
String new_value = element.getAttribute(VALUE) != null ? element.getAttribute(VALUE) : element.getText();
String existing_value = Context.getValue(targetKey) != null ? Context.getValue(targetKey) : targetKey;
if (new_value != existing_value) {
new Result.Warning<>(targetKey, Messages.format(TaroMessages.WARNING_RESOURCES_VALUE_DIFFERENCE_AFTER_REAFFECTATION, existing_value, new_value), true, oscarAccesClientPage.getCallBack());
}
resIterator++;
}
} catch (Exception e) {
new Result.Failure<>(e.getMessage(), Messages.format(TaroMessages.FAIL_MESSAGE_ACCES_CLIENT_XY_CHECK_RESOURCES_VALUE, keyParameter, xyIterator), true, oscarAccesClientPage.getCallBack());
}
}
对于检查和保存值的方法,我实际上是从 NoraUI 的一段代码中启发了自己在 Context 上保存值或从中读取值。
我正在使用 Eclipse Luna 4.4.2,我尝试使用 JDK1.8 进行编译。0_131。
这可能与我不知道这在 Java 中如何工作有关,而不是真正的问题,所以在此先感谢您的帮助或见解。如果您需要有关这段代码或上下文的更多信息,请随时询问。
new Result.Warning<>(targetKey, Messages.format(TaroMessages.WARNING_RESOURCES_VALUE_DIFFERENCE_AFTER_REAFFECTATION, existing_value, new_value), true, 0);
如果您不使用任何模型(数据序列化)或在序列中使用对象的 ID,则使用 0。
我需要在我的一个场景中发出警告,但我不会停止出现此错误:"Cannot infer type arguments for Result.Warning<>"
我实际上尝试以与我之前提出失败相同的方式提出警告:
new Result.Warning<>(targetKey, Messages.format(TaroMessages.WARNING_RESOURCES_VALUE_DIFFERENCE_AFTER_REAFFECTATION, existing_value, new_value), true, oscarAccesClientPage.getCallBack());
我在内部使用它的自定义步骤如下:我正在尝试检查元素列表并检查它们的现有值是否与之前保存的值相同。
protected void checkXyResourcesValue(Integer xyIterator, List<WebElement> elements, String keyParameter) throws TechnicalException, FailureException {
try {
Integer resIterator = 1;
for(WebElement element : elements) {
String targetKey = "XY" + xyIterator + "RES" + resIterator + keyParameter;
String new_value = element.getAttribute(VALUE) != null ? element.getAttribute(VALUE) : element.getText();
String existing_value = Context.getValue(targetKey) != null ? Context.getValue(targetKey) : targetKey;
if (new_value != existing_value) {
new Result.Warning<>(targetKey, Messages.format(TaroMessages.WARNING_RESOURCES_VALUE_DIFFERENCE_AFTER_REAFFECTATION, existing_value, new_value), true, oscarAccesClientPage.getCallBack());
}
resIterator++;
}
} catch (Exception e) {
new Result.Failure<>(e.getMessage(), Messages.format(TaroMessages.FAIL_MESSAGE_ACCES_CLIENT_XY_CHECK_RESOURCES_VALUE, keyParameter, xyIterator), true, oscarAccesClientPage.getCallBack());
}
}
对于检查和保存值的方法,我实际上是从 NoraUI 的一段代码中启发了自己在 Context 上保存值或从中读取值。
我正在使用 Eclipse Luna 4.4.2,我尝试使用 JDK1.8 进行编译。0_131。
这可能与我不知道这在 Java 中如何工作有关,而不是真正的问题,所以在此先感谢您的帮助或见解。如果您需要有关这段代码或上下文的更多信息,请随时询问。
new Result.Warning<>(targetKey, Messages.format(TaroMessages.WARNING_RESOURCES_VALUE_DIFFERENCE_AFTER_REAFFECTATION, existing_value, new_value), true, 0);
如果您不使用任何模型(数据序列化)或在序列中使用对象的 ID,则使用 0。