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

Specify Automatic-Module-Name for kotlinx-coroutines-core #4320

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

fzhinkin
Copy link
Contributor

@fzhinkin fzhinkin commented Jan 3, 2025

Open questions are:

  • The proper module name. Perhaps, kotlinx.coroutines.core.metadata will be better.
  • Should we continue suggesting to use kotlinx-coroutines-core dependency in the readme file? I don't see any immediate benefits, but I see a downside: -core dependency adds an extra dep resolution step.

Fixes #3842

@fzhinkin fzhinkin requested a review from dkhalanskyjb January 3, 2025 22:06
@JakeWharton
Copy link
Contributor

The proper module name.

Definitely would vote for "common" or "metadata" over "trampoline".

Copy link
Collaborator

@dkhalanskyjb dkhalanskyjb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm that the reproducer provided at #3842 no longer has the described issue after these changes.

My understanding of Java modules is surface-level, so please double-check my understanding. Right now, both kotlinx-coroutines-core and kotlinx-coroutines-core-jvm have the Java module name name kotlinx.coroutines.core; core-jvm specifies it explicitly, and -core just gets it automatically. If someone depends on core, they also depend on core-jvm, so any mentions of kotlinx.coroutines.core in Java module specifications will now correctly resolve to core-jvm (and not to both), but in addition to that, kotlinx.coroutines.core.trampoline will refer to a module containing nothing of use, so no one has any reason to write kotlinx.coroutines.core.trampoline in their code, ever. Right?

If so, the name I'd prefer would be scary and highlight the uselessness of the module. Something like kotlinx.coroutines.core.artifact_disambiguating_module.

kotlinx-coroutines-core/build.gradle.kts Outdated Show resolved Hide resolved
@@ -85,7 +85,7 @@ Add dependencies (you can also add other modules that you need):
```xml
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core</artifactId>
<artifactId>kotlinx-coroutines-core-jvm</artifactId>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, -jvm is visual noise in this case and doesn't actually mean anything. Of course it's JVM, we're mentioning a Kotlin project in a Maven file. I understand that there's an extra dependency resolution step, but does it have any non-negligible effect?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that there's an extra dependency resolution step, but does it have any non-negligible effect?

Just trying to make the world better by saving ~130KB of networking traffic for each resolution when the artifact is not cached locally yet. :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, you're also adding 4 bytes to every load of the README file or the title page of kotlinx.coroutines; also, 4 bytes are going to be added to every version of README.md in the git repository starting from this PR (to be fair, those blob objects are compressed, so this is less critical).

@fzhinkin
Copy link
Contributor Author

fzhinkin commented Jan 7, 2025

@dkhalanskyjb,

My understanding [...] Right?

Yes, you're absolutely correct.

If so, the name I'd prefer would be scary and highlight the uselessness of the module. Something like kotlinx.coroutines.core.artifact_disambiguating_module.

That'd work for me.

@@ -85,7 +85,7 @@ Add dependencies (you can also add other modules that you need):
```xml
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core</artifactId>
<artifactId>kotlinx-coroutines-core-jvm</artifactId>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, you're also adding 4 bytes to every load of the README file or the title page of kotlinx.coroutines; also, 4 bytes are going to be added to every version of README.md in the git repository starting from this PR (to be fair, those blob objects are compressed, so this is less critical).

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

Successfully merging this pull request may close these issues.

3 participants