我正在将IntelliJ用于我的GWT项目和此代码
LinkedList<String> modelValue = new LinkedList<>();
componentValue.forEach(product -> {
Product p = (Product) product;
modelValue.add(p.getObjectId());
});
我收到此错误:
Method 'Iterable.forEach(Consumer<? super T>)' is not present in JRE Emulation Library so it cannot be used in client code of 'com.mycompany.app.AppTest' GWT module less... (Ctrl+F1)
This inspection reports usages in client code of JDK classes which are not present in the JRE Emulation Library.
如何使用IntelliJ修复此问题?
答案 0 :(得分:2)
您需要使用GWT 2.8版才能在Java 8中使用新的API,例如Iterable.forEach()
。