New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better module api #1
Conversation
* is called by Guice. | ||
*/ | ||
fun module(configure: BinderScope.() -> Unit) = | ||
Module { binder -> BinderScope(binder).configure() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the big addition here that actually makes the API in the readme possible.
} | ||
} | ||
|
||
// Below, configure jacoco code coverage on all Junit 5 tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, all of these Jacoco changes probably should have been in a different PR. But whatever.
* See the EDSL examples at [com.google.inject.Binder]. | ||
*/ | ||
fun to(implementation: KClass<out T>): ScopedBindingBuilderScope = | ||
ScopedBindingBuilderScope(to(implementation.java)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ This is now double decorated. I should fix this.
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME | |||
distributionPath=wrapper/dists | |||
zipStoreBase=GRADLE_USER_HOME | |||
zipStorePath=wrapper/dists | |||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip | |||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, and I probably shouldn't have updated the version of gradle as a part of this PR either.
/** | ||
* See the EDSL examples at [com.google.inject.Binder]. | ||
*/ | ||
override fun annotatedWith(annotationType: Class<out Annotation>): LinkedBindingBuilder<T> = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ This should be returning LinkedBindingBuilderScope
.
/** | ||
* See the EDSL examples at [com.google.inject.Binder]. | ||
*/ | ||
fun annotatedWith(annotationType: KClass<out Annotation>): LinkedBindingBuilder<T> = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ This should be returning LinkedBindingBuilderScope
.
/** | ||
* See the EDSL examples at [com.google.inject.Binder]. | ||
*/ | ||
override fun annotatedWith(annotation: Annotation): LinkedBindingBuilder<T> = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ This should be returning LinkedBindingBuilderScope
.
The changes to the README sum up the changes pretty well.
Guice Modules
Creating a module in Java requires quite a bit of extra boilerplate.
This is the equivalent in Kotlin:
@SamCarlberg you want to take a look at this PR?