INRIA/spoon

add support for inline templates

Offen

#3.118 geöffnet am 22.09.2019

 (9 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Java (383 Forks)github user discovery
good first issueroadmap

Repository-Metriken

Stars
 (1.933 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 19T 11h) (49 gemergte PRs in 30 T)

Beschreibung

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

Contributor Guide