Skip to content

[EXPERIMENT] test with java 24#1534

Closed
pjfanning wants to merge 2 commits into
apache:mainfrom
pjfanning:java23
Closed

[EXPERIMENT] test with java 24#1534
pjfanning wants to merge 2 commits into
apache:mainfrom
pjfanning:java23

Conversation

@pjfanning

Copy link
Copy Markdown
Member

temporary test run but may be refactored later to run nightly

@pjfanning
pjfanning marked this pull request as draft October 15, 2024 19:12
@pjfanning

Copy link
Copy Markdown
Member Author

running into Java deprecations for methods on 'Unsafe' class

[info] compiling 208 Scala sources and 28 Java sources to /home/runner/work/pekko/pekko/actor/target/scala-2.13/classes ...
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/LightArrayRevolverScheduler.scala:373:63: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]         case x                                  => if (unsafe.compareAndSwapObject(this, taskOffset, x, replaceWith)) x else extractTask(replaceWith)
[error]                                                               ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/RepointableActorRef.scala:69:42: method getObjectVolatile in class Unsafe is deprecated (since 23)
[error]   def underlying: Cell = Unsafe.instance.getObjectVolatile(this, cellOffset).asInstanceOf[Cell]
[error]                                          ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/RepointableActorRef.scala:70:32: method getObjectVolatile in class Unsafe is deprecated (since 23)
[error]   def lookup = Unsafe.instance.getObjectVolatile(this, lookupOffset).asInstanceOf[Cell]
[error]                                ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/RepointableActorRef.scala:74:25: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]     if (Unsafe.instance.compareAndSwapObject(this, cellOffset, old, next)) old else swapCell(next)
[error]                         ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/RepointableActorRef.scala:79:25: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]     if (Unsafe.instance.compareAndSwapObject(this, lookupOffset, old, next)) old else swapLookup(next)
[error]                         ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Children.scala:41:21: method getObjectVolatile in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.getObjectVolatile(this, AbstractActorCell.childrenOffset).asInstanceOf[ChildrenContainer]
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Children.scala:68:21: method getObjectVolatile in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.getObjectVolatile(this, AbstractActorCell.functionRefsOffset).asInstanceOf[Map[String, FunctionRef]]
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Children.scala:87:28: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]       if (!Unsafe.instance.compareAndSwapObject(this, AbstractActorCell.functionRefsOffset, old, added)) rec()
[error]                            ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Children.scala:102:30: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]         if (!Unsafe.instance.compareAndSwapObject(this, AbstractActorCell.functionRefsOffset, old, removed)) rec()
[error]                              ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Children.scala:114:8: method getAndSetObject in class Unsafe is deprecated (since 23)
[error]       .getAndSetObject(this, AbstractActorCell.functionRefsOffset, Map.empty)
[error]        ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Children.scala:121:31: method getAndAddLong in class Unsafe is deprecated (since 23)
[error]     val num = Unsafe.instance.getAndAddLong(this, AbstractActorCell.nextNameOffset, 1)
[error]                               ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Children.scala:125:31: method getAndAddLong in class Unsafe is deprecated (since 23)
[error]     val num = Unsafe.instance.getAndAddLong(this, AbstractActorCell.nextNameOffset, 1)
[error]                               ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Children.scala:154:21: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.compareAndSwapObject(this, AbstractActorCell.childrenOffset, oldChildren, newChildren)
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Children.scala:187:21: method putObjectVolatile in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.putObjectVolatile(this, AbstractActorCell.childrenOffset, TerminatedChildrenContainer)
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Dispatch.scala:56:21: method getObjectVolatile in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.getObjectVolatile(this, AbstractActorCell.mailboxOffset).asInstanceOf[Mailbox]
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/actor/dungeon/Dispatch.scala:60:26: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]     if (!Unsafe.instance.compareAndSwapObject(this, AbstractActorCell.mailboxOffset, oldMailbox, newMailbox))
[error]                          ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/dispatch/AbstractDispatcher.scala:127:31: method getAndAddLong in class Unsafe is deprecated (since 23)
[error]     val old = Unsafe.instance.getAndAddLong(this, inhabitantsOffset, add)
[error]                               ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/dispatch/AbstractDispatcher.scala:139:49: method getLongVolatile in class Unsafe is deprecated (since 23)
[error]   final def inhabitants: Long = Unsafe.instance.getLongVolatile(this, inhabitantsOffset)
[error]                                                 ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/dispatch/AbstractDispatcher.scala:141:61: method getIntVolatile in class Unsafe is deprecated (since 23)
[error]   private final def shutdownSchedule: Int = Unsafe.instance.getIntVolatile(this, shutdownScheduleOffset)
[error]                                                             ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/dispatch/AbstractDispatcher.scala:143:21: method compareAndSwapInt in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.compareAndSwapInt(this, shutdownScheduleOffset, expect, update)
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/dispatch/Mailbox.scala:124:61: method getIntVolatile in class Unsafe is deprecated (since 23)
[error]   final def currentStatus: Mailbox.Status = Unsafe.instance.getIntVolatile(this, AbstractMailbox.mailboxStatusOffset)
[error]                                                             ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/dispatch/Mailbox.scala:137:21: method compareAndSwapInt in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.compareAndSwapInt(this, AbstractMailbox.mailboxStatusOffset, oldStatus, newStatus)
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/dispatch/Mailbox.scala:140:21: method putIntVolatile in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.putIntVolatile(this, AbstractMailbox.mailboxStatusOffset, newStatus)
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/dispatch/Mailbox.scala:213:23: method getObjectVolatile in class Unsafe is deprecated (since 23)
[error]       Unsafe.instance.getObjectVolatile(this, AbstractMailbox.systemMessageOffset).asInstanceOf[SystemMessage])
[error]                       ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/dispatch/Mailbox.scala:220:21: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.compareAndSwapObject(this, AbstractMailbox.systemMessageOffset, _old.head, _new.head)
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/pattern/AskSupport.scala:[553](https://github.com/apache/pekko/actions/runs/11352818502/job/31576426284#step:6:554):21: method getObjectVolatile in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.getObjectVolatile(this, watchedByOffset).asInstanceOf[Set[ActorRef]]
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/pattern/AskSupport.scala:[556](https://github.com/apache/pekko/actions/runs/11352818502/job/31576426284#step:6:557):21: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.compareAndSwapObject(this, watchedByOffset, oldWatchedBy, newWatchedBy)
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/pattern/AskSupport.scala:576:53: method getObjectVolatile in class Unsafe is deprecated (since 23)
[error]   private[this] def state: AnyRef = Unsafe.instance.getObjectVolatile(this, stateOffset)
[error]                                                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/pattern/AskSupport.scala:579:21: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.compareAndSwapObject(this, stateOffset, oldState, newState)
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/pattern/AskSupport.scala:581:72: method putObjectVolatile in class Unsafe is deprecated (since 23)
[error]   private[this] def setState(newState: AnyRef): Unit = Unsafe.instance.putObjectVolatile(this, stateOffset, newState)
[error]                                                                        ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreaker.scala:321:21: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.compareAndSwapObject(this, AbstractCircuitBreaker.stateOffset, oldState, newState)
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreaker.scala:329:21: method getObjectVolatile in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.getObjectVolatile(this, AbstractCircuitBreaker.stateOffset).asInstanceOf[State]
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreaker.scala:335:21: method compareAndSwapObject in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.compareAndSwapObject(
[error]                     ^
[error] /home/runner/work/pekko/pekko/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreaker.scala:345:21: method getObjectVolatile in class Unsafe is deprecated (since 23)
[error]     Unsafe.instance.getObjectVolatile(this, AbstractCircuitBreaker.resetTimeoutOffset).asInstanceOf[FiniteDuration]
[error]                     ^
[error] 34 errors found

@He-Pin

He-Pin commented Nov 29, 2024

Copy link
Copy Markdown
Member

We need later move to Java 11 and migrate some code to VarHandle I think, as Java 25 is coming next year, which is a LTS version.

@pjfanning

Copy link
Copy Markdown
Member Author

The biggest issue is having our builds fail if we use any deprecated code. Scala 2.13.15 upgrade is blocked for similar reasons.

@He-Pin

He-Pin commented Nov 29, 2024

Copy link
Copy Markdown
Member

How about add @nowarn("msg=deprecated") on these classes? @pjfanning , I have not setup my new mac, will try when back home.

@pjfanning

Copy link
Copy Markdown
Member Author

We have to support 3 Scala versions and the deprecation warnings are different on them. Add extra nowarn annotations and they can fix one build but break another.

@He-Pin

He-Pin commented Jan 17, 2025

Copy link
Copy Markdown
Member

I'm working on this, I think we should test the latest JDK too.

@He-Pin

He-Pin commented Jan 20, 2025

Copy link
Copy Markdown
Member

@He-Pin

He-Pin commented Jan 21, 2025

Copy link
Copy Markdown
Member

@pjfanning 3.3.5-RC3 is released.

@He-Pin

He-Pin commented Feb 15, 2025

Copy link
Copy Markdown
Member

@pjfanning how about update this pr to make it test JDK23, it should be ok now.

@He-Pin

He-Pin commented Mar 20, 2025

Copy link
Copy Markdown
Member

We can now test with JDK 24.
refs: netty/netty#14943 FYI

@pjfanning pjfanning changed the title [EXPERIMENT] test with java 23 [EXPERIMENT] test with java 24 Mar 20, 2025
@pjfanning

Copy link
Copy Markdown
Member Author

Scala 2.12.20 does not properly support Java 24

[03-20 21:46:14.741] [error] Error while emitting Future.scala
[03-20 21:46:14.741] [error] Unsupported class file major version 68
[03-20 21:46:14.941] [error] Error while reading InlineInfoAttribute from scala.Function1

@He-Pin

He-Pin commented Mar 21, 2025

Copy link
Copy Markdown
Member

@SethTisue Is there any update for next 2.12.x for JDK 24?

@mkurz

mkurz commented Mar 21, 2025

Copy link
Copy Markdown
Contributor

@SethTisue If you cut a new Scala 2.12.x release, it would be great if that would also already unlock Java 25 by upgrading asm (I hope they cut a new release soon) - so we can test early with latest ea builds already (since it's the next LTS) :

@pjfanning

pjfanning commented Mar 21, 2025

Copy link
Copy Markdown
Member Author

Scala 2.13.16 run went ok - some test failures due to TLS changes in Java 24. Some TLS protocols or cipher suites have been removed.

Scala 3.3.5 run failed with:

[03-20 21:46:39.386] [info] compiling 1 Scala source to /home/runner/work/pekko/pekko/actor/target/scala-3.3.5/CompileJdk9-classes ...
[03-20 21:46:39.395] [error] 24 is not a valid choice for -java-output-version
[03-20 21:46:39.396] [info]   scalac -help  gives more information
[03-20 21:46:39.397] [error] one error found

@SethTisue

SethTisue commented Mar 21, 2025

Copy link
Copy Markdown
Contributor

@He-Pin

He-Pin commented May 9, 2025

Copy link
Copy Markdown
Member

@pjfanning @raboof Wdyt about it, should we run a nightly test with JDK24?

@raboof

raboof commented May 9, 2025

Copy link
Copy Markdown
Member

Wdyt about it, should we run a nightly test with JDK24?

Are the failures in this branch now resolved? If so might be nice (though perhaps we should move some of those to weekly rather than nightly?)

@pjfanning

Copy link
Copy Markdown
Member Author

we also hit issues with TLS ciphers that are no longer supported

[05-09 14:43:22.654] [info]     javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
[05-09 14:43:22.654] [info]     at java.base/sun.security.ssl.HandshakeContext.<init>(HandshakeContext.java:162)
[05-09 14:43:22.654] [info]     at java.base/sun.security.ssl.ClientHandshakeContext.<init>(ClientHandshakeContext.java:103)
[05-09 14:43:22.654] [info]     at java.base/sun.security.ssl.TransportContext.kickstart(TransportContext.java:245)
[05-09 14:43:22.654] [info]     at java.base/sun.security.ssl.SSLEngineImpl.beginHandshake(SSLEngineImpl.java:104)
[05-09 14:43:22.654] [info]     at org.apache.pekko.stream.impl.io.TLSActor.setNewSessionParameters(TLSActor.scala:185)
[05-09 14:43:22.654] [info]     at org.apache.pekko.stream.impl.io.TLSActor$ChoppingBlock.chopInto(TLSActor.scala:115)
[05-09 14:43:22.654] [info]     at org.apache.pekko.stream.impl.io.TLSActor.doOutbound(TLSActor.scala:335)
[05-09 14:43:22.654] [info]     at org.apache.pekko.stream.impl.io.TLSActor.$anonfun$bidirectional$1(TLSActor.scala:247)

@pjfanning pjfanning closed this Nov 14, 2025
@pjfanning
pjfanning deleted the java23 branch November 14, 2025 16:00
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.

5 participants