INRIA/spoon

add support for inline templates

オープン

#3,118 opened on 2019/09/22

 (9 件のコメント) (0 件のリアクション) (0 人の担当者)Java (383 件のフォーク)github user discovery
good first issueroadmap

Repository metrics

Stars
 (1,933 個のスター)
PR merge metrics
 (平均マージ 19d 11h) (30d で 49 merged PRs)

説明

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

コントリビューターガイド