Community
Participate
Working Groups
I would find extremely useful if JDT provided some code templates for some Java 8 features. Above all, a lambda code template, that allows you to type zero or more parameters (having it be context sensitive would be great!) and automatically adds the necessary structure, i.e.: () -> { }. Here are some examples (which however seem not to be context sensitive): https://github.com/Tasktop/eclipse-templates As an example, let Validator be javax.faces.validator.Validator, with its functional method be javax.faces.validator.Validator.validate(FacesContext, UIComponent, Object): public class MyClass { private Validator myValidator = lamb| <= invoke code assist here } let "lambda" be the code template name, the completion could be: public class MyClass { private Validator myValidator = (context, component, value) -> { | <= cursor here } }
See also bug 513688.
Thank you! (In reply to Dani Megert from comment #1) > See also bug 513688. Thank you! I don't understand why I could not find it, I made multiple attempts to find one... Any way, this might be useful to track also other Java 8 templates (like ones for Optional creation/consumption, for instance...).
(In reply to Mauro Molinari from comment #2) > Any way, this might be useful to track also other Java 8 templates (like > ones for Optional creation/consumption, for instance...). Would you like to suggest and/or contribute such templates to JDT?