Skip to content
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

Util functions are exposed, which - can they be marked as 'internal'? #1146

Open
aSemy opened this issue Oct 3, 2022 · 0 comments
Open

Util functions are exposed, which - can they be marked as 'internal'? #1146

aSemy opened this issue Oct 3, 2022 · 0 comments

Comments

@aSemy
Copy link
Contributor

aSemy commented Oct 3, 2022

Is your feature request related to a problem? Please describe.

gradle-intellij-plugin has a number of util methods and classes that are all exposed as public.

https://github.com/JetBrains/gradle-intellij-plugin/blob/41e090367cceb9b7623e31feb604bd6c382e9352/src/main/kotlin/org/jetbrains/intellij/utils.kt

This means that when gradle-intellij-plugin is applied, these functions are made available in the build script. If gradle-intellij-plugin is imported in buildSrc/build.gradle.kts, then the util functions are available in all build scripts, even if gradle-intellij-plugin isn't applied.

This has some drawbacks

  • In projects that use gradle-intellij-plugin, IntelliJ must to do more work to index these functions, degrading performance (which is already pretty poor when it comes to Gradle scripts)
  • Autocomplete contains irrelevant functions
  • Marking them as internal would reduce the API footprint of gradle-intellij-plugin, reducing the amount of code that needs to be supported

Looking at the utils, most are very specific, so don't need to be exposed.

https://github.com/JetBrains/gradle-intellij-plugin/blob/41e090367cceb9b7623e31feb604bd6c382e9352/src/main/kotlin/org/jetbrains/intellij/utils/DependenciesDownloader.kt

Others are extension functions of Any, so they are always available - I think it's better if extension functions are kept targeted to a specific type, or limited in availability, to avoid pollution of functions.

https://github.com/JetBrains/gradle-intellij-plugin/blob/41e090367cceb9b7623e31feb604bd6c382e9352/src/main/kotlin/org/jetbrains/intellij/utils.kt#L263-L268

Describe the solution you'd like

All util methods are marked as 'internal'

Describe alternatives you've considered

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant