You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Wencong Liu (Jira)" <ji...@apache.org> on 2023/03/30 08:30:00 UTC

[jira] [Commented] (FLINK-27007) Should the MailboxDefaultAction interface be annotated with @FunctionalInterface?

    [ https://issues.apache.org/jira/browse/FLINK-27007?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17706769#comment-17706769 ] 

Wencong Liu commented on FLINK-27007:
-------------------------------------

Currently there are many similar cases in Flink repo. If you're willing to add the annotation, I think it's better to find out all similar cases and fix it.

> Should the MailboxDefaultAction interface be annotated with @FunctionalInterface?
> ---------------------------------------------------------------------------------
>
>                 Key: FLINK-27007
>                 URL: https://issues.apache.org/jira/browse/FLINK-27007
>             Project: Flink
>          Issue Type: Improvement
>          Components: Runtime / Task
>            Reporter: Shubin Ruan
>            Priority: Major
>
> When StreamTask initializes mailboxProcessor, it passes in the MailboxDefaultAction parameter through \{this::processInput}.
> {code:java}
> this.mailboxProcessor =
>         new MailboxProcessor(
>                 this::processInput, mailbox, actionExecutor, numMailsProcessedCounter);{code}
> Since the parameter can be passed by Lambda expression, it means that MailboxDefaultAction is a functional interface, that is, there is only one unimplemented method. To increase code readability, should the MailboxDefaultAction interface be annotated with @FunctionalInterface? should the MailboxDefaultAction interface be annotated with @FunctionalInterface?
> {code:java}
> @Internal
> @FunctionalInterface
> public interface MailboxDefaultAction {
>    ...
> } {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)