You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jetlang contains a few widely-used interfaces which contain a single abstract method with no method-level type parameters. These are therefore "functional interfaces", and can be implemented with lambda expressions and method references. The primary example would be Publisher, but Filter, Callback, and Converter are others. In my code, all of these are often implemented by lambdas and method references, probably even a majority of the time.
Java has an annotation, @FunctionalInterface, to mark functional interfaces. It's purely a marker annotation, and has no functional consequences, so these interfaces are just as usable without it as with it.
With one substantial exception: IntelliJ will only consider an interface as the target of an Extract Functional Parameter or Extract Functional Variable refactoring if it is annotated with @FunctionalInterface! I lean very heavily on IntelliJ's refactorings, including that one, and when i'm doing Jetlang plumbing, it's a definite drag not to be able to quickly extract something into a Publisher or whatever.
Jetlang contains a few widely-used interfaces which contain a single abstract method with no method-level type parameters. These are therefore "functional interfaces", and can be implemented with lambda expressions and method references. The primary example would be Publisher, but Filter, Callback, and Converter are others. In my code, all of these are often implemented by lambdas and method references, probably even a majority of the time.
Java has an annotation, @FunctionalInterface, to mark functional interfaces. It's purely a marker annotation, and has no functional consequences, so these interfaces are just as usable without it as with it.
With one substantial exception: IntelliJ will only consider an interface as the target of an Extract Functional Parameter or Extract Functional Variable refactoring if it is annotated with @FunctionalInterface! I lean very heavily on IntelliJ's refactorings, including that one, and when i'm doing Jetlang plumbing, it's a definite drag not to be able to quickly extract something into a Publisher or whatever.
So, could we add @FunctionalInterface to functional interfaces where possible?
I'm happy to submit a PR to that if so.
The text was updated successfully, but these errors were encountered: