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

Java: Add Automatic-Module-Name entries to the Manifest #6568

Merged
merged 1 commit into from Aug 30, 2019
Merged

Java: Add Automatic-Module-Name entries to the Manifest #6568

merged 1 commit into from Aug 30, 2019

Conversation

ennerf
Copy link
Contributor

@ennerf ennerf commented Aug 26, 2019

This PR adds Automatic-Module-Name entries to the Manifest files. This allows Java9+ users to depend on protobuf, without having any impact for users of earlier versions.

The module names match the OSGI symbolic names as recommended in JLBP-20

This fixes #3903 and #6493

@ennerf ennerf changed the title Add Automatic-Module-Name entries to the Manifest Java: Add Automatic-Module-Name entries to the Manifest Aug 26, 2019
Copy link
Contributor

@elharo elharo left a comment

Choose a reason for hiding this comment

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

I think this one should go into the release notes.

Copy link
Contributor

@elharo elharo left a comment

Choose a reason for hiding this comment

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

As @netdpb suggested, the question here is the relation ship between the lite and regular artifacts. If both can reasonably appear in a classpath at the same time this won't work. Anyone know the distinction between these two?

Since lite is mostly for android which doesn't use Java 9+, it might make sense to drop the lite/pom.xml from this PR until we're sure.

@ennerf
Copy link
Contributor Author

ennerf commented Aug 30, 2019

At the moment the lite version is a subset of the regular artifact. Considering that both artifacts use the same package and filenames they are guaranteed to always conflict, and users should really avoid having both of them in the same project.

For example, a regular and a lite runtime with different versions may end up loading a shared class like com.google.protobuf.Utf8 that is incompatible with the other. (At the moment it looks like pretty much everything is shared because all messages extend AbstractMessageLite)

The worst case would be if a dependency transitively adds the lite-runtime, but in that case users could manually exclude it. Any generated lite-messages would still run fine against the regular runtime.

Personally, I'd actually prefer to get a compile time error rather than potentially running into obscure issues at runtime.

@elharo
Copy link
Contributor

elharo commented Aug 30, 2019

FWIW in Java 9 and later you will get a compile time error if both of these appear in the classpath.

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

Successfully merging this pull request may close these issues.

Any plans to modularize (or add Automatic-Module-Name properties to) protobuf-java?
5 participants