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

use Pekko JavaConverter #403

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

pjfanning
Copy link
Contributor

@pjfanning pjfanning commented Nov 3, 2024

  • just updated the 'runtime' module
  • other modules don't necessarily have a dependency on pekko-actor module so can't use Pekko JavaConverter unless we add a dependency - I'd prefer not to do this

@pjfanning pjfanning force-pushed the scala-converter branch 2 times, most recently from 3a84211 to 59b2a09 Compare November 3, 2024 12:47
@raboof
Copy link
Member

raboof commented Nov 3, 2024

IIRC think the only reason org.apache.pekko.util.ccompat existed was because back then scala-collection-compat did not yet promise binary compatibility, so we didn't dare to add it as a dependency, but did want the functionality (https://github.com/apache/pekko/blob/main/actor/src/main/scala-2.13%2B/org/apache/pekko/util/ccompat/package.scala#L27-L29). Now that scala-collection-compat has stabilized, wouldn't it be better to use scala-collection-compat instead of org.apache.pekko.util.ccompat? Perhaps we should even do that in Pekko...

@pjfanning
Copy link
Contributor Author

There is also the issue of having the jar dependency. I don't think we can add a jar dependency like scala-collection-compat in a patch release but we could do it in a minor release.

The plus side to this PR is to avoid using deprecated classes in scala-library jar.

@raboof
Copy link
Member

raboof commented Nov 3, 2024

There is also the issue of having the jar dependency. I don't think we can add a jar dependency like scala-collection-compat in a patch release but we could do it in a minor release.

I'm not sure we can't do it in a patch release but I have no problems having the next release be a minor release. I think I'd prefer adding a dependency on scala-collection-compat over adding a dependency on Pekko code marked 'internal API' - ideally we should be able to eventually replace it there as well.

@mdedetrich
Copy link
Contributor

mdedetrich commented Nov 3, 2024

IIRC think the only reason org.apache.pekko.util.ccompat existed was because back then scala-collection-compat did not yet promise binary compatibility, so we didn't dare to add it as a dependency, but did want the functionality (https://github.com/apache/pekko/blob/main/actor/src/main/scala-2.13%2B/org/apache/pekko/util/ccompat/package.scala#L27-L29). Now that scala-collection-compat has stabilized, wouldn't it be better to use scala-collection-compat instead of org.apache.pekko.util.ccompat? Perhaps we should even do that in Pekko...

Another thing that is going on is the inliner is taking advantage of the source being manually there and hence its inlining the differences away, albeit I don't know whether this is actually creating a performance improvement or not as JDK might be inlining all hotspots anyways.

There are also a couple of cases of some subtles differences to scala-collection-compat but I can't remember it on the top of my head, I can search for them if requested.

Obviously if we want to be ultra safe it makes sense to leave it as is, at least until 2.12 is dropped. Slick is also manually including the source for 2.12 for its own reasons.

@pjfanning
Copy link
Contributor Author

I'm neutral about this PR. We have used the Pekko JavaConverter in most of our modules and this is probably one of the few exceptions. I would prefer to use to the existing deprecated Scala JavaConverter than to introduce a dependency on scala-collection-compat.

@@ -27,6 +27,7 @@ import protocbridge.{ JvmGenerator, ProtocRunner, Target }
import scalapb.ScalaPbCodeGenerator

import scala.beans.BeanProperty
import scala.collection.JavaConverters._
Copy link
Contributor

Choose a reason for hiding this comment

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

Were you meant to change this to import org.apache.pekko.util.ccompat.JavaConverters._?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this module, that class is not found. I guess I could look into changing the build for this module to add a dependency on the pekko-actor lib.

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've repurposed this PR to only update the 'runtime' module

Update VersionSyncCheckPlugin.scala

revert

Update JavaCodeGenerator.scala

revert

more changes

Update ServerReflectionImpl.scala

revert more

reorder imports

more changes

Update ProtocSpec.scala

revert some changes
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