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

[EXPERIMENT] test with java 23 #1534

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

Conversation

pjfanning
Copy link
Contributor

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
Contributor 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
Copy link
Member

He-Pin commented Nov 29, 2024

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
Contributor 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
Copy link
Member

He-Pin commented Nov 29, 2024

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
Contributor 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.

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.

2 participants