From 33c2ceaae5646fc35a41045ea7990098dbc21bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=99=8E=E9=B8=A3?= Date: Sun, 5 Jul 2026 13:45:15 +0800 Subject: [PATCH] refactor: remove deprecated scalaPartialFunction (since 1.2.0) Motivation: scalaPartialFunction was deprecated since pekko-grpc 1.2.0 as it is no longer needed since support for Scala 2.11 was dropped. Modification: Remove the deprecated scalaPartialFunction method and inline its logic into scalaAnonymousPartialFunction. Remove unused @nowarn import. Add MiMa filter for the removed method. Result: Cleaner API surface with one less deprecated method. Tests: Not run - trivial inline refactor References: None - deprecated API cleanup --- .../remove-deprecated-methods.excludes | 1 + .../org/apache/pekko/grpc/javadsl/package.scala | 14 +------------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/runtime/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes b/runtime/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes index 4645fcd5..79ff2a47 100644 --- a/runtime/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes +++ b/runtime/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes @@ -29,3 +29,4 @@ ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.grpc.javads ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.grpc.javadsl.package.javaFunction") ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.grpc.javadsl.package.japiFunction") ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.grpc.internal.ScalaServerStreamingRequestBuilder.this") +ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.grpc.javadsl.package.scalaPartialFunction") diff --git a/runtime/src/main/scala/org/apache/pekko/grpc/javadsl/package.scala b/runtime/src/main/scala/org/apache/pekko/grpc/javadsl/package.scala index 379ed6ca..4f762db4 100644 --- a/runtime/src/main/scala/org/apache/pekko/grpc/javadsl/package.scala +++ b/runtime/src/main/scala/org/apache/pekko/grpc/javadsl/package.scala @@ -13,27 +13,15 @@ package org.apache.pekko.grpc -import scala.annotation.nowarn - import org.apache.pekko package object javadsl { - /** - * Helper for creating Scala partial functions from [[pekko.japi.function.Function]] - * instances. - */ - @deprecated("no longer needed since support for Scala 2.11 has been dropped", "1.2.0") - def scalaPartialFunction[A, B](f: pekko.japi.function.Function[A, B]): PartialFunction[A, B] = { - case a => f(a) - } - /** * Helper for creating Scala anonymous partial functions from [[pekko.japi.function.Function]] * instances. */ - @nowarn("msg=deprecated") def scalaAnonymousPartialFunction[A, B, C]( f: pekko.japi.function.Function[A, pekko.japi.function.Function[B, C]]): A => PartialFunction[B, C] = - a => scalaPartialFunction(f(a)) + a => { case b => f(a)(b) } }