infinispan / infinispan/protostream

org.infinispan.protostream.core package exports are overly restrictive

Open
#722 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
56
Forks
39
Avg merge
5h 36m
Merged PRs (30d)
5

Description

The org.infinispan.protostream.core module only exports its org.infinispan.protostream.impl package to specific modules.
Consequently, when using JPMS, we need to manually add the flag:
```
--add-exports org.infinispan.protostream.core/org.infinispan.protostream.impl=org.wildfly.clustering.marshalling.protostream
```
during compiling of this module, as well as any runtime using org.wildfly.clustering.marshalling.protostream.

wildfly-clustering currently uses the following classes from this package:

* TagWriterImpl
* We rely on TagWriterImpl.newInstance(ImmutableSerializationContext) and TagWriterImpl.newInstance(ImmutableSerializationContext, OutputStream) static factory methods
* We rely on TagWriterImpl.getWrittenBytes() for buffer size calculations. We do use ProtobufUtil.computeSize(...) utility methods since they assume the use of WrappedMessage.
* TagReaderImpl
* We rely on the TagReaderImpl.newInstance(ImmutableSerializationContext, InputStream, int) static factory method

Possible solutions:
1. Relocate static factory methods for TagReaderImpl and TagWriterImpl to classes/interfaces within one of the exported packages (as well add the TagWriterImpl.getWrittenBytes() method to the TagWriter interface (or a sub-interface).
2. Export the org.infinispan.protostream.impl package to the org.wildfly.clustering.marshalling.protostream module
3. Export the org.infinispan.protostream.impl package to all modules

Contributor guide

Open the contributing guide

Research direction

Start by inspecting the module exports for org.infinispan.protostream.core and the usages of TagWriterImpl and TagReaderImpl described in the issue. Compare the three proposed export or API-relocation approaches, then verify JPMS compilation and runtime use of org.wildfly.clustering.marshalling.protostream without the manual --add-exports flag.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.