-
Notifications
You must be signed in to change notification settings - Fork 415
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
Enable explicit API mode #3139
Enable explicit API mode #3139
Conversation
val projectsWithoutOptInDependency = setOf( | ||
":integration-tests", ":integration-tests:gradle", ":integration-tests:maven", ":integration-tests:cli") | ||
kotlin { | ||
explicitApi = ExplicitApiMode.Strict |
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.
If explicitApi
was set in tasks.withType<KotlinCompile>()
, it would be applied to the test sources as well, which we don't want. But setting it in kotlin {}
fixes it, so I did that and moved other compiler arguments into it as well.
fun ContentMatcherBuilder<*>.list(block: ContentMatcherBuilder<ContentList>.() -> Unit) = composite(block) | ||
public fun ContentMatcherBuilder<*>.list(block: ContentMatcherBuilder<ContentList>.() -> Unit) { | ||
composite(block) | ||
} |
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.
Instead of specifying the : Unit
return type, I converted void functions to block bodies. Didn't think it would lead to so many changes lines, sorry if it makes it difficult to review :(
c2ffa20
to
8d7e77a
Compare
Rebased the branch onto |
8d7e77a
to
c384eac
Compare
Had to rebase and force push again after #3149, there were too many conflicts |
Language settings weren't applied to the integrationTest module before by mistake, but now they are, so assertContains is not available
Depends on #3138, will rebase onto master once it gets merged.
This PR enables explicit API mode, which adds compiler checks for explicit visibility modifiers and return types.
You can see by the changes in the
.api
files that I changed some of the return types - I believe they were inferred incorrectly, as in most cases the supertype was deduced instead of the interface / base type. Other than that, I think everything should be fine in terms of backward compatibility.Additionally, because visibility modifiers and return types made the lines longer, I did some small reformatting along the way, mostly adding line breaks or converting functions to block bodies.