INRIA / INRIA/spoon

add support for inline templates

Open
#3,118 9 comments 0 reactions 0 assignees View on GitHub
good first issue roadmap
Dominant language
Java
Stars
2k
Forks
392
Avg merge
11h 24m
Merged PRs (30d)
36

Description

inline templates:

* with anonymous classes
* with lambda

### Inline templates

Templates can be made inline, if the source code of the transformation is passed appropriately, as an anonymous class, as follows:

```java
// example of inline template definition + instantiation
Template t = new StatementTemplate() {
TemplateParameter> _col_ = createVariableAccess(method.getParameters().get(0));
@Override
public void statement() {
if (_col_.S().size() > 10)
throw new OutOfBoundException();
}
}; // end of inline template
CtStatement injectedCode = t.apply();
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.