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();

貢獻者指南