INRIA/spoon

add support for inline templates

Ouverte

#3 118 ouverte le 22 sept. 2019

 (9 commentaires) (0 réaction) (0 personne assignée)Java (383 forks)github user discovery
good first issueroadmap

Métriques du dépôt

Stars
 (1 933 étoiles)
Métriques de merge PR
 (Merge moyen 19j 11h) (49 PRs mergées en 30 j)

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:

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

Guide contributeur