amaembo / streamex

Enhancing Java Stream API
Apache License 2.0
2.18k stars 249 forks source link

package private `one.util.streamex.Joining.Accumulator` is used in public API #262

Closed uhafner closed 2 years ago

uhafner commented 2 years ago

I integrated streamex into one of my Jenkins plugins, but RevApi noticed, that the package private class one.util.streamex.Joining.Accumulator is used in your public API. So it would make sense to make the class public as well (or remove the reference.

{
  "ignore": true,
  "code": "java.class.nonPublicPartOfAPI",
  "old": "class one.util.streamex.Joining.Accumulator",
  "new": "class one.util.streamex.Joining.Accumulator",
  "justification": "ADD YOUR EXPLANATION FOR THE NECESSITY OF THIS CHANGE"
  /*  "classSimpleName": "Accumulator",
  "exampleUseChainInNewApi": "one.util.streamex.Joining.Accumulator is used as a type parameter or type variable bound on method java.util.function.Function<one.util.streamex.Joining.Accumulator, java.lang.String> one.util.streamex.Joining::finisher() (method java.util.function.Function<one.util.streamex.Joining.Accumulator, java.lang.String> one.util.streamex.Joining::finisher() is part of the API)",
  "package": "one.util.streamex",
  "classQualifiedName": "one.util.streamex.Joining.Accumulator",
  "exampleUseChainInOldApi": "one.util.streamex.Joining.Accumulator is used as a type parameter or type variable bound on method java.util.function.Function<one.util.streamex.Joining.Accumulator, java.lang.String> one.util.streamex.Joining::finisher() (method java.util.function.Function<one.util.streamex.Joining.Accumulator, java.lang.String> one.util.streamex.Joining::finisher() is part of the API)",
  "elementKind": "class",
  "oldArchive": "io.jenkins.plugins:plugin-util-api:hpi:2.17.0",
  "oldArchiveRole": "primary",
  "newArchive": "io.jenkins.plugins:plugin-util-api:hpi:2.18.0-SNAPSHOT",
  "newArchiveRole": "primary",
  "breaksVersioningRules": "true",
  */

},
amaembo commented 2 years ago

Hello! How it affects the way you code? Does it cause any practical limitations when using the library? Normally, nobody instantiates the collector accumulator bound.

uhafner commented 2 years ago

It does not affect my code, it just violates an important API rule: public members should not use package private arguments or types. So I just wanted to let you know that you should increase the visibility to avoid that other people will get warnings when they use Revapi.

I ignore the warning in my component: https://github.com/jenkinsci/plugin-util-api-plugin/blob/master/pom.xml#L276

amaembo commented 2 years ago

No, I should not increase the visibility, as this would make the implementation detail class visible which is much worse and may limit the future evolution of the library. I think that a warning from a third-party tool is not enough reason for exposing the library internals. If you know how to make this tool happy without exposing the internals, without changing existing API and without performance degradation, feel free to file a pull request. Thanks.