Skip to content

Commit

Permalink
Annotate Module explicitly as @FunctionalInterface.
Browse files Browse the repository at this point in the history
`Module` is implicitly a `@FunctionalInterface` already. That is very convenient, as it allows to express

```
methodThatTakesAModule(
    new AbstractModule(){
      @OverRide
      protected void configure() {
        bind(Foo.class).annotatedWith(Bar.class).toInstance(barredFoo);
      }
    }
);
```

as

```
methodThatTakesAModule(binder -> binder.bind(Foo.class).annotatedWith(Bar.class).toInstance(barredFoo));
```

PiperOrigin-RevId: 544058444
  • Loading branch information
pawelz authored and Guice Team committed Jun 28, 2023
1 parent ec227cc commit ee93362
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions core/src/com/google/inject/Module.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* all methods annotated with {@literal @}{@link Provides}. Use scope and binding annotations on
* these methods to configure the bindings.
*/
@FunctionalInterface
public interface Module {

/**
Expand Down

0 comments on commit ee93362

Please sign in to comment.