Xtend Active annotations: Statically import method [message #1786934] |
Wed, 16 May 2018 02:24  |
Eclipse User |
|
|
|
I would like to use a statically imported method in code generated with Xtend's active annotations. As an example, I want to get this output:
import static java.util.Collections.emptyList;
@MyActiveAnnotation
public class MyTest {
public void foo() {
emptyList();
}
}
My compilation participant looks like this:
override doTransform(MutableClassDeclaration clazz, extension TransformationContext context) {
clazz.addMethod("foo", [
body = '''
«Collections».emptyList();
])
While this code works and imports Collections, it doesn't statically import the emptyList method.
How can I statically import methods using Xtend's active annotations?
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.08339 seconds