mbien commented on code in PR #6150:
URL: https://github.com/apache/netbeans/pull/6150#discussion_r1254842641
##########
java/form/src/org/netbeans/modules/form/JavaCodeGenerator.java:
##########
@@ -2554,6 +2517,57 @@ private void generateListenerAddCode(RADComponent comp,
generateCatchCode(exceptions, codeWriter);
}
+ private void generateInnerClasses(Writer codeWriter, EventSetDescriptor
eventSetDesc,List<Event> eventList) throws IOException {
+
+ if(formModel.getSettings().getGenerateListenersAsLambda() &&
eventSetDesc.getListenerMethods().length==1) {
+ generateWithLambda(codeWriter,eventSetDesc,eventList);
+ }else{
Review Comment:
I don't think this is correct. A button for example can have multiple event
handlers for `actionPerformed`. This will only generate one and ignore all
others if there are more.
You can only generate a handler call using a method reference if:
`eventList.size() == 1 && eventSetDesc.getListenerMethods().length == 1 &&
eventList.get(0).getEventHandlers.length == 1`
If there are `>1` handlers, you would actually have to use a lambda as the
PR title promises :)
also please add spaces before `({` and after `)}` and `,` to make it
consistent to the rest of the code, thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists