我的Xtend / GWT应用程序运行良好,直到我尝试在阵列上执行forEach。
现在我
了No source code is available for type org.eclipse.xtext.xbase.lib.Conversions; did you forget to inherit a required module?
代码
def transferAttributesToElement(String... attributeNames) {
attributeNames.forEach [
element.setAttribute(it, attributeMap.get(it)?.toString())
]
}
pom中的Xbase条目
<dependencies>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext.xbase.lib.gwt</artifactId>
<version>2.9.2</version>
</dependency>
</dependencies>
在gwt.xml中继承
<inherits name='org.eclipse.xtext.xbase.lib.Lib'/>
Xtend源兼容级别Java 7
Java 7
修改
Xtend为上述代码片段生成的Java源代码
final Procedure1<String> _function = new Procedure1<String>() {
@Override
public void apply(final String it) {
Object _get = HtmlBuilderBase.this.attributeMap.get(it);
String _string = null;
if (_get!=null) {
_string=_get.toString();
}
HtmlBuilderBase.this.element.setAttribute(it, _string);
}
};
IterableExtensions.<String>forEach(((Iterable<String>)Conversions.doWrapArray(attributeNames)), _function);