The GitHub Actions job "Binary Compatibility" on pekko.git/java-1.7 has failed.
Run started by GitHub user pjfanning (triggered by pjfanning).

Head commit for run:
df8cd97d2228521d145499ebb3f94515919a9e6c / PJ Fanning 
<[email protected]>
fix: make AbstractPersistentActorWithTimers and AbstractFSMWithStash 
subclassable from Java on Scala 3 (#3475)

* fix: make AbstractPersistentActorWithTimers and AbstractFSMWithStash 
subclassable from Java on Scala 3

Motivation:
Extending `AbstractPersistentActorWithTimers` from Java fails to compile against
the Scala 3 artifacts:

    class TestActor inherits unrelated defaults for
    aroundPreRestart(Throwable,Option<Object>) from types Timers and 
Eventsourced

Both `Timers` and `Eventsourced` implement `aroundReceive`, `aroundPreRestart`
and `aroundPostStop`. Scala 3 does emit the mixin forwarder into the class, but
flags it `ACC_BRIDGE, ACC_SYNTHETIC`; javac ignores synthetic and bridge members
when resolving inherited members, so it falls back to the two interface defaults
and rejects the subclass. Scala 2.13 emits the same forwarder without those
flags, which is why the 2.12/2.13 artifacts work.

A javac probe over every Java-facing `Abstract*` class that mixes in more than
one trait found one other class with the same defect: `AbstractFSMWithStash`,
where `FSM` and `UnrestrictedStash` both implement `postStop`.

Modification:
Give both classes real (non-synthetic) overrides of the conflicting members that
just delegate to `super`, which resolves exactly like the forwarders they
replace. `AbstractFSMWithStash.postStop` deliberately carries no
`@throws(classOf[Exception])`, since `FSM.postStop` declares no checked
exceptions and a wider throws clause is not a valid override for javac.

Add Java sources exercising both classes so the Scala 3 build fails if this
regresses.

Result:
Java subclasses of `AbstractPersistentActorWithTimers` and
`AbstractFSMWithStash` compile against the Scala 3 artifacts. No other
Java-facing multi-trait base class in the build is affected.

Tests:
- sbt "++3.3.8" "persistence/testOnly 
org.apache.pekko.persistence.TimerPersistentActorSpec" - 5 succeeded, 0 failed
- sbt "++3.3.8" "actor-tests/testOnly 
org.apache.pekko.actor.AbstractFSMWithStashActorTest 
org.apache.pekko.actor.AbstractFSMActorTest" - 2 succeeded, 0 failed
- sbt "persistence/testOnly 
org.apache.pekko.persistence.TimerPersistentActorSpec" - 5 succeeded, 0 failed
- sbt "actor-tests/testOnly 
org.apache.pekko.actor.AbstractFSMWithStashActorTest 
org.apache.pekko.actor.AbstractFSMActorTest" - 2 succeeded, 0 failed
- sbt headerCreateAll javafmtAll scalafmtAll scalafmtSbt (JDK 17) - no churn 
outside the changed files
- sbt +mimaReportBinaryIssues - Not run, left to CI Binary Compatibility job

References:
Fixes #3474

* compile checks

* fix: mark deprecated PersistentFSM compile guard as deprecated for -Werror

Report URL: https://github.com/apache/pekko/actions/runs/33070045874

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to