INRIA/spoon

add support for inline templates

开放

#3,118 创建于 2019年9月22日

 (9 条评论) (0 个反应) (0 位负责人)Java (383 个派生)github user discovery
good first issueroadmap

仓库指标

星标
 (1,933 个星标)
PR 合并指标
 (平均合并 19天 11小时) (30 天内合并 49 个 PR)

描述

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:

// example of inline template definition + instantiation
Template t = new StatementTemplate() {
	TemplateParameter<Collection<?>> _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();

贡献者指南