diff --git a/.github/workflows/binary-compatibility-checks.yml b/.github/workflows/binary-compatibility-checks.yml index 6d5ed8c930f..37369cd0b95 100644 --- a/.github/workflows/binary-compatibility-checks.yml +++ b/.github/workflows/binary-compatibility-checks.yml @@ -37,7 +37,7 @@ jobs: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: 0 @@ -50,7 +50,7 @@ jobs: java-version: 17 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 diff --git a/.github/workflows/build-test-prValidation.yml b/.github/workflows/build-test-prValidation.yml index ec29951ff94..2e7dfe03d74 100644 --- a/.github/workflows/build-test-prValidation.yml +++ b/.github/workflows/build-test-prValidation.yml @@ -26,7 +26,7 @@ jobs: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves fetch-depth: 0 @@ -43,7 +43,7 @@ jobs: java-version: 17 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Code style check run: |- @@ -51,7 +51,7 @@ jobs: sbt \ -Dsbt.override.build.repos=false \ -Dsbt.log.noformat=false \ - checkCodeStyle + javafmtCheckAll pull-request-validation: name: Check / Tests runs-on: ubuntu-22.04 @@ -62,7 +62,7 @@ jobs: scalaVersion: ["2.13.x", "3.3.x"] steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves fetch-depth: 0 @@ -76,7 +76,7 @@ jobs: java-version: 17 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 @@ -126,7 +126,7 @@ jobs: - cluster/test distributed-data/test cluster-tools/test cluster-metrics/test steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves fetch-depth: 0 @@ -140,7 +140,7 @@ jobs: java-version: 17 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 @@ -164,13 +164,13 @@ jobs: clean ${{ matrix.command }} jdk-21-extra-tests: - name: Java 21 Extra Tests + name: Java 21 Extra Tests (including all tests that need Java 9+) runs-on: ubuntu-22.04 env: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves fetch-depth: 0 @@ -184,7 +184,7 @@ jobs: java-version: 21 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 @@ -192,7 +192,7 @@ jobs: - name: Enable jvm-opts run: cp .jvmopts-ci .jvmopts - - name: sbt TestJdk21/test + - name: sbt TestJdk9/test run: |- sbt \ -Dpekko.mima.enabled=false \ @@ -206,4 +206,4 @@ jobs: -Dsbt.log.noformat=false \ -Dpekko.log.timestamps=true \ -Dio.netty.leakDetection.level=PARANOID \ - TestJdk21/test + TestJdk9/test diff --git a/.github/workflows/dependency-graph.yml b/.github/workflows/dependency-graph.yml index 08ccece6a7f..ae8d1a33c34 100644 --- a/.github/workflows/dependency-graph.yml +++ b/.github/workflows/dependency-graph.yml @@ -33,12 +33,12 @@ jobs: # to submit dependencies contents: write steps: - - uses: actions/checkout@v6.0.3 + - uses: actions/checkout@v6.0.2 with: persist-credentials: false - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 - - uses: scalacenter/sbt-dependency-submission@d84eef4c09e633bcf5f113bcad7fd5e9af1baee9 # v3.1.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 + - uses: scalacenter/sbt-dependency-submission@1cc96a7038ea2b014c200c1dae3a0cc92293b91d # v3.1.1 with: - configs-ignore: provided optional test TestJdk21 compile-internal runtime-internal pr-validation multi-jvm scala-tool scala-doc-tool + configs-ignore: provided optional test TestJdk9 compile-internal runtime-internal pr-validation multi-jvm scala-tool scala-doc-tool modules-ignore: pekko-bench-jmh_2.13 pekko-docs_2.13 pekko-bench-jmh_3 pekko-docs_3 diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index bc61de72697..fa81c28fc3e 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout current branch (full) - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 persist-credentials: false diff --git a/.github/workflows/generate-doc-check.yml b/.github/workflows/generate-doc-check.yml index 9c9d6990adc..cde680be983 100644 --- a/.github/workflows/generate-doc-check.yml +++ b/.github/workflows/generate-doc-check.yml @@ -30,7 +30,7 @@ jobs: if: github.repository == 'apache/pekko' steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -43,7 +43,7 @@ jobs: java-version: 17 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 @@ -55,4 +55,4 @@ jobs: - name: Compile testClass&docs for all Scala versions env: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} - run: sbt ";+TestJdk21 / compile ; +compile:doc" + run: sbt ";+TestJdk9 / compile ; +compile:doc" diff --git a/.github/workflows/headers.yml b/.github/workflows/headers.yml index cbf543b5c97..f1ef9ffc3d8 100644 --- a/.github/workflows/headers.yml +++ b/.github/workflows/headers.yml @@ -28,7 +28,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: persist-credentials: false @@ -39,7 +39,7 @@ jobs: java-version: 17 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 diff --git a/.github/workflows/link-validator.yml b/.github/workflows/link-validator.yml index 93742fcd332..84632809065 100644 --- a/.github/workflows/link-validator.yml +++ b/.github/workflows/link-validator.yml @@ -21,7 +21,7 @@ jobs: if: github.repository == 'apache/pekko' steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: persist-credentials: false @@ -38,7 +38,7 @@ jobs: java-version: 17 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 diff --git a/.github/workflows/nightly-1.0-builds.yml b/.github/workflows/nightly-1.0-builds.yml index 3c80dd9854a..d3b290d3088 100644 --- a/.github/workflows/nightly-1.0-builds.yml +++ b/.github/workflows/nightly-1.0-builds.yml @@ -21,7 +21,7 @@ jobs: if: github.repository == 'apache/pekko' steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -35,7 +35,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 @@ -75,7 +75,7 @@ jobs: - cluster-typed/test cluster-sharding-typed/test steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves fetch-depth: 0 @@ -90,7 +90,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 @@ -127,7 +127,7 @@ jobs: javaVersion: [8, 11, 17, 21] steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -141,7 +141,7 @@ jobs: java-version: ${{ matrix.javaVersion }} - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 diff --git a/.github/workflows/nightly-1.1-builds.yml b/.github/workflows/nightly-1.1-builds.yml index 18d7cca69c6..2f06abe6fa5 100644 --- a/.github/workflows/nightly-1.1-builds.yml +++ b/.github/workflows/nightly-1.1-builds.yml @@ -21,7 +21,7 @@ jobs: if: github.repository == 'apache/pekko' steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -35,7 +35,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 @@ -76,7 +76,7 @@ jobs: - cluster-typed/test cluster-sharding-typed/test steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves fetch-depth: 0 @@ -91,7 +91,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 @@ -129,7 +129,7 @@ jobs: javaVersion: [8, 11, 17, 21] steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -143,7 +143,7 @@ jobs: java-version: ${{ matrix.javaVersion }} - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 diff --git a/.github/workflows/nightly-1.2-builds.yml b/.github/workflows/nightly-1.2-builds.yml index e7ddba82ad4..ee9459cee2b 100644 --- a/.github/workflows/nightly-1.2-builds.yml +++ b/.github/workflows/nightly-1.2-builds.yml @@ -21,7 +21,7 @@ jobs: if: github.repository == 'apache/pekko' steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -35,7 +35,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 @@ -76,7 +76,7 @@ jobs: - cluster-typed/test cluster-sharding-typed/test steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves fetch-depth: 0 @@ -91,7 +91,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 @@ -129,7 +129,7 @@ jobs: javaVersion: [8, 11, 17, 21] steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -143,7 +143,7 @@ jobs: java-version: ${{ matrix.javaVersion }} - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 diff --git a/.github/workflows/nightly-1.3-builds.yml b/.github/workflows/nightly-1.3-builds.yml index 5fef32a34b6..278ac44ce07 100644 --- a/.github/workflows/nightly-1.3-builds.yml +++ b/.github/workflows/nightly-1.3-builds.yml @@ -20,7 +20,7 @@ jobs: if: github.repository == 'apache/pekko' steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -34,7 +34,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1 @@ -75,7 +75,7 @@ jobs: - cluster-typed/test cluster-sharding-typed/test steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves fetch-depth: 0 @@ -90,7 +90,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1 @@ -131,7 +131,7 @@ jobs: javaVersion: 25 steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -145,7 +145,7 @@ jobs: java-version: ${{ matrix.javaVersion }} - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1 diff --git a/.github/workflows/nightly-1.4-builds.yml b/.github/workflows/nightly-1.4-builds.yml index 8d6d2ccb91e..66368ce39eb 100644 --- a/.github/workflows/nightly-1.4-builds.yml +++ b/.github/workflows/nightly-1.4-builds.yml @@ -20,7 +20,7 @@ jobs: if: github.repository == 'apache/pekko' steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -34,7 +34,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1 @@ -75,7 +75,7 @@ jobs: - cluster-typed/test cluster-sharding-typed/test steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves fetch-depth: 0 @@ -90,7 +90,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1 @@ -131,7 +131,7 @@ jobs: javaVersion: 25 steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -145,7 +145,7 @@ jobs: java-version: ${{ matrix.javaVersion }} - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1 diff --git a/.github/workflows/nightly-1.5-builds.yml b/.github/workflows/nightly-1.5-builds.yml index a5737ee157d..021cdc3d9dc 100644 --- a/.github/workflows/nightly-1.5-builds.yml +++ b/.github/workflows/nightly-1.5-builds.yml @@ -20,7 +20,7 @@ jobs: if: github.repository == 'apache/pekko' steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -34,7 +34,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1 @@ -75,7 +75,7 @@ jobs: - cluster-typed/test cluster-sharding-typed/test steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves fetch-depth: 0 @@ -90,7 +90,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1 @@ -128,7 +128,7 @@ jobs: javaVersion: [8, 11, 17, 21, 25] steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -142,7 +142,7 @@ jobs: java-version: ${{ matrix.javaVersion }} - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1 diff --git a/.github/workflows/nightly-1.6-builds.yml b/.github/workflows/nightly-1.6-builds.yml index a05f0c62b3e..84e500c597f 100644 --- a/.github/workflows/nightly-1.6-builds.yml +++ b/.github/workflows/nightly-1.6-builds.yml @@ -20,7 +20,7 @@ jobs: if: github.repository == 'apache/pekko' steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -34,7 +34,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1 @@ -75,7 +75,7 @@ jobs: - cluster-typed/test cluster-sharding-typed/test steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves fetch-depth: 0 @@ -90,7 +90,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1 @@ -128,7 +128,7 @@ jobs: javaVersion: [8, 11, 17, 21, 25] steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -142,7 +142,7 @@ jobs: java-version: ${{ matrix.javaVersion }} - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1 diff --git a/.github/workflows/nightly-1.7-builds.yml b/.github/workflows/nightly-1.7-builds.yml index 455a732b7f3..4b98742489a 100644 --- a/.github/workflows/nightly-1.7-builds.yml +++ b/.github/workflows/nightly-1.7-builds.yml @@ -22,7 +22,7 @@ jobs: if: github.repository == 'apache/pekko' steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -36,7 +36,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1 @@ -77,7 +77,7 @@ jobs: - cluster-typed/test cluster-sharding-typed/test steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves fetch-depth: 0 @@ -92,7 +92,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1 @@ -130,7 +130,7 @@ jobs: javaVersion: [8, 11, 17, 21, 25] steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -144,7 +144,7 @@ jobs: java-version: ${{ matrix.javaVersion }} - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1 diff --git a/.github/workflows/nightly-builds-aeron.yml b/.github/workflows/nightly-builds-aeron.yml index 223f388eab0..eb6dedf5bd6 100644 --- a/.github/workflows/nightly-builds-aeron.yml +++ b/.github/workflows/nightly-builds-aeron.yml @@ -29,7 +29,7 @@ jobs: - cluster/test cluster-typed/test steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves fetch-depth: 0 @@ -43,7 +43,7 @@ jobs: java-version: 17 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 diff --git a/.github/workflows/nightly-builds.yml b/.github/workflows/nightly-builds.yml index a84be76fdbd..fd57545ccbb 100644 --- a/.github/workflows/nightly-builds.yml +++ b/.github/workflows/nightly-builds.yml @@ -14,7 +14,7 @@ jobs: if: github.repository == 'apache/pekko' steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -27,7 +27,7 @@ jobs: java-version: 17 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 @@ -68,7 +68,7 @@ jobs: - cluster-typed/test cluster-sharding-typed/test steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves fetch-depth: 0 @@ -82,7 +82,7 @@ jobs: java-version: 17 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 @@ -122,7 +122,7 @@ jobs: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -135,7 +135,7 @@ jobs: java-version: ${{ matrix.javaVersion }} - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 diff --git a/.github/workflows/publish-1.0-docs.yml b/.github/workflows/publish-1.0-docs.yml index adbda6aee33..40911a0b0d4 100644 --- a/.github/workflows/publish-1.0-docs.yml +++ b/.github/workflows/publish-1.0-docs.yml @@ -33,7 +33,7 @@ jobs: steps: # TODO we will need to change to use a release tag in future - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -47,7 +47,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 diff --git a/.github/workflows/publish-1.0-nightly.yml b/.github/workflows/publish-1.0-nightly.yml index 603d1a8ef6f..dc9477cd7e5 100644 --- a/.github/workflows/publish-1.0-nightly.yml +++ b/.github/workflows/publish-1.0-nightly.yml @@ -35,7 +35,7 @@ jobs: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -49,7 +49,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 diff --git a/.github/workflows/publish-1.1-docs.yml b/.github/workflows/publish-1.1-docs.yml index 9249d53ad5c..3549d9094a3 100644 --- a/.github/workflows/publish-1.1-docs.yml +++ b/.github/workflows/publish-1.1-docs.yml @@ -33,7 +33,7 @@ jobs: steps: # TODO we will need to change to use a release tag in future - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -47,7 +47,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 diff --git a/.github/workflows/publish-1.1-nightly.yml b/.github/workflows/publish-1.1-nightly.yml index 74bef670dd2..a9a28f68b34 100644 --- a/.github/workflows/publish-1.1-nightly.yml +++ b/.github/workflows/publish-1.1-nightly.yml @@ -35,7 +35,7 @@ jobs: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -49,7 +49,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 diff --git a/.github/workflows/publish-1.2-docs.yml b/.github/workflows/publish-1.2-docs.yml index c7ece3d93e7..a37efe12918 100644 --- a/.github/workflows/publish-1.2-docs.yml +++ b/.github/workflows/publish-1.2-docs.yml @@ -33,7 +33,7 @@ jobs: steps: # TODO we will need to change to use a release tag in future - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -47,7 +47,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 diff --git a/.github/workflows/publish-1.2-nightly.yml b/.github/workflows/publish-1.2-nightly.yml index d91a88a6e8c..4e7585c3dc4 100644 --- a/.github/workflows/publish-1.2-nightly.yml +++ b/.github/workflows/publish-1.2-nightly.yml @@ -35,7 +35,7 @@ jobs: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -49,7 +49,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 diff --git a/.github/workflows/publish-1.3-docs.yml b/.github/workflows/publish-1.3-docs.yml index 38408d01955..8cb47f33460 100644 --- a/.github/workflows/publish-1.3-docs.yml +++ b/.github/workflows/publish-1.3-docs.yml @@ -33,7 +33,7 @@ jobs: steps: # TODO we will need to change to use a release tag in future - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -47,7 +47,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 diff --git a/.github/workflows/publish-1.3-nightly.yml b/.github/workflows/publish-1.3-nightly.yml index 4b60c004eb4..3e894cc6c81 100644 --- a/.github/workflows/publish-1.3-nightly.yml +++ b/.github/workflows/publish-1.3-nightly.yml @@ -34,7 +34,7 @@ jobs: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -48,7 +48,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1 diff --git a/.github/workflows/publish-1.4-docs.yml b/.github/workflows/publish-1.4-docs.yml index a5208c5df8a..22bb6a48e53 100644 --- a/.github/workflows/publish-1.4-docs.yml +++ b/.github/workflows/publish-1.4-docs.yml @@ -33,7 +33,7 @@ jobs: steps: # TODO we will need to change to use a release tag in future - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -47,7 +47,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 diff --git a/.github/workflows/publish-1.4-nightly.yml b/.github/workflows/publish-1.4-nightly.yml index eaffd3937ee..3cb0829a8de 100644 --- a/.github/workflows/publish-1.4-nightly.yml +++ b/.github/workflows/publish-1.4-nightly.yml @@ -36,7 +36,7 @@ jobs: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -50,7 +50,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1 diff --git a/.github/workflows/publish-1.5-docs.yml b/.github/workflows/publish-1.5-docs.yml index bd0ca4390fa..67297afca8b 100644 --- a/.github/workflows/publish-1.5-docs.yml +++ b/.github/workflows/publish-1.5-docs.yml @@ -33,7 +33,7 @@ jobs: steps: # TODO we will need to change to use a release tag in future - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -47,7 +47,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 diff --git a/.github/workflows/publish-1.5-nightly.yml b/.github/workflows/publish-1.5-nightly.yml index 63f078b1a5a..7c1801e2013 100644 --- a/.github/workflows/publish-1.5-nightly.yml +++ b/.github/workflows/publish-1.5-nightly.yml @@ -34,7 +34,7 @@ jobs: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -48,7 +48,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1 diff --git a/.github/workflows/publish-1.6-docs.yml b/.github/workflows/publish-1.6-docs.yml index c47db4c60d9..a4296e396ca 100644 --- a/.github/workflows/publish-1.6-docs.yml +++ b/.github/workflows/publish-1.6-docs.yml @@ -33,7 +33,7 @@ jobs: steps: # TODO we will need to change to use a release tag in future - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -47,7 +47,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 diff --git a/.github/workflows/publish-1.6-nightly.yml b/.github/workflows/publish-1.6-nightly.yml index b5b2d6bb01c..c74c243c494 100644 --- a/.github/workflows/publish-1.6-nightly.yml +++ b/.github/workflows/publish-1.6-nightly.yml @@ -34,7 +34,7 @@ jobs: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -48,7 +48,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1 diff --git a/.github/workflows/publish-1.7-nightly.yml b/.github/workflows/publish-1.7-nightly.yml index 3d08a2740be..0ec215d0fb8 100644 --- a/.github/workflows/publish-1.7-nightly.yml +++ b/.github/workflows/publish-1.7-nightly.yml @@ -36,7 +36,7 @@ jobs: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -50,7 +50,7 @@ jobs: java-version: 11 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1 diff --git a/.github/workflows/publish-2.0-docs.yml b/.github/workflows/publish-2.0-docs.yml index 2a36b6f6fbe..8f381c978c4 100644 --- a/.github/workflows/publish-2.0-docs.yml +++ b/.github/workflows/publish-2.0-docs.yml @@ -33,7 +33,7 @@ jobs: steps: # TODO we will need to change to use a release tag in future - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -46,7 +46,7 @@ jobs: java-version: 17 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 @@ -60,20 +60,20 @@ jobs: env: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} run: |- - sbt -Dpekko.genjavadoc.enabled=true "set ThisBuild / version := \"2.0.0-M3\"; docs/paradox; unidoc" + sbt -Dpekko.genjavadoc.enabled=true "set ThisBuild / version := \"2.0.0-M2\"; docs/paradox; unidoc" # Create directory structure upfront since rsync does not create intermediate directories otherwise - name: Create directory structure run: |- - mkdir -p target/nightly-docs/docs/pekko/2.0.0-M3/ + mkdir -p target/nightly-docs/docs/pekko/2.0.0-M2/ mkdir -p target/nightly-docs/docs/pekko/2.0/ - cp -r docs/target/paradox/site/main/ target/nightly-docs/docs/pekko/2.0.0-M3/docs + cp -r docs/target/paradox/site/main/ target/nightly-docs/docs/pekko/2.0.0-M2/docs cp -r docs/target/paradox/site/main/ target/nightly-docs/docs/pekko/2.0/docs rm -r docs/target/paradox/site/main/ - cp -r target/scala-2.13/unidoc target/nightly-docs/docs/pekko/2.0.0-M3/api + cp -r target/scala-2.13/unidoc target/nightly-docs/docs/pekko/2.0.0-M2/api cp -r target/scala-2.13/unidoc target/nightly-docs/docs/pekko/2.0/api rm -r target/scala-2.13/unidoc - cp -r target/javaunidoc target/nightly-docs/docs/pekko/2.0.0-M3/japi + cp -r target/javaunidoc target/nightly-docs/docs/pekko/2.0.0-M2/japi cp -r target/javaunidoc target/nightly-docs/docs/pekko/2.0/japi rm -r target/javaunidoc @@ -82,7 +82,7 @@ jobs: with: upload: true switches: --archive --compress --update --delete --progress --relative - local_path: target/nightly-docs/./docs/pekko/2.0.0-M3 # The intermediate dot is to show `--relative` which paths to operate on + local_path: target/nightly-docs/./docs/pekko/2.0.0-M2 # The intermediate dot is to show `--relative` which paths to operate on remote_path: ${{ secrets.NIGHTLIES_RSYNC_PATH }}/pekko remote_host: ${{ secrets.NIGHTLIES_RSYNC_HOST }} remote_port: ${{ secrets.NIGHTLIES_RSYNC_PORT }} diff --git a/.github/workflows/publish-nightly.yml b/.github/workflows/publish-nightly.yml index 1e2a3864943..bee4249990a 100644 --- a/.github/workflows/publish-nightly.yml +++ b/.github/workflows/publish-nightly.yml @@ -36,7 +36,7 @@ jobs: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -49,7 +49,7 @@ jobs: java-version: 17 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 diff --git a/.github/workflows/stage-release-candidate.yml b/.github/workflows/stage-release-candidate.yml index 6e0c0ba238b..d9430905935 100644 --- a/.github/workflows/stage-release-candidate.yml +++ b/.github/workflows/stage-release-candidate.yml @@ -66,7 +66,7 @@ jobs: REF: ${{ github.ref_name }} - name: Checkout - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v5.0.1 + uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v5.0.1 with: fetch-depth: 0 fetch-tags: true @@ -140,7 +140,7 @@ jobs: REF: ${{ github.ref_name }} - name: Checkout - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v5.0.1 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v5.0.1 with: fetch-depth: 0 fetch-tags: true @@ -198,7 +198,7 @@ jobs: REF: ${{ github.ref_name }} - name: Checkout - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v5.0.1 + uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v5.0.1 with: fetch-depth: 0 fetch-tags: true @@ -211,7 +211,7 @@ jobs: java-version: 17 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Install Graphviz run: |- diff --git a/.github/workflows/timing-tests.yml b/.github/workflows/timing-tests.yml index b05e425218c..0e7cf409e7d 100644 --- a/.github/workflows/timing-tests.yml +++ b/.github/workflows/timing-tests.yml @@ -24,7 +24,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v6.0.3 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 fetch-tags: true @@ -37,7 +37,7 @@ jobs: java-version: 17 - name: Install sbt - uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1 + uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24 - name: Cache Coursier cache uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1 diff --git a/.scala-steward.conf b/.scala-steward.conf index 636eb45de4f..cf1ea2423e0 100644 --- a/.scala-steward.conf +++ b/.scala-steward.conf @@ -1,4 +1,6 @@ updates.pin = [ + # https://github.com/apache/pekko/issues/2329 + { groupId = "io.aeron", version = "1.50." }, # Scala 3.3 is the latest LTS version { groupId = "org.scala-lang", artifactId = "scala3-library", version = "3.3." } # sbt-assembly 2.3 causes build issues (https://github.com/apache/pekko/pull/1744) diff --git a/.scalafmt.conf b/.scalafmt.conf index 741e7578268..31f933e39b0 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,5 +1,5 @@ version = 3.11.1 -runner.dialect = scala213source3 +runner.dialect = scala213 project.git = true style = defaultWithAlign docstrings.style = Asterisk @@ -76,13 +76,3 @@ project.excludeFilters = [ "scripts/authors.scala" ] project.layout = StandardConvention - -rewrite.scala3.convertToNewSyntax = true -runner { - dialectOverride { - allowSignificantIndentation = false - allowAsForImportRename = false - allowStarWildcardImport = false - allowPostfixStarVarargSplices = false - } -} diff --git a/AGENTS.md b/AGENTS.md index c9119ccae99..43f24997b71 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -120,7 +120,7 @@ sbt "module-name / Test / testOnly fully.qualified.SpecName" - Use JDK-specific configs when relevant. ```shell -sbt "module-name / TestJdk21 / testOnly fully.qualified.SpecName" +sbt "module-name / TestJdk9 / testOnly fully.qualified.SpecName" ``` - Run PR impact validation for non-trivial code changes. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2a5bd4cfac6..0521bb95fc9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -197,7 +197,7 @@ Strange behavior has been reported by users that have tried it. Pekko, like most Scala projects, compiles faster with the Graal JIT enabled. The easiest way to use it for compiling Pekko is to: -* Use a JDK >= 17 +* Use a JDK > 10 * Use the following JVM options for SBT e.g. by adding them to the `SBT_OPTS` environment variable: `-XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler` ### JDK 21+ Nightly Virtual Threads diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/Effect.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/Effect.scala index ca1d04505bd..32c3ce79988 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/Effect.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/Effect.scala @@ -100,7 +100,7 @@ object Effect { with Serializable { override def equals(other: Any) = other match { - case o: Spawned[?] => + case o: Spawned[_] => this.behavior == o.behavior && this.childName == o.childName && this.props == o.props @@ -113,7 +113,7 @@ object Effect { override def _1: Behavior[T] = behavior override def _2: String = childName override def _3: Props = props - override def canEqual(o: Any) = o.isInstanceOf[Spawned[?]] + override def canEqual(o: Any) = o.isInstanceOf[Spawned[_]] } object Spawned { @@ -131,7 +131,7 @@ object Effect { with Serializable { override def equals(other: Any) = other match { - case o: SpawnedAnonymous[?] => this.behavior == o.behavior && this.props == o.props + case o: SpawnedAnonymous[_] => this.behavior == o.behavior && this.props == o.props case _ => false } override def hashCode: Int = behavior.## * 31 + props.## @@ -140,7 +140,7 @@ object Effect { override def productPrefix = "SpawnedAnonymous" override def _1: Behavior[T] = behavior override def _2: Props = props - override def canEqual(o: Any) = o.isInstanceOf[SpawnedAnonymous[?]] + override def canEqual(o: Any) = o.isInstanceOf[SpawnedAnonymous[_]] } object SpawnedAnonymous { @@ -160,7 +160,7 @@ object Effect { with Serializable { override def equals(other: Any) = other match { - case o: SpawnedAdapter[?] => this.name == o.name + case o: SpawnedAdapter[_] => this.name == o.name case _ => false } override def hashCode: Int = name.## @@ -168,7 +168,7 @@ object Effect { override def productPrefix = "SpawnedAdapter" override def _1: String = name - override def canEqual(o: Any) = o.isInstanceOf[SpawnedAdapter[?]] + override def canEqual(o: Any) = o.isInstanceOf[SpawnedAdapter[_]] } /** @@ -192,17 +192,17 @@ object Effect { with Serializable { override def equals(other: Any): Boolean = other match { - case _: SpawnedAnonymousAdapter[?] => true + case _: SpawnedAnonymousAdapter[_] => true case _ => false } override def hashCode: Int = Nil.## override def toString: String = "SpawnedAnonymousAdapter" override def productPrefix: String = "SpawnedAnonymousAdapter" - override def productIterator: Iterator[?] = Iterator.empty + override def productIterator: Iterator[_] = Iterator.empty override def productArity: Int = 0 override def productElement(n: Int) = throw new NoSuchElementException - override def canEqual(o: Any): Boolean = o.isInstanceOf[SpawnedAnonymousAdapter[?]] + override def canEqual(o: Any): Boolean = o.isInstanceOf[SpawnedAnonymousAdapter[_]] } /** diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/TestKitSettings.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/TestKitSettings.scala index 6c043736583..42251512a32 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/TestKitSettings.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/TestKitSettings.scala @@ -29,7 +29,7 @@ object TestKitSettings { /** * Reads configuration settings from `pekko.actor.testkit.typed` section. */ - def apply(system: ActorSystem[?]): TestKitSettings = + def apply(system: ActorSystem[_]): TestKitSettings = Ext(system).settings /** @@ -42,7 +42,7 @@ object TestKitSettings { /** * Java API: Reads configuration settings from `pekko.actor.testkit.typed` section. */ - def create(system: ActorSystem[?]): TestKitSettings = + def create(system: ActorSystem[_]): TestKitSettings = apply(system) /** @@ -53,11 +53,11 @@ object TestKitSettings { new TestKitSettings(config) private object Ext extends ExtensionId[Ext] { - override def createExtension(system: ActorSystem[?]): Ext = new Ext(system) - def get(system: ActorSystem[?]): Ext = Ext.apply(system) + override def createExtension(system: ActorSystem[_]): Ext = new Ext(system) + def get(system: ActorSystem[_]): Ext = Ext.apply(system) } - private class Ext(system: ActorSystem[?]) extends Extension { + private class Ext(system: ActorSystem[_]) extends Extension { val settings: TestKitSettings = TestKitSettings(system.settings.config.getConfig("pekko.actor.testkit.typed")) } } diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/ActorSystemStub.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/ActorSystemStub.scala index 71882d690d6..b1b77a7c040 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/ActorSystemStub.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/ActorSystemStub.scala @@ -135,7 +135,7 @@ import com.typesafe.config.{ Config, ConfigFactory } override def extension[T <: Extension](ext: ExtensionId[T]): T = throw new UnsupportedOperationException("ActorSystemStub cannot register extensions") - override def hasExtension(ext: ExtensionId[? <: Extension]): Boolean = + override def hasExtension(ext: ExtensionId[_ <: Extension]): Boolean = throw new UnsupportedOperationException("ActorSystemStub cannot register extensions") override def log: Logger = LoggerFactory.getLogger(getClass) diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/LoggingTestKitImpl.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/LoggingTestKitImpl.scala index 66a3727e99b..d2187e91765 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/LoggingTestKitImpl.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/LoggingTestKitImpl.scala @@ -48,7 +48,7 @@ import org.slf4j.event.Level source: Option[String], messageContains: Option[String], messageRegex: Option[Regex], - cause: Option[Class[? <: Throwable]], + cause: Option[Class[_ <: Throwable]], mdc: Map[String, String], checkExcess: Boolean, custom: Option[Function[LoggingEvent, Boolean]]) @@ -95,7 +95,7 @@ import org.slf4j.event.Level todo > 0 } - override def expect[T](code: => T)(implicit system: ActorSystem[?]): T = { + override def expect[T](code: => T)(implicit system: ActorSystem[_]): T = { val effectiveLoggerName = loggerName.getOrElse("") checkLogback(system) TestAppender.setupTestAppender(effectiveLoggerName) @@ -120,10 +120,10 @@ import org.slf4j.event.Level } } - override def expect[T](system: ActorSystem[?], code: Supplier[T]): T = + override def expect[T](system: ActorSystem[_], code: Supplier[T]): T = expect(code.get())(system) - private def checkLogback(system: ActorSystem[?]): Unit = { + private def checkLogback(system: ActorSystem[_]): Unit = { if (!system.dynamicAccess.classIsOnClasspath("ch.qos.logback.classic.spi.ILoggingEvent")) { throw new IllegalStateException("LoggingEventFilter requires logback-classic dependency in classpath.") } @@ -166,7 +166,7 @@ import org.slf4j.event.Level override def withCustom(newCustom: Function[LoggingEvent, Boolean]): LoggingTestKitImpl = copy(custom = Option(newCustom)) - override def withCause(newCause: Class[? <: Throwable]): javadsl.LoggingTestKit = + override def withCause(newCause: Class[_ <: Throwable]): javadsl.LoggingTestKit = copy(cause = Option(newCause)) } diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/StubbedActorContext.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/StubbedActorContext.scala index b765bd62a06..4bf7f51746e 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/StubbedActorContext.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/StubbedActorContext.scala @@ -90,7 +90,7 @@ private[pekko] final class FunctionRef[-T](override val path: ActorPath, send: ( @InternalApi private[pekko] val selfInbox = new TestInboxImpl[T](path) override val self = selfInbox.ref - private var _children = TreeMap.empty[String, BehaviorTestKitImpl[?]] + private var _children = TreeMap.empty[String, BehaviorTestKitImpl[_]] private val childName = Iterator.from(0).map(Helpers.base64(_)) private val substituteLoggerFactory = new SubstituteLoggerFactory private val logger: Logger = substituteLoggerFactory.getLogger("StubbedLogger") @@ -230,7 +230,7 @@ private[pekko] final class FunctionRef[-T](override val path: ActorPath, send: ( checkCurrentActorThread() } - override def setLoggerName(clazz: Class[?]): Unit = { + override def setLoggerName(clazz: Class[_]): Unit = { // nop as we don't track logger checkCurrentActorThread() } diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/TestKitUtils.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/TestKitUtils.scala index 6445998cdad..e54319dae00 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/TestKitUtils.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/TestKitUtils.scala @@ -64,7 +64,7 @@ private[pekko] object ActorTestKitGuardian { reply: ActorRef[ActorRef[T]], props: Props): Catcher[Behavior[TestKitCommand]] = { case NonFatal(e) => - context.log.error("Spawn failed, props [{}]", props, e) + context.log.error(s"Spawn failed, props [$props]", e) reply ! context.spawnAnonymous(Behaviors.stopped) Behaviors.same } @@ -79,7 +79,7 @@ private[pekko] object TestKitUtils { // common internal utility impls for Java and Scala private val TestKitRegex = """org\.apache\.pekko\.testkit\.typed\.(?:javadsl|scaladsl)\.ActorTestKit(?:\$.*)?""".r - def testNameFromCallStack(classToStartFrom: Class[?]): String = + def testNameFromCallStack(classToStartFrom: Class[_]): String = pekko.testkit.TestKitUtils.testNameFromCallStack(classToStartFrom, TestKitRegex) /** @@ -90,7 +90,7 @@ private[pekko] object TestKitUtils { def scrubActorSystemName(name: String): String = pekko.testkit.TestKitUtils.scrubActorSystemName(name) - def shutdown(system: ActorSystem[?], timeout: Duration, throwIfShutdownTimesOut: Boolean): Unit = { + def shutdown(system: ActorSystem[_], timeout: Duration, throwIfShutdownTimesOut: Boolean): Unit = { system.terminate() try Await.ready(system.whenTerminated, timeout) catch { diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/TestProbeImpl.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/TestProbeImpl.scala index 0be9c61f41c..1bb38e9e930 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/TestProbeImpl.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/internal/TestProbeImpl.scala @@ -74,7 +74,7 @@ private[pekko] object TestProbeImpl { } @InternalApi -private[pekko] final class TestProbeImpl[M](name: String, system: ActorSystem[?]) +private[pekko] final class TestProbeImpl[M](name: String, system: ActorSystem[_]) extends JavaTestProbe[M] with ScalaTestProbe[M] with InternalRecipientRef[M] { diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/ActorTestKit.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/ActorTestKit.scala index d6ce52aca47..cb599f57fbc 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/ActorTestKit.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/ActorTestKit.scala @@ -57,7 +57,7 @@ object ActorTestKit { * Config loaded from the provided actor if that exists, otherwise * using default configuration from the reference.conf resources that ship with the Akka libraries. */ - def create(system: ActorSystem[?]): ActorTestKit = + def create(system: ActorSystem[_]): ActorTestKit = new ActorTestKit(scaladsl.ActorTestKit(system)) /** @@ -123,7 +123,7 @@ object ActorTestKit { * an error is printed to stdout when the system did not shutdown but * no exception is thrown. */ - def shutdown(system: ActorSystem[?], duration: Duration, throwIfShutdownTimesOut: Boolean): Unit = { + def shutdown(system: ActorSystem[_], duration: Duration, throwIfShutdownTimesOut: Boolean): Unit = { TestKitUtils.shutdown(system, duration.toScala, throwIfShutdownTimesOut) } @@ -132,7 +132,7 @@ object ActorTestKit { * if more time than `system-shutdown-default` passes an exception is thrown * (can be configured with `throw-on-shutdown-timeout`). */ - def shutdown(system: ActorSystem[?], duration: Duration): Unit = { + def shutdown(system: ActorSystem[_], duration: Duration): Unit = { val settings = TestKitSettings.create(system) shutdown(system, duration, settings.ThrowOnShutdownTimeout) } @@ -142,7 +142,7 @@ object ActorTestKit { * if more time than `system-shutdown-default` passes an exception is thrown * (can be configured with `throw-on-shutdown-timeout`). */ - def shutdown(system: ActorSystem[?]): Unit = { + def shutdown(system: ActorSystem[_]): Unit = { val settings = TestKitSettings.create(system) shutdown(system, settings.DefaultActorSystemShutdownTimeout.toJava, settings.ThrowOnShutdownTimeout) } diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/BehaviorTestKit.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/BehaviorTestKit.scala index 8057b0e8e66..2a97e313234 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/BehaviorTestKit.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/BehaviorTestKit.scala @@ -177,7 +177,7 @@ abstract class BehaviorTestKit[T] { def expectEffect(expectedEffect: Effect): Unit /** - * Asserts that the oldest effect is an instance of class T. Consumes and returns the concrete effect for + * Asserts that the oldest effect is an instance of of class T. Consumes and returns the concrete effect for * further direct assertions. */ def expectEffectClass[U <: Effect](effectClass: Class[U]): U diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/JUnit5TestKitBuilder.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/JUnit5TestKitBuilder.scala index d71359d099f..6cbea0f6a86 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/JUnit5TestKitBuilder.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/JUnit5TestKitBuilder.scala @@ -27,13 +27,13 @@ import com.typesafe.config.Config @deprecated("Use JUnitJupiterTestKitBuilder instead", "2.0.0") final class JUnit5TestKitBuilder() { - var system: Option[ActorSystem[?]] = None + var system: Option[ActorSystem[_]] = None var customConfig: Config = ApplicationTestConfig var name: String = TestKitUtils.testNameFromCallStack(classOf[JUnit5TestKitBuilder]) - def withSystem(system: ActorSystem[?]): JUnit5TestKitBuilder = { + def withSystem(system: ActorSystem[_]): JUnit5TestKitBuilder = { this.system = Some(system) this } diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/JUnitJupiterTestKitBuilder.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/JUnitJupiterTestKitBuilder.scala index c384620fbab..256ecf8cb2f 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/JUnitJupiterTestKitBuilder.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/JUnitJupiterTestKitBuilder.scala @@ -26,13 +26,13 @@ import com.typesafe.config.Config final class JUnitJupiterTestKitBuilder() { - var system: Option[ActorSystem[?]] = None + var system: Option[ActorSystem[_]] = None var customConfig: Config = ApplicationTestConfig var name: String = TestKitUtils.testNameFromCallStack(classOf[JUnitJupiterTestKitBuilder]) - def withSystem(system: ActorSystem[?]): JUnitJupiterTestKitBuilder = { + def withSystem(system: ActorSystem[_]): JUnitJupiterTestKitBuilder = { this.system = Some(system) this } diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/LoggingTestKit.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/LoggingTestKit.scala index 5323c25cd98..d8a7723722d 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/LoggingTestKit.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/LoggingTestKit.scala @@ -78,7 +78,7 @@ import org.slf4j.event.Level * Matching events with an included `throwable` that is a class or subclass of the given * `Throwable` class. */ - def withCause(newCause: Class[? <: Throwable]): LoggingTestKit + def withCause(newCause: Class[_ <: Throwable]): LoggingTestKit /** * Matching events with MDC containing all entries of the given `Map`. @@ -109,7 +109,7 @@ import org.slf4j.event.Level * * Care is taken to remove the testkit when the block is finished or aborted. */ - def expect[T](system: ActorSystem[?], code: Supplier[T]): T + def expect[T](system: ActorSystem[_], code: Supplier[T]): T } @@ -198,7 +198,7 @@ object LoggingTestKit { * * More conditions can be added to the returned [LoggingEventFilter]. */ - def error(causeClass: Class[? <: Throwable]): LoggingTestKit = + def error(causeClass: Class[_ <: Throwable]): LoggingTestKit = empty.withLogLevel(Level.ERROR).withCause(causeClass) /** diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/ManualTime.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/ManualTime.scala index abb91dfa6a2..896932a58fc 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/ManualTime.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/ManualTime.scala @@ -73,7 +73,7 @@ final class ManualTime(delegate: pekko.testkit.ExplicitlyTriggeredScheduler) { def timePasses(amount: Duration): Unit = delegate.timePasses(amount.toScala) @varargs - def expectNoMessageFor(duration: Duration, on: TestProbe[?]*): Unit = { + def expectNoMessageFor(duration: Duration, on: TestProbe[_]*): Unit = { delegate.timePasses(duration.toScala) on.foreach(_.expectNoMessage(Duration.ZERO)) } diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/SerializationTestKit.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/SerializationTestKit.scala index 768e5c7ab85..16b47af91c8 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/SerializationTestKit.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/SerializationTestKit.scala @@ -20,7 +20,7 @@ import pekko.actor.typed.ActorSystem /** * Utilities to test serialization. */ -class SerializationTestKit(system: ActorSystem[?]) { +class SerializationTestKit(system: ActorSystem[_]) { private val delegate = new scaladsl.SerializationTestKit(system) diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestInbox.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestInbox.scala index 69876fc9b4e..bc4467aca48 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestInbox.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestInbox.scala @@ -62,7 +62,7 @@ abstract class TestInbox[T] { def receiveMessage(): T /** - * Assert and remove the oldest message. + * Assert and remove the the oldest message. */ def expectMessage(expectedMessage: T): TestInbox[T] diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestKitJunitResource.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestKitJunitResource.scala index 5b85c2d386b..3c240c662f0 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestKitJunitResource.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestKitJunitResource.scala @@ -72,7 +72,7 @@ final class TestKitJunitResource(_kit: ActorTestKit) extends ExternalResource { /** * Use a custom [[pekko.actor.typed.ActorSystem]] for the actor system. */ - def this(system: ActorSystem[?]) = this(ActorTestKit.create(system)) + def this(system: ActorSystem[_]) = this(ActorTestKit.create(system)) /** * Use a custom config for the actor system. diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestProbe.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestProbe.scala index bba58f2c455..8f602a5cc6f 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestProbe.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestProbe.scala @@ -55,16 +55,16 @@ object FishingOutcomes { object TestProbe { - def create[M](system: ActorSystem[?]): TestProbe[M] = + def create[M](system: ActorSystem[_]): TestProbe[M] = create(name = "testProbe", system) - def create[M](@nowarn("msg=never used") clazz: Class[M], system: ActorSystem[?]): TestProbe[M] = + def create[M](@nowarn("msg=never used") clazz: Class[M], system: ActorSystem[_]): TestProbe[M] = create(system) - def create[M](name: String, system: ActorSystem[?]): TestProbe[M] = + def create[M](name: String, system: ActorSystem[_]): TestProbe[M] = new TestProbeImpl[M](name, system) - def create[M](name: String, @nowarn("msg=never used") clazz: Class[M], system: ActorSystem[?]): TestProbe[M] = + def create[M](name: String, @nowarn("msg=never used") clazz: Class[M], system: ActorSystem[_]): TestProbe[M] = new TestProbeImpl[M](name, system) } diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ActorTestKit.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ActorTestKit.scala index 7476271ffda..01f6a362977 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ActorTestKit.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ActorTestKit.scala @@ -75,7 +75,7 @@ object ActorTestKit { * Config loaded from the provided actor if that exists, otherwise * using default configuration from the reference.conf resources that ship with the Akka libraries. */ - def apply(system: ActorSystem[?]): ActorTestKit = { + def apply(system: ActorSystem[_]): ActorTestKit = { val name = testKitGuardianCounter.incrementAndGet() match { case 1 => "test" case n => s"test-$n" @@ -160,7 +160,7 @@ object ActorTestKit { * Shutdown the given [[pekko.actor.typed.ActorSystem]] and block until it shuts down, * if more time than `TestKitSettings.DefaultActorSystemShutdownTimeout` passes an exception is thrown */ - def shutdown(system: ActorSystem[?]): Unit = { + def shutdown(system: ActorSystem[_]): Unit = { val settings = TestKitSettings(system) TestKitUtils.shutdown(system, settings.DefaultActorSystemShutdownTimeout, settings.ThrowOnShutdownTimeout) } @@ -169,7 +169,7 @@ object ActorTestKit { * Shutdown the given [[pekko.actor.typed.ActorSystem]] and block until it shuts down * or the `duration` hits. If the timeout hits `verifySystemShutdown` decides */ - def shutdown(system: ActorSystem[?], timeout: Duration, throwIfShutdownFails: Boolean = false): Unit = + def shutdown(system: ActorSystem[_], timeout: Duration, throwIfShutdownFails: Boolean = false): Unit = TestKitUtils.shutdown(system, timeout, throwIfShutdownFails) /** @@ -193,7 +193,7 @@ object ActorTestKit { * For synchronous testing of a `Behavior` see [[BehaviorTestKit]] */ final class ActorTestKit private[pekko] ( - val internalSystem: ActorSystem[?], + val internalSystem: ActorSystem[_], internalTestKitGuardian: ActorRef[ActorTestKitGuardian.TestKitCommand], settings: Option[TestKitSettings]) { diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/LoggingTestKit.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/LoggingTestKit.scala index c0bb5c02b0a..23d238c0b6e 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/LoggingTestKit.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/LoggingTestKit.scala @@ -108,7 +108,7 @@ import org.slf4j.event.Level * * Care is taken to remove the testkit when the block is finished or aborted. */ - def expect[T](code: => T)(implicit system: ActorSystem[?]): T + def expect[T](code: => T)(implicit system: ActorSystem[_]): T } /** diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ManualTime.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ManualTime.scala index ae765bcbfef..7074941447d 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ManualTime.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ManualTime.scala @@ -41,7 +41,7 @@ object ManualTime { * Access the manual scheduler, note that you need to setup the actor system/testkit with [[ManualTime.config]] * for this to work. */ - def apply()(implicit system: ActorSystem[?]): ManualTime = + def apply()(implicit system: ActorSystem[_]): ManualTime = system.scheduler match { case adapter: SchedulerAdapter => adapter.classicScheduler match { @@ -73,7 +73,7 @@ final class ManualTime(delegate: pekko.testkit.ExplicitlyTriggeredScheduler) { def timePasses(amount: FiniteDuration): Unit = delegate.timePasses(amount) @varargs - def expectNoMessageFor(duration: FiniteDuration, on: TestProbe[?]*): Unit = { + def expectNoMessageFor(duration: FiniteDuration, on: TestProbe[_]*): Unit = { delegate.timePasses(duration) on.foreach(_.expectNoMessage(Duration.Zero)) } diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ScalaTestWithActorTestKit.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ScalaTestWithActorTestKit.scala index a922ff7bbec..cfa2a492489 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ScalaTestWithActorTestKit.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ScalaTestWithActorTestKit.scala @@ -53,7 +53,7 @@ abstract class ScalaTestWithActorTestKit(override val testKit: ActorTestKit) /** * Use a custom [[pekko.actor.typed.ActorSystem]] for the actor system. */ - def this(system: ActorSystem[?]) = this(ActorTestKit(system)) + def this(system: ActorSystem[_]) = this(ActorTestKit(system)) /** * Use a custom config for the actor system. diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/SerializationTestKit.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/SerializationTestKit.scala index 691291aa15d..84ecfb2adf9 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/SerializationTestKit.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/SerializationTestKit.scala @@ -22,7 +22,7 @@ import pekko.serialization.Serializers /** * Utilities to test serialization. */ -class SerializationTestKit(system: ActorSystem[?]) { +class SerializationTestKit(system: ActorSystem[_]) { private val serialization = SerializationExtension(system.toClassic) diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/TestInbox.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/TestInbox.scala index 8b9086344ec..f6194998355 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/TestInbox.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/TestInbox.scala @@ -61,7 +61,7 @@ trait TestInbox[T] { def receiveMessage(): T /** - * Assert and remove the oldest message. + * Assert and remove the the oldest message. */ def expectMessage(expectedMessage: T): TestInbox[T] diff --git a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/TestProbe.scala b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/TestProbe.scala index ff215bc741b..4ec7625a846 100644 --- a/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/TestProbe.scala +++ b/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/TestProbe.scala @@ -52,10 +52,10 @@ object FishingOutcomes { } object TestProbe { - def apply[M]()(implicit system: ActorSystem[?]): TestProbe[M] = + def apply[M]()(implicit system: ActorSystem[_]): TestProbe[M] = apply(name = "testProbe") - def apply[M](name: String)(implicit system: ActorSystem[?]): TestProbe[M] = + def apply[M](name: String)(implicit system: ActorSystem[_]): TestProbe[M] = new TestProbeImpl[M](name, system) } diff --git a/actor-testkit-typed/src/test/java/jdocs/org/apache/pekko/actor/testkit/typed/javadsl/AsyncTestingExampleTest.java b/actor-testkit-typed/src/test/java/jdocs/org/apache/pekko/actor/testkit/typed/javadsl/AsyncTestingExampleTest.java index c1f375b3e92..c0538b76e62 100644 --- a/actor-testkit-typed/src/test/java/jdocs/org/apache/pekko/actor/testkit/typed/javadsl/AsyncTestingExampleTest.java +++ b/actor-testkit-typed/src/test/java/jdocs/org/apache/pekko/actor/testkit/typed/javadsl/AsyncTestingExampleTest.java @@ -41,12 +41,11 @@ // #test-header @ExtendWith({TestKitJUnitJupiterExtension.class, LogCapturingExtension.class}) public class AsyncTestingExampleTest -// #test-header + // #test-header // #test-header { @JUnitJupiterTestKit public ActorTestKit testKit = new JUnitJupiterTestKitBuilder().build(); - // #test-header // #under-test @@ -94,7 +93,6 @@ public static Behavior create() { .build(); } } - // #under-test // #under-test-2 @@ -131,7 +129,6 @@ private CompletionStage publish(int i) { scheduler); } } - // #under-test-2 // #test-shutdown diff --git a/actor-testkit-typed/src/test/scala/docs/org/apache/pekko/actor/testkit/typed/scaladsl/SyncTestingExampleSpec.scala b/actor-testkit-typed/src/test/scala/docs/org/apache/pekko/actor/testkit/typed/scaladsl/SyncTestingExampleSpec.scala index 8fe060f658e..34a5e4d84fd 100644 --- a/actor-testkit-typed/src/test/scala/docs/org/apache/pekko/actor/testkit/typed/scaladsl/SyncTestingExampleSpec.scala +++ b/actor-testkit-typed/src/test/scala/docs/org/apache/pekko/actor/testkit/typed/scaladsl/SyncTestingExampleSpec.scala @@ -233,10 +233,10 @@ class SyncTestingExampleSpec extends AnyWordSpec with Matchers { testKit.run(ConfigAware.SpawnChild(inbox.ref.narrow)) val childTestKit = inbox.receiveMessage() match { - case ar: ActorRef[?] => + case ar: ActorRef[_] => testKit.childTestKit(ar.unsafeUpcast[Any].narrow[ConfigAware.Command]) case unexpected => - unexpected should be(a[ActorRef[?]]) + unexpected should be(a[ActorRef[_]]) ??? } diff --git a/actor-testkit-typed/src/test/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ActorTestKitSpec.scala b/actor-testkit-typed/src/test/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ActorTestKitSpec.scala index 25d4edd98c2..5061ca4fe5a 100644 --- a/actor-testkit-typed/src/test/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ActorTestKitSpec.scala +++ b/actor-testkit-typed/src/test/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ActorTestKitSpec.scala @@ -56,7 +56,7 @@ class ActorTestKitSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike wi } "use name from given class name with replaced package name" in { - val testkit2 = ActorTestKit(classOf[Vector[?]].getName) + val testkit2 = ActorTestKit(classOf[Vector[_]].getName) try { // removing package name and such testkit2.system.name should ===("Vector") @@ -171,7 +171,7 @@ class MyConcreteDerivateSpec extends MyBaseSpec { } "use name from given class name" in { - val testkit2 = ActorTestKit(classOf[Vector[?]].getName) + val testkit2 = ActorTestKit(classOf[Vector[_]].getName) try { testkit2.system.name should ===("Vector") } finally testkit2.shutdownTestKit() diff --git a/actor-testkit-typed/src/test/scala/org/apache/pekko/actor/testkit/typed/scaladsl/BehaviorTestKitSpec.scala b/actor-testkit-typed/src/test/scala/org/apache/pekko/actor/testkit/typed/scaladsl/BehaviorTestKitSpec.scala index 4f13e0d4154..f85c92f35e5 100644 --- a/actor-testkit-typed/src/test/scala/org/apache/pekko/actor/testkit/typed/scaladsl/BehaviorTestKitSpec.scala +++ b/actor-testkit-typed/src/test/scala/org/apache/pekko/actor/testkit/typed/scaladsl/BehaviorTestKitSpec.scala @@ -210,7 +210,7 @@ class BehaviorTestKitSpec extends AnyWordSpec with Matchers with LogCapturing { "allow assertions on effect type" in { val testkit = BehaviorTestKit[Parent.Command](Parent.init) testkit.run(SpawnAnonymous(1)) - val spawnAnonymous = testkit.expectEffectType[Effect.SpawnedAnonymous[?]] + val spawnAnonymous = testkit.expectEffectType[Effect.SpawnedAnonymous[_]] spawnAnonymous.props should ===(Props.empty) } @@ -401,7 +401,7 @@ class BehaviorTestKitSpec extends AnyWordSpec with Matchers with LogCapturing { val sessionRef = testkit.runAsk[ActorRef[String]](SpawnSession(_, h.ref)).receiveReply() - val s = testkit.expectEffectType[SpawnedAnonymous[?]] + val s = testkit.expectEffectType[SpawnedAnonymous[_]] // must be able to get the created ref, even without explicit reply s.ref shouldBe sessionRef @@ -423,7 +423,7 @@ class BehaviorTestKitSpec extends AnyWordSpec with Matchers with LogCapturing { testkit.expectEffect(Stopped(child.childName)) testkit.run(SpawnChild) - val newChild = testkit.expectEffectType[Spawned[?]] + val newChild = testkit.expectEffectType[Spawned[_]] child.childName shouldBe newChild.childName } } diff --git a/actor-tests/src/test/scala-3/org/apache/pekko/util/LineNumberSpec.scala b/actor-tests/src/test/scala-3/org/apache/pekko/util/LineNumberSpec.scala index 87837251e9b..0cb668d49fa 100644 --- a/actor-tests/src/test/scala-3/org/apache/pekko/util/LineNumberSpec.scala +++ b/actor-tests/src/test/scala-3/org/apache/pekko/util/LineNumberSpec.scala @@ -15,14 +15,14 @@ package org.apache.pekko.util import org.apache.pekko import pekko.testkit.PekkoSpec -import pekko.util.LineNumbers.* +import pekko.util.LineNumbers._ class LineNumberSpec extends PekkoSpec { "LineNumbers" when { "writing Scala" must { - import LineNumberSpecCodeForScala.* + import LineNumberSpecCodeForScala._ "work for small functions" in { LineNumbers(oneline) should ===(SourceFileLines("LineNumberSpecCodeForScala.scala", 22, 22)) diff --git a/actor-tests/src/test/scala/org/apache/pekko/PekkoExceptionSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/PekkoExceptionSpec.scala index 1c178ceb94a..8a0ec42f9a9 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/PekkoExceptionSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/PekkoExceptionSpec.scala @@ -36,7 +36,7 @@ class PekkoExceptionSpec extends AnyWordSpec with Matchers { } } - def verify(clazz: java.lang.Class[?]): Unit = { + def verify(clazz: java.lang.Class[_]): Unit = { clazz.getConstructor(Array(classOf[String]): _*) } } diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/AbstractActorPreRestartFinalSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/AbstractActorPreRestartFinalSpec.scala index f52b1452940..e6d3fb6d42a 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/actor/AbstractActorPreRestartFinalSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/actor/AbstractActorPreRestartFinalSpec.scala @@ -75,7 +75,7 @@ class AbstractActorPreRestartFinalSpec extends PekkoSpec with ImplicitSender { "be declared final via reflection" in { val method = classOf[AbstractActor].getDeclaredMethod( - "preRestart", classOf[Throwable], classOf[Option[?]]) + "preRestart", classOf[Throwable], classOf[Option[_]]) assert( java.lang.reflect.Modifier.isFinal(method.getModifiers), "preRestart(Throwable, Option[Any]) should be final in AbstractActor") @@ -103,7 +103,7 @@ class AbstractActorPreRestartFinalSpec extends PekkoSpec with ImplicitSender { "not be overridable in AbstractActor subclass (preRestart with Optional is the extension point)" in { // Verify that preRestart(Throwable, Optional[Any]) is NOT final val optionalMethod = classOf[AbstractActor].getDeclaredMethod( - "preRestart", classOf[Throwable], classOf[Optional[?]]) + "preRestart", classOf[Throwable], classOf[Optional[_]]) assert( !java.lang.reflect.Modifier.isFinal(optionalMethod.getModifiers), "preRestart(Throwable, Optional[Any]) should NOT be final in AbstractActor") @@ -146,7 +146,7 @@ class AbstractActorPreRestartFinalSpec extends PekkoSpec with ImplicitSender { "also have final preRestart(Throwable, Option[Any]) (inherited from AbstractActor)" in { val method = classOf[UntypedAbstractActor].getMethod( - "preRestart", classOf[Throwable], classOf[Option[?]]) + "preRestart", classOf[Throwable], classOf[Option[_]]) assert( java.lang.reflect.Modifier.isFinal(method.getModifiers), "preRestart(Throwable, Option[Any]) should be final in UntypedAbstractActor") diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/ActorMailboxSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/ActorMailboxSpec.scala index 21ad5613dcd..d299bc7616a 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/actor/ActorMailboxSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/actor/ActorMailboxSpec.scala @@ -242,7 +242,7 @@ class ActorMailboxSpec(conf: Config) extends PekkoSpec(conf) with DefaultTimeout def this() = this(ActorMailboxSpec.mailboxConf) - def checkMailboxQueue(props: Props, name: String, types: Seq[Class[?]]): MessageQueue = { + def checkMailboxQueue(props: Props, name: String, types: Seq[Class[_]]): MessageQueue = { val actor = system.actorOf(props, name) actor ! "ping" diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/DynamicAccessSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/DynamicAccessSpec.scala index 4517af50c21..2f1bf94099d 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/actor/DynamicAccessSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/actor/DynamicAccessSpec.scala @@ -82,7 +82,7 @@ class DynamicAccessSpec extends AnyWordSpec with Matchers with BeforeAndAfterAll case Failure(_: NoSuchMethodException) => dynamicAccess .createInstanceFor[TestSuperclass](fqcn, immutable.Seq((classOf[String], "string ctor argument"))) - case f: Failure[?] => f + case f: Failure[_] => f } } diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/ExtensionSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/ExtensionSpec.scala index 43c7789082e..1586d446839 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/actor/ExtensionSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/actor/ExtensionSpec.scala @@ -46,7 +46,7 @@ object InstanceCountingExtension extends ExtensionId[InstanceCountingExtension] override def createExtension(system: ExtendedActorSystem): InstanceCountingExtension = { new InstanceCountingExtension } - override def lookup: ExtensionId[? <: Extension] = this + override def lookup: ExtensionId[_ <: Extension] = this } class InstanceCountingExtension extends Extension { diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorHierarchySpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorHierarchySpec.scala index 9e46e814bdf..61d75642d7e 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorHierarchySpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorHierarchySpec.scala @@ -929,8 +929,8 @@ class SupervisorHierarchySpec extends PekkoSpec(SupervisorHierarchySpec.config) fsm ! FSM.SubscribeTransitionCallBack(system.actorOf(Props(new Actor { def receive = { - case s: FSM.CurrentState[?] => log.info("{}", s) - case t: FSM.Transition[?] => log.info("{}", t) + case s: FSM.CurrentState[_] => log.info("{}", s) + case t: FSM.Transition[_] => log.info("{}", t) } }))) diff --git a/actor-tests/src/test/scala/org/apache/pekko/dispatch/MailboxConfigSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/dispatch/MailboxConfigSpec.scala index 4720f9195af..ca2039c2efb 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/dispatch/MailboxConfigSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/dispatch/MailboxConfigSpec.scala @@ -128,7 +128,7 @@ abstract class MailboxSpec extends PekkoSpec with BeforeAndAfterAll with BeforeA def ensureInitialMailboxState(config: MailboxType, q: MessageQueue): Unit = { q should not be null q match { - case aQueue: BlockingQueue[?] => + case aQueue: BlockingQueue[_] => config match { case BoundedMailbox(capacity, _) => aQueue.remainingCapacity should ===(capacity) case UnboundedMailbox() => aQueue.remainingCapacity should ===(Int.MaxValue) diff --git a/actor-tests/src/test/scala/org/apache/pekko/io/UdpConnectedIntegrationSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/io/UdpConnectedIntegrationSpec.scala index 686cd47136b..d509c559582 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/io/UdpConnectedIntegrationSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/io/UdpConnectedIntegrationSpec.scala @@ -162,7 +162,7 @@ class UdpConnectedIntegrationSpec extends PekkoSpec(""" clientCommander ! UdpConnected.Send(ByteString("data to trigger fail"), 2) expectMsg(2) - // when a new server appears at the same port it should be able to receive + // when a new server appears at the same port it it should be able to receive val serverIncarnation2Handler = TestProbe() val serverIncarnation2 = bindUdp(serverAddress, serverIncarnation2Handler.ref) val dataToNewIncarnation = ByteString("Data to new incarnation") diff --git a/actor-tests/src/test/scala/org/apache/pekko/io/dns/DockerBindDnsService.scala b/actor-tests/src/test/scala/org/apache/pekko/io/dns/DockerBindDnsService.scala index 501aa8a9e78..ab27bb25142 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/io/dns/DockerBindDnsService.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/io/dns/DockerBindDnsService.scala @@ -19,7 +19,6 @@ import scala.concurrent.duration._ import scala.jdk.CollectionConverters._ import scala.util.Try import scala.util.control.NonFatal - import com.github.dockerjava.api.DockerClient import com.github.dockerjava.api.async.ResultCallback import com.github.dockerjava.api.command.CreateContainerCmd @@ -30,11 +29,10 @@ import com.github.dockerjava.httpclient5.ApacheDockerHttpClient import org.apache.pekko import pekko.actor.Props import pekko.io.dns.internal.DnsClient -import pekko.testkit.PekkoSpec import pekko.util.Timeout +import pekko.testkit.PekkoSpec import org.scalatest.concurrent.Eventually - import com.typesafe.config.Config abstract class DockerBindDnsService(config: Config) extends PekkoSpec(config) with Eventually { diff --git a/actor-tests/src/test/scala/org/apache/pekko/pattern/StatusReplySpec.scala b/actor-tests/src/test/scala/org/apache/pekko/pattern/StatusReplySpec.scala index ec88a1c9f9f..b014ea481c3 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/pattern/StatusReplySpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/pattern/StatusReplySpec.scala @@ -44,7 +44,7 @@ class StatusReplySpec extends PekkoSpec with ScalaFutures { } } "not throw exception if null" in { - (null: StatusReply[?]) match { + (null: StatusReply[_]) match { case StatusReply.Success(_) => fail() case StatusReply.Error(_) => fail() case _ => diff --git a/actor-tests/src/test/scala/org/apache/pekko/serialization/SerializationSetupSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/serialization/SerializationSetupSpec.scala index a2853cf155e..0b4a59bd79a 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/serialization/SerializationSetupSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/serialization/SerializationSetupSpec.scala @@ -46,7 +46,7 @@ final class FakeSerializer extends Serializer { Array(id.toByte) } - def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]) = { + def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]) = { require(bytes.length == 1) val id = bytes(0).toInt registry.get(id) diff --git a/actor-tests/src/test/scala/org/apache/pekko/serialization/SerializeSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/serialization/SerializeSpec.scala index a94ba683680..165d0e09bae 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/serialization/SerializeSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/serialization/SerializeSpec.scala @@ -223,7 +223,7 @@ class SerializeSpec extends PekkoSpec(SerializationTests.serializeConf) { ser.serializerFor(classOf[PlainMessage]).getClass should ===(classOf[NoopSerializer]) } - "resolve serializer for message extending class with binding" in { + "resolve serializer for message extending class with with binding" in { ser.serializerFor(classOf[ExtendedPlainMessage]).getClass should ===(classOf[NoopSerializer]) } @@ -389,7 +389,7 @@ class VerifySerializabilitySpec extends PekkoSpec(SerializationTests.verifySeria class ReferenceSerializationSpec extends PekkoSpec(SerializationTests.mostlyReferenceSystem) { val ser = SerializationExtension(system) - def serializerMustBe(toSerialize: Class[?], expectedSerializer: Class[?]) = + def serializerMustBe(toSerialize: Class[_], expectedSerializer: Class[_]) = ser.serializerFor(toSerialize).getClass should ===(expectedSerializer) "Serialization settings from reference.conf" must { @@ -428,7 +428,7 @@ class ReferenceSerializationSpec extends PekkoSpec(SerializationTests.mostlyRefe class AllowJavaSerializationSpec extends PekkoSpec(SerializationTests.allowJavaSerializationSystem) { val ser = SerializationExtension(system) - def serializerMustBe(toSerialize: Class[?], expectedSerializer: Class[?]) = + def serializerMustBe(toSerialize: Class[_], expectedSerializer: Class[_]) = ser.serializerFor(toSerialize).getClass should ===(expectedSerializer) val address = SerializationTests.Address("120", "Monroe Street", "Santa Clara", "95050") @@ -624,7 +624,7 @@ protected[pekko] class NoopSerializer extends Serializer { Array.empty[Byte] } - def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = null + def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = null } protected[pekko] class NoopSerializer2 extends Serializer { @@ -636,7 +636,7 @@ protected[pekko] class NoopSerializer2 extends Serializer { Array.empty[Byte] } - def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = null + def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = null } protected[pekko] class NoopSerializerSameId extends NoopSerializer @@ -657,7 +657,7 @@ class DeadlockSerializer(system: ExtendedActorSystem) extends Serializer { def toBinary(o: AnyRef): Array[Byte] = Array.empty[Byte] - def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = null + def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = null } object ConstructorSerializer { diff --git a/actor-tests/src/test/scala/org/apache/pekko/util/BoundedBlockingQueueSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/util/BoundedBlockingQueueSpec.scala index 4b92b2c19ba..7cbdadb2693 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/util/BoundedBlockingQueueSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/util/BoundedBlockingQueueSpec.scala @@ -742,7 +742,7 @@ trait BlockingHelpers { /** * Check that a Future does not complete within a set timespan. */ - def mustBlockFor(timeout: Span, action: Future[?])(implicit pos: Position): Unit = + def mustBlockFor(timeout: Span, action: Future[_])(implicit pos: Position): Unit = Exception.ignoring(classOf[TimeoutException]) { Await.ready(action, timeout) fail("Expected action to block for at least " + timeout.prettyString + " but it completed.") diff --git a/actor-tests/src/test/scala/org/apache/pekko/util/ByteStringInitializationSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/util/ByteStringInitializationSpec.scala index 071fbea89c4..b14b5e56f00 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/util/ByteStringInitializationSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/util/ByteStringInitializationSpec.scala @@ -29,7 +29,7 @@ class ByteStringInitializationSpec extends AnyWordSpec with Matchers { val cleanCl = new ClassLoader(null) { val outerCl = ByteStringInitializationSpec.this.getClass.getClassLoader val buffer = new Array[Byte](1000000) - override def loadClass(name: String): Class[?] = + override def loadClass(name: String): Class[_] = if (!name.startsWith("org.apache.pekko")) outerCl.loadClass(name) else { val classFile = name.replace(".", "/") + ".class" diff --git a/actor-tests/src/test/scala/org/apache/pekko/util/ByteStringSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/util/ByteStringSpec.scala index b5549e744cb..a5066552d8b 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/util/ByteStringSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/util/ByteStringSpec.scala @@ -210,7 +210,7 @@ class ByteStringSpec extends AnyWordSpec with Matchers with Checkers { (!strict || (bsAIt.toSeq -> bsBIt.toSeq) == (vecAIt.toSeq -> vecBIt.toSeq)) } - def likeVecBld(body: Builder[Byte, ?] => Unit): Boolean = { + def likeVecBld(body: Builder[Byte, _] => Unit): Boolean = { val bsBuilder = ByteString.newBuilder val vecBuilder = Vector.newBuilder[Byte] diff --git a/actor-tests/src/test/scala/org/apache/pekko/util/SWARUtilSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/util/SWARUtilSpec.scala index 6ce67621375..a88d6b5e8fb 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/util/SWARUtilSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/util/SWARUtilSpec.scala @@ -19,8 +19,8 @@ package org.apache.pekko.util import java.nio.ByteOrder -import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec +import org.scalatest.matchers.should.Matchers class SWARUtilSpec extends AnyWordSpec with Matchers { diff --git a/actor-tests/src/test/scala/org/apache/pekko/util/WildcardIndexSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/util/WildcardIndexSpec.scala index 9ee1fe4bae3..7757db7dafb 100644 --- a/actor-tests/src/test/scala/org/apache/pekko/util/WildcardIndexSpec.scala +++ b/actor-tests/src/test/scala/org/apache/pekko/util/WildcardIndexSpec.scala @@ -20,9 +20,9 @@ class WildcardIndexSpec extends AnyWordSpec with Matchers { "wildcard index" must { "allow to insert elements using Arrays of strings" in { - emptyIndex.insert(Array("a", "b"), 1) shouldBe a[WildcardIndex[?]] - emptyIndex.insert(Array("a"), 1) shouldBe a[WildcardIndex[?]] - emptyIndex.insert(Array.empty[String], 1) shouldBe a[WildcardIndex[?]] + emptyIndex.insert(Array("a", "b"), 1) shouldBe a[WildcardIndex[_]] + emptyIndex.insert(Array("a"), 1) shouldBe a[WildcardIndex[_]] + emptyIndex.insert(Array.empty[String], 1) shouldBe a[WildcardIndex[_]] } "allow to find inserted elements" in { diff --git a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/GracefulStopDocTest.java b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/GracefulStopDocTest.java index d501bc6c62d..2352faa2ce4 100644 --- a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/GracefulStopDocTest.java +++ b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/GracefulStopDocTest.java @@ -86,7 +86,6 @@ private Behavior onPostStop() { return this; } } - // #master-actor public static void main(String[] args) throws Exception { @@ -131,7 +130,6 @@ private Behavior onPostStop() { return this; } } - // #worker-actor interface IllustrateWatch { diff --git a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/InteractionPatternsAskWithStatusTest.java b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/InteractionPatternsAskWithStatusTest.java index 6906a2811f1..d4ddeec0b1c 100644 --- a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/InteractionPatternsAskWithStatusTest.java +++ b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/InteractionPatternsAskWithStatusTest.java @@ -184,7 +184,6 @@ private Behavior onGiveMeCookies(CookieFabric.GiveMeCookie return this; } } - // #standalone-ask-with-status static class NotShown { @@ -210,7 +209,6 @@ else if (failure instanceof StatusReply.ErrorMessage) else System.out.println("Boo! didn't get cookies in time. " + failure); }); } - // #standalone-ask-with-status public void askAndMapInvalid( diff --git a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/IntroTest.java b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/IntroTest.java index 03386d1cf9f..fec211298a9 100644 --- a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/IntroTest.java +++ b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/IntroTest.java @@ -78,7 +78,6 @@ private Behavior onGreet(Greet command) { return this; } } - // #hello-world-actor // #hello-world-bot @@ -112,7 +111,6 @@ private Behavior onGreeted(HelloWorld.Greeted message) { } } } - // #hello-world-bot // #hello-world-main @@ -139,7 +137,6 @@ private HelloWorldMain(ActorContext context) { super(context); greeter = context.spawn(HelloWorld.create(), "greeter"); } - // #hello-world-main-setup @Override @@ -155,7 +152,6 @@ private Behavior onStart(SayHello command) { } // #hello-world-main-setup } - // #hello-world-main-setup // #hello-world-main @@ -172,7 +168,6 @@ public SayHello(String name) { this.name = name; } } - // #hello-world-main-with-dispatchers public static Behavior create() { @@ -229,7 +224,6 @@ public GetSession(String screenName, ActorRef replyTo) { this.replyTo = replyTo; } } - // #chatroom-protocol // #chatroom-behavior private static final class PublishSessionMessage implements RoomCommand { @@ -241,7 +235,6 @@ public PublishSessionMessage(String screenName, String message) { this.message = message; } } - // #chatroom-behavior // #chatroom-protocol @@ -290,7 +283,6 @@ private static final class NotifyClient implements SessionCommand { this.message = message; } } - // #chatroom-protocol // #chatroom-behavior @@ -359,7 +351,6 @@ private static Behavior onNotifyClient( } } } - // #chatroom-behavior // #chatroom-gabbler @@ -399,7 +390,6 @@ private Behavior onMessagePosted(ChatRoom.MessagePosted m return Behaviors.stopped(); } } - // #chatroom-gabbler // #chatroom-main diff --git a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/LoggingDocExamples.java b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/LoggingDocExamples.java index d6477792dcb..b087ee6f48e 100644 --- a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/LoggingDocExamples.java +++ b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/LoggingDocExamples.java @@ -58,7 +58,6 @@ private Behavior onReceive(String message) { return this; } } - // #context-log // #logger-name @@ -87,7 +86,6 @@ private Behavior onReceive(String message) { return this; } } - // #logger-name // #logger-factory @@ -108,7 +106,6 @@ void run() { }); } } - // #logger-factory static void logMessages() { diff --git a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/OOIntroTest.java b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/OOIntroTest.java index c9b62232cc6..f04b4057762 100644 --- a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/OOIntroTest.java +++ b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/OOIntroTest.java @@ -50,7 +50,6 @@ public GetSession(String screenName, ActorRef replyTo) { this.replyTo = replyTo; } } - // #chatroom-protocol // #chatroom-behavior private static final class PublishSessionMessage implements RoomCommand { @@ -62,7 +61,6 @@ public PublishSessionMessage(String screenName, String message) { this.message = message; } } - // #chatroom-behavior // #chatroom-protocol @@ -111,7 +109,6 @@ private static final class NotifyClient implements SessionCommand { this.message = message; } } - // #chatroom-protocol // #chatroom-behavior @@ -200,7 +197,6 @@ private Behavior onNotifyClient(NotifyClient notification) { } } } - // #chatroom-behavior // #chatroom-gabbler @@ -240,7 +236,6 @@ private Behavior onMessagePosted(ChatRoom.MessagePosted m return Behaviors.stopped(); } } - // #chatroom-gabbler // #chatroom-main diff --git a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/SpawnProtocolDocTest.java b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/SpawnProtocolDocTest.java index 8991cda4b95..9d628f1945a 100644 --- a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/SpawnProtocolDocTest.java +++ b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/SpawnProtocolDocTest.java @@ -49,7 +49,6 @@ public static Behavior create() { }); } } - // #main public static void main(String[] args) throws Exception { diff --git a/actor-typed-tests/src/test/java/org/apache/pekko/actor/typed/eventstream/EventStreamSuperClassDocTest.java b/actor-typed-tests/src/test/java/org/apache/pekko/actor/typed/eventstream/EventStreamSuperClassDocTest.java index 0d4d7ac89bc..15f800f1179 100644 --- a/actor-typed-tests/src/test/java/org/apache/pekko/actor/typed/eventstream/EventStreamSuperClassDocTest.java +++ b/actor-typed-tests/src/test/java/org/apache/pekko/actor/typed/eventstream/EventStreamSuperClassDocTest.java @@ -33,7 +33,6 @@ import org.apache.pekko.actor.Dropped; import org.apache.pekko.actor.SuppressedDeadLetter; import org.apache.pekko.actor.UnhandledMessage; - // #listen-to-super-class-imports public class EventStreamSuperClassDocTest { diff --git a/actor-typed-tests/src/test/scala-3/docs/org/apache/pekko/typed/InteractionPatterns3Spec.scala b/actor-typed-tests/src/test/scala-3/docs/org/apache/pekko/typed/InteractionPatterns3Spec.scala index 5adef4dd9fa..cbe5a08dc46 100644 --- a/actor-typed-tests/src/test/scala-3/docs/org/apache/pekko/typed/InteractionPatterns3Spec.scala +++ b/actor-typed-tests/src/test/scala-3/docs/org/apache/pekko/typed/InteractionPatterns3Spec.scala @@ -16,7 +16,7 @@ package docs.org.apache.pekko.typed import java.net.URI import scala.concurrent.Future -import scala.concurrent.duration.* +import scala.concurrent.duration._ import scala.util.Failure import scala.util.Success @@ -47,7 +47,7 @@ object DummyData3 { } class InteractionPatterns3Spec extends ScalaTestWithActorTestKit with AnyWordSpecLike with LogCapturing { - import DummyData3.* + import DummyData3._ private class DummyContext[T](val self: ActorRef[T]) "The interaction patterns docs" must { @@ -206,7 +206,7 @@ class InteractionPatterns3Spec extends ScalaTestWithActorTestKit with AnyWordSpe target: ActorRef[Buncher.Batch], after: FiniteDuration, maxSize: Int) { - import Buncher.* + import Buncher._ private def idle(): Behavior[Command] = { Behaviors.receiveMessage[Command] { message => @@ -222,7 +222,7 @@ class InteractionPatterns3Spec extends ScalaTestWithActorTestKit with AnyWordSpe idle() case m => val newBuffer = buffer :+ m - if newBuffer.size == maxSize then { + if (newBuffer.size == maxSize) { timers.cancel(TimerKey) target ! Batch(newBuffer) idle() @@ -473,7 +473,7 @@ class InteractionPatterns3Spec extends ScalaTestWithActorTestKit with AnyWordSpe def apply(): Behaviors.Receive[CookieFabric.GiveMeCookies] = Behaviors.receiveMessage { message => - if message.count >= 5 then + if (message.count >= 5) message.replyTo ! InvalidRequest("Too many cookies.") else message.replyTo ! Cookies(message.count) @@ -490,14 +490,14 @@ class InteractionPatterns3Spec extends ScalaTestWithActorTestKit with AnyWordSpe // #standalone-ask import org.apache.pekko - import pekko.actor.typed.scaladsl.AskPattern.* + import pekko.actor.typed.scaladsl.AskPattern._ import pekko.util.Timeout // asking someone requires a timeout if the timeout hits without response // the ask is failed with a TimeoutException implicit val timeout: Timeout = 3.seconds // implicit ActorSystem in scope - implicit val system: ActorSystem[?] = theSystem + implicit val system: ActorSystem[_] = theSystem val result: Future[CookieFabric.Reply] = cookieFabric.ask(ref => CookieFabric.GiveMeCookies(3, ref)) @@ -538,7 +538,7 @@ class InteractionPatterns3Spec extends ScalaTestWithActorTestKit with AnyWordSpe def apply(): Behaviors.Receive[CookieFabric.GiveMeCookies] = Behaviors.receiveMessage { message => - if message.count >= 5 then + if (message.count >= 5) message.replyTo ! StatusReply.Error("Too many cookies.") else message.replyTo ! StatusReply.Success(Cookies(message.count)) @@ -555,14 +555,14 @@ class InteractionPatterns3Spec extends ScalaTestWithActorTestKit with AnyWordSpe // #standalone-ask-with-status import org.apache.pekko - import pekko.actor.typed.scaladsl.AskPattern.* + import pekko.actor.typed.scaladsl.AskPattern._ import pekko.util.Timeout // asking someone requires a timeout if the timeout hits without response // the ask is failed with a TimeoutException implicit val timeout: Timeout = 3.seconds // implicit ActorSystem in scope - implicit val system: ActorSystem[?] = theSystem + implicit val system: ActorSystem[_] = theSystem val result: Future[CookieFabric.Cookies] = cookieFabric.askWithStatus(ref => CookieFabric.GiveMeCookies(3, ref)) @@ -622,7 +622,7 @@ class InteractionPatterns3Spec extends ScalaTestWithActorTestKit with AnyWordSpe Behaviors.receive { (context, command) => command match { case Update(value, replyTo) => - if operationsInProgress == MaxOperationsInProgress then { + if (operationsInProgress == MaxOperationsInProgress) { replyTo ! UpdateFailure(value.id, s"Max $MaxOperationsInProgress concurrent operations supported") Behaviors.same } else { diff --git a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/InteractionPatternsSpec.scala b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/InteractionPatternsSpec.scala index 7db4aa25afc..ee7844e1ff3 100644 --- a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/InteractionPatternsSpec.scala +++ b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/InteractionPatternsSpec.scala @@ -495,7 +495,7 @@ class InteractionPatternsSpec extends ScalaTestWithActorTestKit with AnyWordSpec // the ask is failed with a TimeoutException implicit val timeout: Timeout = 3.seconds // implicit ActorSystem in scope - implicit val system: ActorSystem[?] = theSystem + implicit val system: ActorSystem[_] = theSystem val result: Future[CookieFabric.Reply] = cookieFabric.ask(ref => CookieFabric.GiveMeCookies(3, ref)) @@ -560,7 +560,7 @@ class InteractionPatternsSpec extends ScalaTestWithActorTestKit with AnyWordSpec // the ask is failed with a TimeoutException implicit val timeout: Timeout = 3.seconds // implicit ActorSystem in scope - implicit val system: ActorSystem[?] = theSystem + implicit val system: ActorSystem[_] = theSystem val result: Future[CookieFabric.Cookies] = cookieFabric.askWithStatus(ref => CookieFabric.GiveMeCookies(3, ref)) diff --git a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/LoggingDocExamples.scala b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/LoggingDocExamples.scala index ea59d532fb5..f4e62b32794 100644 --- a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/LoggingDocExamples.scala +++ b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/LoggingDocExamples.scala @@ -104,7 +104,7 @@ object LoggingDocExamples { } def withMdc(): Unit = { - val system: ActorSystem[?] = ??? + val system: ActorSystem[_] = ??? // #withMdc val staticMdc = Map("startTime" -> system.startTime.toString) @@ -118,7 +118,7 @@ object LoggingDocExamples { } def logging(): Unit = { - implicit val system: ActorSystem[?] = ??? + implicit val system: ActorSystem[_] = ??? final case class Message(s: String) val ref: ActorRef[Message] = ??? diff --git a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/StyleGuideDocExamples.scala b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/StyleGuideDocExamples.scala index 49d58c530f0..5d950775f7d 100644 --- a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/StyleGuideDocExamples.scala +++ b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/StyleGuideDocExamples.scala @@ -311,7 +311,7 @@ object StyleGuideDocExamples { // #behavior-factory-method object Usage { - val context: ActorContext[?] = ??? + val context: ActorContext[_] = ??? val doneRef: ActorRef[Done] = ??? // #behavior-factory-method-spawn diff --git a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/extensions/ExtensionDocSpec.scala b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/extensions/ExtensionDocSpec.scala index 7e8b20a20ce..d7d6f831e02 100644 --- a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/extensions/ExtensionDocSpec.scala +++ b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/extensions/ExtensionDocSpec.scala @@ -33,16 +33,16 @@ class ExpensiveDatabaseConnection { //#extension-id object DatabasePool extends ExtensionId[DatabasePool] { // will only be called once - def createExtension(system: ActorSystem[?]): DatabasePool = new DatabasePool(system) + def createExtension(system: ActorSystem[_]): DatabasePool = new DatabasePool(system) // Java API - def get(system: ActorSystem[?]): DatabasePool = apply(system) + def get(system: ActorSystem[_]): DatabasePool = apply(system) } //#extension-id @nowarn //#extension -class DatabasePool(system: ActorSystem[?]) extends Extension { +class DatabasePool(system: ActorSystem[_]) extends Extension { // database configuration can be loaded from config // from the actor system private val _connection = new ExpensiveDatabaseConnection() diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/AskSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/AskSpec.scala index 8800f5d962c..a03dee28414 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/AskSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/AskSpec.scala @@ -109,7 +109,7 @@ class AskSpec extends ScalaTestWithActorTestKit(""" "fail the future if the actor doesn't exist" in { val noSuchActor: ActorRef[Msg] = system match { - case adaptedSys: ActorSystemAdapter[?] => + case adaptedSys: ActorSystemAdapter[_] => import pekko.actor.typed.scaladsl.adapter._ adaptedSys.system.provider.resolveActorRef("/foo/bar") case _ => diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/ExtensionsSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/ExtensionsSpec.scala index 781ea42e070..8a6eff66fbc 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/ExtensionsSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/ExtensionsSpec.scala @@ -32,17 +32,17 @@ import com.typesafe.config.{ Config, ConfigFactory } class DummyExtension1 extends Extension object DummyExtension1 extends ExtensionId[DummyExtension1] { - def createExtension(system: ActorSystem[?]) = new DummyExtension1 - def get(system: ActorSystem[?]): DummyExtension1 = apply(system) + def createExtension(system: ActorSystem[_]) = new DummyExtension1 + def get(system: ActorSystem[_]): DummyExtension1 = apply(system) } -class DummyExtension1Setup(factory: ActorSystem[?] => DummyExtension1) +class DummyExtension1Setup(factory: ActorSystem[_] => DummyExtension1) extends AbstractExtensionSetup[DummyExtension1](DummyExtension1, factory) class DummyExtension1ViaSetup extends DummyExtension1 class SlowExtension extends Extension object SlowExtension extends ExtensionId[SlowExtension] { - def createExtension(system: ActorSystem[?]) = { + def createExtension(system: ActorSystem[_]) = { Thread.sleep(25) new SlowExtension } @@ -50,29 +50,29 @@ object SlowExtension extends ExtensionId[SlowExtension] { class FailingToLoadExtension extends Extension object FailingToLoadExtension extends ExtensionId[FailingToLoadExtension] { - def createExtension(system: ActorSystem[?]) = { + def createExtension(system: ActorSystem[_]) = { throw new RuntimeException("I cannot be trusted!") } } class MultiExtension(val n: Int) extends Extension class MultiExtensionId(n: Int) extends ExtensionId[MultiExtension] { - def createExtension(system: ActorSystem[?]): MultiExtension = new MultiExtension(n) + def createExtension(system: ActorSystem[_]): MultiExtension = new MultiExtension(n) } object InstanceCountingExtension extends ExtensionId[DummyExtension1] { val createCount = new AtomicInteger(0) - override def createExtension(system: ActorSystem[?]): DummyExtension1 = { + override def createExtension(system: ActorSystem[_]): DummyExtension1 = { createCount.addAndGet(1) new DummyExtension1 } } object AccessSystemFromConstructorExtensionId extends ExtensionId[AccessSystemFromConstructor] { - override def createExtension(system: ActorSystem[?]): AccessSystemFromConstructor = + override def createExtension(system: ActorSystem[_]): AccessSystemFromConstructor = new AccessSystemFromConstructor(system) } -class AccessSystemFromConstructor(system: ActorSystem[?]) extends Extension { +class AccessSystemFromConstructor(system: ActorSystem[_]) extends Extension { system.log.info("I log from the constructor") system.receptionist ! Receptionist.Find(ServiceKey[String]("i-just-made-it-up"), system.deadLetters) // or touch the receptionist! } @@ -267,7 +267,7 @@ class ExtensionsSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike with } def withEmptyActorSystem[T](name: String, config: Option[Config] = None, setup: Option[ActorSystemSetup] = None)( - f: ActorSystem[?] => T): T = { + f: ActorSystem[_] => T): T = { val bootstrap = config match { case Some(c) => BootstrapSetup(c) diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/LocalActorRefProviderLogMessagesSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/LocalActorRefProviderLogMessagesSpec.scala index 8a5b6fb60ba..c2a05fd6c82 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/LocalActorRefProviderLogMessagesSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/LocalActorRefProviderLogMessagesSpec.scala @@ -39,7 +39,7 @@ class LocalActorRefProviderLogMessagesSpec "An LocalActorRefProvider" must { "logs on dedicated 'serialization' logger of unknown path" in { - val provider = system.asInstanceOf[ActorSystemAdapter[?]].provider + val provider = system.asInstanceOf[ActorSystemAdapter[_]].provider LoggingTestKit .debug("of unknown (invalid) path [dummy/path]") @@ -50,7 +50,7 @@ class LocalActorRefProviderLogMessagesSpec } "logs on dedicated 'serialization' logger when path doesn't match existing actor" in { - val provider = system.asInstanceOf[ActorSystemAdapter[?]].provider + val provider = system.asInstanceOf[ActorSystemAdapter[_]].provider val invalidPath = provider.rootPath / "user" / "invalid" LoggingTestKit @@ -63,10 +63,10 @@ class LocalActorRefProviderLogMessagesSpec "logs on dedicated 'serialization' logger when of foreign path" in { - val otherSystem = ActorTestKit("otherSystem").system.asInstanceOf[ActorSystemAdapter[?]] + val otherSystem = ActorTestKit("otherSystem").system.asInstanceOf[ActorSystemAdapter[_]] val invalidPath = otherSystem.provider.rootPath / "user" / "foo" - val provider = system.asInstanceOf[ActorSystemAdapter[?]].provider + val provider = system.asInstanceOf[ActorSystemAdapter[_]].provider try { LoggingTestKit .debug("Resolve (deserialization) of foreign path [pekko://otherSystem/user/foo]") diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/MailboxSelectorSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/MailboxSelectorSpec.scala index acdb1ad0800..0b7bfbb04f5 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/MailboxSelectorSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/MailboxSelectorSpec.scala @@ -44,7 +44,7 @@ class MailboxSelectorSpec extends ScalaTestWithActorTestKit(""" Behaviors.receiveMessage[WhatsYourMailbox] { case WhatsYourMailbox(replyTo) => val mailbox = context match { - case adapter: ActorContextAdapter[?] => + case adapter: ActorContextAdapter[_] => adapter.classicActorContext match { case cell: ActorCell => cell.mailbox.messageQueue diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/SupervisionSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/SupervisionSpec.scala index 9ced7d25581..30c9d61eee6 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/SupervisionSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/SupervisionSpec.scala @@ -51,8 +51,8 @@ object SupervisionSpec { case object IncrementState extends Command case object GetState extends Command final case class CreateChild[T](behavior: Behavior[T], name: String) extends Command - final case class Watch(ref: ActorRef[?]) extends Command - final case class WatchWith(ref: ActorRef[?], cmd: Command) extends Command + final case class Watch(ref: ActorRef[_]) extends Command + final case class WatchWith(ref: ActorRef[_], cmd: Command) extends Command sealed trait Event final case class Pong(n: Int) extends Event @@ -1438,7 +1438,7 @@ class SupervisionSpec extends ScalaTestWithActorTestKit(""" LoggingTestKit.error[DeathPactException].expect { actor ! "boom" - val child = probe.expectMessageType[ActorRef[?]] + val child = probe.expectMessageType[ActorRef[_]] probe.expectTerminated(child, 3.seconds) } actor ! "ping" diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/DurableProducerControllerSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/DurableProducerControllerSpec.scala index 429d83fdb62..f15c0141970 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/DurableProducerControllerSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/DurableProducerControllerSpec.scala @@ -98,7 +98,7 @@ class DurableProducerControllerSpec val durable = TestDurableProducerQueue[TestConsumer.Job]( Duration.Zero, stateHolder, - (_: DurableProducerQueue.Command[?]) => false) + (_: DurableProducerQueue.Command[_]) => false) val producerController = spawn(ProducerController[TestConsumer.Job](producerId, Some(durable)), s"producerController-$idCount") @@ -183,7 +183,7 @@ class DurableProducerControllerSpec TestDurableProducerQueue[TestConsumer.Job]( Duration.Zero, stateHolder, - (_: DurableProducerQueue.Command[?]) => false) + (_: DurableProducerQueue.Command[_]) => false) val producerController = spawn( diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/DurableWorkPullingSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/DurableWorkPullingSpec.scala index 0b6ba0d4366..264e4e64eb4 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/DurableWorkPullingSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/DurableWorkPullingSpec.scala @@ -168,7 +168,7 @@ class DurableWorkPullingSpec val durable = TestDurableProducerQueue[TestConsumer.Job]( Duration.Zero, stateHolder, - (_: DurableProducerQueue.Command[?]) => false) + (_: DurableProducerQueue.Command[_]) => false) val workPullingController = spawn( @@ -290,7 +290,7 @@ class DurableWorkPullingSpec val durable = TestDurableProducerQueue[TestConsumer.Job]( Duration.Zero, stateHolder, - (_: DurableProducerQueue.Command[?]) => false) + (_: DurableProducerQueue.Command[_]) => false) val workPullingController = spawn( diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/ReliableDeliveryRandomSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/ReliableDeliveryRandomSpec.scala index d229e36dbfa..0aa75315c18 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/ReliableDeliveryRandomSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/ReliableDeliveryRandomSpec.scala @@ -106,7 +106,7 @@ class ReliableDeliveryRandomSpec(config: Config) // RandomFlakyNetwork to simulate lost messages from producerController to consumerController val consumerDrop: Any => Double = { - case _: ConsumerController.SequencedMessage[?] => consumerDropProbability + case _: ConsumerController.SequencedMessage[_] => consumerDropProbability case _ => 0.0 } @@ -124,7 +124,7 @@ class ReliableDeliveryRandomSpec(config: Config) val producerDrop: Any => Double = { case _: ProducerControllerImpl.Request => producerDropProbability case _: ProducerControllerImpl.Resend => producerDropProbability - case _: ProducerController.RegisterConsumer[?] => producerDropProbability + case _: ProducerController.RegisterConsumer[_] => producerDropProbability case _ => 0.0 } diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/internal/ActorSystemSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/internal/ActorSystemSpec.scala index 094624d9674..6ea40fabf4c 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/internal/ActorSystemSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/internal/ActorSystemSpec.scala @@ -193,7 +193,7 @@ class ActorSystemSpec case (context, WhatsYourMailbox(replyTo)) => replyTo ! context - .asInstanceOf[ActorContextImpl[?]] + .asInstanceOf[ActorContextImpl[_]] .classicActorContext .asInstanceOf[Dispatch] .mailbox diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/internal/receptionist/LocalReceptionistSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/internal/receptionist/LocalReceptionistSpec.scala index 2215a7cf800..fc6f1a82cd3 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/internal/receptionist/LocalReceptionistSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/internal/receptionist/LocalReceptionistSpec.scala @@ -208,7 +208,7 @@ class LocalReceptionistSpec extends ScalaTestWithActorTestKit with AnyWordSpecLi class LocalReceptionistBehaviorSpec extends AnyWordSpec with Matchers with LogCapturing { import LocalReceptionistSpec._ - def assertEmpty(inboxes: TestInbox[?]*): Unit = { + def assertEmpty(inboxes: TestInbox[_]*): Unit = { inboxes.foreach(i => withClue(s"inbox $i had messages")(i.hasMessages should be(false))) } diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/MailboxSelectorSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/MailboxSelectorSpec.scala index be93d456e55..32f549bc5b1 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/MailboxSelectorSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/MailboxSelectorSpec.scala @@ -74,9 +74,9 @@ class MailboxSelectorSpec(config: Config) case class WhatsYourMailbox(replyTo: ActorRef[MessageQueue]) extends Command case class WhatsYourDispatcher(replyTo: ActorRef[String]) extends Command - private def extract[R](context: ActorContext[?], f: ActorCell => R): R = { + private def extract[R](context: ActorContext[_], f: ActorCell => R): R = { context match { - case adapter: ActorContextAdapter[?] => + case adapter: ActorContextAdapter[_] => adapter.classicActorContext match { case cell: ActorCell => f(cell) case unexpected => throw new RuntimeException(s"Unexpected: $unexpected") diff --git a/actor-typed/src/main/scala-3/org/apache/pekko/actor/typed/internal/receptionist/Platform.scala b/actor-typed/src/main/scala-3/org/apache/pekko/actor/typed/internal/receptionist/Platform.scala index 6ee2282ddf1..1ae72d69214 100644 --- a/actor-typed/src/main/scala-3/org/apache/pekko/actor/typed/internal/receptionist/Platform.scala +++ b/actor-typed/src/main/scala-3/org/apache/pekko/actor/typed/internal/receptionist/Platform.scala @@ -23,11 +23,11 @@ import pekko.annotation.InternalApi @InternalApi private[receptionist] object Platform { type Aux[P] = AbstractServiceKey { type Protocol = P } - type Service[K <: Aux[?]] = K match { + type Service[K <: Aux[_]] = K match { case Aux[t] => ActorRef[t] } - type Subscriber[K <: Aux[?]] = K match { + type Subscriber[K <: Aux[_]] = K match { case Aux[t] => ActorRef[ReceptionistMessages.Listing[t]] } } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/ActorRef.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/ActorRef.scala index 3d369223b90..b25f0560186 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/ActorRef.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/ActorRef.scala @@ -32,7 +32,7 @@ import pekko.annotation.DoNotInherit * Not for user extension */ @DoNotInherit -trait ActorRef[-T] extends RecipientRef[T] with java.lang.Comparable[ActorRef[?]] with java.io.Serializable { +trait ActorRef[-T] extends RecipientRef[T] with java.lang.Comparable[ActorRef[_]] with java.io.Serializable { this: InternalRecipientRef[T] => /** diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/ActorRefResolver.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/ActorRefResolver.scala index ffa931d9387..aa9769d3439 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/ActorRefResolver.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/ActorRefResolver.scala @@ -18,9 +18,9 @@ import pekko.actor.{ ActorRefWithCell, ExtendedActorSystem } import pekko.annotation.{ DoNotInherit, InternalApi } object ActorRefResolver extends ExtensionId[ActorRefResolver] { - def get(system: ActorSystem[?]): ActorRefResolver = apply(system) + def get(system: ActorSystem[_]): ActorRefResolver = apply(system) - override def createExtension(system: ActorSystem[?]): ActorRefResolver = + override def createExtension(system: ActorSystem[_]): ActorRefResolver = new ActorRefResolverImpl(system) } @@ -53,7 +53,7 @@ abstract class ActorRefResolver extends Extension { /** * INTERNAL API */ -@InternalApi private[pekko] class ActorRefResolverImpl(system: ActorSystem[?]) extends ActorRefResolver { +@InternalApi private[pekko] class ActorRefResolverImpl(system: ActorSystem[_]) extends ActorRefResolver { import pekko.actor.typed.scaladsl.adapter._ private val classicSystem = system.toClassic.asInstanceOf[ExtendedActorSystem] @@ -93,7 +93,7 @@ abstract class ActorRefResolver extends Extension { } object ActorRefResolverSetup { - def apply[T <: Extension](createExtension: ActorSystem[?] => ActorRefResolver): ActorRefResolverSetup = + def apply[T <: Extension](createExtension: ActorSystem[_] => ActorRefResolver): ActorRefResolverSetup = new ActorRefResolverSetup(sys => createExtension(sys)) } @@ -103,5 +103,5 @@ object ActorRefResolverSetup { * to replace the default implementation of the [[ActorRefResolver]] extension. Intended * for tests that need to replace extension with stub/mock implementations. */ -final class ActorRefResolverSetup(createExtension: java.util.function.Function[ActorSystem[?], ActorRefResolver]) +final class ActorRefResolverSetup(createExtension: java.util.function.Function[ActorSystem[_], ActorRefResolver]) extends ExtensionSetup[ActorRefResolver](ActorRefResolver, createExtension) diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/BehaviorInterceptor.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/BehaviorInterceptor.scala index 421b2a11fec..b25a24a50aa 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/BehaviorInterceptor.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/BehaviorInterceptor.scala @@ -102,7 +102,7 @@ object BehaviorInterceptor { */ @DoNotInherit trait PreStartTarget[T] { - def start(ctx: TypedActorContext[?]): Behavior[T] + def start(ctx: TypedActorContext[_]): Behavior[T] } /** @@ -112,7 +112,7 @@ object BehaviorInterceptor { */ @DoNotInherit trait ReceiveTarget[T] { - def apply(ctx: TypedActorContext[?], msg: T): Behavior[T] + def apply(ctx: TypedActorContext[_], msg: T): Behavior[T] /** * INTERNAL API @@ -123,7 +123,7 @@ object BehaviorInterceptor { * is taking place. */ @InternalApi - private[pekko] def signalRestart(ctx: TypedActorContext[?]): Unit + private[pekko] def signalRestart(ctx: TypedActorContext[_]): Unit } /** @@ -133,7 +133,7 @@ object BehaviorInterceptor { */ @DoNotInherit trait SignalTarget[T] { - def apply(ctx: TypedActorContext[?], signal: Signal): Behavior[T] + def apply(ctx: TypedActorContext[_], signal: Signal): Behavior[T] } } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/Extensions.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/Extensions.scala index 92a6c112e9f..e1cfa9e880b 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/Extensions.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/Extensions.scala @@ -120,12 +120,12 @@ abstract class ExtensionId[T <: Extension] { /** * Create the extension, will be invoked at most one time per actor system where the extension is registered. */ - def createExtension(system: ActorSystem[?]): T + def createExtension(system: ActorSystem[_]): T /** * Lookup or create an instance of the extension identified by this id. */ - final def apply(system: ActorSystem[?]): T = system.registerExtension(this) + final def apply(system: ActorSystem[_]): T = system.registerExtension(this) override final def hashCode: Int = System.identityHashCode(this) override final def equals(other: Any): Boolean = this eq other.asInstanceOf[AnyRef] @@ -163,7 +163,7 @@ trait Extensions { * Returns whether the specified extension is already registered, this method can potentially block, waiting for the initialization * of the payload, if is in the process of registration from another Thread of execution */ - def hasExtension(ext: ExtensionId[? <: Extension]): Boolean + def hasExtension(ext: ExtensionId[_ <: Extension]): Boolean } /** @@ -174,7 +174,7 @@ trait Extensions { */ abstract class ExtensionSetup[T <: Extension]( val extId: ExtensionId[T], - val createExtension: java.util.function.Function[ActorSystem[?], T]) + val createExtension: java.util.function.Function[ActorSystem[_], T]) extends Setup /** @@ -183,5 +183,5 @@ abstract class ExtensionSetup[T <: Extension]( * implementation of the extension. Intended for tests that need to replace * extension with stub/mock implementations. */ -abstract class AbstractExtensionSetup[T <: Extension](extId: ExtensionId[T], createExtension: ActorSystem[?] => T) +abstract class AbstractExtensionSetup[T <: Extension](extId: ExtensionId[T], createExtension: ActorSystem[_] => T) extends ExtensionSetup[T](extId, createExtension.apply) diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/SpawnProtocol.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/SpawnProtocol.scala index cf792d9a1c6..3cab20efceb 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/SpawnProtocol.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/SpawnProtocol.scala @@ -47,7 +47,7 @@ object SpawnProtocol { * If `name` is an empty string an anonymous actor (with automatically generated name) will be created. * * If the `name` is already taken of an existing actor a unique name will be used by appending a suffix - * to the `name`. The exact format or value of the suffix is an implementation detail that is + * to the the `name`. The exact format or value of the suffix is an implementation detail that is * undefined. This means that reusing the same name for several actors will not result in * `InvalidActorNameException`, but it's better to use unique names to begin with. */ diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/ConsumerController.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/ConsumerController.scala index 72ae6b08ffb..94ccc54ed53 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/ConsumerController.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/ConsumerController.scala @@ -204,7 +204,7 @@ object ConsumerController { * Scala API: Factory method from config `pekko.reliable-delivery.consumer-controller` * of the `ActorSystem`. */ - def apply(system: ActorSystem[?]): Settings = + def apply(system: ActorSystem[_]): Settings = apply(system.settings.config.getConfig("pekko.reliable-delivery.consumer-controller")) /** @@ -223,7 +223,7 @@ object ConsumerController { * Java API: Factory method from config `pekko.reliable-delivery.producer-controller` * of the `ActorSystem`. */ - def create(system: ActorSystem[?]): Settings = + def create(system: ActorSystem[_]): Settings = apply(system) /** diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/DurableProducerQueue.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/DurableProducerQueue.scala index 82665b917f6..cc51c43095c 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/DurableProducerQueue.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/DurableProducerQueue.scala @@ -173,7 +173,7 @@ object DurableProducerQueue { override def equals(obj: Any): Boolean = { obj match { - case other: MessageSent[?] => + case other: MessageSent[_] => seqNr == other.seqNr && message == other.message && ack == other.ack && confirmationQualifier == other @@ -227,7 +227,7 @@ object DurableProducerQueue { new MessageSent(seqNr, message, ack, confirmationQualifier, timestampMillis) def unapply( - sent: MessageSent[?]): Option[(SeqNr, MessageOrChunk, Boolean, ConfirmationQualifier, TimestampMillis)] = + sent: MessageSent[_]): Option[(SeqNr, MessageOrChunk, Boolean, ConfirmationQualifier, TimestampMillis)] = Some((sent.seqNr, sent.message, sent.ack, sent.confirmationQualifier, sent.timestampMillis)) } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/ProducerController.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/ProducerController.scala index 128321a009d..d385bd0d8be 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/ProducerController.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/ProducerController.scala @@ -157,7 +157,7 @@ object ProducerController { * Scala API: Factory method from config `pekko.reliable-delivery.producer-controller` * of the `ActorSystem`. */ - def apply(system: ActorSystem[?]): Settings = + def apply(system: ActorSystem[_]): Settings = apply(system.settings.config.getConfig("pekko.reliable-delivery.producer-controller")) /** @@ -181,7 +181,7 @@ object ProducerController { * Java API: Factory method from config `pekko.reliable-delivery.producer-controller` * of the `ActorSystem`. */ - def create(system: ActorSystem[?]): Settings = + def create(system: ActorSystem[_]): Settings = apply(system) /** diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/WorkPullingProducerController.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/WorkPullingProducerController.scala index fd3554551f0..3542f837487 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/WorkPullingProducerController.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/WorkPullingProducerController.scala @@ -154,7 +154,7 @@ object WorkPullingProducerController { * Scala API: Factory method from config `pekko.reliable-delivery.work-pulling.producer-controller` * of the `ActorSystem`. */ - def apply(system: ActorSystem[?]): Settings = + def apply(system: ActorSystem[_]): Settings = apply(system.settings.config.getConfig("pekko.reliable-delivery.work-pulling.producer-controller")) /** @@ -172,7 +172,7 @@ object WorkPullingProducerController { * Java API: Factory method from config `pekko.reliable-delivery.work-pulling.producer-controller` * of the `ActorSystem`. */ - def create(system: ActorSystem[?]): Settings = + def create(system: ActorSystem[_]): Settings = apply(system) /** diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/internal/ConsumerControllerImpl.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/internal/ConsumerControllerImpl.scala index d039a6aff13..295392b81bc 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/internal/ConsumerControllerImpl.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/internal/ConsumerControllerImpl.scala @@ -89,7 +89,7 @@ import pekko.util.ConstantFun.scalaIdentityFunction private case object Retry extends InternalCommand - private final case class ConsumerTerminated(consumer: ActorRef[?]) extends InternalCommand + private final case class ConsumerTerminated(consumer: ActorRef[_]) extends InternalCommand private final case class State[A]( producerController: ActorRef[ProducerControllerImpl.InternalCommand], @@ -170,7 +170,7 @@ import pekko.util.ConstantFun.scalaIdentityFunction } Behaviors.same - case _: DeliverThenStop[?] => + case _: DeliverThenStop[_] => if (stashBuffer.isEmpty) { Behaviors.stopped } else { @@ -203,7 +203,7 @@ import pekko.util.ConstantFun.scalaIdentityFunction private def mdcForMessage(msg: InternalCommand): Map[String, String] = { msg match { - case seqMsg: SequencedMessage[?] => Map("producerId" -> seqMsg.producerId) + case seqMsg: SequencedMessage[_] => Map("producerId" -> seqMsg.producerId) case _ => Map.empty } } @@ -225,7 +225,7 @@ import pekko.util.ConstantFun.scalaIdentityFunction stopping) } - def enforceLocalConsumer(ref: ActorRef[?]): Unit = { + def enforceLocalConsumer(ref: ActorRef[_]): Unit = { if (ref.path.address.hasGlobalScope) throw new IllegalArgumentException(s"Consumer [$ref] should be local.") } @@ -359,7 +359,7 @@ private class ConsumerControllerImpl[A] private ( case reg: RegisterToProducerController[A @unchecked] => receiveRegisterToProducerController(s, reg, newState => active(newState)) - case _: DeliverThenStop[?] => + case _: DeliverThenStop[_] => receiveDeliverThenStop(s, newState => active(newState)) case _: UnsealedInternalCommand => @@ -484,7 +484,7 @@ private class ConsumerControllerImpl[A] private ( case reg: RegisterToProducerController[A @unchecked] => receiveRegisterToProducerController(s, reg, newState => active(newState)) - case _: DeliverThenStop[?] => + case _: DeliverThenStop[_] => receiveDeliverThenStop(s, newState => resending(newState)) case _: UnsealedInternalCommand => @@ -604,7 +604,7 @@ private class ConsumerControllerImpl[A] private ( scalaIdentityFunction) } - case msg: SequencedMessage[?] => + case msg: SequencedMessage[_] => flightRecorder.consumerReceivedPreviousInProgress(msg.producerId, msg.seqNr, stashBuffer.size + 1) val expectedSeqNr = seqMsg.seqNr + stashBuffer.size + 1 if (msg.seqNr < expectedSeqNr && msg.producerController == seqMsg.producerController) { @@ -642,7 +642,7 @@ private class ConsumerControllerImpl[A] private ( case reg: RegisterToProducerController[A @unchecked] => receiveRegisterToProducerController(s, reg, newState => waitingForConfirmation(newState, seqMsg)) - case _: DeliverThenStop[?] => + case _: DeliverThenStop[_] => receiveDeliverThenStop(s, newState => waitingForConfirmation(newState, seqMsg)) case _: UnsealedInternalCommand => @@ -708,7 +708,7 @@ private class ConsumerControllerImpl[A] private ( } } - private def receiveConsumerTerminated(c: ActorRef[?]): Behavior[InternalCommand] = { + private def receiveConsumerTerminated(c: ActorRef[_]): Behavior[InternalCommand] = { context.log.debug("Consumer [{}] terminated.", c) Behaviors.stopped } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/internal/ProducerControllerImpl.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/internal/ProducerControllerImpl.scala index 46860168b79..8a9c2e543a2 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/internal/ProducerControllerImpl.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/internal/ProducerControllerImpl.scala @@ -344,7 +344,7 @@ object ProducerControllerImpl { } } - def enforceLocalProducer(ref: ActorRef[?]): Unit = { + def enforceLocalProducer(ref: ActorRef[_]): Unit = { if (ref.path.address.hasGlobalScope) throw new IllegalArgumentException(s"Consumer [$ref] should be local.") } @@ -807,7 +807,7 @@ private class ProducerControllerImpl[A: ClassTag]( active(s.copy(remainingChunks = chunks, storeMessageSentInProgress = seqMsg.seqNr)) } - case StoreMessageSentCompleted(sent: MessageSent[?]) => + case StoreMessageSentCompleted(sent: MessageSent[_]) => receiveStoreMessageSentCompleted(sent.seqNr) case f: StoreMessageSentFailed[A @unchecked] => diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/internal/WorkPullingProducerControllerImpl.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/internal/WorkPullingProducerControllerImpl.scala index 2e8b008bee1..48214170871 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/internal/WorkPullingProducerControllerImpl.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/delivery/internal/WorkPullingProducerControllerImpl.scala @@ -664,7 +664,7 @@ private class WorkPullingProducerControllerImpl[A: ClassTag]( case AskTimeout(outKey, outSeqNr) => context.log.debug( - "Message seqNr [{}] sent to worker [{}] timed out. It will be redelivered.", + "Message seqNr [{}] sent to worker [{}] timed out. It will be be redelivered.", outSeqNr, outKey) Behaviors.same diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/eventstream/EventStream.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/eventstream/EventStream.scala index 51f6ccd18d3..2772dfb339a 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/eventstream/EventStream.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/eventstream/EventStream.scala @@ -64,7 +64,7 @@ object EventStream { /** * INTERNAL API */ - @InternalApi private[pekko] def topic: Class[?] = classTag.runtimeClass + @InternalApi private[pekko] def topic: Class[_] = classTag.runtimeClass } /** diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorContextImpl.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorContextImpl.scala index 6f2e98b9627..3c267d9f0d7 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorContextImpl.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorContextImpl.scala @@ -48,7 +48,7 @@ import org.slf4j.LoggerFactory // single context for logging as there are a few things that are initialized // together that we can cache as long as the actor is alive object LoggingContext { - def apply(logger: Logger, tags: Set[String], ctx: ActorContextImpl[?]): LoggingContext = { + def apply(logger: Logger, tags: Set[String], ctx: ActorContextImpl[_]): LoggingContext = { val tagsString = // "" means no tags if (tags.isEmpty) "" @@ -61,7 +61,7 @@ import org.slf4j.LoggerFactory val pekkoAddress = ctx.system match { - case adapter: ActorSystemAdapter[?] => adapter.provider.addressString + case adapter: ActorSystemAdapter[_] => adapter.provider.addressString case _ => Address("pekko", ctx.system.name).toString } @@ -105,7 +105,7 @@ import org.slf4j.LoggerFactory private var _logging: OptionVal[LoggingContext] = OptionVal.None private var messageAdapterRef: OptionVal[ActorRef[Any]] = OptionVal.None - private var _messageAdapters: List[(Class[?], Any => T)] = Nil + private var _messageAdapters: List[(Class[_], Any => T)] = Nil private var _timer: OptionVal[TimerSchedulerCrossDslSupport[T]] = OptionVal.None // _currentActorThread is on purpose not volatile. Used from `checkCurrentActorThread`. @@ -164,7 +164,7 @@ import org.slf4j.LoggerFactory _logging match { case OptionVal.Some(l) => l case _ => - val logClass = LoggerClass.detectLoggerClassFromStack(classOf[Behavior[?]]) + val logClass = LoggerClass.detectLoggerClassFromStack(classOf[Behavior[_]]) val logger = LoggerFactory.getLogger(logClass.getName) val l = LoggingContext(logger, classicActorContext.props.deploy.tags, this) _logging = OptionVal.Some(l) @@ -186,7 +186,7 @@ import org.slf4j.LoggerFactory _logging = OptionVal.Some(loggingContext().withLogger(LoggerFactory.getLogger(name))) } - override def setLoggerName(clazz: Class[?]): Unit = + override def setLoggerName(clazz: Class[_]): Unit = setLoggerName(clazz.getName) def hasCustomLoggerName: Boolean = loggingContext().hasCustomName @@ -238,7 +238,7 @@ import org.slf4j.LoggerFactory ask(target, createRequest) { case Success(StatusReply.Success(t: Res)) => mapResponse(Success(t)) case Success(StatusReply.Error(why)) => mapResponse(Failure(why)) - case fail: Failure[?] => mapResponse(fail.asInstanceOf[Failure[Res]]) + case fail: Failure[_] => mapResponse(fail.asInstanceOf[Failure[Res]]) case _ => throw new RuntimeException() // won't happen, compiler exhaustiveness check pleaser } @@ -335,7 +335,7 @@ import org.slf4j.LoggerFactory /** * INTERNAL API */ - @InternalApi private[pekko] def messageAdapters: List[(Class[?], Any => T)] = _messageAdapters + @InternalApi private[pekko] def messageAdapters: List[(Class[_], Any => T)] = _messageAdapters /** * INTERNAL API diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorFlightRecorder.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorFlightRecorder.scala index f6bdfd77cb6..371ae67c831 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorFlightRecorder.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorFlightRecorder.scala @@ -25,7 +25,7 @@ import pekko.util.FlightRecorderLoader @InternalApi object ActorFlightRecorder extends ExtensionId[ActorFlightRecorder] { - override def createExtension(system: ActorSystem[?]): ActorFlightRecorder = + override def createExtension(system: ActorSystem[_]): ActorFlightRecorder = FlightRecorderLoader.load[ActorFlightRecorder]( system, "org.apache.pekko.actor.typed.internal.jfr.JFRActorFlightRecorder", diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorRefImpl.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorRefImpl.scala index 89a3772c773..33dd5ae1deb 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorRefImpl.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ActorRefImpl.scala @@ -33,7 +33,7 @@ private[pekko] trait ActorRefImpl[-T] extends ActorRef[T] { this: InternalRecipi /** * Comparison takes path and the unique id of the actor cell into account. */ - final override def compareTo(other: ActorRef[?]) = { + final override def compareTo(other: ActorRef[_]) = { val x = this.path.compareTo(other.path) if (x == 0) if (this.path.uid < other.path.uid) -1 else if (this.path.uid == other.path.uid) 0 else 1 else x @@ -45,7 +45,7 @@ private[pekko] trait ActorRefImpl[-T] extends ActorRef[T] { this: InternalRecipi * Equals takes path and the unique id of the actor cell into account. */ final override def equals(that: Any): Boolean = that match { - case other: ActorRef[?] => path.uid == other.path.uid && path == other.path + case other: ActorRef[_] => path.uid == other.path.uid && path == other.path case _ => false } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/EventStreamExtension.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/EventStreamExtension.scala index 899b9514654..059f8576636 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/EventStreamExtension.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/EventStreamExtension.scala @@ -27,11 +27,11 @@ import pekko.annotation.InternalApi * * It is used as an extension to ensure a single instance per actor system. */ -@InternalApi private[pekko] final class EventStreamExtension(actorSystem: ActorSystem[?]) extends Extension { +@InternalApi private[pekko] final class EventStreamExtension(actorSystem: ActorSystem[_]) extends Extension { val ref: ActorRef[EventStream.Command] = actorSystem.internalSystemActorOf(EventStreamAdapter.behavior, "eventstream", Props.empty) } private[pekko] object EventStreamExtension extends ExtensionId[EventStreamExtension] { - override def createExtension(system: ActorSystem[?]): EventStreamExtension = new EventStreamExtension(system) + override def createExtension(system: ActorSystem[_]): EventStreamExtension = new EventStreamExtension(system) } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ExtensionsImpl.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ExtensionsImpl.scala index 53395451256..5b2ec2a1900 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ExtensionsImpl.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/ExtensionsImpl.scala @@ -30,9 +30,9 @@ import pekko.annotation.InternalApi * Actor system extensions registry */ @InternalApi -private[pekko] trait ExtensionsImpl extends Extensions { self: ActorSystem[?] with InternalRecipientRef[?] => +private[pekko] trait ExtensionsImpl extends Extensions { self: ActorSystem[_] with InternalRecipientRef[_] => - private val extensions = new ConcurrentHashMap[ExtensionId[?], AnyRef] + private val extensions = new ConcurrentHashMap[ExtensionId[_], AnyRef] /** * Hook for ActorSystem to load extensions on startup @@ -54,13 +54,13 @@ private[pekko] trait ExtensionsImpl extends Extensions { self: ActorSystem[?] wi } idTry match { - case Success(id: ExtensionId[?]) => registerExtension(id) + case Success(id: ExtensionId[_]) => registerExtension(id) case Success(_) => if (!throwOnLoadFail) log.error("[{}] is not an 'ExtensionId', skipping...", extensionIdFQCN) else throw new RuntimeException(s"[$extensionIdFQCN] is not an 'ExtensionId'") case Failure(problem) => if (!throwOnLoadFail) - log.error("While trying to load extension {}, skipping...", extensionIdFQCN, problem) + log.error(s"While trying to load extension $extensionIdFQCN, skipping...", problem) else throw new RuntimeException(s"While trying to load extension [$extensionIdFQCN]", problem) } } @@ -68,14 +68,14 @@ private[pekko] trait ExtensionsImpl extends Extensions { self: ActorSystem[?] wi private def idFromJavaSingletonAccessor(extensionIdFQCN: String): Try[ExtensionId[Extension]] = dynamicAccess.getClassFor[ExtensionId[Extension]](extensionIdFQCN).flatMap[ExtensionId[Extension]] { - (clazz: Class[?]) => + (clazz: Class[_]) => Try { val singletonAccessor = clazz.getDeclaredMethod("getInstance") singletonAccessor.invoke(null).asInstanceOf[ExtensionId[Extension]] } } - final override def hasExtension(ext: ExtensionId[? <: Extension]): Boolean = findExtension(ext) != null + final override def hasExtension(ext: ExtensionId[_ <: Extension]): Boolean = findExtension(ext) != null final override def extension[T <: Extension](ext: ExtensionId[T]): T = findExtension(ext) match { case null => throw new IllegalArgumentException(s"Trying to get non-registered extension [$ext]") @@ -96,7 +96,7 @@ private[pekko] trait ExtensionsImpl extends Extensions { self: ActorSystem[?] wi // Create and initialize the extension, first look for ExtensionSetup val instance = self.settings.setup.setups .collectFirst { - case (_, extSetup: ExtensionSetup[?]) if extSetup.extId == ext => extSetup.createExtension(self) + case (_, extSetup: ExtensionSetup[_]) if extSetup.extId == ext => extSetup.createExtension(self) } .getOrElse(ext.createExtension(self)) instance match { diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/InterceptorImpl.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/InterceptorImpl.scala index c5a0fa3c698..4838105e3c2 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/InterceptorImpl.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/InterceptorImpl.scala @@ -56,24 +56,24 @@ private[pekko] final class InterceptorImpl[O, I]( import BehaviorInterceptor._ private val preStartTarget: PreStartTarget[I] = new PreStartTarget[I] { - override def start(ctx: TypedActorContext[?]): Behavior[I] = { + override def start(ctx: TypedActorContext[_]): Behavior[I] = { Behavior.start[I](nestedBehavior, ctx.asInstanceOf[TypedActorContext[I]]) } override def toString: String = s"PreStartTarget($nestedBehavior)" } private val receiveTarget: ReceiveTarget[I] = new ReceiveTarget[I] { - override def apply(ctx: TypedActorContext[?], msg: I): Behavior[I] = + override def apply(ctx: TypedActorContext[_], msg: I): Behavior[I] = Behavior.interpretMessage(nestedBehavior, ctx.asInstanceOf[TypedActorContext[I]], msg) - override def signalRestart(ctx: TypedActorContext[?]): Unit = + override def signalRestart(ctx: TypedActorContext[_]): Unit = Behavior.interpretSignal(nestedBehavior, ctx.asInstanceOf[TypedActorContext[I]], PreRestart) override def toString: String = s"ReceiveTarget($nestedBehavior)" } private val signalTarget = new SignalTarget[I] { - override def apply(ctx: TypedActorContext[?], signal: Signal): Behavior[I] = + override def apply(ctx: TypedActorContext[_], signal: Signal): Behavior[I] = Behavior.interpretSignal(nestedBehavior, ctx.asInstanceOf[TypedActorContext[I]], signal) override def toString: String = s"SignalTarget($nestedBehavior)" } @@ -111,7 +111,7 @@ private[pekko] final class InterceptorImpl[O, I]( } else { // returned behavior could be nested in setups, so we need to start before we deduplicate val duplicateInterceptExists = Behavior.existsInStack(started) { - case i: InterceptorImpl[?, ?] + case i: InterceptorImpl[_, _] if interceptor.isSame(i.interceptor.asInstanceOf[BehaviorInterceptor[Any, Any]]) => true case _ => false diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/LoggerClass.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/LoggerClass.scala index 94a150a0d6c..a47ba35479a 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/LoggerClass.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/LoggerClass.scala @@ -29,17 +29,17 @@ private[pekko] object LoggerClass { private val OPTIONS: java.util.Set[StackWalker.Option] = java.util.Set.of( StackWalker.Option.RETAIN_CLASS_REFERENCE, StackWalker.Option.SHOW_HIDDEN_FRAMES) private val CLASS_STACK_WALKER: java.util.function.Function[ - java.util.stream.Stream[StackWalker.StackFrame], Array[Class[?]]] = + java.util.stream.Stream[StackWalker.StackFrame], Array[Class[_]]] = (frames: java.util.stream.Stream[StackWalker.StackFrame]) => frames.map(frame => frame.getDeclaringClass) - .toArray[Class[?]]((size: Int) => new Array[Class[?]](size)) + .toArray[Class[_]]((size: Int) => new Array[Class[_]](size)) - private def getClassStack: Array[Class[?]] = StackWalker.getInstance(OPTIONS).walk(CLASS_STACK_WALKER) + private def getClassStack: Array[Class[_]] = StackWalker.getInstance(OPTIONS).walk(CLASS_STACK_WALKER) /** * Try to extract a logger class from the call stack, if not possible the provided default is used */ - def detectLoggerClassFromStack(default: Class[?], additionalPrefixesToSkip: List[String] = Nil): Class[?] = { + def detectLoggerClassFromStack(default: Class[_], additionalPrefixesToSkip: List[String] = Nil): Class[_] = { try { def skip(name: String): Boolean = { def loop(skipList: List[String]): Boolean = skipList match { @@ -53,7 +53,7 @@ private[pekko] object LoggerClass { } val trace = getClassStack - var suitableClass: OptionVal[Class[?]] = OptionVal.None + var suitableClass: OptionVal[Class[_]] = OptionVal.None var idx = 1 // skip this method/class and right away while (suitableClass.isEmpty && idx < trace.length) { val clazz = trace(idx) diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/MiscMessageSerializer.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/MiscMessageSerializer.scala index 5de797568f2..45b9f1be221 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/MiscMessageSerializer.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/MiscMessageSerializer.scala @@ -34,13 +34,13 @@ import pekko.serialization.{ BaseSerializer, SerializerWithStringManifest } private val ActorRefManifest = "a" def manifest(o: AnyRef): String = o match { - case _: ActorRef[?] => ActorRefManifest + case _: ActorRef[_] => ActorRefManifest case _ => throw new IllegalArgumentException(s"Can't serialize object of type ${o.getClass} in [${getClass.getName}]") } def toBinary(o: AnyRef): Array[Byte] = o match { - case ref: ActorRef[?] => resolver.toSerializationFormat(ref).getBytes(StandardCharsets.UTF_8) + case ref: ActorRef[_] => resolver.toSerializationFormat(ref).getBytes(StandardCharsets.UTF_8) case _ => throw new IllegalArgumentException(s"Cannot serialize object of type [${o.getClass.getName}]") } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/PoisonPill.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/PoisonPill.scala index 76372e913e3..66a74f76add 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/PoisonPill.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/PoisonPill.scala @@ -61,5 +61,5 @@ import pekko.annotation.InternalApi override def isSame(other: BehaviorInterceptor[Any, Any]): Boolean = // only one interceptor per behavior stack is needed - other.isInstanceOf[PoisonPillInterceptor[?]] + other.isInstanceOf[PoisonPillInterceptor[_]] } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/Supervision.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/Supervision.scala index 19fc70b43bf..d6f2e67de85 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/Supervision.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/Supervision.scala @@ -44,9 +44,9 @@ import org.slf4j.event.Level */ @InternalApi private[pekko] object Supervisor { def apply[T, Thr <: Throwable: ClassTag](initialBehavior: Behavior[T], strategy: SupervisorStrategy): Behavior[T] = { - if (initialBehavior.isInstanceOf[scaladsl.AbstractBehavior[?]] || + if (initialBehavior.isInstanceOf[scaladsl.AbstractBehavior[_]] || initialBehavior - .isInstanceOf[javadsl.AbstractBehavior[?]]) { + .isInstanceOf[javadsl.AbstractBehavior[_]]) { throw new IllegalArgumentException( "The supervised Behavior must not be a AbstractBehavior instance directly," + "because a different instance should be created when it is restarted. Wrap in Behaviors.setup.") @@ -79,7 +79,7 @@ private abstract class AbstractSupervisor[I, Thr <: Throwable](strategy: Supervi override def isSame(other: BehaviorInterceptor[Any, Any]): Boolean = { other match { - case as: AbstractSupervisor[?, ?] if throwableClass == as.throwableClass => true + case as: AbstractSupervisor[_, _] if throwableClass == as.throwableClass => true case _ => false } } @@ -96,10 +96,10 @@ private abstract class AbstractSupervisor[I, Thr <: Throwable](strategy: Supervi } catch handleSignalException(ctx, target) } - def log(ctx: TypedActorContext[?], t: Throwable): Unit = + def log(ctx: TypedActorContext[_], t: Throwable): Unit = log(ctx, t, errorCount = -1) - def log(ctx: TypedActorContext[?], t: Throwable, errorCount: Int): Unit = { + def log(ctx: TypedActorContext[_], t: Throwable, errorCount: Int): Unit = { if (strategy.loggingEnabled) { val unwrapped = UnstashException.unwrap(t) val errorCountStr = if (errorCount >= 0) s" [$errorCount]" else "" @@ -119,7 +119,7 @@ private abstract class AbstractSupervisor[I, Thr <: Throwable](strategy: Supervi } } - def dropped(ctx: TypedActorContext[?], signalOrMessage: Any): Unit = { + def dropped(ctx: TypedActorContext[_], signalOrMessage: Any): Unit = { import pekko.actor.typed.scaladsl.adapter._ ctx.asScala.system.toClassic.eventStream .publish(Dropped(signalOrMessage, s"Stash is full in [${getClass.getSimpleName}]", ctx.asScala.self.toClassic)) @@ -198,10 +198,10 @@ private object RestartSupervisor { } } - final case class ScheduledRestart(owner: RestartSupervisor[?, ? <: Throwable]) + final case class ScheduledRestart(owner: RestartSupervisor[_, _ <: Throwable]) extends Signal with DeadLetterSuppression - final case class ResetRestartCount(current: Int, owner: RestartSupervisor[?, ? <: Throwable]) + final case class ResetRestartCount(current: Int, owner: RestartSupervisor[_, _ <: Throwable]) extends Signal with DeadLetterSuppression } @@ -421,7 +421,7 @@ private class RestartSupervisor[T, Thr <: Throwable: ClassTag](initial: Behavior }) } - private def stopChildren(ctx: TypedActorContext[?], children: Set[ActorRef[Nothing]]): Unit = { + private def stopChildren(ctx: TypedActorContext[_], children: Set[ActorRef[Nothing]]): Unit = { children.foreach { child => // Unwatch in case the actor being restarted used watchWith to watch the child. ctx.asScala.unwatch(child) diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/WithMdcBehaviorInterceptor.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/WithMdcBehaviorInterceptor.scala index 251debe7b63..5f1ea08f53d 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/WithMdcBehaviorInterceptor.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/WithMdcBehaviorInterceptor.scala @@ -59,7 +59,7 @@ import org.slf4j.MDC // so we need to look through the stack and eliminate any MCD already existing def loop(next: Behavior[T]): Behavior[T] = { next match { - case i: InterceptorImpl[?, T @unchecked] + case i: InterceptorImpl[_, T @unchecked] if i.interceptor.isSame(this.asInstanceOf[BehaviorInterceptor[Any, Any]]) => // eliminate that interceptor loop(i.nestedBehavior) @@ -83,7 +83,7 @@ import org.slf4j.MDC // in the normal case, a new withMDC replaces the previous one override def isSame(other: BehaviorInterceptor[Any, Any]): Boolean = other match { - case _: WithMdcBehaviorInterceptor[?] => true + case _: WithMdcBehaviorInterceptor[_] => true case _ => false } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorAdapter.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorAdapter.scala index 5b7b131b6c8..872cfc42980 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorAdapter.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorAdapter.scala @@ -180,7 +180,7 @@ import pekko.util.OptionVal } private def adaptAndHandle(msg: Any): Unit = { - @tailrec def handle(adapters: List[(Class[?], Any => T)]): Unit = { + @tailrec def handle(adapters: List[(Class[_], Any => T)]): Unit = { adapters match { case Nil => // no adapter function registered for message class @@ -240,7 +240,7 @@ import pekko.util.OptionVal case _ => val isTypedActor = sender() match { case afwc: ActorRefWithCell => - afwc.underlying.props.producer.actorClass == classOf[ActorAdapter[?]] + afwc.underlying.props.producer.actorClass == classOf[ActorAdapter[_]] case _ => false } @@ -326,7 +326,7 @@ import pekko.util.OptionVal try { ctx.cancelAllTimers() behavior match { - case _: DeferredBehavior[?] => + case _: DeferredBehavior[_] => // Do not undefer a DeferredBehavior as that may cause creation side-effects, which we do not want on termination. case b => Behavior.interpretSignal(b, ctx, PostStop) } @@ -352,7 +352,7 @@ import pekko.util.OptionVal // first pass the signal to the previous behavior, so that it and potential interceptors // will get the PostStop signal, unless it is deferred, we don't start a behavior while stopping lastBehavior match { - case _: DeferredBehavior[?] => // no starting of behaviors on actor stop + case _: DeferredBehavior[_] => // no starting of behaviors on actor stop case nonDeferred => Behavior.interpretSignal(nonDeferred, ctx, PostStop) } // and then to the potential stop hook, which can have a call back or not diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorContextAdapter.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorContextAdapter.scala index 45b256b1074..4a522b33c2e 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorContextAdapter.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorContextAdapter.scala @@ -26,19 +26,19 @@ import pekko.util.OptionVal @InternalApi private[pekko] object ActorContextAdapter { - private def toClassicImp[U](context: TypedActorContext[?]): classic.ActorContext = + private def toClassicImp[U](context: TypedActorContext[_]): classic.ActorContext = context match { - case adapter: ActorContextAdapter[?] => adapter.classicActorContext + case adapter: ActorContextAdapter[_] => adapter.classicActorContext case _ => throw new UnsupportedOperationException( "Only adapted classic ActorContext permissible " + s"($context of class ${context.getClass.getName})") } - def toClassic[U](context: scaladsl.ActorContext[?]): classic.ActorContext = + def toClassic[U](context: scaladsl.ActorContext[_]): classic.ActorContext = toClassicImp(context) - def toClassic[U](context: javadsl.ActorContext[?]): classic.ActorContext = + def toClassic[U](context: javadsl.ActorContext[_]): classic.ActorContext = toClassicImp(context) } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorRefAdapter.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorRefAdapter.scala index 05e76a921da..5b8986c8adc 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorRefAdapter.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorRefAdapter.scala @@ -59,8 +59,8 @@ private[pekko] object ActorRefAdapter { def toClassic[U](ref: ActorRef[U]): pekko.actor.InternalActorRef = ref match { - case adapter: ActorRefAdapter[?] => adapter.classicRef - case adapter: ActorSystemAdapter[?] => adapter.system.guardian + case adapter: ActorRefAdapter[_] => adapter.classicRef + case adapter: ActorSystemAdapter[_] => adapter.system.guardian case _ => throw new UnsupportedOperationException( "Only adapted classic ActorRefs permissible " + diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorSystemAdapter.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorSystemAdapter.scala index 8a599493eb7..7c9bfb6ca83 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorSystemAdapter.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/ActorSystemAdapter.scala @@ -105,7 +105,7 @@ import org.slf4j.{ Logger, LoggerFactory } } override def dynamicAccess: classic.DynamicAccess = system.dynamicAccess implicit override def executionContext: scala.concurrent.ExecutionContextExecutor = classicSystem.dispatcher - override val log: Logger = LoggerFactory.getLogger(classOf[ActorSystem[?]]) + override val log: Logger = LoggerFactory.getLogger(classOf[ActorSystem[_]]) override def logConfiguration(): Unit = classicSystem.logConfiguration() override def name: String = classicSystem.name override val scheduler: Scheduler = new SchedulerAdapter(classicSystem.scheduler) @@ -147,9 +147,9 @@ private[pekko] object ActorSystemAdapter { case system: classic.ActorSystemImpl => // Optimization to cut out going through adapter lookup if possible system.typedSystem match { - case OptionVal.Some(typedSystem: ActorSystem[?]) => typedSystem + case OptionVal.Some(typedSystem: ActorSystem[_]) => typedSystem case _ => - val typedSystem: ActorSystem[?] = AdapterExtension(system).adapter + val typedSystem: ActorSystem[_] = AdapterExtension(system).adapter system.typedSystem = OptionVal.Some(typedSystem) typedSystem } @@ -182,10 +182,10 @@ private[pekko] object ActorSystemAdapter { } object LoadTypedExtensions extends classic.ExtensionId[LoadTypedExtensions] with classic.ExtensionIdProvider { - override def lookup: actor.ExtensionId[? <: actor.Extension] = this + override def lookup: actor.ExtensionId[_ <: actor.Extension] = this override def createExtension(system: ExtendedActorSystem): LoadTypedExtensions = new LoadTypedExtensions(system) } - def toClassic[U](sys: ActorSystem[?]): classic.ActorSystem = sys.classicSystem + def toClassic[U](sys: ActorSystem[_]): classic.ActorSystem = sys.classicSystem } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/PropsAdapter.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/PropsAdapter.scala index 8847ebb0da0..40e44ef9215 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/PropsAdapter.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/adapter/PropsAdapter.scala @@ -66,7 +66,7 @@ import pekko.dispatch.Mailboxes new pekko.actor.Props( deploy, TypedCreatorFunctionConsumerClazz, - classOf[ActorAdapter[?]] :: (() => new ActorAdapter(behavior(), rethrowTypedFailure)) :: Nil) + classOf[ActorAdapter[_]] :: (() => new ActorAdapter(behavior(), rethrowTypedFailure)) :: Nil) } } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/jfr/Events.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/jfr/Events.scala index 1b330187e20..b6576ba8bcb 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/jfr/Events.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/jfr/Events.scala @@ -21,7 +21,8 @@ import jdk.jfr.StackTrace import org.apache.pekko.annotation.InternalApi -// requires jdk.jfr (available since JDK 9, project baseline is Java 17) +// requires jdk9+ to compile +// for editing these in IntelliJ, open module settings, change JDK dependency to 11 for only this module /** INTERNAL API */ @InternalApi diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/LocalReceptionist.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/LocalReceptionist.scala index 38269c7e421..5cc5a0b1d83 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/LocalReceptionist.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/LocalReceptionist.scala @@ -71,9 +71,9 @@ private[pekko] object LocalReceptionist extends ReceptionistBehaviorProvider { */ private final case class State( services: TypedMultiMap[AbstractServiceKey, Service], - servicesPerActor: Map[ActorRef[?], Set[AbstractServiceKey]], + servicesPerActor: Map[ActorRef[_], Set[AbstractServiceKey]], subscriptions: TypedMultiMap[AbstractServiceKey, Subscriber], - subscriptionsPerActor: Map[ActorRef[?], Set[AbstractServiceKey]]) { + subscriptionsPerActor: Map[ActorRef[_], Set[AbstractServiceKey]]) { def serviceInstanceAdded[Key <: AbstractServiceKey](key: Key)(serviceInstance: ActorRef[key.Protocol]): State = { val newServices = services.inserted(key)(serviceInstance) @@ -101,7 +101,7 @@ private[pekko] object LocalReceptionist extends ReceptionistBehaviorProvider { copy(services = newServices, servicesPerActor = newServicePerActor) } - def serviceInstanceRemoved(serviceInstance: ActorRef[?]): State = { + def serviceInstanceRemoved(serviceInstance: ActorRef[_]): State = { val keys = servicesPerActor.getOrElse(serviceInstance, Set.empty) val newServices = if (keys.isEmpty) services @@ -140,7 +140,7 @@ private[pekko] object LocalReceptionist extends ReceptionistBehaviorProvider { copy(subscriptions = newSubscriptions, subscriptionsPerActor = newSubscriptionsPerActor) } - def subscriberRemoved(subscriber: ActorRef[?]): State = { + def subscriberRemoved(subscriber: ActorRef[_]): State = { val keys = subscriptionsPerActor.getOrElse(subscriber, Set.empty) if (keys.isEmpty) this else { diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ReceptionistImpl.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ReceptionistImpl.scala index 762e660feee..9dfcff15776 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ReceptionistImpl.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ReceptionistImpl.scala @@ -24,7 +24,7 @@ import pekko.annotation.InternalApi /** * INTERNAL API */ -@InternalApi private[pekko] class ReceptionistImpl(system: ActorSystem[?]) extends Receptionist { +@InternalApi private[pekko] class ReceptionistImpl(system: ActorSystem[_]) extends Receptionist { override val ref: ActorRef[Receptionist.Command] = { val provider: ReceptionistBehaviorProvider = diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ReceptionistMessages.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ReceptionistMessages.scala index 8e212d6ef8f..bc7809a580e 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ReceptionistMessages.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ReceptionistMessages.scala @@ -46,7 +46,7 @@ private[pekko] object ReceptionistMessages { final case class Registered[T] private[pekko] (key: ServiceKey[T], _serviceInstance: ActorRef[T]) extends Receptionist.Registered { - def isForKey(key: ServiceKey[?]): Boolean = key == this.key + def isForKey(key: ServiceKey[_]): Boolean = key == this.key def serviceInstance[M](key: ServiceKey[M]): ActorRef[M] = { if (key != this.key) throw new IllegalArgumentException(s"Wrong key [$key] used, must use listing key [${this.key}]") @@ -59,7 +59,7 @@ private[pekko] object ReceptionistMessages { final case class Deregistered[T] private[pekko] (key: ServiceKey[T], _serviceInstance: ActorRef[T]) extends Receptionist.Deregistered { - def isForKey(key: ServiceKey[?]): Boolean = key == this.key + def isForKey(key: ServiceKey[_]): Boolean = key == this.key def serviceInstance[M](key: ServiceKey[M]): ActorRef[M] = { if (key != this.key) throw new IllegalArgumentException(s"Wrong key [$key] used, must use listing key [${this.key}]") @@ -79,7 +79,7 @@ private[pekko] object ReceptionistMessages { servicesWereAddedOrRemoved: Boolean) extends Receptionist.Listing { - def isForKey(key: ServiceKey[?]): Boolean = key == this.key + def isForKey(key: ServiceKey[_]): Boolean = key == this.key def serviceInstances[M](key: ServiceKey[M]): Set[ActorRef[M]] = { if (key != this.key) diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ServiceKeySerializer.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ServiceKeySerializer.scala index 9316e45b542..282f2a5c26e 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ServiceKeySerializer.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/receptionist/ServiceKeySerializer.scala @@ -28,13 +28,13 @@ final class ServiceKeySerializer(val system: pekko.actor.ExtendedActorSystem) extends SerializerWithStringManifest with BaseSerializer { def manifest(o: AnyRef): String = o match { - case key: DefaultServiceKey[?] => key.typeName + case key: DefaultServiceKey[_] => key.typeName case _ => throw new IllegalArgumentException(s"Can't serialize object of type ${o.getClass} in [${getClass.getName}]") } def toBinary(o: AnyRef): Array[Byte] = o match { - case serviceKey: DefaultServiceKey[?] => serviceKey.id.getBytes(StandardCharsets.UTF_8) + case serviceKey: DefaultServiceKey[_] => serviceKey.id.getBytes(StandardCharsets.UTF_8) case _ => throw new IllegalArgumentException(s"Cannot serialize object of type [${o.getClass.getName}]") } diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/routing/GroupRouterImpl.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/routing/GroupRouterImpl.scala index 4d006cf2e3d..a7c35b348bd 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/routing/GroupRouterImpl.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/routing/GroupRouterImpl.scala @@ -33,7 +33,7 @@ import pekko.annotation.InternalApi private[pekko] final case class GroupRouterBuilder[T] private[pekko] ( key: ServiceKey[T], preferLocalRoutees: Boolean = false, - logicFactory: ActorSystem[?] => RoutingLogic[T] = (_: ActorSystem[?]) => new RoutingLogics.RandomLogic[T]()) + logicFactory: ActorSystem[_] => RoutingLogic[T] = (_: ActorSystem[_]) => new RoutingLogics.RandomLogic[T]()) extends javadsl.GroupRouter[T] with scaladsl.GroupRouter[T] { diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/routing/PoolRouterImpl.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/routing/PoolRouterImpl.scala index bd043aca0af..a8c016fde50 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/routing/PoolRouterImpl.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/internal/routing/PoolRouterImpl.scala @@ -30,7 +30,7 @@ import pekko.util.ConstantFun private[pekko] final case class PoolRouterBuilder[T]( poolSize: Int, behavior: Behavior[T], - logicFactory: ActorSystem[?] => RoutingLogic[T] = (_: ActorSystem[?]) => new RoutingLogics.RoundRobinLogic[T], + logicFactory: ActorSystem[_] => RoutingLogic[T] = (_: ActorSystem[_]) => new RoutingLogics.RoundRobinLogic[T], broadcastPredicate: T => Boolean = ConstantFun.anyToFalse, routeeProps: Props = Props.empty) extends javadsl.PoolRouter[T] diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/ActorContext.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/ActorContext.scala index 4c5d3519c3e..2d15fb8fca2 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/ActorContext.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/ActorContext.scala @@ -105,7 +105,7 @@ trait ActorContext[T] extends TypedActorContext[T] with ClassicActorContextProvi * *Warning*: This method is not thread-safe and must not be accessed from threads other * than the ordinary actor message processing thread, such as [[java.util.concurrent.CompletionStage]] callbacks. */ - def setLoggerName(clazz: Class[?]): Unit + def setLoggerName(clazz: Class[_]): Unit /** * The list of child Actors created by this Actor during its lifetime that diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/Adapter.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/Adapter.scala index 4aa942d4b7e..bbd9edc07c8 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/Adapter.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/Adapter.scala @@ -108,10 +108,10 @@ object Adapter { def toTyped(sys: pekko.actor.ActorSystem): ActorSystem[Void] = sys.toTyped.asInstanceOf[ActorSystem[Void]] - def toClassic(sys: ActorSystem[?]): pekko.actor.ActorSystem = + def toClassic(sys: ActorSystem[_]): pekko.actor.ActorSystem = sys.toClassic - def toClassic(ctx: ActorContext[?]): actor.ActorContext = + def toClassic(ctx: ActorContext[_]): actor.ActorContext = ActorContextAdapter.toClassic(ctx) def watch[U](ctx: pekko.actor.ActorContext, other: ActorRef[U]): Unit = @@ -120,25 +120,25 @@ object Adapter { def unwatch[U](ctx: pekko.actor.ActorContext, other: ActorRef[U]): Unit = ctx.unwatch(other) - def stop(ctx: pekko.actor.ActorContext, child: ActorRef[?]): Unit = + def stop(ctx: pekko.actor.ActorContext, child: ActorRef[_]): Unit = ctx.stop(child) - def watch[U](ctx: ActorContext[?], other: pekko.actor.ActorRef): Unit = + def watch[U](ctx: ActorContext[_], other: pekko.actor.ActorRef): Unit = ctx.watch(other) - def unwatch[U](ctx: ActorContext[?], other: pekko.actor.ActorRef): Unit = + def unwatch[U](ctx: ActorContext[_], other: pekko.actor.ActorRef): Unit = ctx.unwatch(other) - def stop(ctx: ActorContext[?], child: pekko.actor.ActorRef): Unit = + def stop(ctx: ActorContext[_], child: pekko.actor.ActorRef): Unit = ctx.stop(child) - def actorOf(ctx: ActorContext[?], props: pekko.actor.Props): pekko.actor.ActorRef = + def actorOf(ctx: ActorContext[_], props: pekko.actor.Props): pekko.actor.ActorRef = ActorContextAdapter.toClassic(ctx).actorOf(props) - def actorOf(ctx: ActorContext[?], props: pekko.actor.Props, name: String): pekko.actor.ActorRef = + def actorOf(ctx: ActorContext[_], props: pekko.actor.Props, name: String): pekko.actor.ActorRef = ActorContextAdapter.toClassic(ctx).actorOf(props, name) - def toClassic(ref: ActorRef[?]): pekko.actor.ActorRef = + def toClassic(ref: ActorRef[_]): pekko.actor.ActorRef = ref.toClassic def toTyped[T](ref: pekko.actor.ActorRef): ActorRef[T] = diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/BehaviorBuilder.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/BehaviorBuilder.scala index a8e4a5dd56f..96b40477428 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/BehaviorBuilder.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/BehaviorBuilder.scala @@ -81,7 +81,7 @@ final class BehaviorBuilder[T] private (messageHandlers: List[Case[T, T]], signa * @param handler action to apply when the type matches * @return a new behavior builder with the specified handling appended */ - def onMessageUnchecked[M <: T](`type`: Class[? <: T], handler: JFunction[M, Behavior[T]]): BehaviorBuilder[T] = + def onMessageUnchecked[M <: T](`type`: Class[_ <: T], handler: JFunction[M, Behavior[T]]): BehaviorBuilder[T] = withMessage[M](OptionVal.Some(`type`.asInstanceOf[Class[M]]), OptionVal.None, handler) /** @@ -173,7 +173,7 @@ object BehaviorBuilder { /** INTERNAL API */ @InternalApi private[javadsl] final case class Case[BT, MT]( - `type`: OptionVal[Class[? <: MT]], + `type`: OptionVal[Class[_ <: MT]], test: OptionVal[MT => Boolean], handler: JFunction[MT, Behavior[BT]]) diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/ReceiveBuilder.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/ReceiveBuilder.scala index fa706b65fb4..1b72e8cab4a 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/ReceiveBuilder.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/ReceiveBuilder.scala @@ -76,7 +76,7 @@ final class ReceiveBuilder[T] private ( * @param handler action to apply when the type matches * @return this behavior builder */ - def onMessageUnchecked[M <: T](`type`: Class[? <: T], handler: JFunction[M, Behavior[T]]): ReceiveBuilder[T] = + def onMessageUnchecked[M <: T](`type`: Class[_ <: T], handler: JFunction[M, Behavior[T]]): ReceiveBuilder[T] = withMessage[M](OptionVal.Some(`type`.asInstanceOf[Class[M]]), OptionVal.None, handler) /** @@ -173,7 +173,7 @@ object ReceiveBuilder { /** INTERNAL API */ @InternalApi private[javadsl] final case class Case[BT, MT]( - `type`: OptionVal[Class[? <: MT]], + `type`: OptionVal[Class[_ <: MT]], test: OptionVal[JPredicate[MT]], handler: JFunction[MT, Behavior[BT]]) diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/receptionist/Receptionist.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/receptionist/Receptionist.scala index 89fa1469d2c..b6fdb63441a 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/receptionist/Receptionist.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/receptionist/Receptionist.scala @@ -104,8 +104,8 @@ abstract class ServiceKey[T] extends AbstractServiceKey { key => * The receptionist is easiest accessed through the system: [[ActorSystem.receptionist]] */ object Receptionist extends ExtensionId[Receptionist] { - def createExtension(system: ActorSystem[?]): Receptionist = new ReceptionistImpl(system) - def get(system: ActorSystem[?]): Receptionist = apply(system) + def createExtension(system: ActorSystem[_]): Receptionist = new ReceptionistImpl(system) + def get(system: ActorSystem[_]): Receptionist = apply(system) /** * The set of commands accepted by a Receptionist. @@ -172,13 +172,13 @@ object Receptionist extends ExtensionId[Receptionist] { @DoNotInherit trait Registered { - def isForKey(key: ServiceKey[?]): Boolean + def isForKey(key: ServiceKey[_]): Boolean /** Scala API */ - def key: ServiceKey[?] + def key: ServiceKey[_] /** Java API */ - def getKey: ServiceKey[?] = key + def getKey: ServiceKey[_] = key /** * Scala API @@ -255,13 +255,13 @@ object Receptionist extends ExtensionId[Receptionist] { @DoNotInherit trait Deregistered { - def isForKey(key: ServiceKey[?]): Boolean + def isForKey(key: ServiceKey[_]): Boolean /** Scala API */ - def key: ServiceKey[?] + def key: ServiceKey[_] /** Java API */ - def getKey: ServiceKey[?] = key + def getKey: ServiceKey[_] = key /** * Scala API @@ -354,12 +354,12 @@ object Receptionist extends ExtensionId[Receptionist] { trait Listing { /** Scala API */ - def key: ServiceKey[?] + def key: ServiceKey[_] /** Java API */ - def getKey: ServiceKey[?] = key + def getKey: ServiceKey[_] = key - def isForKey(key: ServiceKey[?]): Boolean + def isForKey(key: ServiceKey[_]): Boolean /** * Scala API: Return the reachable service instances. @@ -463,7 +463,7 @@ object Receptionist extends ExtensionId[Receptionist] { } object ReceptionistSetup { - def apply[T <: Extension](createExtension: ActorSystem[?] => Receptionist): ReceptionistSetup = + def apply[T <: Extension](createExtension: ActorSystem[_] => Receptionist): ReceptionistSetup = new ReceptionistSetup(createExtension(_)) } @@ -473,5 +473,5 @@ object ReceptionistSetup { * to replace the default implementation of the [[Receptionist]] extension. Intended * for tests that need to replace extension with stub/mock implementations. */ -final class ReceptionistSetup(createExtension: java.util.function.Function[ActorSystem[?], Receptionist]) +final class ReceptionistSetup(createExtension: java.util.function.Function[ActorSystem[_], Receptionist]) extends ExtensionSetup[Receptionist](Receptionist, createExtension) diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/ActorContext.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/ActorContext.scala index e7565d03e7c..86ab53c7658 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/ActorContext.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/ActorContext.scala @@ -105,7 +105,7 @@ trait ActorContext[T] extends TypedActorContext[T] with ClassicActorContextProvi * *Warning*: This method is not thread-safe and must not be accessed from threads other * than the ordinary actor message processing thread, such as [[scala.concurrent.Future]] callbacks. */ - def setLoggerName(clazz: Class[?]): Unit + def setLoggerName(clazz: Class[_]): Unit /** * The list of child Actors created by this Actor during its lifetime that diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/AskPattern.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/AskPattern.scala index 5ab409bccbe..a3e813a0ff5 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/AskPattern.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/AskPattern.scala @@ -41,7 +41,7 @@ object AskPattern { * Provides a scheduler from an actor system (that will likely already be implicit in the scope) to minimize ask * boilerplate. */ - implicit def schedulerFromActorSystem(implicit system: ActorSystem[?]): Scheduler = system.scheduler + implicit def schedulerFromActorSystem(implicit system: ActorSystem[_]): Scheduler = system.scheduler /** * See [[ask]] @@ -141,7 +141,7 @@ object AskPattern { private val onTimeout: String => Throwable = msg => new TimeoutException(msg) - private final class PromiseRef[U](target: InternalRecipientRef[?], timeout: Timeout) { + private final class PromiseRef[U](target: InternalRecipientRef[_], timeout: Timeout) { // Note: _promiseRef mustn't have a type pattern, since it can be null private[this] val (_ref: ActorRef[U], _future: Future[U], _promiseRef) = diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/adapter/package.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/adapter/package.scala index 99b1039c549..18e6583eead 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/adapter/package.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/scaladsl/adapter/package.scala @@ -83,7 +83,7 @@ package object adapter { /** * Extension methods added to [[pekko.actor.typed.ActorSystem]]. */ - implicit class TypedActorSystemOps(val sys: ActorSystem[?]) extends AnyVal { + implicit class TypedActorSystemOps(val sys: ActorSystem[_]) extends AnyVal { def toClassic: pekko.actor.ActorSystem = sys.classicSystem /** @@ -132,14 +132,14 @@ package object adapter { def watch[U](other: ActorRef[U]): Unit = ctx.watch(ActorRefAdapter.toClassic(other)) def unwatch[U](other: ActorRef[U]): Unit = ctx.unwatch(ActorRefAdapter.toClassic(other)) - def stop(child: ActorRef[?]): Unit = + def stop(child: ActorRef[_]): Unit = ctx.stop(ActorRefAdapter.toClassic(child)) } /** * Extension methods added to [[pekko.actor.typed.scaladsl.ActorContext]]. */ - implicit class TypedActorContextOps(val ctx: scaladsl.ActorContext[?]) extends AnyVal { + implicit class TypedActorContextOps(val ctx: scaladsl.ActorContext[_]) extends AnyVal { def actorOf(props: pekko.actor.Props): pekko.actor.ActorRef = ActorContextAdapter.toClassic(ctx).actorOf(props) @@ -154,7 +154,7 @@ package object adapter { /** * Extension methods added to [[pekko.actor.typed.ActorRef]]. */ - implicit class TypedActorRefOps(val ref: ActorRef[?]) extends AnyVal { + implicit class TypedActorRefOps(val ref: ActorRef[_]) extends AnyVal { def toClassic: pekko.actor.ActorRef = ActorRefAdapter.toClassic(ref) } diff --git a/actor/src/main/resources/reference.conf b/actor/src/main/resources/reference.conf index 9a7cf7b62c8..5b4add60f30 100644 --- a/actor/src/main/resources/reference.conf +++ b/actor/src/main/resources/reference.conf @@ -595,7 +595,7 @@ pekko { # If the current runtime does not support virtual thread, # then the executor configured in "fallback" will be used. virtual-thread-executor { - #Please set the underlying pool with system properties below: + #Please set the the underlying pool with system properties below: #jdk.virtualThreadScheduler.parallelism #jdk.virtualThreadScheduler.maxPoolSize #jdk.virtualThreadScheduler.minRunnable diff --git a/actor/src/main/scala-3/org/apache/pekko/util/ByteIterator.scala b/actor/src/main/scala-3/org/apache/pekko/util/ByteIterator.scala index 3e2d80f3cfb..794194f995b 100644 --- a/actor/src/main/scala-3/org/apache/pekko/util/ByteIterator.scala +++ b/actor/src/main/scala-3/org/apache/pekko/util/ByteIterator.scala @@ -46,7 +46,7 @@ object ByteIterator { final def head: Byte = array(from) final def next(): Byte = { - if !hasNext then EmptyImmutableSeq.iterator.next() + if (!hasNext) EmptyImmutableSeq.iterator.next() else { val i = from; from = from + 1; array(i) } @@ -58,12 +58,12 @@ object ByteIterator { final override def ++(that: IterableOnce[Byte]): ByteIterator = that match { case that: ByteIterator => - if that.isEmpty then this - else if this.isEmpty then that + if (that.isEmpty) this + else if (this.isEmpty) that else that match { case that: ByteArrayIterator => - if (this.array eq that.array) && (this.until == that.from) then { + if ((this.array eq that.array) && (this.until == that.from)) { this.until = that.until that.clear() this @@ -80,12 +80,12 @@ object ByteIterator { final override def clone: ByteArrayIterator = new ByteArrayIterator(array, from, until) final override def take(n: Int): this.type = { - if n < len then until = { if n > 0 then from + n else from } + if (n < len) until = { if (n > 0) from + n else from } this } final override def drop(n: Int): this.type = { - if n > 0 then from = { if n < len then from + n else until } + if (n > 0) from = { if (n < len) from + n else until } this } @@ -98,8 +98,8 @@ object ByteIterator { final override def dropWhile(p: Byte => Boolean): this.type = { var stop = false - while !stop && hasNext do { - if p(array(from)) then { + while (!stop && hasNext) { + if (p(array(from))) { from = from + 1 } else { stop = true @@ -123,7 +123,7 @@ object ByteIterator { final override def toByteString: ByteString = { val result = - if (from == 0) && (until == array.length) then ByteString.ByteString1C(array) + if ((from == 0) && (until == array.length)) ByteString.ByteString1C(array) else ByteString.ByteString1(array, from, len) clear() result @@ -131,28 +131,28 @@ object ByteIterator { @throws[NoSuchElementException] def getBytes(xs: Array[Byte], offset: Int, n: Int): this.type = { - if n <= this.len then { + if (n <= this.len) { System.arraycopy(this.array, this.from, xs, offset, n) this.drop(n) } else throw new NoSuchElementException("next on empty iterator") } override def getShort(implicit byteOrder: ByteOrder): Short = { - if len < 2 then throw new NoSuchElementException("next on empty iterator") + if (len < 2) throw new NoSuchElementException("next on empty iterator") val result = SWARUtil.getShort(array, from, byteOrder) from += 2 result } override def getInt(implicit byteOrder: ByteOrder): Int = { - if len < 4 then throw new NoSuchElementException("next on empty iterator") + if (len < 4) throw new NoSuchElementException("next on empty iterator") val result = SWARUtil.getInt(array, from, byteOrder) from += 4 result } override def getLong(implicit byteOrder: ByteOrder): Long = { - if len < 8 then throw new NoSuchElementException("next on empty iterator") + if (len < 8) throw new NoSuchElementException("next on empty iterator") val result = SWARUtil.getLong(array, from, byteOrder) from += 8 result @@ -182,7 +182,7 @@ object ByteIterator { def copyToBuffer(buffer: ByteBuffer): Int = { val copyLength = math.min(buffer.remaining, len) - if copyLength > 0 then { + if (copyLength > 0) { buffer.put(array, from, copyLength) drop(copyLength) } @@ -192,12 +192,12 @@ object ByteIterator { def asInputStream: java.io.InputStream = new java.io.InputStream { override def available: Int = iterator.len - def read: Int = if hasNext then next().toInt & 0xFF else -1 + def read: Int = if (hasNext) next().toInt & 0xFF else -1 override def read(b: Array[Byte], off: Int, len: Int): Int = { - if (off < 0) || (len < 0) || (off + len > b.length) then throw new IndexOutOfBoundsException - if len == 0 then 0 - else if !isEmpty then { + if ((off < 0) || (len < 0) || (off + len > b.length)) throw new IndexOutOfBoundsException + if (len == 0) 0 + else if (!isEmpty) { val nRead = math.min(available(), len) copyToArray(b, off, nRead) nRead @@ -227,8 +227,8 @@ object ByteIterator { // * (!iterator.head.isEmpty || iterators.tail.isEmpty) == true private def normalize(): this.type = { @tailrec def norm(xs: LinearSeq[ByteArrayIterator]): LinearSeq[ByteArrayIterator] = { - if xs.isEmpty then MultiByteArrayIterator.clearedList - else if xs.head.isEmpty then norm(xs.tail) + if (xs.isEmpty) MultiByteArrayIterator.clearedList + else if (xs.head.isEmpty) norm(xs.tail) else xs } iterators = norm(iterators) @@ -255,29 +255,29 @@ object ByteIterator { // back to the byte-by-byte super impl. Cross-fragment reads keep the byte-by-byte path. override def getShort(implicit byteOrder: ByteOrder): Short = { val cur = current - if cur.len >= java.lang.Short.BYTES then { - val r = cur.getShort(using byteOrder) + if (cur.len >= java.lang.Short.BYTES) { + val r = cur.getShort(byteOrder) normalize() r - } else super.getShort(using byteOrder) + } else super.getShort(byteOrder) } override def getInt(implicit byteOrder: ByteOrder): Int = { val cur = current - if cur.len >= java.lang.Integer.BYTES then { - val r = cur.getInt(using byteOrder) + if (cur.len >= java.lang.Integer.BYTES) { + val r = cur.getInt(byteOrder) normalize() r - } else super.getInt(using byteOrder) + } else super.getInt(byteOrder) } override def getLong(implicit byteOrder: ByteOrder): Long = { val cur = current - if cur.len >= java.lang.Long.BYTES then { - val r = cur.getLong(using byteOrder) + if (cur.len >= java.lang.Long.BYTES) { + val r = cur.getLong(byteOrder) normalize() r - } else super.getLong(using byteOrder) + } else super.getLong(byteOrder) } final override def len: Int = iterators.foldLeft(0) { _ + _.len } @@ -295,8 +295,8 @@ object ByteIterator { final override def ++(that: IterableOnce[Byte]): ByteIterator = that match { case that: ByteIterator => - if that.isEmpty then this - else if this.isEmpty then that + if (that.isEmpty) this + else if (this.isEmpty) that else { that match { case that: ByteArrayIterator => @@ -321,9 +321,9 @@ object ByteIterator { final override def take(n: Int): this.type = { var rest = n val builder = new ListBuffer[ByteArrayIterator] - while (rest > 0) && !iterators.isEmpty do { + while ((rest > 0) && !iterators.isEmpty) { current.take(rest) - if current.hasNext then { + if (current.hasNext) { rest -= current.len builder += current } @@ -335,7 +335,7 @@ object ByteIterator { /** For performance sensitive code, call drop() directly on ByteString (it's optimised there) */ final override def drop(n: Int): this.type = - if (n > 0) && !isEmpty then { + if ((n > 0) && !isEmpty) { val nCurrent = math.min(n, current.len) current.drop(n) val rest = n - nCurrent @@ -347,11 +347,11 @@ object ByteIterator { final override def takeWhile(p: Byte => Boolean): this.type = { var stop = false val builder = new ListBuffer[ByteArrayIterator] - while !stop && !iterators.isEmpty do { + while (!stop && !iterators.isEmpty) { val lastLen = current.len current.takeWhile(p) - if current.hasNext then builder += current - if current.len < lastLen then stop = true + if (current.hasNext) builder += current + if (current.len < lastLen) stop = true dropCurrent() } iterators = builder.result() @@ -359,22 +359,22 @@ object ByteIterator { } @tailrec final override def dropWhile(p: Byte => Boolean): this.type = - if !isEmpty then { + if (!isEmpty) { current.dropWhile(p) val dropMore = current.isEmpty normalize() - if dropMore then dropWhile(p) else this + if (dropMore) dropWhile(p) else this } else this final override def copyToArray[B >: Byte](xs: Array[B], start: Int, len: Int): Int = { var pos = start var rest = len - while (rest > 0) && !iterators.isEmpty && pos < xs.length do { + while ((rest > 0) && !iterators.isEmpty && pos < xs.length) { val n = 0 max ((xs.length - pos) min current.len min rest) current.copyToArray(xs, pos, n) pos += n rest -= n - if current.isEmpty then { + if (current.isEmpty) { dropCurrent() } } @@ -388,7 +388,7 @@ object ByteIterator { } final override def toByteString: ByteString = { - if iterators.tail.isEmpty then iterators.head.toByteString + if (iterators.tail.isEmpty) iterators.head.toByteString else { val result = iterators.foldLeft(ByteString.empty) { _ ++ _.toByteString } clear() @@ -398,10 +398,10 @@ object ByteIterator { @tailrec protected final def getToArray[A](xs: Array[A], offset: Int, n: Int, elemSize: Int)(getSingle: => A)( getMult: (Array[A], Int, Int) => Unit): this.type = - if n <= 0 then this + if (n <= 0) this else { - if isEmpty then EmptyImmutableSeq.iterator.next() - val nDone = if current.len >= elemSize then { + if (isEmpty) EmptyImmutableSeq.iterator.next() + val nDone = if (current.len >= elemSize) { val nCurrent = math.min(n, current.len / elemSize) getMult(xs, offset, nCurrent) nCurrent @@ -417,19 +417,19 @@ object ByteIterator { getToArray(xs, offset, n, 1) { getByte } { current.getBytes(_, _, _) } def getShorts(xs: Array[Short], offset: Int, n: Int)(implicit byteOrder: ByteOrder): this.type = - getToArray(xs, offset, n, 2) { getShort(using byteOrder) } { current.getShorts(_, _, _)(using byteOrder) } + getToArray(xs, offset, n, 2) { getShort(byteOrder) } { current.getShorts(_, _, _)(byteOrder) } def getInts(xs: Array[Int], offset: Int, n: Int)(implicit byteOrder: ByteOrder): this.type = - getToArray(xs, offset, n, 4) { getInt(using byteOrder) } { current.getInts(_, _, _)(using byteOrder) } + getToArray(xs, offset, n, 4) { getInt(byteOrder) } { current.getInts(_, _, _)(byteOrder) } def getLongs(xs: Array[Long], offset: Int, n: Int)(implicit byteOrder: ByteOrder): this.type = - getToArray(xs, offset, n, 8) { getLong(using byteOrder) } { current.getLongs(_, _, _)(using byteOrder) } + getToArray(xs, offset, n, 8) { getLong(byteOrder) } { current.getLongs(_, _, _)(byteOrder) } def getFloats(xs: Array[Float], offset: Int, n: Int)(implicit byteOrder: ByteOrder): this.type = - getToArray(xs, offset, n, 8) { getFloat(using byteOrder) } { current.getFloats(_, _, _)(using byteOrder) } + getToArray(xs, offset, n, 8) { getFloat(byteOrder) } { current.getFloats(_, _, _)(byteOrder) } def getDoubles(xs: Array[Double], offset: Int, n: Int)(implicit byteOrder: ByteOrder): this.type = - getToArray(xs, offset, n, 8) { getDouble(using byteOrder) } { current.getDoubles(_, _, _)(using byteOrder) } + getToArray(xs, offset, n, 8) { getDouble(byteOrder) } { current.getDoubles(_, _, _)(byteOrder) } /** For performance sensitive code, call copyToBuffer() directly on ByteString (it's optimised there) */ override def copyToBuffer(buffer: ByteBuffer): Int = { @@ -442,7 +442,7 @@ object ByteIterator { def asInputStream: java.io.InputStream = new java.io.InputStream { override def available: Int = current.len - def read: Int = if hasNext then next().toInt & 0xFF else -1 + def read: Int = if (hasNext) next().toInt & 0xFF else -1 override def read(b: Array[Byte], off: Int, len: Int): Int = { val nRead = current.asInputStream.read(b, off, len) @@ -452,13 +452,13 @@ object ByteIterator { override def skip(n: Long): Long = { @tailrec def skipImpl(n: Long, skipped: Long): Long = - if n > 0 then { - if !isEmpty then { + if (n > 0) { + if (!isEmpty) { val m = current.asInputStream.skip(n) normalize() val newN = n - m val newSkipped = skipped + m - if newN > 0 then skipImpl(newN, newSkipped) + if (newN > 0) skipImpl(newN, newSkipped) else newSkipped } else 0 } else 0 @@ -483,7 +483,7 @@ abstract class ByteIterator extends BufferedIterator[Byte] { def ++(that: IterableOnce[Byte]): ByteIterator = { val it = that.iterator - if it.isEmpty then this + if (it.isEmpty) this else ByteIterator.ByteArrayIterator(it.toArray) } @@ -508,7 +508,7 @@ abstract class ByteIterator extends BufferedIterator[Byte] { throw new UnsupportedOperationException("Method drop is not implemented in ByteIterator") override def slice(from: Int, until: Int): this.type = { - if from > 0 then drop(from).take(until - from) + if (from > 0) drop(from).take(until - from) else take(until) } @@ -533,18 +533,17 @@ abstract class ByteIterator extends BufferedIterator[Byte] { override def indexWhere(p: Byte => Boolean, from: Int = 0): Int = { var index = 0 - while index < from && hasNext do { + while (index < from && hasNext) { next() index += 1 } var found = false - while !found && hasNext do - if p(next()) then { - found = true - } else { - index += 1 - } - if found then index else -1 + while (!found && hasNext) if (p(next())) { + found = true + } else { + index += 1 + } + if (found) index else -1 } def indexOf(elem: Byte): Int = indexOf(elem, 0) @@ -558,7 +557,7 @@ abstract class ByteIterator extends BufferedIterator[Byte] { override def toSeq: ByteString = toByteString override def foreach[@specialized U](f: Byte => U): Unit = - while hasNext do f(next()) + while (hasNext) f(next()) override def foldLeft[@specialized B](z: B)(op: (B, Byte) => B): B = { var acc = z @@ -583,9 +582,9 @@ abstract class ByteIterator extends BufferedIterator[Byte] { * Get a single Short from this iterator. */ def getShort(implicit byteOrder: ByteOrder): Short = { - if byteOrder == ByteOrder.BIG_ENDIAN then + if (byteOrder == ByteOrder.BIG_ENDIAN) ((next() & 0xFF) << 8 | (next() & 0xFF) << 0).toShort - else if byteOrder == ByteOrder.LITTLE_ENDIAN then + else if (byteOrder == ByteOrder.LITTLE_ENDIAN) ((next() & 0xFF) << 0 | (next() & 0xFF) << 8).toShort else throw new IllegalArgumentException("Unknown byte order " + byteOrder) } @@ -594,12 +593,12 @@ abstract class ByteIterator extends BufferedIterator[Byte] { * Get a single Int from this iterator. */ def getInt(implicit byteOrder: ByteOrder): Int = { - if byteOrder == ByteOrder.BIG_ENDIAN then + if (byteOrder == ByteOrder.BIG_ENDIAN) ((next() & 0xFF) << 24 | (next() & 0xFF) << 16 | (next() & 0xFF) << 8 | (next() & 0xFF) << 0) - else if byteOrder == ByteOrder.LITTLE_ENDIAN then + else if (byteOrder == ByteOrder.LITTLE_ENDIAN) ((next() & 0xFF) << 0 | (next() & 0xFF) << 8 | (next() & 0xFF) << 16 @@ -611,7 +610,7 @@ abstract class ByteIterator extends BufferedIterator[Byte] { * Get a single Long from this iterator. */ def getLong(implicit byteOrder: ByteOrder): Long = { - if byteOrder == ByteOrder.BIG_ENDIAN then + if (byteOrder == ByteOrder.BIG_ENDIAN) ((next().toLong & 0xFF) << 56 | (next().toLong & 0xFF) << 48 | (next().toLong & 0xFF) << 40 @@ -620,7 +619,7 @@ abstract class ByteIterator extends BufferedIterator[Byte] { | (next().toLong & 0xFF) << 16 | (next().toLong & 0xFF) << 8 | (next().toLong & 0xFF) << 0) - else if byteOrder == ByteOrder.LITTLE_ENDIAN then + else if (byteOrder == ByteOrder.LITTLE_ENDIAN) ((next().toLong & 0xFF) << 0 | (next().toLong & 0xFF) << 8 | (next().toLong & 0xFF) << 16 @@ -637,11 +636,11 @@ abstract class ByteIterator extends BufferedIterator[Byte] { * bytes were encoded. */ def getLongPart(n: Int)(implicit byteOrder: ByteOrder): Long = { - if byteOrder == ByteOrder.BIG_ENDIAN then { + if (byteOrder == ByteOrder.BIG_ENDIAN) { var x = 0L (1 to n).foreach(_ => x = (x << 8) | (next() & 0xFF)) x - } else if byteOrder == ByteOrder.LITTLE_ENDIAN then { + } else if (byteOrder == ByteOrder.LITTLE_ENDIAN) { var x = 0L (0 until n).foreach(i => x |= (next() & 0xFF) << 8 * i) x @@ -649,10 +648,10 @@ abstract class ByteIterator extends BufferedIterator[Byte] { } def getFloat(implicit byteOrder: ByteOrder): Float = - java.lang.Float.intBitsToFloat(getInt(using byteOrder)) + java.lang.Float.intBitsToFloat(getInt(byteOrder)) def getDouble(implicit byteOrder: ByteOrder): Double = - java.lang.Double.longBitsToDouble(getLong(using byteOrder)) + java.lang.Double.longBitsToDouble(getLong(byteOrder)) /** * Get a specific number of Bytes from this iterator. In contrast to @@ -690,7 +689,7 @@ abstract class ByteIterator extends BufferedIterator[Byte] { * Get a number of Shorts from this iterator. */ def getShorts(xs: Array[Short])(implicit byteOrder: ByteOrder): this.type = - getShorts(xs, 0, xs.length)(using byteOrder) + getShorts(xs, 0, xs.length)(byteOrder) /** * Get a number of Shorts from this iterator. @@ -701,7 +700,7 @@ abstract class ByteIterator extends BufferedIterator[Byte] { * Get a number of Ints from this iterator. */ def getInts(xs: Array[Int])(implicit byteOrder: ByteOrder): this.type = - getInts(xs, 0, xs.length)(using byteOrder) + getInts(xs, 0, xs.length)(byteOrder) /** * Get a number of Ints from this iterator. @@ -712,7 +711,7 @@ abstract class ByteIterator extends BufferedIterator[Byte] { * Get a number of Longs from this iterator. */ def getLongs(xs: Array[Long])(implicit byteOrder: ByteOrder): this.type = - getLongs(xs, 0, xs.length)(using byteOrder) + getLongs(xs, 0, xs.length)(byteOrder) /** * Get a number of Longs from this iterator. @@ -723,7 +722,7 @@ abstract class ByteIterator extends BufferedIterator[Byte] { * Get a number of Floats from this iterator. */ def getFloats(xs: Array[Float])(implicit byteOrder: ByteOrder): this.type = - getFloats(xs, 0, xs.length)(using byteOrder) + getFloats(xs, 0, xs.length)(byteOrder) /** * Get a number of Floats from this iterator. @@ -734,7 +733,7 @@ abstract class ByteIterator extends BufferedIterator[Byte] { * Get a number of Doubles from this iterator. */ def getDoubles(xs: Array[Double])(implicit byteOrder: ByteOrder): this.type = - getDoubles(xs, 0, xs.length)(using byteOrder) + getDoubles(xs, 0, xs.length)(byteOrder) /** * Get a number of Doubles from this iterator. diff --git a/actor/src/main/scala/org/apache/pekko/actor/AbstractProps.scala b/actor/src/main/scala/org/apache/pekko/actor/AbstractProps.scala index bff3f4f22fa..78912498f43 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/AbstractProps.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/AbstractProps.scala @@ -30,7 +30,7 @@ private[pekko] trait AbstractProps { /** * INTERNAL API */ - private[pekko] def validate(clazz: Class[?]): Unit = { + private[pekko] def validate(clazz: Class[_]): Unit = { if (Modifier.isAbstract(clazz.getModifiers)) { throw new IllegalArgumentException(s"Actor class [${clazz.getName}] must not be abstract") } else if (!classOf[Actor].isAssignableFrom(clazz) && @@ -44,7 +44,7 @@ private[pekko] trait AbstractProps { * Java API: create a Props given a class and its constructor arguments. */ @varargs - def create(clazz: Class[?], args: AnyRef*): Props = + def create(clazz: Class[_], args: AnyRef*): Props = new Props(deploy = Props.defaultDeploy, clazz = clazz, args = args.toList) /** @@ -55,10 +55,10 @@ private[pekko] trait AbstractProps { create(classOf[CreatorConsumer], actorClass, creator) } - private def checkCreatorClosingOver(clazz: Class[?]): Unit = { + private def checkCreatorClosingOver(clazz: Class[_]): Unit = { val enclosingClass = clazz.getEnclosingClass - def hasDeclaredConstructorWithEmptyParams(declaredConstructors: Array[Constructor[?]]): Boolean = { + def hasDeclaredConstructorWithEmptyParams(declaredConstructors: Array[Constructor[_]]): Boolean = { @tailrec def loop(i: Int): Boolean = { if (i == declaredConstructors.length) false else { @@ -71,7 +71,7 @@ private[pekko] trait AbstractProps { loop(0) } - def hasDeclaredConstructorWithEnclosingClassParam(declaredConstructors: Array[Constructor[?]]): Boolean = { + def hasDeclaredConstructorWithEnclosingClassParam(declaredConstructors: Array[Constructor[_]]): Boolean = { @tailrec def loop(i: Int): Boolean = { if (i == declaredConstructors.length) false else { diff --git a/actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala b/actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala index 7f853edd8ef..eafd287823c 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala @@ -729,5 +729,5 @@ private[pekko] class ActorCell( try system.eventStream.publish(e) catch { case NonFatal(_) => } - protected final def clazz(o: AnyRef): Class[?] = if (o eq null) this.getClass else o.getClass + protected final def clazz(o: AnyRef): Class[_] = if (o eq null) this.getClass else o.getClass } diff --git a/actor/src/main/scala/org/apache/pekko/actor/ActorRefProvider.scala b/actor/src/main/scala/org/apache/pekko/actor/ActorRefProvider.scala index 472adfbf4ad..286d395945b 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/ActorRefProvider.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/ActorRefProvider.scala @@ -470,18 +470,18 @@ private[pekko] class LocalActorRefProvider private[pekko] ( if (isWalking) message match { case null => throw InvalidMessageException("Message is null") - case _ => log.error("{} received unexpected message [{}]", this, message) + case _ => log.error(s"$this received unexpected message [$message]") } override def sendSystemMessage(message: SystemMessage): Unit = if (isWalking) { message match { case Failed(child: InternalActorRef, ex, _) => - log.error(ex, "guardian {} failed, shutting down!", child) + log.error(ex, s"guardian $child failed, shutting down!") causeOfTermination.tryFailure(ex) child.stop() case Supervise(_, _) => // TODO register child in some map to keep track of it and enable shutdown after all dead case _: DeathWatchNotification => stop() - case _ => log.error("{} received unexpected system message [{}]", this, message) + case _ => log.error(s"$this received unexpected system message [$message]") } } } diff --git a/actor/src/main/scala/org/apache/pekko/actor/ActorSystem.scala b/actor/src/main/scala/org/apache/pekko/actor/ActorSystem.scala index cc0ae959a9d..ba3ace091be 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/ActorSystem.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/ActorSystem.scala @@ -739,7 +739,7 @@ abstract class ActorSystem extends ActorRefFactory with ClassicActorSystemProvid * Returns whether the specified extension is already registered, this method can potentially block, waiting for the initialization * of the payload, if is in the process of registration from another Thread of execution */ - def hasExtension(ext: ExtensionId[? <: Extension]): Boolean + def hasExtension(ext: ExtensionId[_ <: Extension]): Boolean } /** @@ -1189,7 +1189,7 @@ private[pekko] class ActorSystemImpl( // 1) a CountDownLatch (if it's still in the process of being registered), // 2) a Throwable (if it failed initializing), or // 3) the registered extension. - private val extensions = new ConcurrentHashMap[ExtensionId[?], AnyRef] + private val extensions = new ConcurrentHashMap[ExtensionId[_], AnyRef] /** * Returns any extension registered to the specified Extension or returns null if not registered @@ -1246,7 +1246,7 @@ private[pekko] class ActorSystemImpl( case some => some.asInstanceOf[T] } - def hasExtension(ext: ExtensionId[? <: Extension]): Boolean = findExtension(ext) != null + def hasExtension(ext: ExtensionId[_ <: Extension]): Boolean = findExtension(ext) != null private def loadExtensions(): Unit = { @@ -1264,7 +1264,7 @@ private[pekko] class ActorSystemImpl( } match { case Success(p: ExtensionIdProvider) => registerExtension(p.lookup) - case Success(p: ExtensionId[?]) => + case Success(p: ExtensionId[_]) => registerExtension(p) case Success(_) => if (!throwOnLoadFail) log.error("[{}] is not an 'ExtensionIdProvider' or 'ExtensionId', skipping...", fqcn) diff --git a/actor/src/main/scala/org/apache/pekko/actor/CoordinatedShutdown.scala b/actor/src/main/scala/org/apache/pekko/actor/CoordinatedShutdown.scala index e11b514d359..8491f64bd26 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/CoordinatedShutdown.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/CoordinatedShutdown.scala @@ -318,7 +318,7 @@ object CoordinatedShutdown extends ExtensionId[CoordinatedShutdown] with Extensi depends-on = [] """) phasesConf.root.unwrapped.asScala.toMap.map { - case (k, _: java.util.Map[?, ?]) => + case (k, _: java.util.Map[_, _]) => val c = phasesConf.getConfig(k).withFallback(defaultPhaseConfig) val dependsOn = c.getStringList("depends-on").asScala.toSet val timeout = c.getDuration("timeout", MILLISECONDS).millis @@ -722,7 +722,7 @@ final class CoordinatedShutdown private[pekko] ( case Nil => Future.successful(Done) case phaseName :: remaining if !phases(phaseName).enabled => tasks.get(phaseName).foreach { phaseDef => - log.info("Phase [{}] disabled through configuration, skipping [{}] tasks.", phaseName, phaseDef.size) + log.info(s"Phase [{}] disabled through configuration, skipping [{}] tasks.", phaseName, phaseDef.size) } loop(remaining) case phaseName :: remaining => diff --git a/actor/src/main/scala/org/apache/pekko/actor/Deployer.scala b/actor/src/main/scala/org/apache/pekko/actor/Deployer.scala index 9a9394bb580..ebbc9d79b36 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/Deployer.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/Deployer.scala @@ -293,7 +293,7 @@ private[pekko] class Deployer(val settings: ActorSystem.Settings, val dynamicAcc val fqn = routerTypeMapping.getOrElse(routerType, routerType) - def throwCannotInstantiateRouter(args: Seq[(Class[?], AnyRef)], cause: Throwable) = + def throwCannotInstantiateRouter(args: Seq[(Class[_], AnyRef)], cause: Throwable) = throw new IllegalArgumentException( s"Cannot instantiate router [$fqn], defined in [$key], " + s"make sure it extends [${classOf[RouterConfig]}] and has constructor with " + diff --git a/actor/src/main/scala/org/apache/pekko/actor/DynamicAccess.scala b/actor/src/main/scala/org/apache/pekko/actor/DynamicAccess.scala index dd89062f804..0797c4444b5 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/DynamicAccess.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/DynamicAccess.scala @@ -40,13 +40,13 @@ import pekko.annotation.DoNotInherit * val obj = DynamicAccess.createInstanceFor(clazz, Seq(classOf[Config] -> config, classOf[String] -> name)) * }}} */ - def createInstanceFor[T: ClassTag](clazz: Class[?], args: immutable.Seq[(Class[?], AnyRef)]): Try[T] + def createInstanceFor[T: ClassTag](clazz: Class[_], args: immutable.Seq[(Class[_], AnyRef)]): Try[T] /** * Obtain a `Class[_]` object loaded with the right class loader (i.e. the one * returned by `classLoader`). */ - def getClassFor[T: ClassTag](fqcn: String): Try[Class[? <: T]] + def getClassFor[T: ClassTag](fqcn: String): Try[Class[_ <: T]] def classIsOnClasspath(fqcn: String): Boolean @@ -57,7 +57,7 @@ import pekko.annotation.DoNotInherit * `args` argument. The exact usage of args depends on which type is requested, * see the relevant requesting code for details. */ - def createInstanceFor[T: ClassTag](fqcn: String, args: immutable.Seq[(Class[?], AnyRef)]): Try[T] + def createInstanceFor[T: ClassTag](fqcn: String, args: immutable.Seq[(Class[_], AnyRef)]): Try[T] /** * Obtain the Scala “object” instance for the given fully-qualified class name, if there is one. diff --git a/actor/src/main/scala/org/apache/pekko/actor/Extension.scala b/actor/src/main/scala/org/apache/pekko/actor/Extension.scala index 4c34ede55c6..00dc881af39 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/Extension.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/Extension.scala @@ -139,5 +139,5 @@ trait ExtensionIdProvider { /** * Returns the canonical ExtensionId for this Extension */ - def lookup: ExtensionId[? <: Extension] + def lookup: ExtensionId[_ <: Extension] } diff --git a/actor/src/main/scala/org/apache/pekko/actor/FSM.scala b/actor/src/main/scala/org/apache/pekko/actor/FSM.scala index 49aef7c78bd..a46a7378fae 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/FSM.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/FSM.scala @@ -228,13 +228,13 @@ object FSM { def canEqual(that: Any): Boolean = { that match { - case _: State[?, ?] => true + case _: State[_, _] => true case _ => false } } override def equals(that: Any) = that match { - case other: State[?, ?] => + case other: State[_, _] => other.canEqual(this) && this.stateName == other.stateName && this.stateData == other.stateData && diff --git a/actor/src/main/scala/org/apache/pekko/actor/FaultHandling.scala b/actor/src/main/scala/org/apache/pekko/actor/FaultHandling.scala index 73b97fb7f6b..988b0e82c68 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/FaultHandling.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/FaultHandling.scala @@ -244,17 +244,17 @@ object SupervisorStrategy extends SupervisorStrategyLowPriorityImplicits { * Implicit conversion from `Seq` of Throwables to a `Decider`. * This maps the given Throwables to restarts, otherwise escalates. */ - implicit def seqThrowable2Decider(trapExit: immutable.Seq[Class[? <: Throwable]]): Decider = makeDecider(trapExit) + implicit def seqThrowable2Decider(trapExit: immutable.Seq[Class[_ <: Throwable]]): Decider = makeDecider(trapExit) type Decider = PartialFunction[Throwable, Directive] type JDecider = pekko.japi.function.Function[Throwable, Directive] - type CauseDirective = (Class[? <: Throwable], Directive) + type CauseDirective = (Class[_ <: Throwable], Directive) /** * Decider builder which just checks whether one of * the given Throwables matches the cause and restarts, otherwise escalates. */ - def makeDecider(trapExit: immutable.Seq[Class[? <: Throwable]]): Decider = { + def makeDecider(trapExit: immutable.Seq[Class[_ <: Throwable]]): Decider = { case x => if (trapExit.exists(_.isInstance(x))) Restart else Escalate } @@ -262,7 +262,7 @@ object SupervisorStrategy extends SupervisorStrategyLowPriorityImplicits { * Decider builder which just checks whether one of * the given Throwables matches the cause and restarts, otherwise escalates. */ - def makeDecider(trapExit: JIterable[Class[? <: Throwable]]): Decider = makeDecider(immutableSeq(trapExit)) + def makeDecider(trapExit: JIterable[Class[_ <: Throwable]]): Decider = makeDecider(immutableSeq(trapExit)) /** * Decider builder for Iterables of cause-directive pairs, e.g. a map obtained @@ -505,13 +505,13 @@ case class AllForOneStrategy( /** * Java API */ - def this(maxNrOfRetries: Int, withinTimeRange: Duration, trapExit: JIterable[Class[? <: Throwable]]) = + def this(maxNrOfRetries: Int, withinTimeRange: Duration, trapExit: JIterable[Class[_ <: Throwable]]) = this(maxNrOfRetries, withinTimeRange)(SupervisorStrategy.makeDecider(trapExit)) /** * Java API */ - def this(maxNrOfRetries: Int, withinTimeRange: java.time.Duration, trapExit: JIterable[Class[? <: Throwable]]) = + def this(maxNrOfRetries: Int, withinTimeRange: java.time.Duration, trapExit: JIterable[Class[_ <: Throwable]]) = this(maxNrOfRetries, withinTimeRange.toScala)(SupervisorStrategy.makeDecider(trapExit)) /** @@ -618,13 +618,13 @@ case class OneForOneStrategy( /** * Java API */ - def this(maxNrOfRetries: Int, withinTimeRange: Duration, trapExit: JIterable[Class[? <: Throwable]]) = + def this(maxNrOfRetries: Int, withinTimeRange: Duration, trapExit: JIterable[Class[_ <: Throwable]]) = this(maxNrOfRetries, withinTimeRange)(SupervisorStrategy.makeDecider(trapExit)) /** * Java API */ - def this(maxNrOfRetries: Int, withinTimeRange: java.time.Duration, trapExit: JIterable[Class[? <: Throwable]]) = + def this(maxNrOfRetries: Int, withinTimeRange: java.time.Duration, trapExit: JIterable[Class[_ <: Throwable]]) = this(maxNrOfRetries, withinTimeRange.toScala)(SupervisorStrategy.makeDecider(trapExit)) /** diff --git a/actor/src/main/scala/org/apache/pekko/actor/IndirectActorProducer.scala b/actor/src/main/scala/org/apache/pekko/actor/IndirectActorProducer.scala index fa6ec6f4a5f..0094a1d7aba 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/IndirectActorProducer.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/IndirectActorProducer.scala @@ -44,7 +44,7 @@ trait IndirectActorProducer { * that the instance created for calling `actorClass` is not necessarily reused * later to produce the actor. */ - def actorClass: Class[? <: Actor] + def actorClass: Class[_ <: Actor] } private[pekko] object IndirectActorProducer { @@ -52,7 +52,7 @@ private[pekko] object IndirectActorProducer { val CreatorConsumerClass = classOf[CreatorConsumer] val TypedCreatorFunctionConsumerClass = classOf[TypedCreatorFunctionConsumer] @nowarn - def apply(clazz: Class[?], args: immutable.Seq[Any]): IndirectActorProducer = { + def apply(clazz: Class[_], args: immutable.Seq[Any]): IndirectActorProducer = { if (classOf[IndirectActorProducer].isAssignableFrom(clazz)) { def get1stArg[T]: T = args.head.asInstanceOf[T] def get2ndArg[T]: T = args.tail.head.asInstanceOf[T] @@ -69,8 +69,8 @@ private[pekko] object IndirectActorProducer { Reflect.instantiate(clazz, args).asInstanceOf[IndirectActorProducer] } } else if (classOf[Actor].isAssignableFrom(clazz)) { - if (args.isEmpty) new NoArgsReflectConstructor(clazz.asInstanceOf[Class[? <: Actor]]) - else new ArgsReflectConstructor(clazz.asInstanceOf[Class[? <: Actor]], args) + if (args.isEmpty) new NoArgsReflectConstructor(clazz.asInstanceOf[Class[_ <: Actor]]) + else new ArgsReflectConstructor(clazz.asInstanceOf[Class[_ <: Actor]], args) } else throw new IllegalArgumentException(s"unknown actor creator [$clazz]") } } @@ -86,7 +86,7 @@ private[pekko] class CreatorFunctionConsumer(creator: () => Actor) extends Indir /** * INTERNAL API */ -private[pekko] class CreatorConsumer(clazz: Class[? <: Actor], creator: Creator[Actor]) extends IndirectActorProducer { +private[pekko] class CreatorConsumer(clazz: Class[_ <: Actor], creator: Creator[Actor]) extends IndirectActorProducer { override def actorClass = clazz override def produce() = creator.create() } @@ -94,7 +94,7 @@ private[pekko] class CreatorConsumer(clazz: Class[? <: Actor], creator: Creator[ /** * INTERNAL API */ -private[pekko] class TypedCreatorFunctionConsumer(clz: Class[? <: Actor], creator: () => Actor) +private[pekko] class TypedCreatorFunctionConsumer(clz: Class[_ <: Actor], creator: () => Actor) extends IndirectActorProducer { override def actorClass = clz override def produce() = creator() @@ -103,7 +103,7 @@ private[pekko] class TypedCreatorFunctionConsumer(clz: Class[? <: Actor], creato /** * INTERNAL API */ -private[pekko] class ArgsReflectConstructor(clz: Class[? <: Actor], args: immutable.Seq[Any]) +private[pekko] class ArgsReflectConstructor(clz: Class[_ <: Actor], args: immutable.Seq[Any]) extends IndirectActorProducer { private[this] val constructor = Reflect.findConstructor(clz, args) override def actorClass = clz @@ -113,7 +113,7 @@ private[pekko] class ArgsReflectConstructor(clz: Class[? <: Actor], args: immuta /** * INTERNAL API */ -private[pekko] class NoArgsReflectConstructor(clz: Class[? <: Actor]) extends IndirectActorProducer { +private[pekko] class NoArgsReflectConstructor(clz: Class[_ <: Actor]) extends IndirectActorProducer { Reflect.findConstructor(clz, List.empty) override def actorClass = clz override def produce() = Reflect.instantiate(clz) diff --git a/actor/src/main/scala/org/apache/pekko/actor/Props.scala b/actor/src/main/scala/org/apache/pekko/actor/Props.scala index 69f2ef1f79c..80637e04fe2 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/Props.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/Props.scala @@ -87,13 +87,13 @@ object Props extends AbstractProps { def apply[T <: Actor: ClassTag](creator: => T): Props = mkProps(implicitly[ClassTag[T]].runtimeClass, () => creator) - private def mkProps(classOfActor: Class[?], ctor: () => Actor): Props = + private def mkProps(classOfActor: Class[_], ctor: () => Actor): Props = Props(classOf[TypedCreatorFunctionConsumer], classOfActor, ctor) /** * Scala API: create a Props given a class and its constructor arguments. */ - def apply(clazz: Class[?], args: Any*): Props = apply(defaultDeploy, clazz, args.toList) + def apply(clazz: Class[_], args: Any*): Props = apply(defaultDeploy, clazz, args.toList) } @@ -121,7 +121,7 @@ object Props extends AbstractProps { * }}} */ @SerialVersionUID(2L) -final case class Props(deploy: Deploy, clazz: Class[?], args: immutable.Seq[Any]) { +final case class Props(deploy: Deploy, clazz: Class[_], args: immutable.Seq[Any]) { Props.validate(clazz) @@ -131,7 +131,7 @@ final case class Props(deploy: Deploy, clazz: Class[?], args: immutable.Seq[Any] // derived property, does not need to be serialized @transient - private[this] var _cachedActorClass: Class[? <: Actor] = _ + private[this] var _cachedActorClass: Class[_ <: Actor] = _ /** * INTERNAL API @@ -143,7 +143,7 @@ final case class Props(deploy: Deploy, clazz: Class[?], args: immutable.Seq[Any] _producer } - private[this] def cachedActorClass: Class[? <: Actor] = { + private[this] def cachedActorClass: Class[_ <: Actor] = { if (_cachedActorClass eq null) _cachedActorClass = producer.actorClass @@ -223,7 +223,7 @@ final case class Props(deploy: Deploy, clazz: Class[?], args: immutable.Seq[Any] * the actor system to select special dispatchers or mailboxes in case * dependencies are encoded in the actor type. */ - def actorClass(): Class[? <: Actor] = cachedActorClass + def actorClass(): Class[_ <: Actor] = cachedActorClass /** * INTERNAL API diff --git a/actor/src/main/scala/org/apache/pekko/actor/ReflectiveDynamicAccess.scala b/actor/src/main/scala/org/apache/pekko/actor/ReflectiveDynamicAccess.scala index a35feafce5c..1bd02406a3c 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/ReflectiveDynamicAccess.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/ReflectiveDynamicAccess.scala @@ -34,14 +34,14 @@ import pekko.annotation.DoNotInherit @DoNotInherit class ReflectiveDynamicAccess(val classLoader: ClassLoader) extends DynamicAccess { - override def getClassFor[T: ClassTag](fqcn: String): Try[Class[? <: T]] = - Try[Class[? <: T]] { - val c = Class.forName(fqcn, false, classLoader).asInstanceOf[Class[? <: T]] + override def getClassFor[T: ClassTag](fqcn: String): Try[Class[_ <: T]] = + Try[Class[_ <: T]] { + val c = Class.forName(fqcn, false, classLoader).asInstanceOf[Class[_ <: T]] val t = implicitly[ClassTag[T]].runtimeClass if (t.isAssignableFrom(c)) c else throw new ClassCastException(t.toString + " is not assignable from " + c) } - override def createInstanceFor[T: ClassTag](clazz: Class[?], args: immutable.Seq[(Class[?], AnyRef)]): Try[T] = + override def createInstanceFor[T: ClassTag](clazz: Class[_], args: immutable.Seq[(Class[_], AnyRef)]): Try[T] = Try { val types = args.map(_._1).toArray val values = args.map(_._2).toArray @@ -53,7 +53,7 @@ class ReflectiveDynamicAccess(val classLoader: ClassLoader) extends DynamicAcces else throw new ClassCastException(clazz.getName + " is not a subtype of " + t) }.recover { case i: InvocationTargetException if i.getTargetException ne null => throw i.getTargetException } - override def createInstanceFor[T: ClassTag](fqcn: String, args: immutable.Seq[(Class[?], AnyRef)]): Try[T] = + override def createInstanceFor[T: ClassTag](fqcn: String, args: immutable.Seq[(Class[_], AnyRef)]): Try[T] = getClassFor(fqcn).flatMap { c => createInstanceFor(c, args) } diff --git a/actor/src/main/scala/org/apache/pekko/actor/Stash.scala b/actor/src/main/scala/org/apache/pekko/actor/Stash.scala index 104962a103f..823253f0ab9 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/Stash.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/Stash.scala @@ -254,7 +254,7 @@ private[pekko] trait StashSupport { /** * INTERNAL API. * - * Clears the stash and returns all envelopes that have not been unstashed. + * Clears the stash and and returns all envelopes that have not been unstashed. */ @InternalStableApi private[pekko] def clearStash(): Vector[Envelope] = { diff --git a/actor/src/main/scala/org/apache/pekko/actor/dungeon/ChildrenContainer.scala b/actor/src/main/scala/org/apache/pekko/actor/dungeon/ChildrenContainer.scala index bbba764ed9d..c433d4170dc 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/dungeon/ChildrenContainer.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/dungeon/ChildrenContainer.scala @@ -59,14 +59,14 @@ private[pekko] object ChildrenContainer { final case class Creation() extends SuspendReason with WaitingForChildren case object Termination extends SuspendReason - class ChildRestartsIterable(stats: immutable.Map[?, ChildStats]) + class ChildRestartsIterable(stats: immutable.Map[_, ChildStats]) extends PartialImmutableValuesIterable[ChildStats, ChildRestartStats] { override final def apply(c: ChildStats) = c.asInstanceOf[ChildRestartStats] override final def isDefinedAt(c: ChildStats) = c.isInstanceOf[ChildRestartStats] override final def valuesIterator = stats.valuesIterator } - class ChildrenIterable(stats: immutable.Map[?, ChildStats]) + class ChildrenIterable(stats: immutable.Map[_, ChildStats]) extends PartialImmutableValuesIterable[ChildStats, ActorRef] { override final def apply(c: ChildStats) = c.asInstanceOf[ChildRestartStats].child override final def isDefinedAt(c: ChildStats) = c.isInstanceOf[ChildRestartStats] diff --git a/actor/src/main/scala/org/apache/pekko/actor/dungeon/Dispatch.scala b/actor/src/main/scala/org/apache/pekko/actor/dungeon/Dispatch.scala index 03ab027db62..cfdd058062e 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/dungeon/Dispatch.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/dungeon/Dispatch.scala @@ -91,7 +91,7 @@ private[pekko] trait Dispatch { this: ActorCell => // it properly in the normal way val actorClass = props.actorClass() val createMessage = mailboxType match { - case _: ProducesMessageQueue[?] if system.mailboxes.hasRequiredType(actorClass) => + case _: ProducesMessageQueue[_] if system.mailboxes.hasRequiredType(actorClass) => val req = system.mailboxes.getRequiredType(actorClass) if (req.isInstance(mbox.messageQueue)) Create(None) else { diff --git a/actor/src/main/scala/org/apache/pekko/actor/dungeon/TimerSchedulerImpl.scala b/actor/src/main/scala/org/apache/pekko/actor/dungeon/TimerSchedulerImpl.scala index e1ea980f3c8..f5a973ef63e 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/dungeon/TimerSchedulerImpl.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/dungeon/TimerSchedulerImpl.scala @@ -149,7 +149,7 @@ import pekko.util.OptionVal } else { // it was from an old timer that was enqueued in mailbox before canceled log.debug( - "Received timer [{}] from old generation [{}], expected generation [{}], discarding", + "Received timer [{}] from from old generation [{}], expected generation [{}], discarding", timerMsg.key, timerMsg.generation, t.generation) diff --git a/actor/src/main/scala/org/apache/pekko/actor/setup/ActorSystemSetup.scala b/actor/src/main/scala/org/apache/pekko/actor/setup/ActorSystemSetup.scala index cfc541d84f2..acde21bf5d3 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/setup/ActorSystemSetup.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/setup/ActorSystemSetup.scala @@ -61,7 +61,7 @@ object ActorSystemSetup { * Constructor is *Internal API*. Use the factory methods [[ActorSystemSetup#create]] and [[ActorSystemSetup#apply]] to create * instances. */ -final class ActorSystemSetup private[pekko] (@InternalApi private[pekko] val setups: Map[Class[?], AnyRef]) { +final class ActorSystemSetup private[pekko] (@InternalApi private[pekko] val setups: Map[Class[_], AnyRef]) { /** * Java API: Extract a concrete [[pekko.actor.setup.Setup]] of type `T` if it is defined in the settings. diff --git a/actor/src/main/scala/org/apache/pekko/dispatch/CompletionStages.scala b/actor/src/main/scala/org/apache/pekko/dispatch/CompletionStages.scala index 808f83016f5..c46edde9153 100644 --- a/actor/src/main/scala/org/apache/pekko/dispatch/CompletionStages.scala +++ b/actor/src/main/scala/org/apache/pekko/dispatch/CompletionStages.scala @@ -50,10 +50,10 @@ object CompletionStages { * @since 1.2.0 */ def find[T <: AnyRef]( - stages: java.lang.Iterable[? <: CompletionStage[? <: T]], + stages: java.lang.Iterable[_ <: CompletionStage[_ <: T]], predicate: pekko.japi.function.Function[T, java.lang.Boolean] ): CompletionStage[Optional[T]] = { - def search(iterator: java.util.Iterator[? <: CompletionStage[? <: T]]): CompletionStage[Optional[T]] = { + def search(iterator: java.util.Iterator[_ <: CompletionStage[_ <: T]]): CompletionStage[Optional[T]] = { if (iterator.hasNext) { iterator.next().thenCompose { t => if (predicate.apply(t)) { @@ -79,7 +79,7 @@ object CompletionStages { * with the same value or exception. * @since 1.2.0 */ - def firstCompletedOf[T <: AnyRef](stages: java.lang.Iterable[? <: CompletionStage[? <: T]]): CompletionStage[T] = { + def firstCompletedOf[T <: AnyRef](stages: java.lang.Iterable[_ <: CompletionStage[_ <: T]]): CompletionStage[T] = { val iterator = stages.iterator() if (!iterator.hasNext) { new CompletableFuture[T]() // never completes @@ -102,7 +102,7 @@ object CompletionStages { } private def foldWithNext[T, R]( - iterator: java.util.Iterator[? <: CompletionStage[? <: T]], + iterator: java.util.Iterator[_ <: CompletionStage[_ <: T]], previous: R, function: pekko.japi.function.Function2[R, T, R]): CompletionStage[R] = { if (iterator.hasNext) { @@ -127,7 +127,7 @@ object CompletionStages { */ def fold[T <: AnyRef, R]( zero: R, - stages: java.lang.Iterable[? <: CompletionStage[? <: T]], + stages: java.lang.Iterable[_ <: CompletionStage[_ <: T]], function: pekko.japi.function.Function2[R, T, R]): CompletionStage[R] = { foldWithNext[T, R](stages.iterator(), zero, function) } @@ -145,9 +145,9 @@ object CompletionStages { */ @nowarn("msg=deprecated") def reduce[T <: AnyRef, R >: T]( - stages: java.lang.Iterable[? <: CompletionStage[? <: T]], + stages: java.lang.Iterable[_ <: CompletionStage[_ <: T]], function: pekko.japi.function.Function2[R, T, R]): CompletionStage[R] = { - val iterator: java.util.Iterator[? <: CompletionStage[? <: T]] = stages.iterator() + val iterator: java.util.Iterator[_ <: CompletionStage[_ <: T]] = stages.iterator() if (iterator.hasNext) { iterator.next().thenCompose { v => foldWithNext[T, R](iterator, v, function) } } else { @@ -165,7 +165,7 @@ object CompletionStages { private def combineNext[T]( accumulate: CompletionStage[java.util.List[T]], - next: CompletionStage[? <: T], + next: CompletionStage[_ <: T], executor: Executor): CompletionStage[java.util.List[T]] = { if (executor eq null) { accumulate.thenCombine(next, addToListFunction()) @@ -185,7 +185,7 @@ object CompletionStages { * @since 1.2.0 */ def sequence[T]( - stages: java.lang.Iterable[? <: CompletionStage[? <: T]], + stages: java.lang.Iterable[_ <: CompletionStage[_ <: T]], executor: Executor): CompletionStage[java.util.List[T]] = { var result: CompletionStage[java.util.List[T]] = CompletableFuture.completedFuture(new java.util.ArrayList[T]()) val iterator = stages.iterator() diff --git a/actor/src/main/scala/org/apache/pekko/dispatch/ForkJoinExecutorConfigurator.scala b/actor/src/main/scala/org/apache/pekko/dispatch/ForkJoinExecutorConfigurator.scala index 3a88f3136bb..7135594d356 100644 --- a/actor/src/main/scala/org/apache/pekko/dispatch/ForkJoinExecutorConfigurator.scala +++ b/actor/src/main/scala/org/apache/pekko/dispatch/ForkJoinExecutorConfigurator.scala @@ -15,11 +15,11 @@ package org.apache.pekko.dispatch import java.util.concurrent.{ ExecutorService, ForkJoinPool, ForkJoinTask, ThreadFactory, TimeUnit } +import com.typesafe.config.Config + import org.apache.pekko.annotation.InternalApi import org.apache.pekko.util.JavaVersion -import com.typesafe.config.Config - object ForkJoinExecutorConfigurator { /** @@ -60,7 +60,7 @@ object ForkJoinExecutorConfigurator { override def execute(r: Runnable): Unit = if (r ne null) super.execute( - (if (r.isInstanceOf[ForkJoinTask[?]]) r else new PekkoForkJoinTask(r)).asInstanceOf[ForkJoinTask[Any]]) + (if (r.isInstanceOf[ForkJoinTask[_]]) r else new PekkoForkJoinTask(r)).asInstanceOf[ForkJoinTask[Any]]) else throw new NullPointerException("Runnable was null") diff --git a/actor/src/main/scala/org/apache/pekko/dispatch/Mailboxes.scala b/actor/src/main/scala/org/apache/pekko/dispatch/Mailboxes.scala index f255eb832d4..f3b30140e6d 100644 --- a/actor/src/main/scala/org/apache/pekko/dispatch/Mailboxes.scala +++ b/actor/src/main/scala/org/apache/pekko/dispatch/Mailboxes.scala @@ -73,7 +73,7 @@ private[pekko] class Mailboxes( private val mailboxTypeConfigurators = new ConcurrentHashMap[String, MailboxType] - private val mailboxBindings: Map[Class[? <: Any], String] = { + private val mailboxBindings: Map[Class[_ <: Any], String] = { import scala.jdk.CollectionConverters._ settings.config .getConfig("pekko.actor.mailbox.requirements") @@ -81,7 +81,7 @@ private[pekko] class Mailboxes( .unwrapped .asScala .toMap - .foldLeft(Map.empty[Class[? <: Any], String]) { + .foldLeft(Map.empty[Class[_ <: Any], String]) { case (m, (k, v)) => dynamicAccess .getClassFor[Any](k) @@ -107,18 +107,18 @@ private[pekko] class Mailboxes( /** * Returns a mailbox type as specified in configuration, based on the type, or if not defined None. */ - def lookupByQueueType(queueType: Class[? <: Any]): MailboxType = lookup(lookupId(queueType)) + def lookupByQueueType(queueType: Class[_ <: Any]): MailboxType = lookup(lookupId(queueType)) - private final val rmqClass = classOf[RequiresMessageQueue[?]] + private final val rmqClass = classOf[RequiresMessageQueue[_]] /** * Return the required message queue type for this class if any. */ - def getRequiredType(actorClass: Class[? <: Actor]): Class[?] = + def getRequiredType(actorClass: Class[_ <: Actor]): Class[_] = Reflect.findMarker(actorClass, rmqClass) match { case t: ParameterizedType => t.getActualTypeArguments.head match { - case c: Class[?] => c + case c: Class[_] => c case x => throw new IllegalArgumentException(s"no wildcard type allowed in RequireMessageQueue argument (was [$x])") } @@ -135,14 +135,14 @@ private[pekko] class Mailboxes( case x => dynamicAccess.getClassFor[AnyRef](x).get } - def getProducedMessageQueueType(mailboxType: MailboxType): Class[?] = { - val pmqClass = classOf[ProducesMessageQueue[?]] + def getProducedMessageQueueType(mailboxType: MailboxType): Class[_] = { + val pmqClass = classOf[ProducesMessageQueue[_]] if (!pmqClass.isAssignableFrom(mailboxType.getClass)) classOf[MessageQueue] else Reflect.findMarker(mailboxType.getClass, pmqClass) match { case t: ParameterizedType => t.getActualTypeArguments.head match { - case c: Class[?] => c + case c: Class[_] => c case x => throw new IllegalArgumentException( s"no wildcard type allowed in ProducesMessageQueue argument (was [$x])") @@ -161,7 +161,7 @@ private[pekko] class Mailboxes( val actorClass = props.actorClass() lazy val actorRequirement = getRequiredType(actorClass) - val mailboxRequirement: Class[?] = getMailboxRequirement(dispatcherConfig) + val mailboxRequirement: Class[_] = getMailboxRequirement(dispatcherConfig) val hasMailboxRequirement: Boolean = mailboxRequirement != classOf[MessageQueue] @@ -180,7 +180,7 @@ private[pekko] class Mailboxes( } def verifyRequirements(mailboxType: MailboxType): MailboxType = { - lazy val mqType: Class[?] = getProducedMessageQueueType(mailboxType) + lazy val mqType: Class[_] = getProducedMessageQueueType(mailboxType) if (hasMailboxRequirement && !mailboxRequirement.isAssignableFrom(mqType)) throw new IllegalArgumentException( s"produced message queue type [$mqType] does not fulfill requirement for dispatcher [$id]. " + @@ -214,9 +214,9 @@ private[pekko] class Mailboxes( /** * Check if this class can have a required message queue type. */ - def hasRequiredType(actorClass: Class[? <: Actor]): Boolean = rmqClass.isAssignableFrom(actorClass) + def hasRequiredType(actorClass: Class[_ <: Actor]): Boolean = rmqClass.isAssignableFrom(actorClass) - private def lookupId(queueType: Class[?]): String = + private def lookupId(queueType: Class[_]): String = mailboxBindings.get(queueType) match { case None => throw new ConfigurationException(s"Mailbox Mapping for [$queueType] not configured") case Some(s) => s diff --git a/actor/src/main/scala/org/apache/pekko/dispatch/ThreadPoolBuilder.scala b/actor/src/main/scala/org/apache/pekko/dispatch/ThreadPoolBuilder.scala index 20e69a1f233..e1321c7cab1 100644 --- a/actor/src/main/scala/org/apache/pekko/dispatch/ThreadPoolBuilder.scala +++ b/actor/src/main/scala/org/apache/pekko/dispatch/ThreadPoolBuilder.scala @@ -297,14 +297,14 @@ trait ExecutorServiceDelegate extends ExecutorService { def submit(runnable: Runnable) = executor.submit(runnable) - def invokeAll[T](callables: Collection[? <: Callable[T]]) = executor.invokeAll(callables) + def invokeAll[T](callables: Collection[_ <: Callable[T]]) = executor.invokeAll(callables) - def invokeAll[T](callables: Collection[? <: Callable[T]], l: Long, timeUnit: TimeUnit) = + def invokeAll[T](callables: Collection[_ <: Callable[T]], l: Long, timeUnit: TimeUnit) = executor.invokeAll(callables, l, timeUnit) - def invokeAny[T](callables: Collection[? <: Callable[T]]) = executor.invokeAny(callables) + def invokeAny[T](callables: Collection[_ <: Callable[T]]) = executor.invokeAny(callables) - def invokeAny[T](callables: Collection[? <: Callable[T]], l: Long, timeUnit: TimeUnit) = + def invokeAny[T](callables: Collection[_ <: Callable[T]], l: Long, timeUnit: TimeUnit) = executor.invokeAny(callables, l, timeUnit) } diff --git a/actor/src/main/scala/org/apache/pekko/dispatch/VirtualizedExecutorService.scala b/actor/src/main/scala/org/apache/pekko/dispatch/VirtualizedExecutorService.scala index 160224cb047..be6cf1b0a3c 100644 --- a/actor/src/main/scala/org/apache/pekko/dispatch/VirtualizedExecutorService.scala +++ b/actor/src/main/scala/org/apache/pekko/dispatch/VirtualizedExecutorService.scala @@ -141,24 +141,24 @@ final class VirtualizedExecutorService( executor.submit(task, result) } - override def submit(task: Runnable): Future[?] = { + override def submit(task: Runnable): Future[_] = { executor.submit(task) } - override def invokeAll[T](tasks: util.Collection[? <: Callable[T]]): util.List[Future[T]] = { + override def invokeAll[T](tasks: util.Collection[_ <: Callable[T]]): util.List[Future[T]] = { executor.invokeAll(tasks) } override def invokeAll[T]( - tasks: util.Collection[? <: Callable[T]], timeout: Long, unit: TimeUnit): util.List[Future[T]] = { + tasks: util.Collection[_ <: Callable[T]], timeout: Long, unit: TimeUnit): util.List[Future[T]] = { executor.invokeAll(tasks, timeout, unit) } - override def invokeAny[T](tasks: util.Collection[? <: Callable[T]]): T = { + override def invokeAny[T](tasks: util.Collection[_ <: Callable[T]]): T = { executor.invokeAny(tasks) } - override def invokeAny[T](tasks: util.Collection[? <: Callable[T]], timeout: Long, unit: TimeUnit): T = { + override def invokeAny[T](tasks: util.Collection[_ <: Callable[T]], timeout: Long, unit: TimeUnit): T = { executor.invokeAny(tasks, timeout, unit) } diff --git a/actor/src/main/scala/org/apache/pekko/event/EventStream.scala b/actor/src/main/scala/org/apache/pekko/event/EventStream.scala index 8e777f18709..0822f39e573 100644 --- a/actor/src/main/scala/org/apache/pekko/event/EventStream.scala +++ b/actor/src/main/scala/org/apache/pekko/event/EventStream.scala @@ -36,24 +36,24 @@ class EventStream(sys: ActorSystem, private val debug: Boolean) extends LoggingB def this(sys: ActorSystem) = this(sys, debug = false) type Event = Any - type Classifier = Class[?] + type Classifier = Class[_] /** Either the list of subscribed actors, or a ref to a [[pekko.event.EventStreamUnsubscriber]] */ private val initiallySubscribedOrUnsubscriber = new AtomicReference[Either[Set[ActorRef], ActorRef]](Left(Set.empty)) - protected implicit val subclassification: Subclassification[Classifier] = new Subclassification[Class[?]] { - def isEqual(x: Class[?], y: Class[?]) = x == y - def isSubclass(x: Class[?], y: Class[?]) = y.isAssignableFrom(x) + protected implicit val subclassification: Subclassification[Classifier] = new Subclassification[Class[_]] { + def isEqual(x: Class[_], y: Class[_]) = x == y + def isSubclass(x: Class[_], y: Class[_]) = y.isAssignableFrom(x) } - protected def classify(event: Any): Class[?] = event.getClass + protected def classify(event: Any): Class[_] = event.getClass protected def publish(event: Any, subscriber: ActorRef) = { if ((sys eq null) && subscriber.isTerminated) unsubscribe(subscriber) else subscriber ! event } - override def subscribe(subscriber: ActorRef, channel: Class[?]): Boolean = { + override def subscribe(subscriber: ActorRef, channel: Class[_]): Boolean = { if (subscriber eq null) throw new IllegalArgumentException("subscriber is null") if (debug) publish(Logging.Debug(simpleName(this), this.getClass, "subscribing " + subscriber + " to channel " + channel)) @@ -61,7 +61,7 @@ class EventStream(sys: ActorSystem, private val debug: Boolean) extends LoggingB super.subscribe(subscriber, channel) } - override def unsubscribe(subscriber: ActorRef, channel: Class[?]): Boolean = { + override def unsubscribe(subscriber: ActorRef, channel: Class[_]): Boolean = { if (subscriber eq null) throw new IllegalArgumentException("subscriber is null") val ret = super.unsubscribe(subscriber, channel) unregisterIfNoMoreSubscribedChannels(subscriber) diff --git a/actor/src/main/scala/org/apache/pekko/event/Logging.scala b/actor/src/main/scala/org/apache/pekko/event/Logging.scala index 7a1ef230638..d7b4c8fbc2d 100644 --- a/actor/src/main/scala/org/apache/pekko/event/Logging.scala +++ b/actor/src/main/scala/org/apache/pekko/event/Logging.scala @@ -45,7 +45,7 @@ import pekko.util.Timeout trait LoggingBus extends ActorEventBus { type Event >: Logging.LogEvent - type Classifier >: Class[?] + type Classifier >: Class[_] import Logging._ @@ -216,7 +216,7 @@ trait LoggingBus extends ActorEventBus { */ private def addLogger( system: ActorSystemImpl, - clazz: Class[? <: Actor], + clazz: Class[_ <: Actor], level: LogLevel, logName: String): ActorRef = { val name = "log" + LogExt(system).id() + "-" + simpleName(clazz) @@ -291,13 +291,13 @@ trait LoggingBus extends ActorEventBus { -T] { def genString(t: T): String def genString(t: T, @nowarn("msg=never used") system: ActorSystem): String = genString(t) - def getClazz(t: T): Class[?] = t.getClass + def getClazz(t: T): Class[_] = t.getClass } /** * INTERNAL API */ -@InternalApi private[pekko] final case class ActorWithLogClass(actor: Actor, logClass: Class[?]) +@InternalApi private[pekko] final case class ActorWithLogClass(actor: Actor, logClass: Class[_]) /** * This is a “marker” class which is inserted as originator class into @@ -355,14 +355,14 @@ object LogSource { new LogSource[ActorWithLogClass] { def genString(a: ActorWithLogClass) = fromActor.genString(a.actor) override def genString(a: ActorWithLogClass, system: ActorSystem) = fromActor.genString(a.actor, system) - override def getClazz(a: ActorWithLogClass): Class[?] = a.logClass + override def getClazz(a: ActorWithLogClass): Class[_] = a.logClass } // this one unfortunately does not work as implicit, because existential types have some weird behavior - val fromClass: LogSource[Class[?]] = new LogSource[Class[?]] { - def genString(c: Class[?]): String = Logging.simpleName(c) - override def genString(c: Class[?], system: ActorSystem): String = genString(c) + "(" + system + ")" - override def getClazz(c: Class[?]): Class[?] = c + val fromClass: LogSource[Class[_]] = new LogSource[Class[_]] { + def genString(c: Class[_]): String = Logging.simpleName(c) + override def genString(c: Class[_], system: ActorSystem): String = genString(c) + "(" + system + ")" + override def getClazz(c: Class[_]): Class[_] = c } implicit def fromAnyClass[T]: LogSource[Class[T]] = fromClass.asInstanceOf[LogSource[Class[T]]] @@ -370,7 +370,7 @@ object LogSource { * Convenience converter access: given an implicit `LogSource`, generate the * string representation and originating class. */ - def apply[T: LogSource](o: T): (String, Class[?]) = { + def apply[T: LogSource](o: T): (String, Class[_]) = { val ls = implicitly[LogSource[T]] (ls.genString(o), ls.getClazz(o)) } @@ -380,7 +380,7 @@ object LogSource { * [[pekko.actor.ActorSystem]], generate the string representation and * originating class. */ - def apply[T: LogSource](o: T, system: ActorSystem): (String, Class[?]) = { + def apply[T: LogSource](o: T, system: ActorSystem): (String, Class[_]) = { val ls = implicitly[LogSource[T]] (ls.genString(o, system), ls.getClazz(o)) } @@ -389,9 +389,9 @@ object LogSource { * construct string representation for any object according to * rules above with fallback to its `Class`’s simple name. */ - def fromAnyRef(o: AnyRef): (String, Class[?]) = + def fromAnyRef(o: AnyRef): (String, Class[_]) = o match { - case c: Class[?] => apply(c) + case c: Class[_] => apply(c) case a: Actor => apply(a) case a: ActorRef => apply(a) case s: String => apply(s) @@ -403,9 +403,9 @@ object LogSource { * rules above (including the actor system’s address) with fallback to its * `Class`’s simple name. */ - def fromAnyRef(o: AnyRef, system: ActorSystem): (String, Class[?]) = + def fromAnyRef(o: AnyRef, system: ActorSystem): (String, Class[_]) = o match { - case c: Class[?] => apply(c) + case c: Class[_] => apply(c) case a: Actor => apply(a) case a: ActorRef => apply(a) case s: String => apply(s) @@ -458,7 +458,7 @@ object Logging { * Returns a 'safe' getSimpleName for the provided Class * @return the simple name of the given Class */ - def simpleName(clazz: Class[?]): String = { + def simpleName(clazz: Class[_]): String = { val n = clazz.getName val i = n.lastIndexOf('.') n.substring(i + 1) @@ -539,7 +539,7 @@ object Logging { * Returns the LogLevel associated with the given event class. * Defaults to DebugLevel. */ - def levelFor(eventClass: Class[? <: LogEvent]): LogLevel = { + def levelFor(eventClass: Class[_ <: LogEvent]): LogLevel = { if (classOf[Error].isAssignableFrom(eventClass)) ErrorLevel else if (classOf[Warning].isAssignableFrom(eventClass)) WarningLevel else if (classOf[Info].isAssignableFrom(eventClass)) InfoLevel @@ -550,7 +550,7 @@ object Logging { /** * Returns the event class associated with the given LogLevel */ - def classFor(level: LogLevel): Class[? <: LogEvent] = level match { + def classFor(level: LogLevel): Class[_ <: LogEvent] = level match { case ErrorLevel => classOf[Error] case WarningLevel => classOf[Warning] case InfoLevel => classOf[Info] @@ -758,7 +758,7 @@ object Logging { /** * The class of the source of this event */ - def logClass: Class[?] + def logClass: Class[_] /** * The message, may be any object or null. @@ -780,7 +780,7 @@ object Logging { } object LogEvent { - def apply(level: LogLevel, logSource: String, logClass: Class[?], message: Any): LogEvent = level match { + def apply(level: LogLevel, logSource: String, logClass: Class[_], message: Any): LogEvent = level match { case ErrorLevel => Error(logSource, logClass, message) case WarningLevel => Warning(logSource, logClass, message) case InfoLevel => Info(logSource, logClass, message) @@ -788,7 +788,7 @@ object Logging { case level => throw new IllegalArgumentException(s"Unsupported log level [$level]") } - def apply(level: LogLevel, logSource: String, logClass: Class[?], message: Any, mdc: MDC): LogEvent = level match { + def apply(level: LogLevel, logSource: String, logClass: Class[_], message: Any, mdc: MDC): LogEvent = level match { case ErrorLevel => Error(logSource, logClass, message, mdc) case WarningLevel => Warning(logSource, logClass, message, mdc) case InfoLevel => Info(logSource, logClass, message, mdc) @@ -799,7 +799,7 @@ object Logging { def apply( level: LogLevel, logSource: String, - logClass: Class[?], + logClass: Class[_], message: Any, mdc: MDC, marker: LogMarker): LogEvent = level match { @@ -819,49 +819,49 @@ object Logging { /** * For ERROR Logging */ - case class Error(override val cause: Throwable, logSource: String, logClass: Class[?], message: Any = "") + case class Error(override val cause: Throwable, logSource: String, logClass: Class[_], message: Any = "") extends LogEvent with LogEventWithCause { - def this(logSource: String, logClass: Class[?], message: Any) = this(Error.NoCause, logSource, logClass, message) + def this(logSource: String, logClass: Class[_], message: Any) = this(Error.NoCause, logSource, logClass, message) override def level = ErrorLevel } class Error2( override val cause: Throwable, logSource: String, - logClass: Class[?], + logClass: Class[_], message: Any = "", override val mdc: MDC) extends Error(cause, logSource, logClass, message) { - def this(logSource: String, logClass: Class[?], message: Any, mdc: MDC) = + def this(logSource: String, logClass: Class[_], message: Any, mdc: MDC) = this(Error.NoCause, logSource, logClass, message, mdc) } class Error3( override val cause: Throwable, logSource: String, - logClass: Class[?], + logClass: Class[_], message: Any, override val mdc: MDC, override val marker: LogMarker) extends Error2(cause, logSource, logClass, message, mdc) with LogEventWithMarker { - def this(logSource: String, logClass: Class[?], message: Any, mdc: MDC, marker: LogMarker) = + def this(logSource: String, logClass: Class[_], message: Any, mdc: MDC, marker: LogMarker) = this(Error.NoCause, logSource, logClass, message, mdc, marker) } object Error { - def apply(logSource: String, logClass: Class[?], message: Any) = + def apply(logSource: String, logClass: Class[_], message: Any) = new Error(NoCause, logSource, logClass, message) - def apply(logSource: String, logClass: Class[?], message: Any, marker: LogMarker) = + def apply(logSource: String, logClass: Class[_], message: Any, marker: LogMarker) = new Error3(NoCause, logSource, logClass, message, Map.empty, marker) - def apply(cause: Throwable, logSource: String, logClass: Class[?], message: Any, mdc: MDC) = + def apply(cause: Throwable, logSource: String, logClass: Class[_], message: Any, mdc: MDC) = new Error2(cause, logSource, logClass, message, mdc) - def apply(cause: Throwable, logSource: String, logClass: Class[?], message: Any, mdc: MDC, marker: LogMarker) = + def apply(cause: Throwable, logSource: String, logClass: Class[_], message: Any, mdc: MDC, marker: LogMarker) = new Error3(cause, logSource, logClass, message, mdc, marker) - def apply(logSource: String, logClass: Class[?], message: Any, mdc: MDC) = + def apply(logSource: String, logClass: Class[_], message: Any, mdc: MDC) = new Error2(NoCause, logSource, logClass, message, mdc) - def apply(logSource: String, logClass: Class[?], message: Any, mdc: MDC, marker: LogMarker) = + def apply(logSource: String, logClass: Class[_], message: Any, mdc: MDC, marker: LogMarker) = new Error3(NoCause, logSource, logClass, message, mdc, marker) /** Null Object used for errors without cause Throwable */ @@ -872,14 +872,14 @@ object Logging { /** * For WARNING Logging */ - case class Warning(logSource: String, logClass: Class[?], message: Any = "") extends LogEvent { + case class Warning(logSource: String, logClass: Class[_], message: Any = "") extends LogEvent { override def level = WarningLevel } - class Warning2(logSource: String, logClass: Class[?], message: Any, override val mdc: MDC) + class Warning2(logSource: String, logClass: Class[_], message: Any, override val mdc: MDC) extends Warning(logSource, logClass, message) class Warning3( logSource: String, - logClass: Class[?], + logClass: Class[_], message: Any, override val mdc: MDC, override val marker: LogMarker) @@ -887,7 +887,7 @@ object Logging { with LogEventWithMarker class Warning4( logSource: String, - logClass: Class[?], + logClass: Class[_], message: Any, override val mdc: MDC, override val marker: LogMarker, @@ -896,60 +896,60 @@ object Logging { with LogEventWithMarker with LogEventWithCause object Warning { - def apply(logSource: String, logClass: Class[?], message: Any, mdc: MDC) = + def apply(logSource: String, logClass: Class[_], message: Any, mdc: MDC) = new Warning2(logSource, logClass, message, mdc) - def apply(logSource: String, logClass: Class[?], message: Any, mdc: MDC, marker: LogMarker) = + def apply(logSource: String, logClass: Class[_], message: Any, mdc: MDC, marker: LogMarker) = new Warning3(logSource, logClass, message, mdc, marker) - def apply(cause: Throwable, logSource: String, logClass: Class[?], message: Any, mdc: MDC) = + def apply(cause: Throwable, logSource: String, logClass: Class[_], message: Any, mdc: MDC) = new Warning4(logSource, logClass, message, mdc, null, cause) - def apply(cause: Throwable, logSource: String, logClass: Class[?], message: Any, mdc: MDC, marker: LogMarker) = + def apply(cause: Throwable, logSource: String, logClass: Class[_], message: Any, mdc: MDC, marker: LogMarker) = new Warning4(logSource, logClass, message, mdc, marker, cause) } /** * For INFO Logging */ - case class Info(logSource: String, logClass: Class[?], message: Any = "") extends LogEvent { + case class Info(logSource: String, logClass: Class[_], message: Any = "") extends LogEvent { override def level = InfoLevel } - class Info2(logSource: String, logClass: Class[?], message: Any, override val mdc: MDC) + class Info2(logSource: String, logClass: Class[_], message: Any, override val mdc: MDC) extends Info(logSource, logClass, message) class Info3( logSource: String, - logClass: Class[?], + logClass: Class[_], message: Any, override val mdc: MDC, override val marker: LogMarker) extends Info2(logSource, logClass, message, mdc) with LogEventWithMarker object Info { - def apply(logSource: String, logClass: Class[?], message: Any, mdc: MDC) = + def apply(logSource: String, logClass: Class[_], message: Any, mdc: MDC) = new Info2(logSource, logClass, message, mdc) - def apply(logSource: String, logClass: Class[?], message: Any, mdc: MDC, marker: LogMarker) = + def apply(logSource: String, logClass: Class[_], message: Any, mdc: MDC, marker: LogMarker) = new Info3(logSource, logClass, message, mdc, marker) } /** * For DEBUG Logging */ - case class Debug(logSource: String, logClass: Class[?], message: Any = "") extends LogEvent { + case class Debug(logSource: String, logClass: Class[_], message: Any = "") extends LogEvent { override def level = DebugLevel } - class Debug2(logSource: String, logClass: Class[?], message: Any, override val mdc: MDC) + class Debug2(logSource: String, logClass: Class[_], message: Any, override val mdc: MDC) extends Debug(logSource, logClass, message) class Debug3( logSource: String, - logClass: Class[?], + logClass: Class[_], message: Any, override val mdc: MDC, override val marker: LogMarker) extends Debug2(logSource, logClass, message, mdc) with LogEventWithMarker object Debug { - def apply(logSource: String, logClass: Class[?], message: Any, mdc: MDC) = + def apply(logSource: String, logClass: Class[_], message: Any, mdc: MDC) = new Debug2(logSource, logClass, message, mdc) - def apply(logSource: String, logClass: Class[?], message: Any, mdc: MDC, marker: LogMarker) = + def apply(logSource: String, logClass: Class[_], message: Any, mdc: MDC, marker: LogMarker) = new Debug3(logSource, logClass, message, mdc, marker) } @@ -1530,8 +1530,8 @@ trait LoggingAdapter { * there are more than four arguments. */ private def format1(t: String, arg: Any): String = arg match { - case a: Array[?] if !a.getClass.getComponentType.isPrimitive => formatImpl(t, a.toSeq) - case a: Array[?] => formatImpl(t, a.toSeq.asInstanceOf[Seq[AnyRef]]) + case a: Array[_] if !a.getClass.getComponentType.isPrimitive => formatImpl(t, a.toSeq) + case a: Array[_] => formatImpl(t, a.toSeq.asInstanceOf[Seq[AnyRef]]) case x => format(t, x) } @@ -1571,10 +1571,10 @@ trait LoggingAdapter { */ trait LoggingFilter { // for backward-compatibility reason implementation of method without marker only must work - def isErrorEnabled(logClass: Class[?], logSource: String): Boolean - def isWarningEnabled(logClass: Class[?], logSource: String): Boolean - def isInfoEnabled(logClass: Class[?], logSource: String): Boolean - def isDebugEnabled(logClass: Class[?], logSource: String): Boolean + def isErrorEnabled(logClass: Class[_], logSource: String): Boolean + def isWarningEnabled(logClass: Class[_], logSource: String): Boolean + def isInfoEnabled(logClass: Class[_], logSource: String): Boolean + def isDebugEnabled(logClass: Class[_], logSource: String): Boolean } /** @@ -1583,13 +1583,13 @@ trait LoggingFilter { */ @nowarn("msg=never us") trait LoggingFilterWithMarker extends LoggingFilter { - def isErrorEnabled(logClass: Class[?], logSource: String, marker: LogMarker): Boolean = + def isErrorEnabled(logClass: Class[_], logSource: String, marker: LogMarker): Boolean = isErrorEnabled(logClass, logSource) - def isWarningEnabled(logClass: Class[?], logSource: String, marker: LogMarker): Boolean = + def isWarningEnabled(logClass: Class[_], logSource: String, marker: LogMarker): Boolean = isWarningEnabled(logClass, logSource) - def isInfoEnabled(logClass: Class[?], logSource: String, marker: LogMarker): Boolean = + def isInfoEnabled(logClass: Class[_], logSource: String, marker: LogMarker): Boolean = isInfoEnabled(logClass, logSource) - def isDebugEnabled(logClass: Class[?], logSource: String, marker: LogMarker): Boolean = + def isDebugEnabled(logClass: Class[_], logSource: String, marker: LogMarker): Boolean = isDebugEnabled(logClass, logSource) } @@ -1602,13 +1602,13 @@ object LoggingFilterWithMarker { } class LoggingFilterWithMarkerWrapper(loggingFilter: LoggingFilter) extends LoggingFilterWithMarker { - override def isErrorEnabled(logClass: Class[?], logSource: String): Boolean = + override def isErrorEnabled(logClass: Class[_], logSource: String): Boolean = loggingFilter.isErrorEnabled(logClass, logSource) - override def isWarningEnabled(logClass: Class[?], logSource: String): Boolean = + override def isWarningEnabled(logClass: Class[_], logSource: String): Boolean = loggingFilter.isWarningEnabled(logClass, logSource) - override def isInfoEnabled(logClass: Class[?], logSource: String): Boolean = + override def isInfoEnabled(logClass: Class[_], logSource: String): Boolean = loggingFilter.isInfoEnabled(logClass, logSource) - override def isDebugEnabled(logClass: Class[?], logSource: String): Boolean = + override def isDebugEnabled(logClass: Class[_], logSource: String): Boolean = loggingFilter.isDebugEnabled(logClass, logSource) } @@ -1622,10 +1622,10 @@ class DefaultLoggingFilter(logLevel: () => Logging.LogLevel) extends LoggingFilt def this(settings: Settings, eventStream: EventStream) = this(() => eventStream.logLevel) import Logging._ - def isErrorEnabled(logClass: Class[?], logSource: String) = logLevel() >= ErrorLevel - def isWarningEnabled(logClass: Class[?], logSource: String) = logLevel() >= WarningLevel - def isInfoEnabled(logClass: Class[?], logSource: String) = logLevel() >= InfoLevel - def isDebugEnabled(logClass: Class[?], logSource: String) = logLevel() >= DebugLevel + def isErrorEnabled(logClass: Class[_], logSource: String) = logLevel() >= ErrorLevel + def isWarningEnabled(logClass: Class[_], logSource: String) = logLevel() >= WarningLevel + def isInfoEnabled(logClass: Class[_], logSource: String) = logLevel() >= InfoLevel + def isDebugEnabled(logClass: Class[_], logSource: String) = logLevel() >= DebugLevel } /** @@ -1747,14 +1747,14 @@ object LogMarker { class MarkerLoggingAdapter( override val bus: LoggingBus, override val logSource: String, - override val logClass: Class[?], + override val logClass: Class[_], loggingFilter: LoggingFilter) extends BusLogging(bus, logSource, logClass, loggingFilter) { // TODO when breaking binary compatibility, these marker methods should become baked into LoggingAdapter itself // For backwards compatibility, and when LoggingAdapter is created without direct // association to an ActorSystem - def this(bus: LoggingBus, logSource: String, logClass: Class[?]) = + def this(bus: LoggingBus, logSource: String, logClass: Class[_]) = this(bus, logSource, logClass, new DefaultLoggingFilter(() => bus.logLevel)) val loggingFilterWithMarker: LoggingFilterWithMarker = LoggingFilterWithMarker.wrap(loggingFilter) @@ -2002,8 +2002,8 @@ class MarkerLoggingAdapter( // Copy of LoggingAdapter.format1 due to binary compatibility restrictions private def format1(t: String, arg: Any): String = arg match { - case a: Array[?] if !a.getClass.getComponentType.isPrimitive => format(t, a.toIndexedSeq) - case a: Array[?] => format(t, a.toIndexedSeq.asInstanceOf[IndexedSeq[AnyRef]]) + case a: Array[_] if !a.getClass.getComponentType.isPrimitive => format(t, a.toIndexedSeq) + case a: Array[_] => format(t, a.toIndexedSeq.asInstanceOf[IndexedSeq[AnyRef]]) case x => format(t, x) } } @@ -2011,7 +2011,7 @@ class MarkerLoggingAdapter( final class DiagnosticMarkerBusLoggingAdapter( override val bus: LoggingBus, override val logSource: String, - override val logClass: Class[?], + override val logClass: Class[_], loggingFilter: LoggingFilter) extends MarkerLoggingAdapter(bus, logSource, logClass, loggingFilter) with DiagnosticLoggingAdapter @@ -2019,12 +2019,12 @@ final class DiagnosticMarkerBusLoggingAdapter( /** * [[pekko.event.LoggingAdapter]] that publishes [[pekko.event.Logging.LogEvent]] to event stream. */ -class BusLogging(val bus: LoggingBus, val logSource: String, val logClass: Class[?], loggingFilter: LoggingFilter) +class BusLogging(val bus: LoggingBus, val logSource: String, val logClass: Class[_], loggingFilter: LoggingFilter) extends LoggingAdapter { // For backwards compatibility, and when LoggingAdapter is created without direct // association to an ActorSystem - def this(bus: LoggingBus, logSource: String, logClass: Class[?]) = + def this(bus: LoggingBus, logSource: String, logClass: Class[_]) = this(bus, logSource, logClass, new DefaultLoggingFilter(() => bus.logLevel)) import Logging._ diff --git a/actor/src/main/scala/org/apache/pekko/io/DnsProvider.scala b/actor/src/main/scala/org/apache/pekko/io/DnsProvider.scala index 5fe606224fd..864f1bbf40d 100644 --- a/actor/src/main/scala/org/apache/pekko/io/DnsProvider.scala +++ b/actor/src/main/scala/org/apache/pekko/io/DnsProvider.scala @@ -35,12 +35,12 @@ private[pekko] trait DnsProvider { * DNS resolver actor. Should respond to [[pekko.io.dns.DnsProtocol.Resolve]] with * [[pekko.io.dns.DnsProtocol.Resolved]] */ - def actorClass: Class[? <: Actor] + def actorClass: Class[_ <: Actor] /** * DNS manager class. Is responsible for creating resolvers and doing any cache cleanup. * The DNS extension will create one of these Actors. It should have a ctr that accepts * a [[DnsExt]] */ - def managerClass: Class[? <: Actor] + def managerClass: Class[_ <: Actor] } diff --git a/actor/src/main/scala/org/apache/pekko/io/SelectionHandler.scala b/actor/src/main/scala/org/apache/pekko/io/SelectionHandler.scala index 338b823b87c..db0bd4ace6c 100644 --- a/actor/src/main/scala/org/apache/pekko/io/SelectionHandler.scala +++ b/actor/src/main/scala/org/apache/pekko/io/SelectionHandler.scala @@ -200,12 +200,12 @@ private[io] object SelectionHandler { executionContext.execute(select) // start selection "loop" def register(channel: SelectableChannel, initialOps: Int)(implicit channelActor: ActorRef): Unit = { - if (settings.TraceLogging) log.debug("Scheduling Registering channel {} with initialOps {}", channel, initialOps) + if (settings.TraceLogging) log.debug(s"Scheduling Registering channel $channel with initialOps $initialOps") execute { new Task { def tryRun(): Unit = try { - if (settings.TraceLogging) log.debug("Registering channel {} with initialOps {}", channel, initialOps) + if (settings.TraceLogging) log.debug(s"Registering channel $channel with initialOps $initialOps") val key = channel.register(selector, initialOps, channelActor) channelActor ! new ChannelRegistration { def enableInterest(ops: Int): Unit = enableInterestOps(key, ops) @@ -244,7 +244,7 @@ private[io] object SelectionHandler { execute { new Task { def tryRun(): Unit = { - if (settings.TraceLogging) log.debug("Enabling {} on {}", ops, key) + if (settings.TraceLogging) log.debug(s"Enabling $ops on $key") val currentOps = key.interestOps val newOps = currentOps | ops if (newOps != currentOps) key.interestOps(newOps) diff --git a/actor/src/main/scala/org/apache/pekko/io/SimpleDnsCache.scala b/actor/src/main/scala/org/apache/pekko/io/SimpleDnsCache.scala index 27e735ff2fa..c175aee614a 100644 --- a/actor/src/main/scala/org/apache/pekko/io/SimpleDnsCache.scala +++ b/actor/src/main/scala/org/apache/pekko/io/SimpleDnsCache.scala @@ -34,11 +34,9 @@ private[io] trait PeriodicCacheCleanup { class SimpleDnsCache extends Dns with PeriodicCacheCleanup with NoSerializationVerificationNeeded { import SimpleDnsCache._ - private implicit val expiryOrdering: Ordering[ExpiryEntry[(String, RequestType)]] = - expiryEntryOrdering[(String, RequestType)]() private val cacheRef = new AtomicReference( new Cache[(String, RequestType), Resolved]( - immutable.SortedSet.empty[ExpiryEntry[(String, RequestType)]], + immutable.SortedSet()(expiryEntryOrdering()), immutable.Map(), () => clock())) diff --git a/actor/src/main/scala/org/apache/pekko/japi/JavaAPI.scala b/actor/src/main/scala/org/apache/pekko/japi/JavaAPI.scala index cdd5831ecca..6af233658d6 100644 --- a/actor/src/main/scala/org/apache/pekko/japi/JavaAPI.scala +++ b/actor/src/main/scala/org/apache/pekko/japi/JavaAPI.scala @@ -109,7 +109,7 @@ object Util { * Returns an immutable.Seq representing the provided array of Classes, * an overloading of the generic immutableSeq in Util, to accommodate for erasure. */ - def immutableSeq(arr: Array[Class[?]]): immutable.Seq[Class[?]] = immutableSeq[Class[?]](arr) + def immutableSeq(arr: Array[Class[_]]): immutable.Seq[Class[_]] = immutableSeq[Class[_]](arr) /** * Turns an array into an immutable Scala sequence (by copying it). @@ -122,7 +122,7 @@ object Util { */ def immutableSeq[T](iterable: java.lang.Iterable[T]): immutable.Seq[T] = iterable match { - case imm: immutable.Seq[?] => imm.asInstanceOf[immutable.Seq[T]] + case imm: immutable.Seq[_] => imm.asInstanceOf[immutable.Seq[T]] case other => val i = other.iterator() if (i.hasNext) { diff --git a/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreaker.scala b/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreaker.scala index 7b9f81f0df9..25c296f06ff 100644 --- a/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreaker.scala +++ b/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreaker.scala @@ -767,8 +767,8 @@ class CircuitBreaker( case _ => allowExceptions.contains(ex.getClass.getName) }) - private val failureFn: Try[?] => Boolean = { - case _: Success[?] => false + private val failureFn: Try[_] => Boolean = { + case _: Success[_] => false case Failure(t) if isIgnoredException(t) => false case _ => true } @@ -828,7 +828,7 @@ class CircuitBreaker( val f = materialize(body) f.onComplete { - case _: Success[?] => + case _: Success[_] => notifyCallSuccessListeners(start) callSucceeds() case Failure(_) => diff --git a/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreakersRegistry.scala b/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreakersRegistry.scala index 2298537643b..c3694e0b0da 100644 --- a/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreakersRegistry.scala +++ b/actor/src/main/scala/org/apache/pekko/pattern/CircuitBreakersRegistry.scala @@ -44,7 +44,7 @@ object CircuitBreakersRegistry extends ExtensionId[CircuitBreakersRegistry] with /** * Returns the canonical ExtensionId for this Extension */ - override def lookup: ExtensionId[? <: Extension] = CircuitBreakersRegistry + override def lookup: ExtensionId[_ <: Extension] = CircuitBreakersRegistry /** * Returns an instance of the extension identified by this ExtensionId instance. diff --git a/actor/src/main/scala/org/apache/pekko/pattern/Patterns.scala b/actor/src/main/scala/org/apache/pekko/pattern/Patterns.scala index 1920d29efd2..f56faed9683 100644 --- a/actor/src/main/scala/org/apache/pekko/pattern/Patterns.scala +++ b/actor/src/main/scala/org/apache/pekko/pattern/Patterns.scala @@ -129,7 +129,7 @@ object Patterns { */ def askWithReplyTo(actor: ActorRef, messageFactory: japi.function.Function[ActorRef, Any], timeout: Timeout) : Future[AnyRef] = - extended.ask(actor, ref => messageFactory.apply(ref))(timeout).asInstanceOf[Future[AnyRef]] + extended.ask(actor, messageFactory.apply _)(timeout).asInstanceOf[Future[AnyRef]] /** * A variation of ask which allows to implement "replyTo" pattern by including @@ -150,8 +150,7 @@ object Patterns { actor: ActorRef, messageFactory: japi.function.Function[ActorRef, Any], timeout: java.time.Duration): CompletionStage[AnyRef] = - extended.ask(actor, ref => messageFactory.apply(ref))(Timeout.create(timeout)).asJava.asInstanceOf[CompletionStage[ - AnyRef]] + extended.ask(actor, messageFactory.apply _)(Timeout.create(timeout)).asJava.asInstanceOf[CompletionStage[AnyRef]] /** * Java API for `org.apache.pekko.pattern.ask`: @@ -202,7 +201,7 @@ object Patterns { actor: ActorRef, messageFactory: japi.function.Function[ActorRef, Any], timeoutMillis: Long): Future[AnyRef] = - extended.ask(actor, ref => messageFactory.apply(ref))(Timeout(timeoutMillis.millis)).asInstanceOf[Future[AnyRef]] + extended.ask(actor, messageFactory.apply _)(Timeout(timeoutMillis.millis)).asInstanceOf[Future[AnyRef]] /** * Java API for `org.apache.pekko.pattern.ask`: @@ -317,8 +316,7 @@ object Patterns { selection: ActorSelection, messageFactory: japi.function.Function[ActorRef, Any], timeoutMillis: Long): Future[AnyRef] = - extended.ask(selection, ref => messageFactory.apply(ref))(Timeout(timeoutMillis.millis)).asInstanceOf[Future[ - AnyRef]] + extended.ask(selection, messageFactory.apply _)(Timeout(timeoutMillis.millis)).asInstanceOf[Future[AnyRef]] /** * A variation of ask which allows to implement "replyTo" pattern by including @@ -335,8 +333,7 @@ object Patterns { selection: ActorSelection, messageFactory: japi.function.Function[ActorRef, Any], timeout: java.time.Duration): CompletionStage[AnyRef] = - extended.ask(selection, ref => messageFactory.apply(ref))(timeout.toScala).asJava.asInstanceOf[CompletionStage[ - AnyRef]] + extended.ask(selection, messageFactory.apply _)(timeout.toScala).asJava.asInstanceOf[CompletionStage[AnyRef]] /** * Register an onComplete callback on this [[scala.concurrent.Future]] to send diff --git a/actor/src/main/scala/org/apache/pekko/pattern/StatusReply.scala b/actor/src/main/scala/org/apache/pekko/pattern/StatusReply.scala index 87a2aa8cff6..31e274914b8 100644 --- a/actor/src/main/scala/org/apache/pekko/pattern/StatusReply.scala +++ b/actor/src/main/scala/org/apache/pekko/pattern/StatusReply.scala @@ -57,7 +57,7 @@ final class StatusReply[+T] private (private val status: Try[T]) { def isSuccess: Boolean = status.isSuccess override def equals(other: Any): Boolean = other match { - case that: StatusReply[?] => status == that.status + case that: StatusReply[_] => status == that.status case _ => false } @@ -229,7 +229,7 @@ object StatusReply { * Also note that Pekko does not contain pre-built serializers for arbitrary exceptions. */ def apply[T](exception: Throwable): StatusReply[T] = new StatusReply(ScalaFailure(exception)) - def unapply(status: StatusReply[?]): Option[Throwable] = + def unapply(status: StatusReply[_]): Option[Throwable] = if ((status ne null) && status.isError) Some(status.getError) else None } diff --git a/actor/src/main/scala/org/apache/pekko/pattern/internal/BackoffOnRestartSupervisor.scala b/actor/src/main/scala/org/apache/pekko/pattern/internal/BackoffOnRestartSupervisor.scala index 3c9b8ffe768..b9dbefb557d 100644 --- a/actor/src/main/scala/org/apache/pekko/pattern/internal/BackoffOnRestartSupervisor.scala +++ b/actor/src/main/scala/org/apache/pekko/pattern/internal/BackoffOnRestartSupervisor.scala @@ -105,7 +105,7 @@ import pekko.pattern.{ def onTerminated: Receive = { case Terminated(c) => - log.debug("Terminating, because child [{}] terminated itself", c) + log.debug(s"Terminating, because child [$c] terminated itself") stop(self) } diff --git a/actor/src/main/scala/org/apache/pekko/serialization/PrimitiveSerializers.scala b/actor/src/main/scala/org/apache/pekko/serialization/PrimitiveSerializers.scala index 224046002ee..e256893779e 100644 --- a/actor/src/main/scala/org/apache/pekko/serialization/PrimitiveSerializers.scala +++ b/actor/src/main/scala/org/apache/pekko/serialization/PrimitiveSerializers.scala @@ -51,7 +51,7 @@ import pekko.util.ByteString result } - override def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = { + override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = { var result = 0L var i = 7 while (i >= 0) { @@ -89,7 +89,7 @@ import pekko.util.ByteString result } - override def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = { + override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = { var result = 0 var i = 3 while (i >= 0) { @@ -121,7 +121,7 @@ import pekko.util.ByteString override def toBinary(o: AnyRef): Array[Byte] = o.asInstanceOf[String].getBytes(StandardCharsets.UTF_8) - override def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = + override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = new String(bytes, StandardCharsets.UTF_8) } @@ -154,7 +154,7 @@ import pekko.util.ByteString result } - override def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = { + override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = { ByteString(bytes) } @@ -204,7 +204,7 @@ import pekko.util.ByteString result } - override def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = { + override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = { bytes(0) match { case TrueB => TRUE case FalseB => FALSE diff --git a/actor/src/main/scala/org/apache/pekko/serialization/Serialization.scala b/actor/src/main/scala/org/apache/pekko/serialization/Serialization.scala index 6a0301af64c..eb878635ec2 100644 --- a/actor/src/main/scala/org/apache/pekko/serialization/Serialization.scala +++ b/actor/src/main/scala/org/apache/pekko/serialization/Serialization.scala @@ -39,7 +39,7 @@ object Serialization { /** * Tuple that represents mapping from Class to Serializer */ - type ClassSerializer = (Class[?], Serializer) + type ClassSerializer = (Class[_], Serializer) /** * INTERNAL API: This holds a reference to the current transport serialization information used for @@ -152,7 +152,7 @@ class Serialization(val system: ExtendedActorSystem) extends Extension { private[this] val _log = Logging.withMarker(system, getClass.getName) val log: LoggingAdapter = _log - private val manifestCache = new AtomicReference[Map[String, Option[Class[?]]]](Map.empty[String, Option[Class[?]]]) + private val manifestCache = new AtomicReference[Map[String, Option[Class[_]]]](Map.empty[String, Option[Class[_]]]) /** INTERNAL API */ @InternalApi private[pekko] def serializationInformation: Serialization.Information = @@ -197,7 +197,7 @@ class Serialization(val system: ExtendedActorSystem) extends Extension { private def deserializeByteArray(bytes: Array[Byte], serializer: Serializer, manifest: String): AnyRef = { - @tailrec def updateCache(cache: Map[String, Option[Class[?]]], key: String, value: Option[Class[?]]): Boolean = { + @tailrec def updateCache(cache: Map[String, Option[Class[_]]], key: String, value: Option[Class[_]]): Boolean = { manifestCache.compareAndSet(cache, cache.updated(key, value)) || updateCache(manifestCache.get, key, value) // recursive, try again } @@ -215,7 +215,7 @@ class Serialization(val system: ExtendedActorSystem) extends Extension { case None => system.dynamicAccess.getClassFor[AnyRef](manifest) match { case Success(classManifest) => - val classManifestOption: Option[Class[?]] = Some(classManifest) + val classManifestOption: Option[Class[_]] = Some(classManifest) updateCache(cache, manifest, classManifestOption) s1.fromBinary(bytes, classManifestOption) case Failure(_) => @@ -291,10 +291,10 @@ class Serialization(val system: ExtendedActorSystem) extends Extension { * Throws java.io.NotSerializableException if no `serialization-bindings` is configured for the class. */ @throws(classOf[NotSerializableException]) - def serializerFor(clazz: Class[?]): Serializer = + def serializerFor(clazz: Class[_]): Serializer = serializerMap.get(clazz) match { case null => // bindings are ordered from most specific to least specific - def unique(possibilities: immutable.Seq[(Class[?], Serializer)]): Boolean = + def unique(possibilities: immutable.Seq[(Class[_], Serializer)]): Boolean = possibilities.size == 1 || { val possibility = possibilities.head possibilities.forall(_._1.isAssignableFrom(possibility._1)) || @@ -380,14 +380,14 @@ class Serialization(val system: ExtendedActorSystem) extends Extension { } else serializerFQN // Try constructors in order of preference (most specific first) - val singleArgConstructors: List[List[(Class[?], AnyRef)]] = + val singleArgConstructors: List[List[(Class[_], AnyRef)]] = List( List(classOf[ExtendedActorSystem] -> system), List(classOf[ActorSystem] -> system), List(classOf[ClassicActorSystemProvider] -> (system: ClassicActorSystemProvider)), Nil) - val twoArgConstructors: List[List[(Class[?], AnyRef)]] = + val twoArgConstructors: List[List[(Class[_], AnyRef)]] = if (bindingName == "") Nil else List( @@ -398,7 +398,7 @@ class Serialization(val system: ExtendedActorSystem) extends Extension { val allConstructors = singleArgConstructors ++ twoArgConstructors - def tryNext(remaining: List[List[(Class[?], AnyRef)]]): Try[Serializer] = + def tryNext(remaining: List[List[(Class[_], AnyRef)]]): Try[Serializer] = remaining match { case Nil => Failure( @@ -469,7 +469,7 @@ class Serialization(val system: ExtendedActorSystem) extends Extension { } } - private def warnUnexpectedNonPekkoSerializer(clazz: Class[?], ser: Serializer): Boolean = { + private def warnUnexpectedNonPekkoSerializer(clazz: Class[_], ser: Serializer): Boolean = { val clazzName = clazz.getName if (clazzName.startsWith(PekkoPackagePrefix) && !ser.getClass.getName.startsWith(PekkoPackagePrefix)) { log.warning( @@ -510,8 +510,8 @@ class Serialization(val system: ExtendedActorSystem) extends Extension { * serializerMap is a Map whose keys is the class that is serializable and values is the serializer * to be used for that class. */ - private val serializerMap: ConcurrentHashMap[Class[?], Serializer] = - bindings.foldLeft(new ConcurrentHashMap[Class[?], Serializer]) { case (map, (c, s)) => map.put(c, s); map } + private val serializerMap: ConcurrentHashMap[Class[_], Serializer] = + bindings.foldLeft(new ConcurrentHashMap[Class[_], Serializer]) { case (map, (c, s)) => map.put(c, s); map } /** * Maps from a Serializer Identity (Int) to a Serializer instance (optimization) @@ -569,9 +569,9 @@ class Serialization(val system: ExtendedActorSystem) extends Extension { /** * INTERNAL API */ - @InternalApi private[pekko] def shouldWarnAboutJavaSerializer(serializedClass: Class[?], serializer: Serializer) = { + @InternalApi private[pekko] def shouldWarnAboutJavaSerializer(serializedClass: Class[_], serializer: Serializer) = { - def suppressWarningOnNonSerializationVerification(serializedClass: Class[?]) = { + def suppressWarningOnNonSerializationVerification(serializedClass: Class[_]) = { // suppressed, only when warn-on-no-serialization-verification = off, and extending NoSerializationVerificationNeeded !isWarningOnNoVerificationEnabled && classOf[NoSerializationVerificationNeeded].isAssignableFrom(serializedClass) } diff --git a/actor/src/main/scala/org/apache/pekko/serialization/SerializationSetup.scala b/actor/src/main/scala/org/apache/pekko/serialization/SerializationSetup.scala index 0e32bd811f5..a6f942a8a37 100644 --- a/actor/src/main/scala/org/apache/pekko/serialization/SerializationSetup.scala +++ b/actor/src/main/scala/org/apache/pekko/serialization/SerializationSetup.scala @@ -55,7 +55,7 @@ object SerializerDetails { * @param useFor A set of classes or superclasses to bind to the serializer, selection works just as if * the classes, the alias and the serializer had been in the config. */ - def apply(alias: String, serializer: Serializer, useFor: immutable.Seq[Class[?]]): SerializerDetails = + def apply(alias: String, serializer: Serializer, useFor: immutable.Seq[Class[_]]): SerializerDetails = new SerializerDetails(alias, serializer, useFor) /** @@ -65,7 +65,7 @@ object SerializerDetails { * @param useFor A set of classes or superclasses to bind to the serializer, selection works just as if * the classes, the alias and the serializer had been in the config. */ - def create(alias: String, serializer: Serializer, useFor: java.util.List[Class[?]]): SerializerDetails = + def create(alias: String, serializer: Serializer, useFor: java.util.List[Class[_]]): SerializerDetails = apply(alias, serializer, useFor.asScala.toVector) } @@ -77,4 +77,4 @@ object SerializerDetails { final class SerializerDetails private ( val alias: String, val serializer: Serializer, - val useFor: immutable.Seq[Class[?]]) + val useFor: immutable.Seq[Class[_]]) diff --git a/actor/src/main/scala/org/apache/pekko/serialization/Serializer.scala b/actor/src/main/scala/org/apache/pekko/serialization/Serializer.scala index 01cc91c3814..b553d0db2f3 100644 --- a/actor/src/main/scala/org/apache/pekko/serialization/Serializer.scala +++ b/actor/src/main/scala/org/apache/pekko/serialization/Serializer.scala @@ -78,7 +78,7 @@ trait Serializer { * the class should be loaded using ActorSystem.dynamicAccess. */ @throws(classOf[NotSerializableException]) - def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef + def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef /** * Java API: deserialize without type hint @@ -89,7 +89,7 @@ trait Serializer { * Java API: deserialize with type hint */ @throws(classOf[NotSerializableException]) - final def fromBinary(bytes: Array[Byte], clazz: Class[?]): AnyRef = fromBinary(bytes, Option(clazz)) + final def fromBinary(bytes: Array[Byte], clazz: Class[_]): AnyRef = fromBinary(bytes, Option(clazz)) } object Serializers { @@ -175,7 +175,7 @@ abstract class SerializerWithStringManifest extends Serializer { @throws(classOf[NotSerializableException]) def fromBinary(bytes: Array[Byte], manifest: String): AnyRef - final def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = { + final def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = { val manifestString = manifest match { case Some(c) => c.getName case None => "" @@ -286,7 +286,7 @@ object BaseSerializer { /** INTERNAL API */ @InternalApi - private[pekko] def identifierFromConfig(clazz: Class[?], system: ExtendedActorSystem): Int = + private[pekko] def identifierFromConfig(clazz: Class[_], system: ExtendedActorSystem): Int = system.settings.config.getInt(s"""$SerializationIdentifiers."${clazz.getName}"""") /** INTERNAL API */ @@ -304,13 +304,13 @@ object BaseSerializer { abstract class JSerializer extends Serializer { @throws(classOf[NotSerializableException]) - final def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = + final def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = fromBinaryJava(bytes, manifest.orNull) /** * This method must be implemented, manifest may be null. */ - protected def fromBinaryJava(bytes: Array[Byte], manifest: Class[?]): AnyRef + protected def fromBinaryJava(bytes: Array[Byte], manifest: Class[_]): AnyRef } object NullSerializer extends NullSerializer @@ -365,7 +365,7 @@ class JavaSerializer(val system: ExtendedActorSystem) extends BaseSerializer { } @throws(classOf[NotSerializableException]) - def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = { + def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = { val in = new ClassLoaderObjectInputStream(system.dynamicAccess.classLoader, new UnsynchronizedByteArrayInputStream(bytes)) try JavaSerializer.currentSystem.withValue(system) { in.readObject } @@ -398,7 +398,7 @@ final case class DisabledJavaSerializer(system: ExtendedActorSystem) extends Ser } @throws(classOf[NotSerializableException]) - override def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = { + override def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = { log.warning( LogMarker.Security, "Incoming message attempted to use Java Serialization even though `pekko.actor.allow-java-serialization = off` was set!") @@ -438,7 +438,7 @@ class NullSerializer extends Serializer { def identifier = 0 def toBinary(o: AnyRef): Array[Byte] = nullAsBytes @throws(classOf[NotSerializableException]) - def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = null + def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = null } /** @@ -457,7 +457,7 @@ class ByteArraySerializer(val system: ExtendedActorSystem) extends BaseSerialize } @throws(classOf[NotSerializableException]) - def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = bytes + def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = bytes override def toBinary(o: AnyRef, buf: ByteBuffer): Unit = o match { diff --git a/actor/src/main/scala/org/apache/pekko/util/BoundedBlockingQueue.scala b/actor/src/main/scala/org/apache/pekko/util/BoundedBlockingQueue.scala index a51e2cbb62c..e6ffeae3fb4 100644 --- a/actor/src/main/scala/org/apache/pekko/util/BoundedBlockingQueue.scala +++ b/actor/src/main/scala/org/apache/pekko/util/BoundedBlockingQueue.scala @@ -30,11 +30,11 @@ class BoundedBlockingQueue[E <: AnyRef](val maxCapacity: Int, private val backin backing match { case null => throw new IllegalArgumentException("Backing Queue may not be null") - case b: BlockingQueue[?] => + case b: BlockingQueue[_] => require(maxCapacity > 0) require(b.size() == 0) require(b.remainingCapacity >= maxCapacity) - case b: Queue[?] => + case b: Queue[_] => require(b.size() == 0) require(maxCapacity > 0) } @@ -186,9 +186,9 @@ class BoundedBlockingQueue[E <: AnyRef](val maxCapacity: Int, private val backin finally lock.unlock() } - def drainTo(c: Collection[? >: E]): Int = drainTo(c, Int.MaxValue) + def drainTo(c: Collection[_ >: E]): Int = drainTo(c, Int.MaxValue) - def drainTo(c: Collection[? >: E], maxElements: Int): Int = { + def drainTo(c: Collection[_ >: E], maxElements: Int): Int = { if (c eq null) throw new NullPointerException if (c eq this) throw new IllegalArgumentException if (c eq backing) throw new IllegalArgumentException @@ -211,13 +211,13 @@ class BoundedBlockingQueue[E <: AnyRef](val maxCapacity: Int, private val backin } } - override def containsAll(c: Collection[?]): Boolean = { + override def containsAll(c: Collection[_]): Boolean = { lock.lock() try backing.containsAll(c) finally lock.unlock() } - override def removeAll(c: Collection[?]): Boolean = { + override def removeAll(c: Collection[_]): Boolean = { lock.lock() try { if (backing.removeAll(c)) { @@ -229,7 +229,7 @@ class BoundedBlockingQueue[E <: AnyRef](val maxCapacity: Int, private val backin } finally lock.unlock() } - override def retainAll(c: Collection[?]): Boolean = { + override def retainAll(c: Collection[_]): Boolean = { lock.lock() try { if (backing.retainAll(c)) { diff --git a/actor/src/main/scala/org/apache/pekko/util/BoxedType.scala b/actor/src/main/scala/org/apache/pekko/util/BoxedType.scala index 0e7fc097548..e26094214d0 100644 --- a/actor/src/main/scala/org/apache/pekko/util/BoxedType.scala +++ b/actor/src/main/scala/org/apache/pekko/util/BoxedType.scala @@ -16,7 +16,7 @@ package org.apache.pekko.util object BoxedType { import java.{ lang => jl } - private val toBoxed = Map[Class[?], Class[?]]( + private val toBoxed = Map[Class[_], Class[_]]( classOf[Boolean] -> classOf[jl.Boolean], classOf[Byte] -> classOf[jl.Byte], classOf[Char] -> classOf[jl.Character], @@ -27,5 +27,5 @@ object BoxedType { classOf[Double] -> classOf[jl.Double], classOf[Unit] -> classOf[scala.runtime.BoxedUnit]) - final def apply(c: Class[?]): Class[?] = if (c.isPrimitive) toBoxed(c) else c + final def apply(c: Class[_]): Class[_] = if (c.isPrimitive) toBoxed(c) else c } diff --git a/actor/src/main/scala/org/apache/pekko/util/ClassLoaderObjectInputStream.scala b/actor/src/main/scala/org/apache/pekko/util/ClassLoaderObjectInputStream.scala index b5a6f66a8df..ed35147fa3e 100644 --- a/actor/src/main/scala/org/apache/pekko/util/ClassLoaderObjectInputStream.scala +++ b/actor/src/main/scala/org/apache/pekko/util/ClassLoaderObjectInputStream.scala @@ -23,7 +23,7 @@ import java.io.{ InputStream, ObjectInputStream, ObjectStreamClass } * @param is - the InputStream that is wrapped */ class ClassLoaderObjectInputStream(classLoader: ClassLoader, is: InputStream) extends ObjectInputStream(is) { - override protected def resolveClass(objectStreamClass: ObjectStreamClass): Class[?] = + override protected def resolveClass(objectStreamClass: ObjectStreamClass): Class[_] = try Class.forName(objectStreamClass.getName, false, classLoader) catch { case _: ClassNotFoundException => super.resolveClass(objectStreamClass) diff --git a/actor/src/main/scala/org/apache/pekko/util/LineNumbers.scala b/actor/src/main/scala/org/apache/pekko/util/LineNumbers.scala index 424941490c1..5d22f9d79fc 100644 --- a/actor/src/main/scala/org/apache/pekko/util/LineNumbers.scala +++ b/actor/src/main/scala/org/apache/pekko/util/LineNumbers.scala @@ -196,7 +196,7 @@ object LineNumbers { } } - private def getStreamForClass(c: Class[?]): Option[(InputStream, None.type)] = { + private def getStreamForClass(c: Class[_]): Option[(InputStream, None.type)] = { val resource = c.getName.replace('.', '/') + ".class" val cl = c.getClassLoader val r = cl.getResourceAsStream(resource) @@ -358,7 +358,7 @@ object LineNumbers { private def readAttributes(d: DataInputStream)(implicit c: Constants): Option[String] = { val count = d.readUnsignedShort() if (debug) println(s"LNB: reading $count attributes") - if (c.contains("SourceFile")) { + if (c contains "SourceFile") { val s = c("SourceFile") val attributes = for (_ <- 1 to count) yield { diff --git a/actor/src/main/scala/org/apache/pekko/util/Reflect.scala b/actor/src/main/scala/org/apache/pekko/util/Reflect.scala index 14d78505906..8b89481ce88 100644 --- a/actor/src/main/scala/org/apache/pekko/util/Reflect.scala +++ b/actor/src/main/scala/org/apache/pekko/util/Reflect.scala @@ -40,11 +40,11 @@ private[pekko] object Reflect { * * Hint: when comparing to Thread.currentThread().getStackTrace, add two levels. */ - val getCallerClass: Option[Int => Class[?]] = { + val getCallerClass: Option[Int => Class[_]] = { try { val c = Class.forName("sun.reflect.Reflection") val m = c.getMethod("getCallerClass", Array(classOf[Int]): _*) - Some((i: Int) => m.invoke(null, Array[AnyRef](i.asInstanceOf[java.lang.Integer]): _*).asInstanceOf[Class[?]]) + Some((i: Int) => m.invoke(null, Array[AnyRef](i.asInstanceOf[java.lang.Integer]): _*).asInstanceOf[Class[_]]) } catch { case NonFatal(_) => None } @@ -123,7 +123,7 @@ private[pekko] object Reflect { else constructor } - private def safeGetClass(a: Any): Class[?] = + private def safeGetClass(a: Any): Class[_] = if (a == null) classOf[AnyRef] else a.getClass /** @@ -133,17 +133,17 @@ private[pekko] object Reflect { */ private[pekko] def instantiator[T](clazz: Class[T]): () => T = () => instantiate(clazz) - def findMarker(root: Class[?], marker: Class[?]): Type = { - @tailrec def rec(curr: Class[?]): Type = { + def findMarker(root: Class[_], marker: Class[_]): Type = { + @tailrec def rec(curr: Class[_]): Type = { if ((curr.getSuperclass ne null) && marker.isAssignableFrom(curr.getSuperclass)) rec(curr.getSuperclass) else curr.getGenericInterfaces.collectFirst { - case c: Class[?] if marker.isAssignableFrom(c) => c - case t: ParameterizedType if marker.isAssignableFrom(t.getRawType.asInstanceOf[Class[?]]) => t + case c: Class[_] if marker.isAssignableFrom(c) => c + case t: ParameterizedType if marker.isAssignableFrom(t.getRawType.asInstanceOf[Class[_]]) => t } match { case None => throw new IllegalArgumentException(s"cannot find [$marker] in ancestors of [$root]") - case Some(c: Class[?]) => if (c == marker) c else rec(c) - case Some(t: ParameterizedType) => if (t.getRawType == marker) t else rec(t.getRawType.asInstanceOf[Class[?]]) + case Some(c: Class[_]) => if (c == marker) c else rec(c) + case Some(t: ParameterizedType) => if (t.getRawType == marker) t else rec(t.getRawType.asInstanceOf[Class[_]]) case _ => ??? // cannot happen due to collectFirst } } @@ -154,7 +154,7 @@ private[pekko] object Reflect { * INTERNAL API */ private[pekko] def findClassLoader(): ClassLoader = { - def findCaller(get: Int => Class[?]): ClassLoader = + def findCaller(get: Int => Class[_]): ClassLoader = Iterator .from(2 /*is the magic number, promise*/ ) .map(get) diff --git a/actor/src/main/scala/org/apache/pekko/util/TypedMultiMap.scala b/actor/src/main/scala/org/apache/pekko/util/TypedMultiMap.scala index cdec7a46c37..16774260287 100644 --- a/actor/src/main/scala/org/apache/pekko/util/TypedMultiMap.scala +++ b/actor/src/main/scala/org/apache/pekko/util/TypedMultiMap.scala @@ -109,7 +109,7 @@ class TypedMultiMap[T <: AnyRef, K[_ <: T]] private (private val map: Map[T, Set override def toString: String = s"TypedMultiMap($map)" override def equals(other: Any) = other match { - case o: TypedMultiMap[?, ?] => map == o.map + case o: TypedMultiMap[_, _] => map == o.map case _ => false } override def hashCode: Int = map.hashCode diff --git a/bench-jmh/src/main/scala/org/apache/pekko/actor/typed/TypedBenchmarkActors.scala b/bench-jmh/src/main/scala/org/apache/pekko/actor/typed/TypedBenchmarkActors.scala index dea2a1b1e2a..0976e64c5a2 100644 --- a/bench-jmh/src/main/scala/org/apache/pekko/actor/typed/TypedBenchmarkActors.scala +++ b/bench-jmh/src/main/scala/org/apache/pekko/actor/typed/TypedBenchmarkActors.scala @@ -161,7 +161,7 @@ object TypedBenchmarkActors { } private def startPingPongActorPairs( - ctx: ActorContext[?], + ctx: ActorContext[_], messagesPerPair: Int, numPairs: Int, dispatcher: String): (Vector[(ActorRef[Message], ActorRef[Message])], CountDownLatch) = { diff --git a/bench-jmh/src/main/scala/org/apache/pekko/remote/artery/CodecBenchmark.scala b/bench-jmh/src/main/scala/org/apache/pekko/remote/artery/CodecBenchmark.scala index 3f019fd3b00..d60f1dafc17 100644 --- a/bench-jmh/src/main/scala/org/apache/pekko/remote/artery/CodecBenchmark.scala +++ b/bench-jmh/src/main/scala/org/apache/pekko/remote/artery/CodecBenchmark.scala @@ -295,7 +295,7 @@ object CodecBenchmark { override def toBinary(o: AnyRef): Array[Byte] = Preserialized - override def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = + override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = fromBinary(ByteBuffer.wrap(bytes), "NoManifestForYou") } diff --git a/bench-jmh/src/main/scala/org/apache/pekko/stream/ActorGraphInterpreterBoundaryBenchmark.scala b/bench-jmh/src/main/scala/org/apache/pekko/stream/ActorGraphInterpreterBoundaryBenchmark.scala index 92b07b53ccc..d737283cc4b 100644 --- a/bench-jmh/src/main/scala/org/apache/pekko/stream/ActorGraphInterpreterBoundaryBenchmark.scala +++ b/bench-jmh/src/main/scala/org/apache/pekko/stream/ActorGraphInterpreterBoundaryBenchmark.scala @@ -47,7 +47,7 @@ object ActorGraphInterpreterBoundaryBenchmark { final val CancelAfter = ElementCount / 2 final class SynchronousPublisher(elements: Array[MutableElement]) extends Publisher[MutableElement] { - override def subscribe(subscriber: Subscriber[? >: MutableElement]): Unit = { + override def subscribe(subscriber: Subscriber[_ >: MutableElement]): Unit = { if (subscriber eq null) throw new NullPointerException("subscriber") subscriber.onSubscribe(new Subscription { diff --git a/bench-jmh/src/main/scala/org/apache/pekko/stream/AsyncBoundaryThroughputBenchmark.scala b/bench-jmh/src/main/scala/org/apache/pekko/stream/AsyncBoundaryThroughputBenchmark.scala deleted file mode 100644 index d508d074c36..00000000000 --- a/bench-jmh/src/main/scala/org/apache/pekko/stream/AsyncBoundaryThroughputBenchmark.scala +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.pekko.stream - -import java.util.concurrent.CountDownLatch -import java.util.concurrent.TimeUnit - -import scala.annotation.nowarn -import scala.concurrent.Await -import scala.concurrent.duration._ - -import org.openjdk.jmh.annotations._ -import org.openjdk.jmh.infra.Blackhole - -import org.apache.pekko -import pekko.NotUsed -import pekko.actor.ActorSystem -import pekko.stream.scaladsl._ -import pekko.stream.stage._ - -import com.typesafe.config.ConfigFactory - -object AsyncBoundaryThroughputBenchmark { - final val ElementCount = 100 * 1000 -} - -@State(Scope.Benchmark) -@OutputTimeUnit(TimeUnit.SECONDS) -@BenchmarkMode(Array(Mode.Throughput)) -class AsyncBoundaryThroughputBenchmark { - - import AsyncBoundaryThroughputBenchmark._ - - val config = ConfigFactory.parseString(s""" - pekko.stream.materializer.sync-processing-limit = ${Int.MaxValue} - """) - - implicit val system: ActorSystem = ActorSystem("AsyncBoundaryThroughputBenchmark", config) - - @Param(Array("1", "3", "10")) - var asyncBoundaries = 0 - - var source: Source[Int, NotUsed] = _ - var flow: Flow[Int, Int, NotUsed] = _ - - @Setup - def setup(): Unit = { - SystemMaterializer(system).materializer - source = Source(1 to ElementCount) - var f: Flow[Int, Int, NotUsed] = Flow[Int] - for (_ <- 1 to asyncBoundaries) { - f = f.map(identity).async - } - flow = f - } - - @Benchmark - @OperationsPerInvocation(ElementCount) - def async_boundary_throughput(blackhole: Blackhole): CountDownLatch = { - FusedGraphsBenchmark.blackhole = blackhole - val latch = source - .via(flow) - .toMat(Sink.fromGraph(new JitSafeCompletionLatchInt))(Keep.right) - .run() - if (!latch.await(30, TimeUnit.SECONDS)) - throw new RuntimeException("Latch timed out") - latch - } - - @TearDown - def shutdown(): Unit = { - Await.result(system.terminate(), 5.seconds) - } -} - -class JitSafeCompletionLatchInt extends GraphStageWithMaterializedValue[SinkShape[Int], CountDownLatch] { - val in = Inlet[Int]("JitSafeCompletionLatchInt.in") - override val shape = SinkShape(in) - - @nowarn("cat=unused-params") - override def createLogicAndMaterializedValue(inheritedAttributes: Attributes): (GraphStageLogic, CountDownLatch) = { - val latch = new CountDownLatch(1) - val logic = new GraphStageLogic(shape) with InHandler { - private var count = 0 - - override def preStart(): Unit = pull(in) - override def onPush(): Unit = { - grab(in) // consume element - count += 1 - pull(in) - } - - override def onUpstreamFinish(): Unit = { - FusedGraphsBenchmark.blackhole.consume(count) - latch.countDown() - completeStage() - } - - override def onUpstreamFailure(ex: Throwable): Unit = { - latch.countDown() - failStage(ex) - } - - setHandler(in, this) - } - (logic, latch) - } -} diff --git a/bench-jmh/src/main/scala/org/apache/pekko/stream/BroadcastHubBenchRunner.scala b/bench-jmh/src/main/scala/org/apache/pekko/stream/BroadcastHubBenchRunner.scala deleted file mode 100644 index 0efe9e8d499..00000000000 --- a/bench-jmh/src/main/scala/org/apache/pekko/stream/BroadcastHubBenchRunner.scala +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.pekko.stream - -import java.util.concurrent.{ CountDownLatch, TimeUnit } - -import scala.concurrent.Await -import scala.concurrent.duration._ - -import org.apache.pekko.actor.ActorSystem -import org.apache.pekko.remote.artery.{ BenchTestSource, LatchSink } -import org.apache.pekko.stream.scaladsl._ - -import com.typesafe.config.ConfigFactory - -/** - * Standalone benchmark runner for BroadcastHub consumer wheel performance. - * Run with: sbt "bench-jmh/runMain org.apache.pekko.stream.BroadcastHubBenchRunner" - */ -object BroadcastHubBenchRunner { - - final val Elements = 100000 - final val SmallBuffer = 64 - final val LargeBuffer = 256 - final val WarmupRuns = 2 - final val MeasureRuns = 3 - - def main(args: Array[String]): Unit = { - val config = ConfigFactory.parseString(""" - pekko.actor.default-dispatcher { - executor = "fork-join-executor" - fork-join-executor { - parallelism-factor = 1 - } - } - """) - - val consumerCounts = Array(64, 256, 1000, 2000) - - println("=" * 80) - println("BroadcastHub Consumer Wheel Benchmark") - println(s"Elements per run: $Elements") - println(s"Warmup: $WarmupRuns runs, Measure: $MeasureRuns runs") - println("=" * 80) - - for (bufferSize <- Array(SmallBuffer, LargeBuffer)) { - println(s"\n--- Buffer size: $bufferSize (wheel slots: ${bufferSize * 2}) ---") - println(f"${"Consumers"}%-12s ${"Avg (elem/s)"}%16s ${"Min"}%12s ${"Max"}%12s ${"StdDev"}%10s") - println("-" * 70) - - for (consumerCount <- consumerCounts) { - implicit val system: ActorSystem = ActorSystem(s"bench-$consumerCount-$bufferSize", config) - - // eager init - SystemMaterializer(system).materializer - - val results = new Array[Double](WarmupRuns + MeasureRuns) - - for (run <- 0 until WarmupRuns + MeasureRuns) { - val latch = new CountDownLatch(consumerCount) - val broadcastSink = - BroadcastHub.sink[java.lang.Integer](bufferSize = bufferSize, startAfterNrOfConsumers = consumerCount) - val testSource = Source.fromGraph(new BenchTestSource(Elements)) - val source = testSource.runWith(broadcastSink) - - val start = System.nanoTime() - var idx = 0 - while (idx < consumerCount) { - source.runWith(new LatchSink(Elements, latch)) - idx += 1 - } - - if (!latch.await(120, TimeUnit.SECONDS)) { - println(s" TIMEOUT at consumers=$consumerCount buffer=$bufferSize run=$run") - Await.result(system.terminate(), 10.seconds) - System.exit(1) - } - val elapsed = (System.nanoTime() - start) / 1e9 - results(run) = Elements / elapsed - } - - val measured = results.drop(WarmupRuns) - val avg = measured.sum / measured.length - val min = measured.min - val max = measured.max - val variance = measured.map(x => (x - avg) * (x - avg)).sum / measured.length - val stddev = math.sqrt(variance) - - println(f"$consumerCount%-12d $avg%16.0f $min%12.0f $max%12.0f $stddev%10.0f") - - Await.result(system.terminate(), 10.seconds) - } - } - - println("\n" + "=" * 80) - println("Done.") - } -} diff --git a/bench-jmh/src/main/scala/org/apache/pekko/stream/BroadcastHubBenchmark.scala b/bench-jmh/src/main/scala/org/apache/pekko/stream/BroadcastHubBenchmark.scala index 687f695183f..c46bcf5aee0 100644 --- a/bench-jmh/src/main/scala/org/apache/pekko/stream/BroadcastHubBenchmark.scala +++ b/bench-jmh/src/main/scala/org/apache/pekko/stream/BroadcastHubBenchmark.scala @@ -32,24 +32,8 @@ import org.apache.pekko.stream.testkit.scaladsl.StreamTestKit import com.typesafe.config.ConfigFactory -/** - * Benchmarks BroadcastHub throughput under high-fan-out lockstep consumer scenarios. - * - * The consumer wheel uses a LongMap per slot for O(1) keyed add/remove without Long boxing. - * In lockstep, all consumers cluster in the same wheel slot, maximizing per-slot contention. - * With a small buffer (64), the wheel has only 128 slots, so `consumerCount / 128` consumers - * share each slot — the old ArrayList.removeIf was O(k) per removal, now O(1). - * - * The `broadcast` benchmark parameterizes over consumer count with a fixed small buffer, - * measuring how throughput scales as wheel slot pressure increases. - * - * The `broadcastLargeBuffer` benchmark uses a larger buffer (256) for comparison, - * showing how the optimization holds up when consumers are spread across more slots. - */ object BroadcastHubBenchmark { final val OperationsPerInvocation = 100000 - final val SmallBufferSize = 64 - final val LargeBufferSize = 256 } @State(Scope.Benchmark) @@ -72,7 +56,7 @@ class BroadcastHubBenchmark { var testSource: Source[java.lang.Integer, NotUsed] = _ - @Param(Array("64", "256", "1000", "2000")) + @Param(Array("64", "256")) var parallelism = 0 @Setup @@ -87,40 +71,12 @@ class BroadcastHubBenchmark { Await.result(system.terminate(), 5.seconds) } - /** - * Lockstep broadcast with small buffer (64). - * All consumers stay at roughly the same wheel offset, clustering in the same slot. - * With 128 wheel slots and 2000 consumers, ~16 consumers share each slot on average; - * during NeedWakeup bursts, thousands cluster in a single slot. - * This maximizes the O(1) vs O(k) per-removal difference. - */ @Benchmark @OperationsPerInvocation(OperationsPerInvocation) def broadcast(): Unit = { val latch = new CountDownLatch(parallelism) val broadcastSink = - BroadcastHub.sink[java.lang.Integer](bufferSize = SmallBufferSize, startAfterNrOfConsumers = parallelism) - val sink = new LatchSink(OperationsPerInvocation, latch) - val source = testSource.runWith(broadcastSink) - var idx = 0 - while (idx < parallelism) { - source.runWith(sink) - idx += 1 - } - awaitLatch(latch) - } - - /** - * Lockstep broadcast with larger buffer (256) for comparison. - * The wheel has 512 slots, so consumers are spread more thinly. - * Shows how the optimization scales when per-slot pressure is lower. - */ - @Benchmark - @OperationsPerInvocation(OperationsPerInvocation) - def broadcastLargeBuffer(): Unit = { - val latch = new CountDownLatch(parallelism) - val broadcastSink = - BroadcastHub.sink[java.lang.Integer](bufferSize = LargeBufferSize, startAfterNrOfConsumers = parallelism) + BroadcastHub.sink[java.lang.Integer](bufferSize = parallelism, startAfterNrOfConsumers = parallelism) val sink = new LatchSink(OperationsPerInvocation, latch) val source = testSource.runWith(broadcastSink) var idx = 0 @@ -132,7 +88,7 @@ class BroadcastHubBenchmark { } private def awaitLatch(latch: CountDownLatch): Unit = { - if (!latch.await(60, TimeUnit.SECONDS)) { + if (!latch.await(30, TimeUnit.SECONDS)) { StreamTestKit.printDebugDump(SystemMaterializer(system).materializer.supervisor) throw new RuntimeException("Latch didn't complete in time") } diff --git a/bench-jmh/src/main/scala/org/apache/pekko/stream/FlowMapBenchmark.scala b/bench-jmh/src/main/scala/org/apache/pekko/stream/FlowMapBenchmark.scala index b7a60858023..f689aa2095d 100644 --- a/bench-jmh/src/main/scala/org/apache/pekko/stream/FlowMapBenchmark.scala +++ b/bench-jmh/src/main/scala/org/apache/pekko/stream/FlowMapBenchmark.scala @@ -111,7 +111,7 @@ class FlowMapBenchmark { } // source setup - private def mkMaps[O, Mat](source: Source[O, Mat], count: Int)(flow: => Graph[FlowShape[O, O], ?]): Source[O, Mat] = { + private def mkMaps[O, Mat](source: Source[O, Mat], count: Int)(flow: => Graph[FlowShape[O, O], _]): Source[O, Mat] = { var f = source for (_ <- 1 to count) f = f.via(flow) diff --git a/bench-jmh/src/main/scala/org/apache/pekko/stream/GraphStageConstructionBenchmark.scala b/bench-jmh/src/main/scala/org/apache/pekko/stream/GraphStageConstructionBenchmark.scala index efa220f2960..fb2aa9a9637 100644 --- a/bench-jmh/src/main/scala/org/apache/pekko/stream/GraphStageConstructionBenchmark.scala +++ b/bench-jmh/src/main/scala/org/apache/pekko/stream/GraphStageConstructionBenchmark.scala @@ -22,14 +22,6 @@ import java.util.concurrent.TimeUnit import scala.collection.immutable import scala.concurrent.Promise -import org.openjdk.jmh.annotations.Benchmark -import org.openjdk.jmh.annotations.BenchmarkMode -import org.openjdk.jmh.annotations.Mode -import org.openjdk.jmh.annotations.OutputTimeUnit -import org.openjdk.jmh.annotations.Scope -import org.openjdk.jmh.annotations.State -import org.openjdk.jmh.infra.Blackhole - import org.apache.pekko.NotUsed import org.apache.pekko.stream.impl.LinearTraversalBuilder import org.apache.pekko.stream.impl.Stages.DefaultAttributes @@ -40,6 +32,13 @@ import org.apache.pekko.stream.scaladsl.Keep import org.apache.pekko.stream.scaladsl.Sink import org.apache.pekko.stream.scaladsl.Source import org.apache.pekko.stream.stage.GraphStageWithMaterializedValue +import org.openjdk.jmh.annotations.Benchmark +import org.openjdk.jmh.annotations.BenchmarkMode +import org.openjdk.jmh.annotations.Mode +import org.openjdk.jmh.annotations.OutputTimeUnit +import org.openjdk.jmh.annotations.Scope +import org.openjdk.jmh.annotations.State +import org.openjdk.jmh.infra.Blackhole @State(Scope.Benchmark) @BenchmarkMode(Array(Mode.Throughput)) diff --git a/bench-jmh/src/main/scala/org/apache/pekko/stream/MaterializerWiringBenchmark.scala b/bench-jmh/src/main/scala/org/apache/pekko/stream/MaterializerWiringBenchmark.scala deleted file mode 100644 index 00e7d70c8f2..00000000000 --- a/bench-jmh/src/main/scala/org/apache/pekko/stream/MaterializerWiringBenchmark.scala +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.pekko.stream - -import java.util.concurrent.TimeUnit - -import scala.concurrent.Await -import scala.concurrent.duration._ - -import org.openjdk.jmh.annotations._ - -import org.apache.pekko -import pekko.NotUsed -import pekko.actor.ActorSystem -import pekko.stream.scaladsl._ - -object MaterializerWiringBenchmark { - - val linearFlowBuilder: Int => RunnableGraph[NotUsed] = numOfOperators => { - var source = Source.single(()) - for (_ <- 1 to numOfOperators) { - source = source.map(identity) - } - source.to(Sink.ignore) - } - - val broadcastMergeBuilder: Int => RunnableGraph[NotUsed] = numOfJunctions => - RunnableGraph.fromGraph(GraphDSL.create() { implicit b => - import GraphDSL.Implicits._ - - val broadcast = b.add(Broadcast[Unit](numOfJunctions)) - var outlet = broadcast.out(0) - for (i <- 1 until numOfJunctions) { - val merge = b.add(Merge[Unit](2)) - outlet ~> merge - broadcast.out(i) ~> merge - outlet = merge.out - } - - Source.single(()) ~> broadcast - outlet ~> Sink.ignore - ClosedShape - }) - - val broadcastMergeImmediateBuilder: Int => RunnableGraph[NotUsed] = numOfJunctions => - RunnableGraph.fromGraph(GraphDSL.create() { implicit b => - import GraphDSL.Implicits._ - - val broadcast = b.add(Broadcast[Unit](numOfJunctions)) - val merge = b.add(Merge[Unit](numOfJunctions)) - for (_ <- 0 until numOfJunctions) { - broadcast ~> merge - } - - Source.single(()) ~> broadcast - merge ~> Sink.ignore - ClosedShape - }) - - val importedFlowBuilder: Int => RunnableGraph[NotUsed] = numOfFlows => - RunnableGraph.fromGraph(GraphDSL.createGraph(Source.single(())) { implicit b => source => - import GraphDSL.Implicits._ - val flow = Flow[Unit].map(identity) - var out: Outlet[Unit] = source.out - for (_ <- 0 until numOfFlows) { - val flowShape = b.add(flow) - out ~> flowShape - out = flowShape.outlet - } - out ~> Sink.ignore - ClosedShape - }) -} - -@State(Scope.Benchmark) -@OutputTimeUnit(TimeUnit.SECONDS) -@BenchmarkMode(Array(Mode.Throughput)) -class MaterializerWiringBenchmark { - - import MaterializerWiringBenchmark._ - - implicit val system: ActorSystem = ActorSystem("MaterializerWiringBenchmark") - - var linearFlow: RunnableGraph[NotUsed] = _ - var broadcastMerge: RunnableGraph[NotUsed] = _ - var broadcastMergeImmediate: RunnableGraph[NotUsed] = _ - var importedFlow: RunnableGraph[NotUsed] = _ - - @Param(Array("100", "500", "1000")) - var complexity = 0 - - @Setup - def setup(): Unit = { - SystemMaterializer(system).materializer - linearFlow = linearFlowBuilder(complexity) - broadcastMerge = broadcastMergeBuilder(complexity) - broadcastMergeImmediate = broadcastMergeImmediateBuilder(complexity) - importedFlow = importedFlowBuilder(complexity) - } - - @Benchmark - def linear(): NotUsed = linearFlow.run() - - @Benchmark - def broadcast_merge_gradual(): NotUsed = broadcastMerge.run() - - @Benchmark - def broadcast_merge_immediate(): NotUsed = broadcastMergeImmediate.run() - - @Benchmark - def imported_flow(): NotUsed = importedFlow.run() - - @TearDown - def shutdown(): Unit = { - Await.result(system.terminate(), 5.seconds) - } -} diff --git a/bench-jmh/src/main/scala/org/apache/pekko/stream/StageActorRefBenchmark.scala b/bench-jmh/src/main/scala/org/apache/pekko/stream/StageActorRefBenchmark.scala deleted file mode 100644 index 007253e275f..00000000000 --- a/bench-jmh/src/main/scala/org/apache/pekko/stream/StageActorRefBenchmark.scala +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.pekko.stream - -import java.util.concurrent.CountDownLatch -import java.util.concurrent.TimeUnit - -import scala.concurrent.Await -import scala.concurrent.Promise -import scala.concurrent.duration._ - -import org.openjdk.jmh.annotations._ - -import org.apache.pekko -import pekko.actor.ActorRef -import pekko.actor.ActorSystem -import pekko.actor.NoSerializationVerificationNeeded -import pekko.stream.scaladsl.Keep -import pekko.stream.scaladsl.Sink -import pekko.stream.scaladsl.Source -import pekko.stream.stage.GraphStageLogic -import pekko.stream.stage.GraphStageWithMaterializedValue -import pekko.stream.stage.InHandler - -object StageActorRefBenchmark { - final val OperationsPerInvocation = 10000 - private case object CountDown extends NoSerializationVerificationNeeded - - private final class Control { - private val ready = new CountDownLatch(1) - @volatile private var ref: ActorRef = _ - @volatile private var latch: CountDownLatch = _ - - def init(ref: ActorRef): Unit = { - this.ref = ref - ready.countDown() - } - - def stageActorRef: ActorRef = { - if (!ready.await(10, TimeUnit.SECONDS)) - throw new RuntimeException("Stage actor ref was not initialized") - ref - } - - def reset(expectedMessages: Int): Unit = - latch = new CountDownLatch(expectedMessages) - - def countDown(): Unit = - latch.countDown() - - def awaitDone(): Unit = - if (!latch.await(10, TimeUnit.SECONDS)) - throw new RuntimeException("Stage actor ref benchmark messages timed out") - } - - private final class StageActorSink extends GraphStageWithMaterializedValue[SinkShape[Any], Control] { - val in: Inlet[Any] = Inlet("StageActorSink.in") - override val shape: SinkShape[Any] = SinkShape(in) - - override def createLogicAndMaterializedValue(inheritedAttributes: Attributes): (GraphStageLogic, Control) = { - val control = new Control - - val logic = new GraphStageLogic(shape) { - override def preStart(): Unit = { - control.init(getStageActor { - case (_, CountDown) => control.countDown() - }.ref) - pull(in) - } - - setHandler( - in, - new InHandler { - override def onPush(): Unit = pull(in) - }) - } - - logic -> control - } - } -} - -@State(Scope.Benchmark) -@OutputTimeUnit(TimeUnit.SECONDS) -@BenchmarkMode(Array(Mode.Throughput)) -class StageActorRefBenchmark { - import StageActorRefBenchmark._ - - implicit val system: ActorSystem = ActorSystem("StageActorRefBenchmark") - - private var completion: Promise[Option[Any]] = _ - private var control: Control = _ - private var stageActorRef: ActorRef = _ - - @Setup - def setup(): Unit = { - SystemMaterializer(system).materializer - val materialized = Source.maybe[Any].toMat(Sink.fromGraph(new StageActorSink))(Keep.both).run() - completion = materialized._1 - control = materialized._2 - stageActorRef = control.stageActorRef - } - - @TearDown - def shutdown(): Unit = { - completion.trySuccess(None) - Await.result(system.terminate(), 5.seconds) - } - - @Benchmark - @OperationsPerInvocation(OperationsPerInvocation) - def lazy_stage_actor_ref_tell_10k(): Unit = { - control.reset(OperationsPerInvocation) - var remaining = OperationsPerInvocation - while (remaining > 0) { - stageActorRef ! CountDown - remaining -= 1 - } - control.awaitDone() - } -} diff --git a/bench-jmh/src/main/scala/org/apache/pekko/stream/io/TlsBenchmark.scala b/bench-jmh/src/main/scala/org/apache/pekko/stream/io/TlsBenchmark.scala index 64968581df5..e02ee3ada9b 100644 --- a/bench-jmh/src/main/scala/org/apache/pekko/stream/io/TlsBenchmark.scala +++ b/bench-jmh/src/main/scala/org/apache/pekko/stream/io/TlsBenchmark.scala @@ -25,6 +25,7 @@ import scala.concurrent.Await import scala.concurrent.duration._ import scala.util.{ Success, Try } +import com.typesafe.config.{ Config, ConfigFactory } import org.openjdk.jmh.annotations._ import org.apache.pekko @@ -36,8 +37,6 @@ import pekko.stream.impl.io.{ TlsGraphStage, TlsModule } import pekko.stream.scaladsl._ import pekko.util.ByteString -import com.typesafe.config.{ Config, ConfigFactory } - /** * JMH benchmark comparing the legacy actor-based TLS path (`TlsModule`) to the * GraphStage path (`TlsGraphStage`). diff --git a/bench-jmh/src/main/scala/org/apache/pekko/util/ByteStringParser_readNum_Benchmark.scala b/bench-jmh/src/main/scala/org/apache/pekko/util/ByteStringParser_readNum_Benchmark.scala index 6df3f7a1e84..a018c109809 100644 --- a/bench-jmh/src/main/scala/org/apache/pekko/util/ByteStringParser_readNum_Benchmark.scala +++ b/bench-jmh/src/main/scala/org/apache/pekko/util/ByteStringParser_readNum_Benchmark.scala @@ -19,11 +19,11 @@ package org.apache.pekko.util import java.util.concurrent.TimeUnit -import org.openjdk.jmh.annotations._ - import org.apache.pekko import pekko.stream.impl.io.ByteStringParser +import org.openjdk.jmh.annotations._ + @State(Scope.Benchmark) @Measurement(timeUnit = TimeUnit.MILLISECONDS) class ByteStringParser_readNum_Benchmark { diff --git a/build.sbt b/build.sbt index b2fc153f84e..f49e77f6a3f 100644 --- a/build.sbt +++ b/build.sbt @@ -38,9 +38,6 @@ enablePlugins( JavaFormatterPlugin) disablePlugins(MimaPlugin) -ThisBuild / javafmtFormatterCompatibleJavaVersion := 17 -ThisBuild / javafmtSortImports := false - addCommandAlias("checkCodeStyle", "scalafmtCheckAll; scalafmtSbtCheck; javafmtCheckAll; +headerCheckAll") addCommandAlias("applyCodeStyle", "+headerCreateAll; scalafmtAll; scalafmtSbt; javafmtAll") @@ -137,10 +134,10 @@ lazy val actor = pekkoModule("actor") .enablePlugins(BoilerplatePlugin, SbtOsgi) lazy val actorTests = pekkoModule("actor-tests") - .configs(Jdk21.TestJdk21) + .configs(Jdk9.TestJdk9) .dependsOn(testkit % "compile->compile;test->test", actor) .settings(Dependencies.actorTests) - .enablePlugins(NoPublish, Jdk21) + .enablePlugins(NoPublish, Jdk9) .disablePlugins(MimaPlugin) lazy val pekkoScalaNightly = pekkoModule("scala-nightly") diff --git a/cluster-metrics/src/main/java/org/apache/pekko/cluster/metrics/protobuf/msg/ClusterMetricsMessages.java b/cluster-metrics/src/main/java/org/apache/pekko/cluster/metrics/protobuf/msg/ClusterMetricsMessages.java index d69e9509472..5e132ae71b4 100644 --- a/cluster-metrics/src/main/java/org/apache/pekko/cluster/metrics/protobuf/msg/ClusterMetricsMessages.java +++ b/cluster-metrics/src/main/java/org/apache/pekko/cluster/metrics/protobuf/msg/ClusterMetricsMessages.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: ClusterMetricsMessages.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package org.apache.pekko.cluster.metrics.protobuf.msg; @@ -25,8 +25,8 @@ private ClusterMetricsMessages() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ClusterMetricsMessages"); } @@ -101,8 +101,8 @@ public static final class MetricsGossipEnvelope extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "MetricsGossipEnvelope"); } @@ -248,8 +248,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getFrom()); @@ -262,15 +267,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBoolSize(3, reply_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -1057,8 +1053,8 @@ public static final class MetricsGossip extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "MetricsGossip"); } @@ -1247,8 +1243,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { final int count = allAddresses_.size(); @@ -1275,15 +1276,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2408,8 +2400,8 @@ public static final class NodeMetrics extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "NodeMetrics"); } @@ -2470,8 +2462,8 @@ public enum NumberType org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "NumberType"); } @@ -2631,8 +2623,8 @@ public static final class Number extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Number"); } @@ -2771,8 +2763,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeEnumSize(1, type_); @@ -2789,15 +2786,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(4, serialized_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -3394,8 +3382,8 @@ public static final class EWMA extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "EWMA"); } @@ -3493,8 +3481,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeDoubleSize(1, value_); @@ -3503,15 +3496,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeDoubleSize(2, alpha_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -4003,8 +3987,8 @@ public static final class Metric extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Metric"); } @@ -4148,8 +4132,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt32Size(1, nameIndex_); @@ -4162,15 +4151,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(3, getEwma()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -4975,8 +4955,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt32Size(1, addressIndex_); @@ -4994,15 +4979,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -5832,8 +5808,8 @@ public static final class Address extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Address"); } @@ -6072,8 +6048,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, system_); } @@ -6087,15 +6068,6 @@ private int computeSerializedSize_0() { if (((bitField0_ & 0x00000008) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(4, protocol_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -6878,8 +6850,8 @@ public static final class AdaptiveLoadBalancingPool extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "AdaptiveLoadBalancingPool"); } @@ -7089,8 +7061,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getMetricsSelector()); @@ -7106,15 +7083,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBoolSize(4, usePoolDispatcher_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -7931,8 +7899,8 @@ public static final class MetricsSelector extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "MetricsSelector"); } @@ -8088,8 +8056,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeUInt32Size(1, serializerId_); @@ -8101,15 +8074,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(3, data_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -8691,8 +8655,8 @@ public static final class MixMetricsSelector extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "MixMetricsSelector"); } @@ -8788,8 +8752,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { final int count = selectors_.size(); @@ -8799,15 +8768,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/ClusterMetricsCollector.scala b/cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/ClusterMetricsCollector.scala index b3744986853..f20fa74f228 100644 --- a/cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/ClusterMetricsCollector.scala +++ b/cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/ClusterMetricsCollector.scala @@ -84,10 +84,10 @@ private[metrics] class ClusterMetricsSupervisor extends Actor with ActorLogging children.foreach(stop) collectorInstance += 1 actorOf(Props(classOf[ClusterMetricsCollector]), collectorName) - log.debug("Collection started.") + log.debug(s"Collection started.") case CollectionStopMessage => children.foreach(stop) - log.debug("Collection stopped.") + log.debug(s"Collection stopped.") } } diff --git a/cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/ClusterMetricsExtension.scala b/cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/ClusterMetricsExtension.scala index d4898b79424..0150118bd21 100644 --- a/cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/ClusterMetricsExtension.scala +++ b/cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/ClusterMetricsExtension.scala @@ -63,8 +63,8 @@ class ClusterMetricsExtension(system: ExtendedActorSystem) extends Extension { immutable.Seq(classOf[Config] -> SupervisorStrategyConfiguration)) .getOrElse { val log: LoggingAdapter = Logging(system, classOf[ClusterMetricsExtension]) - log.error("Configured strategy provider {} failed to load, using default {}.", - SupervisorStrategyProvider, classOf[ClusterMetricsStrategy].getName) + log.error(s"Configured strategy provider $SupervisorStrategyProvider failed to load, using default ${classOf[ + ClusterMetricsStrategy].getName}.") new ClusterMetricsStrategy(SupervisorStrategyConfiguration) } diff --git a/cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/MetricsCollector.scala b/cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/MetricsCollector.scala index 64005d2db61..8f332ec22b3 100644 --- a/cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/MetricsCollector.scala +++ b/cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/MetricsCollector.scala @@ -71,7 +71,7 @@ private[metrics] object MetricsCollector { val useInternal = CollectorFallback && CollectorProvider == "" def create(provider: String) = TryNative { - log.debug("Trying {}.", provider) + log.debug(s"Trying $provider.") system .asInstanceOf[ExtendedActorSystem] .dynamicAccess diff --git a/cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/protobuf/NumberInputStream.scala b/cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/protobuf/NumberInputStream.scala index 6a5d073c3f5..9ce5438c382 100644 --- a/cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/protobuf/NumberInputStream.scala +++ b/cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/protobuf/NumberInputStream.scala @@ -45,7 +45,7 @@ private[protobuf] class NumberInputStream( * @return the Class object described by the ObjectStreamClass * @throws ClassNotFoundException if the Class cannot be found (or is rejected) */ - override protected def resolveClass(objectStreamClass: ObjectStreamClass): Class[?] = { + override protected def resolveClass(objectStreamClass: ObjectStreamClass): Class[_] = { val clazz = super.resolveClass(objectStreamClass) if (clazz.isPrimitive() || (clazz.isArray() && clazz.getComponentType.isPrimitive) || classOf[Number].isAssignableFrom(clazz) || clazz.getPackage.getName == "java.math") { diff --git a/cluster-sharding-typed/src/main/java/org/apache/pekko/cluster/sharding/typed/internal/protobuf/ShardingMessages.java b/cluster-sharding-typed/src/main/java/org/apache/pekko/cluster/sharding/typed/internal/protobuf/ShardingMessages.java index 7fad808d1e5..3adc1fb8f61 100644 --- a/cluster-sharding-typed/src/main/java/org/apache/pekko/cluster/sharding/typed/internal/protobuf/ShardingMessages.java +++ b/cluster-sharding-typed/src/main/java/org/apache/pekko/cluster/sharding/typed/internal/protobuf/ShardingMessages.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: ShardingMessages.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package org.apache.pekko.cluster.sharding.typed.internal.protobuf; @@ -25,8 +25,8 @@ private ShardingMessages() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ShardingMessages"); } @@ -87,8 +87,8 @@ public static final class ShardingEnvelope extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ShardingEnvelope"); } @@ -228,8 +228,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, entityId_); } @@ -237,15 +242,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getMessage()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -876,8 +872,8 @@ public static final class DaemonProcessScaleState extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "DaemonProcessScaleState"); } @@ -1027,8 +1023,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(1, revision_); @@ -1045,15 +1046,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(4, startedTimestampMillis_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -1661,8 +1653,8 @@ public static final class ChangeNumberOfProcesses extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ChangeNumberOfProcesses"); } @@ -1791,8 +1783,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt32Size(1, newNumberOfProcesses_); @@ -1800,15 +1797,6 @@ private int computeSerializedSize_0() { if (((bitField0_ & 0x00000002) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(2, replyTo_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2314,8 +2302,8 @@ public static final class GetNumberOfProcesses extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "GetNumberOfProcesses"); } @@ -2418,20 +2406,16 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, replyTo_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, replyTo_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2899,8 +2883,8 @@ public static final class GetNumberOfProcessesReply extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "GetNumberOfProcessesReply"); } @@ -3050,8 +3034,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(1, revision_); @@ -3068,15 +3057,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(4, startedTimestampMillis_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/cluster-sharding-typed/src/main/mima-filters/2.0.x.backwards.excludes/remove-old-passivation-strategy.excludes b/cluster-sharding-typed/src/main/mima-filters/2.0.x.backwards.excludes/remove-old-passivation-strategy.excludes deleted file mode 100644 index c8d912c1ed1..00000000000 --- a/cluster-sharding-typed/src/main/mima-filters/2.0.x.backwards.excludes/remove-old-passivation-strategy.excludes +++ /dev/null @@ -1,20 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Remove old passivation strategy -ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.cluster.sharding.typed.ClusterShardingSettings#PassivationStrategySettings.oldDefault") -ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.cluster.sharding.typed.ClusterShardingSettings#PassivationStrategySettings.oldSettingUsed") diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ClusterShardingQuery.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ClusterShardingQuery.scala index 308c9566fb8..4349ddf3285 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ClusterShardingQuery.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ClusterShardingQuery.scala @@ -36,7 +36,7 @@ sealed trait ClusterShardingQuery * * For the statistics for the entire cluster, see [[GetClusterShardingStats]]. */ -final case class GetShardRegionState(entityTypeKey: EntityTypeKey[?], replyTo: ActorRef[CurrentShardRegionState]) +final case class GetShardRegionState(entityTypeKey: EntityTypeKey[_], replyTo: ActorRef[CurrentShardRegionState]) extends ClusterShardingQuery { /** @@ -45,7 +45,7 @@ final case class GetShardRegionState(entityTypeKey: EntityTypeKey[?], replyTo: A * Query the ShardRegion state for the given entity type key. This will get the state of the * local ShardRegion's state. */ - def this(entityTypeKey: javadsl.EntityTypeKey[?], replyTo: ActorRef[CurrentShardRegionState]) = + def this(entityTypeKey: javadsl.EntityTypeKey[_], replyTo: ActorRef[CurrentShardRegionState]) = this(entityTypeKey.asScala, replyTo) } @@ -61,7 +61,7 @@ final case class GetShardRegionState(entityTypeKey: EntityTypeKey[?], replyTo: A * @param replyTo the actor to send the result to */ final case class GetClusterShardingStats( - entityTypeKey: EntityTypeKey[?], + entityTypeKey: EntityTypeKey[_], timeout: FiniteDuration, replyTo: ActorRef[ClusterShardingStats]) extends ClusterShardingQuery { @@ -74,7 +74,7 @@ final case class GetClusterShardingStats( * shard regions the reply will contain an empty map of regions. */ def this( - entityTypeKey: javadsl.EntityTypeKey[?], + entityTypeKey: javadsl.EntityTypeKey[_], timeout: java.time.Duration, replyTo: ActorRef[ClusterShardingStats]) = this(entityTypeKey.asScala, timeout.toScala, replyTo) diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ClusterShardingSettings.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ClusterShardingSettings.scala index f4a5cf6c985..6a8fa9abde4 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ClusterShardingSettings.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ClusterShardingSettings.scala @@ -19,7 +19,7 @@ import scala.jdk.DurationConverters._ import org.apache.pekko import pekko.actor.typed.ActorSystem -import pekko.annotation.InternalApi +import pekko.annotation.{ ApiMayChange, InternalApi } import pekko.cluster.ClusterSettings.DataCenter import pekko.cluster.sharding.{ ClusterShardingSettings => ClassicShardingSettings } import pekko.cluster.singleton.{ ClusterSingletonManagerSettings => ClassicClusterSingletonManagerSettings } @@ -33,7 +33,7 @@ import com.typesafe.config.Config object ClusterShardingSettings { /** Scala API: Creates new cluster sharding settings object */ - def apply(system: ActorSystem[?]): ClusterShardingSettings = + def apply(system: ActorSystem[_]): ClusterShardingSettings = fromConfig(system.settings.config.getConfig("pekko.cluster.sharding")) def fromConfig(config: Config): ClusterShardingSettings = { @@ -43,7 +43,7 @@ object ClusterShardingSettings { } /** Java API: Creates new cluster sharding settings object */ - def create(system: ActorSystem[?]): ClusterShardingSettings = + def create(system: ActorSystem[_]): ClusterShardingSettings = apply(system) /** INTERNAL API: Intended only for internal use, it is not recommended to keep converting between the setting types */ @@ -174,22 +174,46 @@ object ClusterShardingSettings { } case object RememberEntitiesStoreModeDData extends RememberEntitiesStoreMode { override def name = "ddata" } + /** + * API MAY CHANGE: Settings for passivation strategies may change after additional testing and feedback. + */ + @ApiMayChange final class PassivationStrategySettings private ( val idleEntitySettings: Option[PassivationStrategySettings.IdleSettings], val activeEntityLimit: Option[Int], val replacementPolicySettings: Option[PassivationStrategySettings.PolicySettings], - val admissionSettings: Option[PassivationStrategySettings.AdmissionSettings]) { + val admissionSettings: Option[PassivationStrategySettings.AdmissionSettings], + private[pekko] val oldSettingUsed: Boolean) { + + private[pekko] def this( + idleEntitySettings: Option[PassivationStrategySettings.IdleSettings], + activeEntityLimit: Option[Int], + replacementPolicySettings: Option[PassivationStrategySettings.PolicySettings], + oldSettingUsed: Boolean) = + this(idleEntitySettings, activeEntityLimit, replacementPolicySettings, admissionSettings = None, oldSettingUsed) + + def this( + idleEntitySettings: Option[PassivationStrategySettings.IdleSettings], + activeEntityLimit: Option[Int], + replacementPolicySettings: Option[PassivationStrategySettings.PolicySettings], + admissionSettings: Option[PassivationStrategySettings.AdmissionSettings]) = + this(idleEntitySettings, activeEntityLimit, replacementPolicySettings, admissionSettings, oldSettingUsed = false) def this( idleEntitySettings: Option[PassivationStrategySettings.IdleSettings], activeEntityLimit: Option[Int], replacementPolicySettings: Option[PassivationStrategySettings.PolicySettings]) = - this(idleEntitySettings, activeEntityLimit, replacementPolicySettings, admissionSettings = None) + this( + idleEntitySettings, + activeEntityLimit, + replacementPolicySettings, + admissionSettings = None, + oldSettingUsed = false) import PassivationStrategySettings._ def withIdleEntityPassivation(settings: IdleSettings): PassivationStrategySettings = - copy(idleEntitySettings = Some(settings)) + copy(idleEntitySettings = Some(settings), oldSettingUsed = false) def withIdleEntityPassivation(timeout: FiniteDuration): PassivationStrategySettings = withIdleEntityPassivation(IdleSettings.defaults.withTimeout(timeout)) @@ -223,18 +247,32 @@ object ClusterShardingSettings { def withAdmission(settings: AdmissionSettings): PassivationStrategySettings = copy(admissionSettings = Some(settings)) + private[pekko] def withOldIdleStrategy(timeout: FiniteDuration): PassivationStrategySettings = + copy( + idleEntitySettings = Some(new IdleSettings(timeout, None)), + activeEntityLimit = None, + replacementPolicySettings = None, + admissionSettings = None, + oldSettingUsed = true) + private def copy( idleEntitySettings: Option[IdleSettings] = idleEntitySettings, activeEntityLimit: Option[Int] = activeEntityLimit, replacementPolicySettings: Option[PolicySettings] = replacementPolicySettings, - admissionSettings: Option[AdmissionSettings] = admissionSettings): PassivationStrategySettings = + admissionSettings: Option[AdmissionSettings] = admissionSettings, + oldSettingUsed: Boolean = oldSettingUsed): PassivationStrategySettings = new PassivationStrategySettings( idleEntitySettings, activeEntityLimit, replacementPolicySettings, - admissionSettings) + admissionSettings, + oldSettingUsed) } + /** + * API MAY CHANGE: Settings for passivation strategies may change after additional testing and feedback. + */ + @ApiMayChange object PassivationStrategySettings { import ClassicShardingSettings.{ PassivationStrategySettings => ClassicPassivationStrategySettings } @@ -242,7 +280,8 @@ object ClusterShardingSettings { idleEntitySettings = None, activeEntityLimit = None, replacementPolicySettings = None, - admissionSettings = None) + admissionSettings = None, + oldSettingUsed = false) val disabled: PassivationStrategySettings = defaults @@ -251,14 +290,16 @@ object ClusterShardingSettings { classic.idleEntitySettings.map(IdleSettings.apply), classic.activeEntityLimit, classic.replacementPolicySettings.map(PolicySettings.apply), - classic.admissionSettings.map(AdmissionSettings.apply)) + classic.admissionSettings.map(AdmissionSettings.apply), + classic.oldSettingUsed) def toClassic(settings: PassivationStrategySettings): ClassicPassivationStrategySettings = new ClassicPassivationStrategySettings( settings.idleEntitySettings.map(IdleSettings.toClassic), settings.activeEntityLimit, settings.replacementPolicySettings.map(PolicySettings.toClassic), - settings.admissionSettings.map(AdmissionSettings.toClassic)) + settings.admissionSettings.map(AdmissionSettings.toClassic), + settings.oldSettingUsed) object IdleSettings { val defaults: IdleSettings = new IdleSettings(timeout = 2.minutes, interval = None) @@ -608,6 +649,8 @@ object ClusterShardingSettings { new AdmissionSettings(filter, window) } + private[pekko] def oldDefault(idleTimeout: FiniteDuration): PassivationStrategySettings = + disabled.withOldIdleStrategy(idleTimeout) } // generated using kaze-class @@ -830,6 +873,10 @@ final class ClusterShardingSettings( rememberEntitiesStoreMode: ClusterShardingSettings.RememberEntitiesStoreMode): ClusterShardingSettings = copy(rememberEntitiesStoreMode = rememberEntitiesStoreMode) + /** + * API MAY CHANGE: Settings for passivation strategies may change after additional testing and feedback. + */ + @ApiMayChange def withPassivationStrategy(settings: ClusterShardingSettings.PassivationStrategySettings): ClusterShardingSettings = copy(passivationStrategySettings = settings) diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingExtension.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingExtension.scala index b470adba799..7340770f78b 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingExtension.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingExtension.scala @@ -30,10 +30,10 @@ import pekko.persistence.typed.ReplicaId */ object ReplicatedShardingExtension extends ExtensionId[ReplicatedShardingExtension] { - override def createExtension(system: ActorSystem[?]): ReplicatedShardingExtension = + override def createExtension(system: ActorSystem[_]): ReplicatedShardingExtension = new ReplicatedShardingExtensionImpl(system) - def get(system: ActorSystem[?]): ReplicatedShardingExtension = apply(system) + def get(system: ActorSystem[_]): ReplicatedShardingExtension = apply(system) } diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ShardedDaemonProcessSettings.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ShardedDaemonProcessSettings.scala index b64fc1930d1..7364fd74ea2 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ShardedDaemonProcessSettings.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/ShardedDaemonProcessSettings.scala @@ -29,12 +29,12 @@ import com.typesafe.config.Config object ShardedDaemonProcessSettings { /** Scala API: Create default settings for system */ - def apply(system: ActorSystem[?]): ShardedDaemonProcessSettings = { + def apply(system: ActorSystem[_]): ShardedDaemonProcessSettings = { fromConfig(system.settings.config.getConfig("pekko.cluster.sharded-daemon-process")) } /** Java API: Create default settings for system */ - def create(system: ActorSystem[?]): ShardedDaemonProcessSettings = + def create(system: ActorSystem[_]): ShardedDaemonProcessSettings = apply(system) /** @@ -88,7 +88,7 @@ final class ShardedDaemonProcessSettings @InternalApi private[pekko] ( /** * Specifies that the ShardedDaemonProcess should run on nodes with a specific role. * If the role is not specified all nodes in the cluster are used. If the given role does - * not match the role of the current node the ShardedDaemonProcess will not be started. + * not match the role of the current node the the ShardedDaemonProcess will not be started. */ def withRole(role: String): ShardedDaemonProcessSettings = copy(role = Option(role)) diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/ShardingConsumerController.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/ShardingConsumerController.scala index 6ef3a74be9e..ab29606f759 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/ShardingConsumerController.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/ShardingConsumerController.scala @@ -55,7 +55,7 @@ object ShardingConsumerController { * Scala API: Factory method from config `pekko.reliable-delivery.sharding.consumer-controller` * of the `ActorSystem`. */ - def apply(system: ActorSystem[?]): Settings = + def apply(system: ActorSystem[_]): Settings = apply(system.settings.config.getConfig("pekko.reliable-delivery.sharding.consumer-controller")) /** @@ -70,7 +70,7 @@ object ShardingConsumerController { * Java API: Factory method from config `pekko.reliable-delivery.sharding.consumer-controller` * of the `ActorSystem`. */ - def create(system: ActorSystem[?]): Settings = + def create(system: ActorSystem[_]): Settings = apply(system) /** diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/ShardingProducerController.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/ShardingProducerController.scala index 342ecf2b29c..2a4e1d58841 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/ShardingProducerController.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/ShardingProducerController.scala @@ -175,7 +175,7 @@ object ShardingProducerController { * Scala API: Factory method from config `pekko.reliable-delivery.sharding.producer-controller` * of the `ActorSystem`. */ - def apply(system: ActorSystem[?]): Settings = + def apply(system: ActorSystem[_]): Settings = apply(system.settings.config.getConfig("pekko.reliable-delivery.sharding.producer-controller")) /** @@ -195,7 +195,7 @@ object ShardingProducerController { * Java API: Factory method from config `pekko.reliable-delivery.sharding.producer-controller` * of the `ActorSystem`. */ - def create(system: ActorSystem[?]): Settings = + def create(system: ActorSystem[_]): Settings = apply(system) /** diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/internal/ShardingConsumerControllerImpl.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/internal/ShardingConsumerControllerImpl.scala index 3e85591e2a2..adf156f918a 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/internal/ShardingConsumerControllerImpl.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/internal/ShardingConsumerControllerImpl.scala @@ -46,7 +46,7 @@ import pekko.cluster.sharding.typed.delivery.ShardingConsumerController private def waitForStart[A]( context: ActorContext[ConsumerController.Command[A]], settings: ShardingConsumerController.Settings, - consumer: ActorRef[?]): Behavior[ConsumerController.Command[A]] = { + consumer: ActorRef[_]): Behavior[ConsumerController.Command[A]] = { Behaviors.withStash(settings.bufferSize) { stashBuffer => Behaviors .receiveMessage[ConsumerController.Command[A]] { diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/internal/ShardingProducerControllerImpl.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/internal/ShardingProducerControllerImpl.scala index 1778f005a02..19ad5d4cf29 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/internal/ShardingProducerControllerImpl.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/delivery/internal/ShardingProducerControllerImpl.scala @@ -408,7 +408,7 @@ private class ShardingProducerControllerImpl[A: ClassTag]( context.log.error(errorMessage) throw new TimeoutException(errorMessage) } else { - context.log.info("StoreMessageSent seqNr [{}] failed, attempt [{}], retrying.", f.messageSent.seqNr, f.attempt) + context.log.info(s"StoreMessageSent seqNr [{}] failed, attempt [{}], retrying.", f.messageSent.seqNr, f.attempt) // retry storeMessageSent(f.messageSent, attempt = f.attempt + 1) Behaviors.same @@ -573,7 +573,7 @@ private class ShardingProducerControllerImpl[A: ClassTag]( case AskTimeout(outKey, outSeqNr) => context.log.debug( - "Message seqNr [{}] sent to entity [{}] timed out. It will be redelivered.", + "Message seqNr [{}] sent to entity [{}] timed out. It will be be redelivered.", outSeqNr, outKey) Behaviors.same diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ClusterShardingImpl.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ClusterShardingImpl.scala index 98406919d64..97f08acba07 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ClusterShardingImpl.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ClusterShardingImpl.scala @@ -100,14 +100,14 @@ import pekko.util.{ ByteString, Timeout } } /** INTERNAL API */ -@InternalApi private[pekko] final class ClusterShardingImpl(system: ActorSystem[?]) +@InternalApi private[pekko] final class ClusterShardingImpl(system: ActorSystem[_]) extends javadsl.ClusterSharding with scaladsl.ClusterSharding { import pekko.actor.typed.scaladsl.adapter._ require( - system.isInstanceOf[ActorSystemAdapter[?]], + system.isInstanceOf[ActorSystemAdapter[_]], "only adapted classic actor systems can be used for cluster features") private val cluster = Cluster(system) @@ -327,7 +327,7 @@ import pekko.util.{ ByteString, Timeout } override def equals(other: Any): Boolean = other match { - case eri: EntityRefImpl[?] => + case eri: EntityRefImpl[_] => (eri.entityId == entityId) && (eri.typeKey == typeKey) && (eri.dataCenter == dataCenter) @@ -406,13 +406,13 @@ import pekko.util.{ ByteString, Timeout } // impl InternalRecipientRef override def provider: ActorRefProvider = { import pekko.actor.typed.scaladsl.adapter._ - shardRegion.toTyped.asInstanceOf[InternalRecipientRef[?]].provider + shardRegion.toTyped.asInstanceOf[InternalRecipientRef[_]].provider } // impl InternalRecipientRef def isTerminated: Boolean = { import pekko.actor.typed.scaladsl.adapter._ - shardRegion.toTyped.asInstanceOf[InternalRecipientRef[?]].isTerminated + shardRegion.toTyped.asInstanceOf[InternalRecipientRef[_]].isTerminated } override def toString: String = s"EntityRef($typeKey, $entityId)" @@ -435,7 +435,7 @@ import pekko.util.{ ByteString, Timeout } import pekko.cluster.sharding.ShardRegion.{ Passivate => ClassicPassivate } def behavior(stopMessage: Any): Behavior[scaladsl.ClusterSharding.ShardCommand] = { - def sendClassicPassivate(entity: ActorRef[?], classicSystem: actor.ActorSystem): Unit = { + def sendClassicPassivate(entity: ActorRef[_], classicSystem: actor.ActorSystem): Unit = { val classicRef = entity.toClassic val pathToShard = classicRef.path.elements.take(4).mkString("/") classicSystem.actorSelection(pathToShard).tell(ClassicPassivate(stopMessage), classicRef) diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ReplicatedShardingExtensionImpl.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ReplicatedShardingExtensionImpl.scala index a69331442c5..8f66a234d32 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ReplicatedShardingExtensionImpl.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ReplicatedShardingExtensionImpl.scala @@ -39,7 +39,7 @@ import org.slf4j.LoggerFactory * INTERNAL API */ @InternalApi -private[pekko] final class ReplicatedShardingExtensionImpl(system: ActorSystem[?]) extends ReplicatedShardingExtension { +private[pekko] final class ReplicatedShardingExtensionImpl(system: ActorSystem[_]) extends ReplicatedShardingExtension { private val counter = new AtomicLong(0) diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardedDaemonProcessCoordinator.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardedDaemonProcessCoordinator.scala index bea64bff40a..bda407ffeff 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardedDaemonProcessCoordinator.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardedDaemonProcessCoordinator.scala @@ -383,7 +383,7 @@ private final class ShardedDaemonProcessCoordinator private ( sortedIdentities.foreach(id => shardingRef ! StartEntity(id)) None } else { - implicit val system: ActorSystem[?] = context.system + implicit val system: ActorSystem[_] = context.system Some( Source(sortedIdentities) .viaMat(KillSwitches.single)(Keep.right) diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardedDaemonProcessImpl.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardedDaemonProcessImpl.scala index fb69fe2a8e3..fed10e2ab42 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardedDaemonProcessImpl.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardedDaemonProcessImpl.scala @@ -46,7 +46,7 @@ import pekko.cluster.typed.SingletonActor * INTERNAL API */ @InternalApi -private[pekko] final class ShardedDaemonProcessImpl(system: ActorSystem[?]) +private[pekko] final class ShardedDaemonProcessImpl(system: ActorSystem[_]) extends javadsl.ShardedDaemonProcess with scaladsl.ShardedDaemonProcess { diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardingSerializer.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardingSerializer.scala index 3287d94929f..a0158fe73d6 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardingSerializer.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardingSerializer.scala @@ -50,7 +50,7 @@ import pekko.serialization.SerializerWithStringManifest private val GetNumberOfProcessesReplyManifest = "e" override def manifest(o: AnyRef): String = o match { - case _: ShardingEnvelope[?] => ShardingEnvelopeManifest + case _: ShardingEnvelope[_] => ShardingEnvelopeManifest case _: ShardedDaemonProcessState => DaemonProcessStateManifest case _: ChangeNumberOfProcesses => ChangeNumberOfProcessesManifest case _: GetNumberOfProcesses => GetNumberOfProcessesManifest @@ -60,7 +60,7 @@ import pekko.serialization.SerializerWithStringManifest } override def toBinary(o: AnyRef): Array[Byte] = o match { - case env: ShardingEnvelope[?] => + case env: ShardingEnvelope[_] => val builder = ShardingMessages.ShardingEnvelope.newBuilder() builder.setEntityId(env.entityId) builder.setMessage(payloadSupport.payloadBuilder(env.message)) @@ -143,7 +143,7 @@ import pekko.serialization.SerializerWithStringManifest // buffer based avoiding a copy for artery override def toBinary(o: AnyRef, buf: ByteBuffer): Unit = o match { - case env: ShardingEnvelope[?] => + case env: ShardingEnvelope[_] => val builder = ShardingMessages.ShardingEnvelope.newBuilder() builder.setEntityId(env.entityId) builder.setMessage(payloadSupport.payloadBuilder(env.message)) diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/testkit/TestEntityRefImpl.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/testkit/TestEntityRefImpl.scala index 65b36b56a73..1ec48423c5d 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/testkit/TestEntityRefImpl.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/testkit/TestEntityRefImpl.scala @@ -68,12 +68,12 @@ import pekko.util.Timeout // impl InternalRecipientRef override def provider: ActorRefProvider = { - probe.asInstanceOf[InternalRecipientRef[?]].provider + probe.asInstanceOf[InternalRecipientRef[_]].provider } // impl InternalRecipientRef def isTerminated: Boolean = { - probe.asInstanceOf[InternalRecipientRef[?]].isTerminated + probe.asInstanceOf[InternalRecipientRef[_]].isTerminated } override def toString: String = s"TestEntityRef($entityId)" diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/javadsl/ClusterSharding.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/javadsl/ClusterSharding.scala index 7a41f057b9d..c70d3e8b45f 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/javadsl/ClusterSharding.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/javadsl/ClusterSharding.scala @@ -41,7 +41,7 @@ trait EntityFactory[M] { } object ClusterSharding { - def get(system: ActorSystem[?]): ClusterSharding = + def get(system: ActorSystem[_]): ClusterSharding = scaladsl.ClusterSharding(system).asJava /** diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/javadsl/ShardedDaemonProcess.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/javadsl/ShardedDaemonProcess.scala index 32f63beb801..408922f2ef9 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/javadsl/ShardedDaemonProcess.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/javadsl/ShardedDaemonProcess.scala @@ -14,8 +14,8 @@ package org.apache.pekko.cluster.sharding.typed.javadsl import java.util.Optional -import java.util.function.{ Function => JFunction } import java.util.function.IntFunction +import java.util.function.{ Function => JFunction } import org.apache.pekko import pekko.actor.typed.ActorRef @@ -29,7 +29,7 @@ import pekko.cluster.sharding.typed.ShardedDaemonProcessContext import pekko.cluster.sharding.typed.ShardedDaemonProcessSettings object ShardedDaemonProcess { - def get(system: ActorSystem[?]): ShardedDaemonProcess = + def get(system: ActorSystem[_]): ShardedDaemonProcess = pekko.cluster.sharding.typed.scaladsl.ShardedDaemonProcess(system).asJava } diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ClusterSharding.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ClusterSharding.scala index 5fbd1d5856d..83c9b825b06 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ClusterSharding.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ClusterSharding.scala @@ -39,7 +39,7 @@ import pekko.util.Timeout object ClusterSharding extends ExtensionId[ClusterSharding] { - override def createExtension(system: ActorSystem[?]): ClusterSharding = + override def createExtension(system: ActorSystem[_]): ClusterSharding = new ClusterShardingImpl(system) /** @@ -539,7 +539,7 @@ object EntityTypeKey { } object ClusterShardingSetup { - def apply[T <: Extension](createExtension: ActorSystem[?] => ClusterSharding): ClusterShardingSetup = + def apply[T <: Extension](createExtension: ActorSystem[_] => ClusterSharding): ClusterShardingSetup = new ClusterShardingSetup(createExtension(_)) } @@ -549,5 +549,5 @@ object ClusterShardingSetup { * to replace the default implementation of the [[ClusterSharding]] extension. Intended * for tests that need to replace extension with stub/mock implementations. */ -final class ClusterShardingSetup(createExtension: java.util.function.Function[ActorSystem[?], ClusterSharding]) +final class ClusterShardingSetup(createExtension: java.util.function.Function[ActorSystem[_], ClusterSharding]) extends ExtensionSetup[ClusterSharding](ClusterSharding, createExtension) diff --git a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ShardedDaemonProcess.scala b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ShardedDaemonProcess.scala index 2f742b25a26..7155223f594 100644 --- a/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ShardedDaemonProcess.scala +++ b/cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ShardedDaemonProcess.scala @@ -32,7 +32,7 @@ import pekko.cluster.sharding.typed.internal.ShardedDaemonProcessImpl import pekko.cluster.sharding.typed.javadsl object ShardedDaemonProcess extends ExtensionId[ShardedDaemonProcess] { - override def createExtension(system: ActorSystem[?]): ShardedDaemonProcess = new ShardedDaemonProcessImpl(system) + override def createExtension(system: ActorSystem[_]): ShardedDaemonProcess = new ShardedDaemonProcessImpl(system) } /** diff --git a/cluster-sharding-typed/src/multi-jvm/scala/org/apache/pekko/cluster/sharding/typed/delivery/DeliveryThroughputSpec.scala b/cluster-sharding-typed/src/multi-jvm/scala/org/apache/pekko/cluster/sharding/typed/delivery/DeliveryThroughputSpec.scala index 2e447782cda..47a4711a7f6 100644 --- a/cluster-sharding-typed/src/multi-jvm/scala/org/apache/pekko/cluster/sharding/typed/delivery/DeliveryThroughputSpec.scala +++ b/cluster-sharding-typed/src/multi-jvm/scala/org/apache/pekko/cluster/sharding/typed/delivery/DeliveryThroughputSpec.scala @@ -67,7 +67,7 @@ object DeliveryThroughputSpec extends MultiNodeConfig { actor.allow-java-serialization = off # quicker dissemination the service keys cluster.typed.receptionist.distributed-data.write-consistency = all - cluster.sharding.passivation.default-idle-strategy.idle-entity.timeout = 5s + cluster.sharding.passivate-idle-entity-after = 5s } """) diff --git a/cluster-sharding-typed/src/test/java/jdocs/delivery/PointToPointDocExample.java b/cluster-sharding-typed/src/test/java/jdocs/delivery/PointToPointDocExample.java index 6accf53e209..0e02f6d5991 100644 --- a/cluster-sharding-typed/src/test/java/jdocs/delivery/PointToPointDocExample.java +++ b/cluster-sharding-typed/src/test/java/jdocs/delivery/PointToPointDocExample.java @@ -92,7 +92,6 @@ private Behavior onWrappedRequestNext(WrappedRequestNext w) { } } } - // #producer // #consumer @@ -146,7 +145,6 @@ private Behavior onDelivery(WrappedDelivery w) { return this; } } - // #consumer public class Guardian { diff --git a/cluster-sharding-typed/src/test/java/jdocs/delivery/ShardingDocExample.java b/cluster-sharding-typed/src/test/java/jdocs/delivery/ShardingDocExample.java index 02ea8b6cfbb..768a0e05e20 100644 --- a/cluster-sharding-typed/src/test/java/jdocs/delivery/ShardingDocExample.java +++ b/cluster-sharding-typed/src/test/java/jdocs/delivery/ShardingDocExample.java @@ -250,7 +250,6 @@ private Behavior onSaveSuccess(SaveSuccess success) { } } } - // #consumer // #producer @@ -408,7 +407,6 @@ private Behavior onTimedOut(TimedOut timedOut) { } } } - // #producer static void illustrateInit() { diff --git a/cluster-sharding-typed/src/test/java/jdocs/delivery/WorkPullingDocExample.java b/cluster-sharding-typed/src/test/java/jdocs/delivery/WorkPullingDocExample.java index d6a6c3f92e9..9a41b5709c8 100644 --- a/cluster-sharding-typed/src/test/java/jdocs/delivery/WorkPullingDocExample.java +++ b/cluster-sharding-typed/src/test/java/jdocs/delivery/WorkPullingDocExample.java @@ -101,7 +101,6 @@ private static Behavior onDelivery(WrappedDelivery w) { return Behaviors.same(); } } - // #consumer // #producer @@ -290,7 +289,6 @@ private Behavior onConvert( resultId, convert.fromFormat, convert.toFormat, convert.image)); return waitForNext(); } - // #producer Object askScope = diff --git a/cluster-sharding-typed/src/test/java/jdocs/org/apache/pekko/cluster/sharding/typed/AccountExampleDocTest.java b/cluster-sharding-typed/src/test/java/jdocs/org/apache/pekko/cluster/sharding/typed/AccountExampleDocTest.java index 0347162e01c..a9ffeb1103d 100644 --- a/cluster-sharding-typed/src/test/java/jdocs/org/apache/pekko/cluster/sharding/typed/AccountExampleDocTest.java +++ b/cluster-sharding-typed/src/test/java/jdocs/org/apache/pekko/cluster/sharding/typed/AccountExampleDocTest.java @@ -40,21 +40,19 @@ @ExtendWith(TestKitJUnitJupiterExtension.class) @ExtendWith(LogCapturingExtension.class) public class AccountExampleDocTest -// #test - + // #test + // #test { // #testkit - @JUnitJupiterTestKit - public ActorTestKit testKit = ActorTestKit.create(EventSourcedBehaviorTestKit.config()); + @JUnitJupiterTestKit public ActorTestKit testKit = ActorTestKit.create(EventSourcedBehaviorTestKit.config()); private EventSourcedBehaviorTestKit< AccountEntity.Command, AccountEntity.Event, AccountEntity.Account> eventSourcedTestKit = EventSourcedBehaviorTestKit.create( testKit.system(), AccountEntity.create("1", PersistenceId.of("Account", "1"))); - // #testkit @BeforeEach diff --git a/cluster-sharding-typed/src/test/java/jdocs/org/apache/pekko/cluster/sharding/typed/AccountExamplePersistenceProbeDocTest.java b/cluster-sharding-typed/src/test/java/jdocs/org/apache/pekko/cluster/sharding/typed/AccountExamplePersistenceProbeDocTest.java index 3c17fddb8a2..c48dad85745 100644 --- a/cluster-sharding-typed/src/test/java/jdocs/org/apache/pekko/cluster/sharding/typed/AccountExamplePersistenceProbeDocTest.java +++ b/cluster-sharding-typed/src/test/java/jdocs/org/apache/pekko/cluster/sharding/typed/AccountExamplePersistenceProbeDocTest.java @@ -30,134 +30,131 @@ import org.junit.jupiter.api.Test; public class AccountExamplePersistenceProbeDocTest -// #test - + // #test + // #test { - @Test - public void createWithEmptyBalance() { - PersistenceProbeBehavior - persistenceProbe = emptyAccount(); - - BehaviorTestKit testkit = persistenceProbe.getBehaviorTestKit(); + @Test + public void createWithEmptyBalance() { + PersistenceProbeBehavior + persistenceProbe = emptyAccount(); - StatusReplyInbox ackInbox = testkit.runAskWithStatus(AccountEntity.CreateAccount::new); + BehaviorTestKit testkit = persistenceProbe.getBehaviorTestKit(); - ackInbox.expectValue(Done.getInstance()); - persistenceProbe.getEventProbe().expectPersisted(AccountEntity.AccountCreated.INSTANCE); + StatusReplyInbox ackInbox = testkit.runAskWithStatus(AccountEntity.CreateAccount::new); - // internal state is only exposed by the behavior via responses to messages or if it happens - // to snapshot. This particular behavior never snapshots, so we query within the actor's - // protocol - assertFalse(persistenceProbe.getSnapshotProbe().hasEffects()); + ackInbox.expectValue(Done.getInstance()); + persistenceProbe.getEventProbe().expectPersisted(AccountEntity.AccountCreated.INSTANCE); - ReplyInbox currentBalanceInbox = - testkit.runAsk(AccountEntity.GetBalance::new); + // internal state is only exposed by the behavior via responses to messages or if it happens + // to snapshot. This particular behavior never snapshots, so we query within the actor's + // protocol + assertFalse(persistenceProbe.getSnapshotProbe().hasEffects()); - assertEquals(BigDecimal.ZERO, currentBalanceInbox.receiveReply().balance); - } + ReplyInbox currentBalanceInbox = + testkit.runAsk(AccountEntity.GetBalance::new); - @Test - public void handleDepositAndWithdraw() { - PersistenceProbeBehavior - persistenceProbe = openedAccount(); + assertEquals(BigDecimal.ZERO, currentBalanceInbox.receiveReply().balance); + } - BehaviorTestKit testkit = persistenceProbe.getBehaviorTestKit(); - BigDecimal currentBalance; + @Test + public void handleDepositAndWithdraw() { + PersistenceProbeBehavior + persistenceProbe = openedAccount(); - testkit - .runAskWithStatus( - Done.class, replyTo -> new AccountEntity.Deposit(BigDecimal.valueOf(100), replyTo)) - .expectValue(Done.getInstance()); + BehaviorTestKit testkit = persistenceProbe.getBehaviorTestKit(); + BigDecimal currentBalance; - assertEquals( - BigDecimal.valueOf(100), - persistenceProbe - .getEventProbe() - .expectPersistedClass(AccountEntity.Deposited.class) - .persistedObject() - .amount); + testkit + .runAskWithStatus( + Done.class, replyTo -> new AccountEntity.Deposit(BigDecimal.valueOf(100), replyTo)) + .expectValue(Done.getInstance()); + + assertEquals( + BigDecimal.valueOf(100), + persistenceProbe + .getEventProbe() + .expectPersistedClass(AccountEntity.Deposited.class) + .persistedObject() + .amount); + + currentBalance = + testkit + .runAsk(AccountEntity.CurrentBalance.class, AccountEntity.GetBalance::new) + .receiveReply() + .balance; + + assertEquals(BigDecimal.valueOf(100), currentBalance); - currentBalance = testkit - .runAsk(AccountEntity.CurrentBalance.class, AccountEntity.GetBalance::new) - .receiveReply() - .balance; + .runAskWithStatus( + Done.class, replyTo -> new AccountEntity.Withdraw(BigDecimal.valueOf(10), replyTo)) + .expectValue(Done.getInstance()); + + // can save the persistence effect for in-depth inspection + PersistenceEffect withdrawEffect = + persistenceProbe.getEventProbe().expectPersistedClass(AccountEntity.Withdrawn.class); + assertEquals(BigDecimal.valueOf(10), withdrawEffect.persistedObject().amount); + assertEquals(3L, withdrawEffect.sequenceNr()); + assertTrue(withdrawEffect.tags().isEmpty()); + + currentBalance = + testkit + .runAsk(AccountEntity.CurrentBalance.class, AccountEntity.GetBalance::new) + .receiveReply() + .balance; - assertEquals(BigDecimal.valueOf(100), currentBalance); + assertEquals(BigDecimal.valueOf(90), currentBalance); + } - testkit - .runAskWithStatus( - Done.class, replyTo -> new AccountEntity.Withdraw(BigDecimal.valueOf(10), replyTo)) - .expectValue(Done.getInstance()); + @Test + public void rejectWithdrawOverdraft() { + PersistenceProbeBehavior + persistenceProbe = accountWithBalance(BigDecimal.valueOf(100)); - // can save the persistence effect for in-depth inspection - PersistenceEffect withdrawEffect = - persistenceProbe.getEventProbe().expectPersistedClass(AccountEntity.Withdrawn.class); - assertEquals(BigDecimal.valueOf(10), withdrawEffect.persistedObject().amount); - assertEquals(3L, withdrawEffect.sequenceNr()); - assertTrue(withdrawEffect.tags().isEmpty()); + BehaviorTestKit testkit = persistenceProbe.getBehaviorTestKit(); - currentBalance = testkit - .runAsk(AccountEntity.CurrentBalance.class, AccountEntity.GetBalance::new) - .receiveReply() - .balance; - - assertEquals(BigDecimal.valueOf(90), currentBalance); - } - - @Test - public void rejectWithdrawOverdraft() { - PersistenceProbeBehavior - persistenceProbe = accountWithBalance(BigDecimal.valueOf(100)); - - BehaviorTestKit testkit = persistenceProbe.getBehaviorTestKit(); - - testkit - .runAskWithStatus( - Done.class, replyTo -> new AccountEntity.Withdraw(BigDecimal.valueOf(110), replyTo)) - .expectErrorMessage("not enough funds to withdraw 110"); - - assertFalse(persistenceProbe.getEventProbe().hasEffects()); - } - - // #test - private PersistenceProbeBehavior< - AccountEntity.Command, AccountEntity.Event, AccountEntity.Account> - emptyAccount() { - return - // #persistenceProbe-behavior - PersistenceProbeBehavior.fromEventSourced( - AccountEntity.create("1", PersistenceId.of("Account", "1")), - null, // use the initial state - 0 // initial sequence number - ); - // #persistenceProbe-behavior - } - - private PersistenceProbeBehavior< - AccountEntity.Command, AccountEntity.Event, AccountEntity.Account> - openedAccount() { - return - // #persistenceProbe-behavior-provided-state - PersistenceProbeBehavior.fromEventSourced( - AccountEntity.create("1", PersistenceId.of("Account", "1")), - new AccountEntity.EmptyAccount() - .openedAccount(), // duplicate the event handler for AccountCreated on an EmptyAccount - 1 // assume that CreateAccount was the first command - ); - // #persistenceProbe-behavior-provided-state - } - - private PersistenceProbeBehavior< - AccountEntity.Command, AccountEntity.Event, AccountEntity.Account> - accountWithBalance(BigDecimal balance) { - return PersistenceProbeBehavior.fromEventSourced( - AccountEntity.create("1", PersistenceId.of("Account", "1")), - new AccountEntity.OpenedAccount(balance), - 2); - } - // #test + .runAskWithStatus( + Done.class, replyTo -> new AccountEntity.Withdraw(BigDecimal.valueOf(110), replyTo)) + .expectErrorMessage("not enough funds to withdraw 110"); + + assertFalse(persistenceProbe.getEventProbe().hasEffects()); + } + + // #test + private PersistenceProbeBehavior + emptyAccount() { + return + // #persistenceProbe-behavior + PersistenceProbeBehavior.fromEventSourced( + AccountEntity.create("1", PersistenceId.of("Account", "1")), + null, // use the initial state + 0 // initial sequence number + ); + // #persistenceProbe-behavior + } + + private PersistenceProbeBehavior + openedAccount() { + return + // #persistenceProbe-behavior-provided-state + PersistenceProbeBehavior.fromEventSourced( + AccountEntity.create("1", PersistenceId.of("Account", "1")), + new AccountEntity.EmptyAccount() + .openedAccount(), // duplicate the event handler for AccountCreated on an EmptyAccount + 1 // assume that CreateAccount was the first command + ); + // #persistenceProbe-behavior-provided-state + } + + private PersistenceProbeBehavior + accountWithBalance(BigDecimal balance) { + return PersistenceProbeBehavior.fromEventSourced( + AccountEntity.create("1", PersistenceId.of("Account", "1")), + new AccountEntity.OpenedAccount(balance), + 2); + } + // #test } // #test diff --git a/cluster-sharding-typed/src/test/java/jdocs/org/apache/pekko/cluster/sharding/typed/HelloWorldPersistentEntityExample.java b/cluster-sharding-typed/src/test/java/jdocs/org/apache/pekko/cluster/sharding/typed/HelloWorldPersistentEntityExample.java index 3a386263aac..0820b68dda9 100644 --- a/cluster-sharding-typed/src/test/java/jdocs/org/apache/pekko/cluster/sharding/typed/HelloWorldPersistentEntityExample.java +++ b/cluster-sharding-typed/src/test/java/jdocs/org/apache/pekko/cluster/sharding/typed/HelloWorldPersistentEntityExample.java @@ -38,8 +38,8 @@ import org.apache.pekko.cluster.sharding.typed.javadsl.Entity; import org.apache.pekko.persistence.typed.javadsl.EventSourcedBehavior; import org.apache.pekko.serialization.jackson.CborSerializable; +import org.apache.pekko.util.Timeout; import com.fasterxml.jackson.annotation.JsonCreator; - // #persistent-entity-usage-import public class HelloWorldPersistentEntityExample { @@ -76,7 +76,6 @@ public CompletionStage sayHello(String worldId, String whom) { return result.thenApply(greeting -> greeting.numberOfPeople); } } - // #persistent-entity-usage // #persistent-entity diff --git a/cluster-sharding-typed/src/test/java/jdocs/org/apache/pekko/cluster/sharding/typed/ShardingCompileOnlyTest.java b/cluster-sharding-typed/src/test/java/jdocs/org/apache/pekko/cluster/sharding/typed/ShardingCompileOnlyTest.java index 6ea19ac6afe..a6a0db70baf 100644 --- a/cluster-sharding-typed/src/test/java/jdocs/org/apache/pekko/cluster/sharding/typed/ShardingCompileOnlyTest.java +++ b/cluster-sharding-typed/src/test/java/jdocs/org/apache/pekko/cluster/sharding/typed/ShardingCompileOnlyTest.java @@ -95,7 +95,6 @@ private Behavior onGetValue(GetValue msg) { return this; } } - // #counter // #counter-passivate @@ -176,7 +175,6 @@ private Behavior onGoodByeCounter() { return Behaviors.stopped(); } } - // #counter-passivate public static void initPassivateExample() { diff --git a/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/DurableStateStoreQueryUsageCompileOnlySpec.scala b/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/DurableStateStoreQueryUsageCompileOnlySpec.scala index 9fe939082c2..c43d3134699 100644 --- a/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/DurableStateStoreQueryUsageCompileOnlySpec.scala +++ b/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/DurableStateStoreQueryUsageCompileOnlySpec.scala @@ -35,7 +35,7 @@ object DurableStateStoreQueryUsageCompileOnlySpec { val source: Source[DurableStateChange[Record], NotUsed] = durableStateStoreQuery.changes("tag", offset) source.map { case UpdatedDurableState(persistenceId, revision, value, offset, timestamp) => Some(value) - case _: DeletedDurableState[?] => None + case _: DeletedDurableState[_] => None } // #get-durable-state-store-query-example } diff --git a/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/ExternalShardAllocationCompileOnlySpec.scala b/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/ExternalShardAllocationCompileOnlySpec.scala index a134e650b9b..36d109a657f 100644 --- a/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/ExternalShardAllocationCompileOnlySpec.scala +++ b/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/ExternalShardAllocationCompileOnlySpec.scala @@ -30,7 +30,7 @@ import docs.org.apache.pekko.cluster.sharding.typed.ShardingCompileOnlySpec.Basi import scala.concurrent.Future class ExternalShardAllocationCompileOnlySpec { - val system: ActorSystem[?] = ??? + val system: ActorSystem[_] = ??? val sharding = ClusterSharding(system) diff --git a/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/HelloWorldPersistentEntityExample.scala b/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/HelloWorldPersistentEntityExample.scala index 5091dd5bfc8..e91e122428c 100644 --- a/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/HelloWorldPersistentEntityExample.scala +++ b/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/HelloWorldPersistentEntityExample.scala @@ -32,7 +32,7 @@ object HelloWorldPersistentEntityExample { import pekko.cluster.sharding.typed.scaladsl.Entity import pekko.util.Timeout - class HelloWorldService(system: ActorSystem[?]) { + class HelloWorldService(system: ActorSystem[_]) { import system.executionContext private val sharding = ClusterSharding(system) diff --git a/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingCompileOnlySpec.scala b/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingCompileOnlySpec.scala index 28984bccd8f..5145b0370b5 100644 --- a/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingCompileOnlySpec.scala +++ b/cluster-sharding-typed/src/test/scala/docs/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingCompileOnlySpec.scala @@ -31,7 +31,7 @@ object ReplicatedShardingCompileOnlySpec { sealed trait Command - val system: ActorSystem[?] = ??? + val system: ActorSystem[_] = ??? object MyEventSourcedBehavior { def apply(replicationId: ReplicationId): Behavior[Command] = ??? diff --git a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/FlightRecording.scala b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/FlightRecording.scala index d1628667c03..94dc53e2459 100644 --- a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/FlightRecording.scala +++ b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/FlightRecording.scala @@ -21,7 +21,7 @@ import org.apache.pekko.actor.{ ActorSystem, ExtendedActorSystem } * This will work on JDK11 and JDK8 built with the enable-jfr flag (8u262+). * * For Pekko JRF recordings you may need to run a publish for multi jvm tests - * to get the JFR classes compiled. + * to get the ComileJDK9 things compiled. */ class FlightRecording(system: ActorSystem) { diff --git a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/JoinConfigCompatCheckerClusterShardingSpec.scala b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/JoinConfigCompatCheckerClusterShardingSpec.scala index 17bb7741f85..9430c300a1c 100644 --- a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/JoinConfigCompatCheckerClusterShardingSpec.scala +++ b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/JoinConfigCompatCheckerClusterShardingSpec.scala @@ -62,10 +62,10 @@ class JoinConfigCompatCheckerClusterShardingSpec private val clusterWaitDuration = 5.seconds - private def configured(system: ActorSystem[?]): Int = + private def configured(system: ActorSystem[_]): Int = system.settings.config.getInt(Key) - private def join(sys: ActorSystem[?]): ClassicCluster = { + private def join(sys: ActorSystem[_]): ClassicCluster = { if (sys eq system) { configured(system) should ===(Shards) val seedNode = ClassicCluster(system) diff --git a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingSpec.scala b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingSpec.scala index 0811ba1b468..a722c65175b 100644 --- a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingSpec.scala +++ b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/ReplicatedShardingSpec.scala @@ -265,7 +265,7 @@ abstract class ReplicatedShardingSpec(replicationType: ReplicationType, configA: } "start replicated sharding on both nodes" in { - def start(sys: ActorSystem[?]) = { + def start(sys: ActorSystem[_]) = { ReplicatedShardingExtension(sys).init(MyReplicatedStringSet.provider(replicationType)) ReplicatedShardingExtension(sys).init(MyReplicatedIntSet.provider(replicationType)) } diff --git a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/delivery/DurableShardingSpec.scala b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/delivery/DurableShardingSpec.scala index d9c6ac12c48..48bd8b5962c 100644 --- a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/delivery/DurableShardingSpec.scala +++ b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/delivery/DurableShardingSpec.scala @@ -116,7 +116,7 @@ class DurableShardingSpec (1 to 4).foreach { n => producerProbe.receiveMessage().sendNextTo ! ShardingEnvelope("entity-1", TestConsumer.Job(s"msg-$n")) journalOperations.expectMessageType[InmemJournal.Write].event.getClass should ===( - classOf[DurableProducerQueue.MessageSent[?]]) + classOf[DurableProducerQueue.MessageSent[_]]) } journalOperations.expectNoMessage() @@ -185,7 +185,7 @@ class DurableShardingSpec val next5 = producerProbe.receiveMessage() next5.sendNextTo ! ShardingEnvelope("entity-1", TestConsumer.Job(s"msg-5")) journalOperations.expectMessageType[InmemJournal.Write].event.getClass should ===( - classOf[DurableProducerQueue.MessageSent[?]]) + classOf[DurableProducerQueue.MessageSent[_]]) // issue #30489: the consumer controller may have stopped after msg-5, so allow for resend on timeout (10-15s) val delivery5 = consumerProbe.receiveMessage(20.seconds) @@ -227,7 +227,7 @@ class DurableShardingSpec TestConsumer.Job(s"msg-1"), replyProbe.ref) journalOperations.expectMessageType[InmemJournal.Write].event.getClass should ===( - classOf[DurableProducerQueue.MessageSent[?]]) + classOf[DurableProducerQueue.MessageSent[_]]) replyProbe.expectMessage(Done) producerProbe.receiveMessage().askNextTo ! MessageWithConfirmation( @@ -235,7 +235,7 @@ class DurableShardingSpec TestConsumer.Job(s"msg-2"), replyProbe.ref) journalOperations.expectMessageType[InmemJournal.Write].event.getClass should ===( - classOf[DurableProducerQueue.MessageSent[?]]) + classOf[DurableProducerQueue.MessageSent[_]]) replyProbe.expectMessage(Done) testKit.stop(shardingProducerController) diff --git a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/delivery/ReliableDeliveryShardingSpec.scala b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/delivery/ReliableDeliveryShardingSpec.scala index e05cf0d23d4..56a30704ee1 100644 --- a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/delivery/ReliableDeliveryShardingSpec.scala +++ b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/delivery/ReliableDeliveryShardingSpec.scala @@ -305,7 +305,7 @@ class ReliableDeliveryShardingSpec next8.entitiesWithDemand should ===(Set("entity-2")) next8.bufferedForEntitiesWithoutDemand should ===(Map("entity-1" -> 1)) - // when new demand the buffered messages will be sent + // when new demand the buffered messages will be be sent seq5.producerController ! ProducerControllerImpl.Request(confirmedSeqNr = 5L, requestUpToSeqNr = 10, true, false) val seq6 = shardingProbe .fishForMessage(testKit.testKitSettings.dilated(3.seconds), "waiting for buffered msg-6 after renewed demand") { diff --git a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardedDaemonProcessIdSpec.scala b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardedDaemonProcessIdSpec.scala index bedfc268403..f7f4d1fdd64 100644 --- a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardedDaemonProcessIdSpec.scala +++ b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/internal/ShardedDaemonProcessIdSpec.scala @@ -14,7 +14,6 @@ package org.apache.pekko.cluster.sharding.typed.internal import org.apache.pekko.cluster.sharding.typed.internal.ShardedDaemonProcessId.DecodedId - import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpecLike diff --git a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ClusterShardingPersistenceSpec.scala b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ClusterShardingPersistenceSpec.scala index 229374a70ac..a44a4412e7c 100644 --- a/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ClusterShardingPersistenceSpec.scala +++ b/cluster-sharding-typed/src/test/scala/org/apache/pekko/cluster/sharding/typed/scaladsl/ClusterShardingPersistenceSpec.scala @@ -167,7 +167,7 @@ class ClusterShardingPersistenceSpec _entityId.toString } - private def awaitEntityTerminatedAndRemoved(ref: ActorRef[?], entityId: String): Unit = { + private def awaitEntityTerminatedAndRemoved(ref: ActorRef[_], entityId: String): Unit = { val p = TestProbe[Any]() p.expectTerminated(ref, p.remainingOrDefault) diff --git a/cluster-sharding/src/main/java/org/apache/pekko/cluster/sharding/protobuf/msg/ClusterShardingMessages.java b/cluster-sharding/src/main/java/org/apache/pekko/cluster/sharding/protobuf/msg/ClusterShardingMessages.java index 0a028b64ae0..752a0441a62 100644 --- a/cluster-sharding/src/main/java/org/apache/pekko/cluster/sharding/protobuf/msg/ClusterShardingMessages.java +++ b/cluster-sharding/src/main/java/org/apache/pekko/cluster/sharding/protobuf/msg/ClusterShardingMessages.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: ClusterShardingMessages.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package org.apache.pekko.cluster.sharding.protobuf.msg; @@ -25,8 +25,8 @@ private ClusterShardingMessages() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ClusterShardingMessages"); } @@ -154,8 +154,8 @@ public static final class CoordinatorState extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "CoordinatorState"); } @@ -241,8 +241,8 @@ public static final class ShardEntry extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ShardEntry"); } @@ -402,23 +402,19 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, shardId_); - } - if (((bitField0_ & 0x00000002) != 0)) { - size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(2, regionRef_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, shardId_); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(2, regionRef_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -1119,8 +1115,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { final int count = shards_.size(); @@ -1154,15 +1155,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getUnallocatedShardsList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2218,8 +2210,8 @@ public static final class ActorRefMessage extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ActorRefMessage"); } @@ -2322,20 +2314,16 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, ref_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, ref_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2776,8 +2764,8 @@ public static final class ShardIdMessage extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ShardIdMessage"); } @@ -2880,20 +2868,16 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, shard_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, shard_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -3351,8 +3335,8 @@ public static final class ShardHomeAllocated extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ShardHomeAllocated"); } @@ -3512,23 +3496,19 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, shard_); - } - if (((bitField0_ & 0x00000002) != 0)) { - size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(2, region_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, shard_); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(2, region_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -4093,8 +4073,8 @@ public static final class ShardHome extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ShardHome"); } @@ -4254,23 +4234,19 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, shard_); - } - if (((bitField0_ & 0x00000002) != 0)) { - size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(2, region_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, shard_); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(2, region_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -4847,8 +4823,8 @@ public static final class ShardHomesEntry extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ShardHomesEntry"); } @@ -4993,8 +4969,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, region_); } @@ -5006,15 +4987,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getShardList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -5604,8 +5576,8 @@ public static final class ShardHomes extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ShardHomes"); } @@ -5701,8 +5673,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { final int count = homes_.size(); @@ -5712,15 +5689,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -6370,8 +6338,8 @@ public static final class EntityState extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "EntityState"); } @@ -6458,8 +6426,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { int dataSize = 0; for (int i = 0; i < entities_.size(); i++) { @@ -6468,15 +6441,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getEntitiesList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -6950,8 +6914,8 @@ public static final class EntityStarted extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "EntityStarted"); } @@ -7054,20 +7018,16 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, entityId_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, entityId_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -7520,8 +7480,8 @@ public static final class EntitiesStarted extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "EntitiesStarted"); } @@ -7608,8 +7568,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { int dataSize = 0; for (int i = 0; i < entityId_.size(); i++) { @@ -7618,15 +7583,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getEntityIdList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -8100,8 +8056,8 @@ public static final class EntityStopped extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "EntityStopped"); } @@ -8204,20 +8160,16 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, entityId_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, entityId_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -8670,8 +8622,8 @@ public static final class EntitiesStopped extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "EntitiesStopped"); } @@ -8758,8 +8710,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { int dataSize = 0; for (int i = 0; i < entityId_.size(); i++) { @@ -8768,15 +8725,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getEntityIdList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -9257,8 +9205,8 @@ public static final class ShardStats extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ShardStats"); } @@ -9387,8 +9335,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, shard_); } @@ -9396,15 +9349,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt32Size(2, entityCount_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -9942,8 +9886,8 @@ public static final class ShardRegionStats extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ShardRegionStats"); } @@ -10075,8 +10019,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { final int count = stats_.size(); @@ -10094,15 +10043,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getFailedList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -10888,8 +10828,8 @@ public static final class MapFieldEntry extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "MapFieldEntry"); } @@ -11010,8 +10950,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, key_); } @@ -11019,15 +10964,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt32Size(2, value_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -11521,8 +11457,8 @@ public static final class GetClusterShardingStats extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "GetClusterShardingStats"); } @@ -11594,21 +11530,17 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream - .computeInt64Size(1, timeoutNanos_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream + .computeInt64Size(1, timeoutNanos_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -12015,8 +11947,8 @@ public static final class ClusterShardingStats extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ClusterShardingStats"); } @@ -12112,8 +12044,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { final int count = stats_.size(); @@ -12123,15 +12060,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -12786,8 +12714,8 @@ public static final class ClusterShardingStatsEntry extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ClusterShardingStatsEntry"); } @@ -12903,8 +12831,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getAddress()); @@ -12913,15 +12846,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getStats()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -13580,8 +13504,8 @@ public static final class CurrentRegions extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "CurrentRegions"); } @@ -13677,8 +13601,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { final int count = regions_.size(); @@ -13688,15 +13617,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -14346,8 +14266,8 @@ public static final class StopShards extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "StopShards"); } @@ -14434,8 +14354,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { int dataSize = 0; for (int i = 0; i < shards_.size(); i++) { @@ -14444,15 +14369,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getShardsList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -14972,8 +14888,8 @@ public static final class Address extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Address"); } @@ -15216,8 +15132,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, protocol_); } @@ -15231,15 +15152,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeUInt32Size(4, port_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -15964,8 +15876,8 @@ public static final class StartEntity extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "StartEntity"); } @@ -16068,20 +15980,16 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, entityId_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, entityId_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -16539,8 +16447,8 @@ public static final class StartEntityAck extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "StartEntityAck"); } @@ -16700,23 +16608,19 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, entityId_); - } - if (((bitField0_ & 0x00000002) != 0)) { - size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(2, shardId_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, entityId_); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(2, shardId_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -17289,8 +17193,8 @@ public static final class CurrentShardState extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "CurrentShardState"); } @@ -17435,8 +17339,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, shardId_); } @@ -17448,15 +17357,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getEntityIdsList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -18060,8 +17960,8 @@ public static final class ShardState extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ShardState"); } @@ -18206,8 +18106,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, shardId_); } @@ -18219,15 +18124,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getEntityIdsList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -18838,8 +18734,8 @@ public static final class CurrentShardRegionState extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "CurrentShardRegionState"); } @@ -18977,8 +18873,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { final int count = shards_.size(); @@ -18996,15 +18897,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getFailedList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -19803,8 +19695,8 @@ public static final class RememberedShardState extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "RememberedShardState"); } @@ -19914,8 +19806,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { int dataSize = 0; for (int i = 0; i < shardId_.size(); i++) { @@ -19928,15 +19825,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBoolSize(2, marker_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/cluster-sharding/src/main/mima-filters/2.0.x.backwards.excludes/remove-old-passivation-strategy.excludes b/cluster-sharding/src/main/mima-filters/2.0.x.backwards.excludes/remove-old-passivation-strategy.excludes deleted file mode 100644 index 51f1e6e1cd9..00000000000 --- a/cluster-sharding/src/main/mima-filters/2.0.x.backwards.excludes/remove-old-passivation-strategy.excludes +++ /dev/null @@ -1,21 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Remove old passivation strategy -ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.cluster.sharding.ClusterShardingSettings#PassivationStrategySettings.fromSharding") -ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.cluster.sharding.ClusterShardingSettings#PassivationStrategySettings.oldDefault") -ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.cluster.sharding.ClusterShardingSettings#PassivationStrategySettings.oldSettingUsed") diff --git a/cluster-sharding/src/main/resources/reference.conf b/cluster-sharding/src/main/resources/reference.conf index f49250ee39e..65de646647c 100644 --- a/cluster-sharding/src/main/resources/reference.conf +++ b/cluster-sharding/src/main/resources/reference.conf @@ -30,6 +30,12 @@ pekko.cluster.sharding { # Default is ddata for backwards compatibility. remember-entities-store = "ddata" + # Deprecated: use the `passivation.default-idle-strategy.idle-entity.timeout` setting instead. + # Set this to a time duration to have sharding passivate entities when they have not + # received any message in this length of time. Set to 'off' to disable. + # It is always disabled if `remember-entities` is enabled. + passivate-idle-entity-after = null + # Automatic entity passivation settings. passivation { diff --git a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ClusterSharding.scala b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ClusterSharding.scala index bb393b299ac..d8515977a4c 100755 --- a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ClusterSharding.scala +++ b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ClusterSharding.scala @@ -72,7 +72,7 @@ import pekko.util.ByteString * '''ShardRegion''': * Each entity actor runs only at one place, and messages can be sent to the entity without * requiring the sender to know the location of the destination actor. This is achieved by - * sending the messages via a `ShardRegion` actor, provided by this extension. The `ShardRegion` + * sending the messages via a [[ShardRegion]] actor, provided by this extension. The [[ShardRegion]] * knows the shard mappings and routes inbound messages to the entity with the entity id. * Messages to the entities are always sent via the local `ShardRegion`. * The `ShardRegion` actor is started on each node in the cluster, or group of nodes @@ -198,10 +198,10 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { /** * Scala API: Register a named entity type by defining the [[pekko.actor.Props]] of the entity actor - * and functions to extract entity and shard identifier from messages. The `ShardRegion` actor + * and functions to extract entity and shard identifier from messages. The [[ShardRegion]] actor * for this type can later be retrieved with the [[shardRegion]] method. * - * This method will start a `ShardRegion` in proxy mode when there is no match between the roles of + * This method will start a [[ShardRegion]] in proxy mode when there is no match between the roles of * the current cluster node and the role specified in [[ClusterShardingSettings]] passed to this method. * * Some settings can be configured as described in the `pekko.cluster.sharding` section @@ -219,7 +219,7 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { * rebalancing logic * @param handOffStopMessage the message that will be sent to entities when they are to be stopped * for a rebalance or graceful shutdown of a `ShardRegion`, e.g. `PoisonPill`. - * @return the actor ref of the `ShardRegion` that is to be responsible for the shard + * @return the actor ref of the [[ShardRegion]] that is to be responsible for the shard */ def start( typeName: String, @@ -242,10 +242,10 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { /** * Scala API: Register a named entity type by defining the [[pekko.actor.Props]] of the entity actor - * and functions to extract entity and shard identifier from messages. The `ShardRegion` actor + * and functions to extract entity and shard identifier from messages. The [[ShardRegion]] actor * for this type can later be retrieved with the [[shardRegion]] method. * - * This method will start a `ShardRegion` in proxy mode when there is no match between the roles of + * This method will start a [[ShardRegion]] in proxy mode when there is no match between the roles of * the current cluster node and the role specified in [[ClusterShardingSettings]] passed to this method. * * Some settings can be configured as described in the `pekko.cluster.sharding` section @@ -262,7 +262,7 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { * rebalancing logic * @param handOffStopMessage the message that will be sent to entities when they are to be stopped * for a rebalance or graceful shutdown of a `ShardRegion`, e.g. `PoisonPill`. - * @return the actor ref of the `ShardRegion` that is to be responsible for the shard + * @return the actor ref of the [[ShardRegion]] that is to be responsible for the shard */ def start( typeName: String, @@ -335,13 +335,13 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { /** * Register a named entity type by defining the [[pekko.actor.Props]] of the entity actor and - * functions to extract entity and shard identifier from messages. The `ShardRegion` actor + * functions to extract entity and shard identifier from messages. The [[ShardRegion]] actor * for this type can later be retrieved with the [[shardRegion]] method. * * The default shard allocation strategy [[ShardCoordinator.LeastShardAllocationStrategy]] * is used. [[pekko.actor.PoisonPill]] is used as `handOffStopMessage`. * - * This method will start a `ShardRegion` in proxy mode when there is no match between the + * This method will start a [[ShardRegion]] in proxy mode when there is no match between the * node roles and the role specified in the [[ClusterShardingSettings]] passed to this method. * * Some settings can be configured as described in the `pekko.cluster.sharding` section @@ -355,7 +355,7 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { * be `unhandled`, i.e. posted as `Unhandled` messages on the event stream * @param extractShardId function to determine the shard id for an incoming message, only messages * that passed the `extractEntityId` will be used - * @return the actor ref of the `ShardRegion` that is to be responsible for the shard + * @return the actor ref of the [[ShardRegion]] that is to be responsible for the shard */ def start( typeName: String, @@ -371,13 +371,13 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { /** * Register a named entity type by defining the [[pekko.actor.Props]] of the entity actor and - * functions to extract entity and shard identifier from messages. The `ShardRegion` actor + * functions to extract entity and shard identifier from messages. The [[ShardRegion]] actor * for this type can later be retrieved with the [[shardRegion]] method. * * The default shard allocation strategy [[ShardCoordinator.LeastShardAllocationStrategy]] * is used. [[pekko.actor.PoisonPill]] is used as `handOffStopMessage`. * - * This method will start a `ShardRegion` in proxy mode when there is no match between the + * This method will start a [[ShardRegion]] in proxy mode when there is no match between the * node roles and the role specified in the [[ClusterShardingSettings]] passed to this method. * * Some settings can be configured as described in the `pekko.cluster.sharding` section @@ -390,7 +390,7 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { * be `unhandled`, i.e. posted as `Unhandled` messages on the event stream * @param extractShardId function to determine the shard id for an incoming message, only messages * that passed the `extractEntityId` will be used - * @return the actor ref of the `ShardRegion` that is to be responsible for the shard + * @return the actor ref of the [[ShardRegion]] that is to be responsible for the shard */ def start( typeName: String, @@ -403,10 +403,10 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { /** * Java/Scala API: Register a named entity type by defining the [[pekko.actor.Props]] of the entity actor - * and functions to extract entity and shard identifier from messages. The `ShardRegion` actor + * and functions to extract entity and shard identifier from messages. The [[ShardRegion]] actor * for this type can later be retrieved with the [[#shardRegion]] method. * - * This method will start a `ShardRegion` in proxy mode when there is no match between the + * This method will start a [[ShardRegion]] in proxy mode when there is no match between the * node roles and the role specified in the [[ClusterShardingSettings]] passed to this method. * * Some settings can be configured as described in the `pekko.cluster.sharding` section @@ -421,7 +421,7 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { * rebalancing logic * @param handOffStopMessage the message that will be sent to entities when they are to be stopped * for a rebalance or graceful shutdown of a `ShardRegion`, e.g. `PoisonPill`. - * @return the actor ref of the `ShardRegion` that is to be responsible for the shard + * @return the actor ref of the [[ShardRegion]] that is to be responsible for the shard */ def start( typeName: String, @@ -446,13 +446,13 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { /** * Java/Scala API: Register a named entity type by defining the [[pekko.actor.Props]] of the entity actor - * and functions to extract entity and shard identifier from messages. The `ShardRegion` actor + * and functions to extract entity and shard identifier from messages. The [[ShardRegion]] actor * for this type can later be retrieved with the [[#shardRegion]] method. * * The default shard allocation strategy [[ShardCoordinator.LeastShardAllocationStrategy]] * is used. [[pekko.actor.PoisonPill]] is used as `handOffStopMessage`. * - * This method will start a `ShardRegion` in proxy mode when there is no match between the + * This method will start a [[ShardRegion]] in proxy mode when there is no match between the * node roles and the role specified in the [[ClusterShardingSettings]] passed to this method. * * Some settings can be configured as described in the `pekko.cluster.sharding` section @@ -463,7 +463,7 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { * @param settings configuration settings, see [[ClusterShardingSettings]] * @param messageExtractor functions to extract the entity id, shard id, and the message to send to the * entity from the incoming message - * @return the actor ref of the `ShardRegion` that is to be responsible for the shard + * @return the actor ref of the [[ShardRegion]] that is to be responsible for the shard */ def start( typeName: String, @@ -478,13 +478,13 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { /** * Java/Scala API: Register a named entity type by defining the [[pekko.actor.Props]] of the entity actor - * and functions to extract entity and shard identifier from messages. The `ShardRegion` actor + * and functions to extract entity and shard identifier from messages. The [[ShardRegion]] actor * for this type can later be retrieved with the [[#shardRegion]] method. * * The default shard allocation strategy [[ShardCoordinator.LeastShardAllocationStrategy]] * is used. [[pekko.actor.PoisonPill]] is used as `handOffStopMessage`. * - * This method will start a `ShardRegion` in proxy mode when there is no match between the + * This method will start a [[ShardRegion]] in proxy mode when there is no match between the * node roles and the role specified in the [[ClusterShardingSettings]] passed to this method. * * Some settings can be configured as described in the `pekko.cluster.sharding` section @@ -494,7 +494,7 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { * @param entityProps the `Props` of the entity actors that will be created by the `ShardRegion` * @param messageExtractor functions to extract the entity id, shard id, and the message to send to the * entity from the incoming message - * @return the actor ref of the `ShardRegion` that is to be responsible for the shard + * @return the actor ref of the [[ShardRegion]] that is to be responsible for the shard */ def start(typeName: String, entityProps: Props, messageExtractor: ShardRegion.MessageExtractor): ActorRef = { start(typeName, entityProps, ClusterShardingSettings(system), messageExtractor) @@ -503,7 +503,7 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { /** * Scala API: Register a named entity type `ShardRegion` on this node that will run in proxy only mode, * i.e. it will delegate messages to other `ShardRegion` actors on other nodes, but not host any - * entity actors itself. The `ShardRegion` actor for this type can later be retrieved with the + * entity actors itself. The [[ShardRegion]] actor for this type can later be retrieved with the * [[#shardRegion]] method. * * Some settings can be configured as described in the `pekko.cluster.sharding` section @@ -517,7 +517,7 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { * be `unhandled`, i.e. posted as `Unhandled` messages on the event stream * @param extractShardId function to determine the shard id for an incoming message, only messages * that passed the `extractEntityId` will be used - * @return the actor ref of the `ShardRegion` that is to be responsible for the shard + * @return the actor ref of the [[ShardRegion]] that is to be responsible for the shard */ def startProxy( typeName: String, @@ -529,7 +529,7 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { /** * Scala API: Register a named entity type `ShardRegion` on this node that will run in proxy only mode, * i.e. it will delegate messages to other `ShardRegion` actors on other nodes, but not host any - * entity actors itself. The `ShardRegion` actor for this type can later be retrieved with the + * entity actors itself. The [[ShardRegion]] actor for this type can later be retrieved with the * [[#shardRegion]] method. * * Some settings can be configured as described in the `pekko.cluster.sharding` section @@ -545,7 +545,7 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { * be `unhandled`, i.e. posted as `Unhandled` messages on the event stream * @param extractShardId function to determine the shard id for an incoming message, only messages * that passed the `extractEntityId` will be used - * @return the actor ref of the `ShardRegion` that is to be responsible for the shard + * @return the actor ref of the [[ShardRegion]] that is to be responsible for the shard */ def startProxy( typeName: String, @@ -578,7 +578,7 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { /** * Java/Scala API: Register a named entity type `ShardRegion` on this node that will run in proxy only mode, * i.e. it will delegate messages to other `ShardRegion` actors on other nodes, but not host any - * entity actors itself. The `ShardRegion` actor for this type can later be retrieved with the + * entity actors itself. The [[ShardRegion]] actor for this type can later be retrieved with the * [[#shardRegion]] method. * * Some settings can be configured as described in the `pekko.cluster.sharding` section @@ -589,7 +589,7 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { * If the role is not specified all nodes in the cluster are used. * @param messageExtractor functions to extract the entity id, shard id, and the message to send to the * entity from the incoming message - * @return the actor ref of the `ShardRegion` that is to be responsible for the shard + * @return the actor ref of the [[ShardRegion]] that is to be responsible for the shard */ def startProxy(typeName: String, role: Optional[String], messageExtractor: ShardRegion.MessageExtractor): ActorRef = startProxy(typeName, role, dataCenter = Optional.empty(), messageExtractor) @@ -597,7 +597,7 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { /** * Java/Scala API: Register a named entity type `ShardRegion` on this node that will run in proxy only mode, * i.e. it will delegate messages to other `ShardRegion` actors on other nodes, but not host any - * entity actors itself. The `ShardRegion` actor for this type can later be retrieved with the + * entity actors itself. The [[ShardRegion]] actor for this type can later be retrieved with the * [[#shardRegion]] method. * * Some settings can be configured as described in the `pekko.cluster.sharding` section @@ -610,7 +610,7 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { * If None then the same data center as current node. * @param messageExtractor functions to extract the entity id, shard id, and the message to send to the * entity from the incoming message - * @return the actor ref of the `ShardRegion` that is to be responsible for the shard + * @return the actor ref of the [[ShardRegion]] that is to be responsible for the shard */ def startProxy( typeName: String, @@ -637,7 +637,7 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { def getShardTypeNames: java.util.Set[String] = regions.keySet() /** - * Retrieve the actor reference of the `ShardRegion` actor responsible for the named entity type. + * Retrieve the actor reference of the [[ShardRegion]] actor responsible for the named entity type. * The entity type must be registered with the [[#start]] or [[#startProxy]] method before it * can be used here. Messages to the entity is always sent via the `ShardRegion`. */ @@ -655,7 +655,7 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension { } /** - * Retrieve the actor reference of the `ShardRegion` actor that will act as a proxy to the + * Retrieve the actor reference of the [[ShardRegion]] actor that will act as a proxy to the * named entity type running in another data center. A proxy within the same data center can be accessed * with [[#shardRegion]] instead of this method. The entity type must be registered with the * [[#startProxy]] method before it can be used here. Messages to the entity is always sent @@ -717,7 +717,7 @@ private[pekko] object ClusterShardingGuardian { } /** - * INTERNAL API. `ShardRegion` and [[ShardCoordinator]] actors are created as children + * INTERNAL API. [[ShardRegion]] and [[ShardCoordinator]] actors are created as children * of this actor. */ private[pekko] class ClusterShardingGuardian extends Actor { diff --git a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ClusterShardingSettings.scala b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ClusterShardingSettings.scala index 9093e912a63..bb1f5c1445d 100644 --- a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ClusterShardingSettings.scala +++ b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ClusterShardingSettings.scala @@ -20,7 +20,7 @@ import scala.jdk.DurationConverters._ import org.apache.pekko import pekko.actor.ActorSystem import pekko.actor.NoSerializationVerificationNeeded -import pekko.annotation.InternalApi +import pekko.annotation.{ ApiMayChange, InternalApi } import pekko.cluster.Cluster import pekko.cluster.singleton.ClusterSingletonManagerSettings import pekko.coordination.lease.LeaseUsageSettings @@ -101,7 +101,7 @@ object ClusterShardingSettings { val coordinatorSingletonSettings = ClusterSingletonManagerSettings(config.getConfig("coordinator-singleton")) - val passivationStrategySettings = PassivationStrategySettings(config.getConfig("passivation")) + val passivationStrategySettings = PassivationStrategySettings.fromSharding(config) val lease = config.getString("use-lease") match { case s if s.isEmpty => None @@ -141,22 +141,46 @@ object ClusterShardingSettings { private[pekko] def roleOption(role: String): Option[String] = if (role == "") None else Option(role) - final class PassivationStrategySettings( + /** + * API MAY CHANGE: Settings for passivation strategies may change after additional testing and feedback. + */ + @ApiMayChange + final class PassivationStrategySettings private[pekko] ( val idleEntitySettings: Option[PassivationStrategySettings.IdleSettings], val activeEntityLimit: Option[Int], val replacementPolicySettings: Option[PassivationStrategySettings.PolicySettings], - val admissionSettings: Option[PassivationStrategySettings.AdmissionSettings]) { + val admissionSettings: Option[PassivationStrategySettings.AdmissionSettings], + private[pekko] val oldSettingUsed: Boolean) { + + private[pekko] def this( + idleEntitySettings: Option[PassivationStrategySettings.IdleSettings], + activeEntityLimit: Option[Int], + replacementPolicySettings: Option[PassivationStrategySettings.PolicySettings], + oldSettingUsed: Boolean) = + this(idleEntitySettings, activeEntityLimit, replacementPolicySettings, admissionSettings = None, oldSettingUsed) + + def this( + idleEntitySettings: Option[PassivationStrategySettings.IdleSettings], + activeEntityLimit: Option[Int], + replacementPolicySettings: Option[PassivationStrategySettings.PolicySettings], + admissionSettings: Option[PassivationStrategySettings.AdmissionSettings]) = + this(idleEntitySettings, activeEntityLimit, replacementPolicySettings, admissionSettings, oldSettingUsed = false) def this( idleEntitySettings: Option[PassivationStrategySettings.IdleSettings], activeEntityLimit: Option[Int], replacementPolicySettings: Option[PassivationStrategySettings.PolicySettings]) = - this(idleEntitySettings, activeEntityLimit, replacementPolicySettings, admissionSettings = None) + this( + idleEntitySettings, + activeEntityLimit, + replacementPolicySettings, + admissionSettings = None, + oldSettingUsed = false) import PassivationStrategySettings._ def withIdleEntityPassivation(settings: IdleSettings): PassivationStrategySettings = - copy(idleEntitySettings = Some(settings)) + copy(idleEntitySettings = Some(settings), oldSettingUsed = false) def withIdleEntityPassivation(timeout: FiniteDuration): PassivationStrategySettings = withIdleEntityPassivation(IdleSettings.defaults.withTimeout(timeout)) @@ -190,24 +214,39 @@ object ClusterShardingSettings { def withAdmission(settings: AdmissionSettings): PassivationStrategySettings = copy(admissionSettings = Some(settings)) + private[pekko] def withOldIdleStrategy(timeout: FiniteDuration): PassivationStrategySettings = + copy( + idleEntitySettings = Some(new IdleSettings(timeout, None)), + activeEntityLimit = None, + replacementPolicySettings = None, + admissionSettings = None, + oldSettingUsed = true) + private def copy( idleEntitySettings: Option[IdleSettings] = idleEntitySettings, activeEntityLimit: Option[Int] = activeEntityLimit, replacementPolicySettings: Option[PolicySettings] = replacementPolicySettings, - admissionSettings: Option[AdmissionSettings] = admissionSettings): PassivationStrategySettings = + admissionSettings: Option[AdmissionSettings] = admissionSettings, + oldSettingUsed: Boolean = oldSettingUsed): PassivationStrategySettings = new PassivationStrategySettings( idleEntitySettings, activeEntityLimit, replacementPolicySettings, - admissionSettings) + admissionSettings, + oldSettingUsed) } + /** + * API MAY CHANGE: Settings for passivation strategies may change after additional testing and feedback. + */ + @ApiMayChange object PassivationStrategySettings { val defaults = new PassivationStrategySettings( idleEntitySettings = None, activeEntityLimit = None, replacementPolicySettings = None, - admissionSettings = None) + admissionSettings = None, + oldSettingUsed = false) val disabled: PassivationStrategySettings = defaults @@ -533,6 +572,11 @@ object ClusterShardingSettings { new AdmissionSettings(filter, window) } + /** + * API MAY CHANGE: Settings and configuration for passivation strategies may change after additional + * testing and feedback. + */ + @ApiMayChange def apply(config: Config): PassivationStrategySettings = { toRootLowerCase(config.getString("strategy")) match { case "off" | "none" => PassivationStrategySettings.disabled @@ -554,6 +598,20 @@ object ClusterShardingSettings { } } + def fromSharding(shardingConfig: Config): PassivationStrategySettings = { + // default to old setting if it exists (defined in application.conf), overriding the new settings + if (shardingConfig.hasPath("passivate-idle-entity-after")) { + val timeout = + if (toRootLowerCase(shardingConfig.getString("passivate-idle-entity-after")) == "off") Duration.Zero + else shardingConfig.getDuration("passivate-idle-entity-after", MILLISECONDS).millis + oldDefault(timeout) + } else { + PassivationStrategySettings(shardingConfig.getConfig("passivation")) + } + } + + private[pekko] def oldDefault(idleTimeout: FiniteDuration): PassivationStrategySettings = + defaults.withOldIdleStrategy(idleTimeout) } /** @@ -960,6 +1018,10 @@ final class ClusterShardingSettings( def withStateStoreMode(stateStoreMode: String): ClusterShardingSettings = copy(stateStoreMode = stateStoreMode) + /** + * API MAY CHANGE: Settings for passivation strategies may change after additional testing and feedback. + */ + @ApiMayChange def withPassivationStrategy(settings: ClusterShardingSettings.PassivationStrategySettings): ClusterShardingSettings = copy(passivationStrategySettings = settings) diff --git a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardCoordinator.scala b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardCoordinator.scala index b353bd7ede8..538f5cde2de 100644 --- a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardCoordinator.scala +++ b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardCoordinator.scala @@ -141,12 +141,12 @@ object ShardCoordinator { /** * Invoked when the location of a new shard is to be decided. * - * @param requester actor reference to the `ShardRegion` that requested the location of the + * @param requester actor reference to the [[ShardRegion]] that requested the location of the * shard, can be returned if preference should be given to the node where the shard was first accessed * @param shardId the id of the shard to allocate * @param currentShardAllocations all actor refs to `ShardRegion` and their current allocated shards, * in the order they were allocated - * @return a `Future` of the actor ref of the `ShardRegion` that is to be responsible for the shard, must be one of + * @return a `Future` of the actor ref of the [[ShardRegion]] that is to be responsible for the shard, must be one of * the references included in the `currentShardAllocations` parameter */ def allocateShard( @@ -171,7 +171,7 @@ object ShardCoordinator { /** * Shard allocation strategy where start is called by the shard coordinator before any calls to * rebalance or allocate shard. This can be used if there is any expensive initialization to be done - * that you do not want to do in the constructor as it will happen on every node rather than just + * that you do not want to to in the constructor as it will happen on every node rather than just * the node that hosts the ShardCoordinator */ trait StartableAllocationStrategy extends ShardAllocationStrategy { @@ -227,12 +227,12 @@ object ShardCoordinator { /** * Invoked when the location of a new shard is to be decided. * - * @param requester actor reference to the `ShardRegion` that requested the location of the + * @param requester actor reference to the [[ShardRegion]] that requested the location of the * shard, can be returned if preference should be given to the node where the shard was first accessed * @param shardId the id of the shard to allocate * @param currentShardAllocations all actor refs to `ShardRegion` and their current allocated shards, * in the order they were allocated - * @return a `Future` of the actor ref of the `ShardRegion` that is to be responsible for the shard, must be one of + * @return a `Future` of the actor ref of the [[ShardRegion]] that is to be responsible for the shard, must be one of * the references included in the `currentShardAllocations` parameter */ def allocateShard( diff --git a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardRegion.scala b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardRegion.scala index 86dd77d8c50..d6347f4ee6d 100644 --- a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardRegion.scala +++ b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardRegion.scala @@ -27,6 +27,7 @@ import org.apache.pekko import pekko.Done import pekko.actor._ import pekko.annotation.{ InternalApi, InternalStableApi } +import pekko.annotation.ApiMayChange import pekko.cluster.Cluster import pekko.cluster.ClusterEvent._ import pekko.cluster.ClusterSettings @@ -50,7 +51,7 @@ object ShardRegion { /** * INTERNAL API - * Factory method for the [[pekko.actor.Props]] of the `ShardRegion` actor. + * Factory method for the [[pekko.actor.Props]] of the [[ShardRegion]] actor. */ private[pekko] def props( typeName: String, @@ -75,7 +76,7 @@ object ShardRegion { /** * INTERNAL API - * Factory method for the [[pekko.actor.Props]] of the `ShardRegion` actor + * Factory method for the [[pekko.actor.Props]] of the [[ShardRegion]] actor * when using it in proxy only mode. */ private[pekko] def proxyProps( @@ -113,7 +114,7 @@ object ShardRegion { type Msg = Any /** - * Interface of the partial function used by the `ShardRegion` to + * Interface of the partial function used by the [[ShardRegion]] to * extract the entity id and the message to send to the entity from an * incoming message. The implementation is application specific. * If the partial function does not match the message will be @@ -125,7 +126,7 @@ object ShardRegion { type ExtractEntityId = PartialFunction[Msg, (EntityId, Msg)] /** - * Interface of the function used by the `ShardRegion` to + * Interface of the function used by the [[ShardRegion]] to * extract the shard id from an incoming message. * Only messages that passed the [[ExtractEntityId]] will be used * as input to this function. @@ -500,8 +501,11 @@ object ShardRegion { with DeadLetterSuppression /** + * API MAY CHANGE: Messages for passivation strategies may change after additional testing and feedback. + * * When limit-based automatic passivation is enabled, set a new active entity limit for a shard region. */ + @ApiMayChange final case class SetActiveEntityLimit(perRegionLimit: Int) /** @@ -638,10 +642,7 @@ private[pekko] class ShardRegion( // sort by age, oldest first val ageOrdering = Member.ageOrdering // membersByAge is only used for tracking where coordinator is running - var membersByAge: immutable.SortedSet[Member] = { - implicit val ord: Ordering[Member] = ageOrdering - immutable.SortedSet.empty[Member] - } + var membersByAge: immutable.SortedSet[Member] = immutable.SortedSet.empty(ageOrdering) // membersByAge contains members with these status private val memberStatusOfInterest: Set[MemberStatus] = Set(MemberStatus.Up, MemberStatus.Leaving, MemberStatus.Exiting) @@ -699,6 +700,12 @@ private[pekko] class ShardRegion( } private def logPassivationStrategy(): Unit = { + if (settings.passivationStrategySettings.oldSettingUsed) { + log.warning( + "The `pekko.cluster.sharding.passivate-idle-entity-after` setting and associated methods are deprecated. " + + "Use the `pekko.cluster.sharding.passivation.default-idle-strategy.idle-entity.timeout` setting instead. " + + "See the documentation and reference config for more information on automatic passivation strategies.") + } if (settings.rememberEntities) { log.debug("{}: Entities will not be passivated automatically because 'rememberEntities' is enabled.", typeName) } else { @@ -775,10 +782,9 @@ private[pekko] class ShardRegion( } def receiveClusterState(state: CurrentClusterState): Unit = { - implicit val ord: Ordering[Member] = ageOrdering changeMembers( immutable.SortedSet - .empty[Member] + .empty(ageOrdering) .union(state.members.filter(m => memberStatusOfInterest(m.status) && matchingCoordinatorRole(m)))) } @@ -1090,7 +1096,7 @@ private[pekko] class ShardRegion( Future.traverse(shards.toSeq) { case (shardId, shard) => askOne(shard, msg, shardId) }.map { ps => val qr = ShardsQueryResult[T](ps, this.shards.size, timeout.duration) - if (qr.failed.nonEmpty) log.warning("{}: {}", typeName, qr) + if (qr.failed.nonEmpty) log.warning(s"{}: $qr", typeName) qr } } diff --git a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardingFlightRecorder.scala b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardingFlightRecorder.scala index 52bd659492a..29bb1a6c771 100644 --- a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardingFlightRecorder.scala +++ b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardingFlightRecorder.scala @@ -23,7 +23,7 @@ import pekko.util.FlightRecorderLoader @InternalApi object ShardingFlightRecorder extends ExtensionId[ShardingFlightRecorder] with ExtensionIdProvider { - override def lookup: ExtensionId[? <: Extension] = this + override def lookup: ExtensionId[_ <: Extension] = this override def createExtension(system: ExtendedActorSystem): ShardingFlightRecorder = FlightRecorderLoader.load[ShardingFlightRecorder]( diff --git a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/internal/jfr/Events.scala b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/internal/jfr/Events.scala index 73b7a102615..8403161e819 100644 --- a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/internal/jfr/Events.scala +++ b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/internal/jfr/Events.scala @@ -17,7 +17,8 @@ import jdk.jfr.{ Category, Event, Label, StackTrace, Timespan } import org.apache.pekko.annotation.InternalApi -// requires jdk.jfr (available since JDK 9, project baseline is Java 17) +// requires jdk9+ to compile +// for editing these in IntelliJ, open module settings, change JDK dependency to 11 for only this module /** INTERNAL API */ diff --git a/cluster-sharding/src/multi-jvm/scala/org/apache/pekko/cluster/sharding/ClusterShardingCoordinatorRoleSpec.scala b/cluster-sharding/src/multi-jvm/scala/org/apache/pekko/cluster/sharding/ClusterShardingCoordinatorRoleSpec.scala index e4fd8737ac4..d1bb7c545b8 100644 --- a/cluster-sharding/src/multi-jvm/scala/org/apache/pekko/cluster/sharding/ClusterShardingCoordinatorRoleSpec.scala +++ b/cluster-sharding/src/multi-jvm/scala/org/apache/pekko/cluster/sharding/ClusterShardingCoordinatorRoleSpec.scala @@ -15,6 +15,9 @@ package org.apache.pekko.cluster.sharding import scala.concurrent.duration._ +import com.typesafe.config.Config +import com.typesafe.config.ConfigFactory + import org.apache.pekko import pekko.actor.ActorRef import pekko.actor.PoisonPill @@ -22,9 +25,6 @@ import pekko.actor.Props import pekko.cluster.sharding.MultiNodeClusterShardingSpec.EntityActor import pekko.testkit._ -import com.typesafe.config.Config -import com.typesafe.config.ConfigFactory - class ClusterShardingCoordinatorRoleSpecConfig( mode: String, rememberEntities: Boolean, diff --git a/cluster-sharding/src/multi-jvm/scala/org/apache/pekko/cluster/sharding/MultiNodeClusterShardingConfig.scala b/cluster-sharding/src/multi-jvm/scala/org/apache/pekko/cluster/sharding/MultiNodeClusterShardingConfig.scala index 8db34c68395..16ec015e77b 100644 --- a/cluster-sharding/src/multi-jvm/scala/org/apache/pekko/cluster/sharding/MultiNodeClusterShardingConfig.scala +++ b/cluster-sharding/src/multi-jvm/scala/org/apache/pekko/cluster/sharding/MultiNodeClusterShardingConfig.scala @@ -24,7 +24,7 @@ import com.typesafe.config.{ Config, ConfigFactory } object MultiNodeClusterShardingConfig { - private[sharding] def testNameFromCallStack(classToStartFrom: Class[?]): String = { + private[sharding] def testNameFromCallStack(classToStartFrom: Class[_]): String = { def isAbstractClass(className: String): Boolean = { try { diff --git a/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/ClusterShardingSettingsSpec.scala b/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/ClusterShardingSettingsSpec.scala index b194c5ecf45..56fecd542ed 100644 --- a/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/ClusterShardingSettingsSpec.scala +++ b/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/ClusterShardingSettingsSpec.scala @@ -821,5 +821,16 @@ class ClusterShardingSettingsSpec extends AnyWordSpec with Matchers { .passivationStrategy shouldBe ClusterShardingSettings.NoPassivationStrategy } + "support old `passivate-idle-entity-after` setting (overriding new strategy settings)" in { + settings(""" + pekko.cluster.sharding { + passivate-idle-entity-after = 5 minutes + passivation.strategy = default-strategy + } + """).passivationStrategy shouldBe ClusterShardingSettings.IdlePassivationStrategy( + timeout = 5.minutes, + interval = 2.5.minutes) + } + } } diff --git a/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/ConcurrentStartupShardingSpec.scala b/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/ConcurrentStartupShardingSpec.scala index ea8ae11bb42..37463335bc3 100644 --- a/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/ConcurrentStartupShardingSpec.scala +++ b/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/ConcurrentStartupShardingSpec.scala @@ -78,7 +78,7 @@ class ConcurrentStartupShardingSpec extends PekkoSpec(ConcurrentStartupShardingS if (!log.isDebugEnabled) system.eventStream.publish(Mute(DeadLettersFilter[Any])) - // The intended usage is to start sharding in one (or a few) places when the ActorSystem + // The intended usage is to start sharding in one (or a few) places when the the ActorSystem // is started and not to do it concurrently from many threads. However, we can do our best and when using // FJP the Await will create additional threads when needed. "Concurrent Sharding startup" must { diff --git a/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/PersistentShardingMigrationSpec.scala b/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/PersistentShardingMigrationSpec.scala index 6d7c4ced175..49edf1ccbf7 100644 --- a/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/PersistentShardingMigrationSpec.scala +++ b/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/PersistentShardingMigrationSpec.scala @@ -42,7 +42,7 @@ object PersistentShardingMigrationSpec { remember-entities-store = "eventsourced" # this forces the remembered entity store to use persistence - # is deprecated + # is is deprecated state-store-mode = "persistence" # make sure we test snapshots diff --git a/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/RememberEntitiesAndStartEntitySpec.scala b/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/RememberEntitiesAndStartEntitySpec.scala index 431537c964e..330961469dc 100644 --- a/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/RememberEntitiesAndStartEntitySpec.scala +++ b/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/RememberEntitiesAndStartEntitySpec.scala @@ -13,8 +13,6 @@ package org.apache.pekko.cluster.sharding -import scala.concurrent.duration._ - import org.apache.pekko import pekko.actor.Actor import pekko.actor.ActorRef @@ -32,6 +30,7 @@ import pekko.testkit.WithLogCapturing import org.scalatest.wordspec.AnyWordSpecLike +import scala.concurrent.duration._ import com.typesafe.config.ConfigFactory object RememberEntitiesAndStartEntitySpec { diff --git a/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/ShardRegionDataTypesSpec.scala b/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/ShardRegionDataTypesSpec.scala deleted file mode 100644 index 47ef090e58e..00000000000 --- a/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/ShardRegionDataTypesSpec.scala +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.pekko.cluster.sharding - -import org.apache.pekko.cluster.sharding.ShardRegion._ - -import org.scalatest.matchers.should.Matchers -import org.scalatest.wordspec.AnyWordSpec - -class ShardRegionDataTypesSpec extends AnyWordSpec with Matchers { - - "ShardRegionStats" must { - - "be constructable with only stats (failed defaults to empty set)" in { - val s = ShardRegionStats(Map("s1" -> 3)) - s.stats shouldBe Map("s1" -> 3) - s.failed shouldBe Set.empty[ShardId] - } - - "be constructable with both stats and failed" in { - val s = ShardRegionStats(Map("s1" -> 3, "s2" -> 7), Set("s3")) - s.stats shouldBe Map("s1" -> 3, "s2" -> 7) - s.failed shouldBe Set("s3") - } - - "support equality" in { - val a = ShardRegionStats(Map("s1" -> 1), Set("s2")) - val b = ShardRegionStats(Map("s1" -> 1), Set("s2")) - val c = ShardRegionStats(Map("s1" -> 2), Set("s2")) - a shouldBe b - a should not be c - } - - "support copy" in { - val original = ShardRegionStats(Map("s1" -> 1), Set("s2")) - val copied = original.copy(stats = Map("s1" -> 5)) - copied.stats shouldBe Map("s1" -> 5) - copied.failed shouldBe Set("s2") - } - - "support pattern matching" in { - val s = ShardRegionStats(Map("s1" -> 1), Set("s2")) - s match { - case ShardRegionStats(stats) => - stats shouldBe Map("s1" -> 1) - } - } - - "expose Java API getStats and getFailed" in { - import scala.jdk.CollectionConverters._ - val s = ShardRegionStats(Map("s1" -> 3), Set("s2")) - s.getStats().asScala shouldBe Map("s1" -> 3) - s.getFailed().asScala shouldBe Set("s2") - } - } - - "CurrentShardRegionState" must { - - "be constructable with only shards (failed defaults to empty set)" in { - val state = CurrentShardRegionState(Set(ShardState("s1", Set("e1")))) - state.shards shouldBe Set(ShardState("s1", Set("e1"))) - state.failed shouldBe Set.empty[ShardId] - } - - "be constructable with both shards and failed" in { - val state = CurrentShardRegionState(Set(ShardState("s1", Set("e1"))), Set("s2")) - state.shards shouldBe Set(ShardState("s1", Set("e1"))) - state.failed shouldBe Set("s2") - } - - "support equality" in { - val a = CurrentShardRegionState(Set(ShardState("s1", Set("e1"))), Set("s2")) - val b = CurrentShardRegionState(Set(ShardState("s1", Set("e1"))), Set("s2")) - val c = CurrentShardRegionState(Set(ShardState("s1", Set("e2"))), Set("s2")) - a shouldBe b - a should not be c - } - - "support copy" in { - val original = CurrentShardRegionState(Set(ShardState("s1", Set("e1"))), Set("s2")) - val copied = original.copy(shards = Set(ShardState("s1", Set("e2")))) - copied.shards shouldBe Set(ShardState("s1", Set("e2"))) - copied.failed shouldBe Set("s2") - } - - "support pattern matching" in { - val state = CurrentShardRegionState(Set(ShardState("s1", Set("e1"))), Set("s2")) - state match { - case CurrentShardRegionState(shards) => - shards shouldBe Set(ShardState("s1", Set("e1"))) - } - } - - "expose Java API getShards and getFailed" in { - import scala.jdk.CollectionConverters._ - val state = CurrentShardRegionState(Set(ShardState("s1", Set("e1"))), Set("s2")) - state.getShards().asScala shouldBe Set(ShardState("s1", Set("e1"))) - state.getFailed().asScala shouldBe Set("s2") - } - } -} diff --git a/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/ShardingQueriesSpec.scala b/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/ShardingQueriesSpec.scala index 01dd8006cb3..112b32ef170 100644 --- a/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/ShardingQueriesSpec.scala +++ b/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/ShardingQueriesSpec.scala @@ -27,13 +27,13 @@ class ShardingQueriesSpec extends PekkoSpec { "ShardsQueryResult" must { - def nonEmpty(qr: ShardsQueryResult[?]): Boolean = + def nonEmpty(qr: ShardsQueryResult[_]): Boolean = qr.total > 0 && qr.queried > 0 - def isTotalFailed(qr: ShardsQueryResult[?]): Boolean = + def isTotalFailed(qr: ShardsQueryResult[_]): Boolean = nonEmpty(qr) && qr.failed.size == qr.total - def isAllSubsetFailed(qr: ShardsQueryResult[?]): Boolean = + def isAllSubsetFailed(qr: ShardsQueryResult[_]): Boolean = nonEmpty(qr) && qr.queried < qr.total && qr.failed.size == qr.queried "reflect nothing to acquire metadata from - 0 shards" in { diff --git a/cluster-tools/src/main/java/org/apache/pekko/cluster/client/protobuf/msg/ClusterClientMessages.java b/cluster-tools/src/main/java/org/apache/pekko/cluster/client/protobuf/msg/ClusterClientMessages.java index d612c5febe9..5a8db54105f 100644 --- a/cluster-tools/src/main/java/org/apache/pekko/cluster/client/protobuf/msg/ClusterClientMessages.java +++ b/cluster-tools/src/main/java/org/apache/pekko/cluster/client/protobuf/msg/ClusterClientMessages.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: ClusterClientMessages.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package org.apache.pekko.cluster.client.protobuf.msg; @@ -25,8 +25,8 @@ private ClusterClientMessages() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ClusterClientMessages"); } @@ -80,8 +80,8 @@ public static final class Contacts extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Contacts"); } @@ -168,8 +168,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { int dataSize = 0; for (int i = 0; i < contactPoints_.size(); i++) { @@ -178,15 +183,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getContactPointsList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/cluster-tools/src/main/java/org/apache/pekko/cluster/pubsub/protobuf/msg/DistributedPubSubMessages.java b/cluster-tools/src/main/java/org/apache/pekko/cluster/pubsub/protobuf/msg/DistributedPubSubMessages.java index b96eb35a1cf..a0e72716d56 100644 --- a/cluster-tools/src/main/java/org/apache/pekko/cluster/pubsub/protobuf/msg/DistributedPubSubMessages.java +++ b/cluster-tools/src/main/java/org/apache/pekko/cluster/pubsub/protobuf/msg/DistributedPubSubMessages.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: DistributedPubSubMessages.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package org.apache.pekko.cluster.pubsub.protobuf.msg; @@ -25,8 +25,8 @@ private DistributedPubSubMessages() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "DistributedPubSubMessages"); } @@ -90,8 +90,8 @@ public static final class Status extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Status"); } @@ -163,8 +163,8 @@ public static final class Version extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Version"); } @@ -273,8 +273,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getAddress()); @@ -283,15 +288,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(2, timestamp_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -910,8 +906,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { final int count = versions_.size(); @@ -925,15 +926,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBoolSize(2, replyToStatus_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -1647,8 +1639,8 @@ public static final class Delta extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Delta"); } @@ -1739,8 +1731,8 @@ public static final class Entry extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Entry"); } @@ -1922,8 +1914,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, key_); } @@ -1934,15 +1931,6 @@ private int computeSerializedSize_0() { if (((bitField0_ & 0x00000004) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(3, ref_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2586,8 +2574,8 @@ public static final class Bucket extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Bucket"); } @@ -2747,8 +2735,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getOwner()); @@ -2766,15 +2759,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -3681,8 +3665,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { final int count = buckets_.size(); @@ -3692,15 +3681,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -4392,8 +4372,8 @@ public static final class Address extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Address"); } @@ -4632,8 +4612,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, system_); } @@ -4647,15 +4632,6 @@ private int computeSerializedSize_0() { if (((bitField0_ & 0x00000008) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(4, protocol_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -5408,8 +5384,8 @@ public static final class Send extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Send"); } @@ -5575,8 +5551,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, path_); } @@ -5588,15 +5569,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(3, getPayload()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -6302,8 +6274,8 @@ public static final class SendToAll extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "SendToAll"); } @@ -6469,8 +6441,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, path_); } @@ -6482,15 +6459,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(3, getPayload()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -7185,8 +7153,8 @@ public static final class Publish extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Publish"); } @@ -7326,8 +7294,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, topic_); } @@ -7335,15 +7308,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(3, getPayload()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -7955,8 +7919,8 @@ public static final class SendToOneSubscriber extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "SendToOneSubscriber"); } @@ -8039,21 +8003,17 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream - .computeMessageSize(1, getPayload()); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream + .computeMessageSize(1, getPayload()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -8571,8 +8531,8 @@ public static final class Payload extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Payload"); } @@ -8694,8 +8654,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(1, enclosedMessage_); @@ -8708,15 +8673,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(4, messageManifest_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/cluster-tools/src/main/scala/org/apache/pekko/cluster/client/ClusterClient.scala b/cluster-tools/src/main/scala/org/apache/pekko/cluster/client/ClusterClient.scala index 1b617b9f13e..237b625f04c 100644 --- a/cluster-tools/src/main/scala/org/apache/pekko/cluster/client/ClusterClient.scala +++ b/cluster-tools/src/main/scala/org/apache/pekko/cluster/client/ClusterClient.scala @@ -516,7 +516,7 @@ final class ClusterClient(settings: ClusterClientSettings) extends Actor with Ac else if (contacts.size == 1) initialContactsSel.union(contacts) else contacts if (log.isDebugEnabled) - log.debug("Sending GetContacts to [{}]", sendTo.mkString(",")) + log.debug(s"""Sending GetContacts to [${sendTo.mkString(",")}]""") sendTo.foreach { _ ! GetContacts } } diff --git a/cluster-tools/src/main/scala/org/apache/pekko/cluster/singleton/ClusterSingletonManager.scala b/cluster-tools/src/main/scala/org/apache/pekko/cluster/singleton/ClusterSingletonManager.scala index 6727f883aa4..6a1a2bf6eed 100644 --- a/cluster-tools/src/main/scala/org/apache/pekko/cluster/singleton/ClusterSingletonManager.scala +++ b/cluster-tools/src/main/scala/org/apache/pekko/cluster/singleton/ClusterSingletonManager.scala @@ -219,7 +219,7 @@ object ClusterSingletonManager { case object HandOverDone extends ClusterSingletonMessage /** - * Sent from previous oldest to new oldest to + * Sent from from previous oldest to new oldest to * initiate the normal hand-over process. * Especially useful when new node joins and becomes * oldest immediately, without knowing who was previous @@ -297,10 +297,7 @@ object ClusterSingletonManager { val cluster = Cluster(context.system) // sort by age, oldest first val ageOrdering = Member.ageOrdering - var membersByAge: immutable.SortedSet[Member] = { - implicit val ord: Ordering[Member] = ageOrdering - immutable.SortedSet.empty[Member] - } + var membersByAge: immutable.SortedSet[Member] = immutable.SortedSet.empty(ageOrdering) var changes = Vector.empty[AnyRef] @@ -340,9 +337,8 @@ object ClusterSingletonManager { def handleInitial(state: CurrentClusterState): Unit = { // all members except Joining and WeaklyUp - implicit val ord: Ordering[Member] = ageOrdering membersByAge = immutable.SortedSet - .empty[Member] + .empty(ageOrdering) .union(state.members.filter(m => m.upNumber != Int.MaxValue && matchingRole(m))) // If there is some removal in progress of an older node it's not safe to immediately become oldest, diff --git a/cluster-tools/src/main/scala/org/apache/pekko/cluster/singleton/ClusterSingletonProxy.scala b/cluster-tools/src/main/scala/org/apache/pekko/cluster/singleton/ClusterSingletonProxy.scala index ba001c38a41..d1d2607395b 100644 --- a/cluster-tools/src/main/scala/org/apache/pekko/cluster/singleton/ClusterSingletonProxy.scala +++ b/cluster-tools/src/main/scala/org/apache/pekko/cluster/singleton/ClusterSingletonProxy.scala @@ -182,10 +182,7 @@ final class ClusterSingletonProxy(singletonManagerPath: String, settings: Cluste var singleton: Option[ActorRef] = None // sort by age, oldest first val ageOrdering = Member.ageOrdering - var membersByAge: immutable.SortedSet[Member] = { - implicit val ord: Ordering[Member] = ageOrdering - immutable.SortedSet.empty[Member] - } + var membersByAge: immutable.SortedSet[Member] = immutable.SortedSet.empty(ageOrdering) var buffer: MessageBuffer = MessageBuffer.empty @@ -215,9 +212,8 @@ final class ClusterSingletonProxy(singletonManagerPath: String, settings: Cluste def handleInitial(state: CurrentClusterState): Unit = { trackChange { () => - implicit val ord: Ordering[Member] = ageOrdering membersByAge = immutable.SortedSet - .empty[Member] + .empty(ageOrdering) .union(state.members.collect { case m if m.status == MemberStatus.Up && matchingRole(m) => m }) diff --git a/cluster-typed/src/main/java/org/apache/pekko/cluster/typed/internal/protobuf/ClusterMessages.java b/cluster-typed/src/main/java/org/apache/pekko/cluster/typed/internal/protobuf/ClusterMessages.java index 10a7f370576..82e1d2dd59b 100644 --- a/cluster-typed/src/main/java/org/apache/pekko/cluster/typed/internal/protobuf/ClusterMessages.java +++ b/cluster-typed/src/main/java/org/apache/pekko/cluster/typed/internal/protobuf/ClusterMessages.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: ClusterMessages.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package org.apache.pekko.cluster.typed.internal.protobuf; @@ -25,8 +25,8 @@ private ClusterMessages() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ClusterMessages"); } @@ -94,8 +94,8 @@ public static final class ReceptionistEntry extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ReceptionistEntry"); } @@ -246,8 +246,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, actorRef_); } @@ -259,15 +264,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(3, createdTimestamp_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -835,8 +831,8 @@ public static final class PubSubMessagePublished extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "PubSubMessagePublished"); } @@ -919,21 +915,17 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream - .computeMessageSize(1, getMessage()); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream + .computeMessageSize(1, getMessage()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/cluster-typed/src/main/java/org/apache/pekko/cluster/typed/internal/protobuf/ReliableDelivery.java b/cluster-typed/src/main/java/org/apache/pekko/cluster/typed/internal/protobuf/ReliableDelivery.java index d4ce18d9da8..83eb4e1bf58 100644 --- a/cluster-typed/src/main/java/org/apache/pekko/cluster/typed/internal/protobuf/ReliableDelivery.java +++ b/cluster-typed/src/main/java/org/apache/pekko/cluster/typed/internal/protobuf/ReliableDelivery.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: ReliableDelivery.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package org.apache.pekko.cluster.typed.internal.protobuf; @@ -25,8 +25,8 @@ private ReliableDelivery() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ReliableDelivery"); } @@ -163,8 +163,8 @@ public static final class SequencedMessage extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "SequencedMessage"); } @@ -483,8 +483,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, producerId_); } @@ -515,15 +520,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBoolSize(8, lastChunk_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -1566,8 +1562,8 @@ public static final class RegisterConsumer extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "RegisterConsumer"); } @@ -1670,20 +1666,16 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, consumerControllerRef_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, consumerControllerRef_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2159,8 +2151,8 @@ public static final class Request extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Request"); } @@ -2310,8 +2302,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(1, confirmedSeqNr_); @@ -2328,15 +2325,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBoolSize(4, viaTimeout_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2936,8 +2924,8 @@ public static final class Resend extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Resend"); } @@ -3009,21 +2997,17 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream - .computeInt64Size(1, fromSeqNr_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream + .computeInt64Size(1, fromSeqNr_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -3425,8 +3409,8 @@ public static final class Ack extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Ack"); } @@ -3498,21 +3482,17 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream - .computeInt64Size(1, confirmedSeqNr_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream + .computeInt64Size(1, confirmedSeqNr_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -3973,8 +3953,8 @@ public static final class State extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "State"); } @@ -4174,8 +4154,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(1, currentSeqNr_); @@ -4202,15 +4187,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -5322,8 +5298,8 @@ public static final class Confirmed extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Confirmed"); } @@ -5478,8 +5454,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(1, seqNr_); @@ -5491,15 +5472,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(3, timestamp_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -6150,8 +6122,8 @@ public static final class MessageSent extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "MessageSent"); } @@ -6413,8 +6385,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(1, seqNr_); @@ -6442,15 +6419,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBoolSize(7, lastChunk_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -7394,8 +7362,8 @@ public static final class Cleanup extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Cleanup"); } @@ -7482,8 +7450,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { int dataSize = 0; for (int i = 0; i < qualifiers_.size(); i++) { @@ -7492,15 +7465,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getQualifiersList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/cluster-typed/src/main/scala-3/org/apache/pekko/cluster/typed/internal/receptionist/ClusterReceptionistProtocol.scala b/cluster-typed/src/main/scala-3/org/apache/pekko/cluster/typed/internal/receptionist/ClusterReceptionistProtocol.scala index 5fda7dbf49c..de934f487ee 100644 --- a/cluster-typed/src/main/scala-3/org/apache/pekko/cluster/typed/internal/receptionist/ClusterReceptionistProtocol.scala +++ b/cluster-typed/src/main/scala-3/org/apache/pekko/cluster/typed/internal/receptionist/ClusterReceptionistProtocol.scala @@ -25,7 +25,7 @@ import pekko.annotation.InternalApi private[receptionist] object ClusterReceptionistProtocol { type Aux[P] = AbstractServiceKey { type Protocol = P } - type SubscriptionsKV[K <: Aux[?]] = K match { + type SubscriptionsKV[K <: Aux[_]] = K match { case Aux[t] => ActorRef[ReceptionistMessages.Listing[t]] } } diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/internal/ReplicatorBehavior.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/internal/ReplicatorBehavior.scala index 24debd520da..d245699ca85 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/internal/ReplicatorBehavior.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/internal/ReplicatorBehavior.scala @@ -77,7 +77,7 @@ import pekko.util.Timeout Behaviors .receive[SReplicator.Command] { (ctx, msg) => msg match { - case cmd: SReplicator.Get[?] => + case cmd: SReplicator.Get[_] => classicReplicator.tell(dd.Replicator.Get(cmd.key, cmd.consistency), sender = cmd.replyTo.toClassic) Behaviors.same @@ -102,7 +102,7 @@ import pekko.util.Timeout reply.foreach { cmd.replyTo ! _ } Behaviors.same - case cmd: SReplicator.Update[?] => + case cmd: SReplicator.Update[_] => classicReplicator.tell( dd.Replicator.Update(cmd.key, cmd.writeConsistency, None)(cmd.modify), sender = cmd.replyTo.toClassic) @@ -131,7 +131,7 @@ import pekko.util.Timeout reply.foreach { cmd.replyTo ! _ } Behaviors.same - case cmd: SReplicator.Subscribe[?] => + case cmd: SReplicator.Subscribe[_] => // For the Scala API the SubscribeResponse messages can be sent directly to the subscriber classicReplicator.tell( dd.Replicator.Subscribe(cmd.key, cmd.subscriber.toClassic), @@ -157,13 +157,13 @@ import pekko.util.Timeout case InternalSubscribeResponse(rsp, subscriber) => rsp match { - case chg: dd.Replicator.Changed[?] => subscriber ! JReplicator.Changed(chg.key)(chg.dataValue) - case del: dd.Replicator.Deleted[?] => subscriber ! JReplicator.Deleted(del.key) - case exp: dd.Replicator.Expired[?] => subscriber ! JReplicator.Expired(exp.key) + case chg: dd.Replicator.Changed[_] => subscriber ! JReplicator.Changed(chg.key)(chg.dataValue) + case del: dd.Replicator.Deleted[_] => subscriber ! JReplicator.Deleted(del.key) + case exp: dd.Replicator.Expired[_] => subscriber ! JReplicator.Expired(exp.key) } Behaviors.same - case cmd: SReplicator.Unsubscribe[?] => + case cmd: SReplicator.Unsubscribe[_] => classicReplicator.tell( dd.Replicator.Unsubscribe(cmd.key, cmd.subscriber.toClassic), sender = cmd.subscriber.toClassic) @@ -172,7 +172,7 @@ import pekko.util.Timeout case cmd: JReplicator.Unsubscribe[ReplicatedData] @unchecked => stopSubscribeAdapter(cmd.subscriber) - case cmd: SReplicator.Delete[?] => + case cmd: SReplicator.Delete[_] => classicReplicator.tell(dd.Replicator.Delete(cmd.key, cmd.consistency), sender = cmd.replyTo.toClassic) Behaviors.same diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/javadsl/DistributedData.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/javadsl/DistributedData.scala index 33799cb01ee..622bbc45e27 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/javadsl/DistributedData.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/javadsl/DistributedData.scala @@ -31,9 +31,9 @@ import pekko.cluster.ddata.ReplicatedData import pekko.cluster.ddata.SelfUniqueAddress object DistributedData extends ExtensionId[DistributedData] { - def get(system: ActorSystem[?]): DistributedData = apply(system) + def get(system: ActorSystem[_]): DistributedData = apply(system) - override def createExtension(system: ActorSystem[?]): DistributedData = + override def createExtension(system: ActorSystem[_]): DistributedData = new DistributedDataImpl(system) /** @@ -98,7 +98,7 @@ abstract class DistributedData extends Extension { /** * INTERNAL API */ -@InternalApi private[pekko] class DistributedDataImpl(system: ActorSystem[?]) extends DistributedData { +@InternalApi private[pekko] class DistributedDataImpl(system: ActorSystem[_]) extends DistributedData { override val replicator: ActorRef[Replicator.Command] = pekko.cluster.ddata.typed.scaladsl.DistributedData(system).replicator.narrow[Replicator.Command] @@ -109,7 +109,7 @@ abstract class DistributedData extends Extension { } object DistributedDataSetup { - def apply[T <: Extension](createExtension: ActorSystem[?] => DistributedData): DistributedDataSetup = + def apply[T <: Extension](createExtension: ActorSystem[_] => DistributedData): DistributedDataSetup = new DistributedDataSetup(createExtension(_)) } @@ -119,5 +119,5 @@ object DistributedDataSetup { * to replace the default implementation of the [[DistributedData]] extension. Intended * for tests that need to replace extension with stub/mock implementations. */ -final class DistributedDataSetup(createExtension: java.util.function.Function[ActorSystem[?], DistributedData]) +final class DistributedDataSetup(createExtension: java.util.function.Function[ActorSystem[_], DistributedData]) extends ExtensionSetup[DistributedData](DistributedData, createExtension) diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/javadsl/ReplicatorMessageAdapter.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/javadsl/ReplicatorMessageAdapter.scala index 8fbaa0f835a..3910c3b0882 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/javadsl/ReplicatorMessageAdapter.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/javadsl/ReplicatorMessageAdapter.scala @@ -101,7 +101,7 @@ class ReplicatorMessageAdapter[A, B <: ReplicatedData]( * `responseAdapter` function. * * Note that `createRequest` is a function that creates the `Update` message from the provided - * `ActorRef[UpdateResponse]` that the replicator will send the response message back through. + * `ActorRef[UpdateResponse]` that the the replicator will send the response message back through. * Use that `ActorRef[UpdateResponse]` as the `replyTo` parameter in the `Update` message. */ def askUpdate( @@ -120,7 +120,7 @@ class ReplicatorMessageAdapter[A, B <: ReplicatedData]( * `responseAdapter` function. * * Note that `createRequest` is a function that creates the `Get` message from the provided - * `ActorRef[GetResponse]` that the replicator will send the response message back through. + * `ActorRef[GetResponse]` that the the replicator will send the response message back through. * Use that `ActorRef[GetResponse]` as the `replyTo` parameter in the `Get` message. */ @nowarn @@ -140,7 +140,7 @@ class ReplicatorMessageAdapter[A, B <: ReplicatedData]( * `responseAdapter` function. * * Note that `createRequest` is a function that creates the `Delete` message from the provided - * `ActorRef[DeleteResponse]` that the replicator will send the response message back through. + * `ActorRef[DeleteResponse]` that the the replicator will send the response message back through. * Use that `ActorRef[DeleteResponse]` as the `replyTo` parameter in the `Delete` message. */ def askDelete( @@ -159,7 +159,7 @@ class ReplicatorMessageAdapter[A, B <: ReplicatedData]( * `responseAdapter` function. * * Note that `createRequest` is a function that creates the `GetReplicaCount` message from the provided - * `ActorRef[ReplicaCount]` that the replicator will send the response message back through. + * `ActorRef[ReplicaCount]` that the the replicator will send the response message back through. * Use that `ActorRef[ReplicaCount]` as the `replyTo` parameter in the `GetReplicaCount` message. */ def askReplicaCount( diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/javadsl/ReplicatorSettings.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/javadsl/ReplicatorSettings.scala index d6bbda36471..4b2ca8ceeae 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/javadsl/ReplicatorSettings.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/javadsl/ReplicatorSettings.scala @@ -26,7 +26,7 @@ object ReplicatorSettings { * Create settings from the default configuration * `pekko.cluster.distributed-data`. */ - def create(system: ActorSystem[?]): dd.ReplicatorSettings = + def create(system: ActorSystem[_]): dd.ReplicatorSettings = dd.ReplicatorSettings(system.toClassic) /** diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/scaladsl/DistributedData.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/scaladsl/DistributedData.scala index 74819d18f6e..b0b63f73ce7 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/scaladsl/DistributedData.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/scaladsl/DistributedData.scala @@ -31,9 +31,9 @@ import pekko.cluster.ddata.SelfUniqueAddress import org.slf4j.LoggerFactory object DistributedData extends ExtensionId[DistributedData] { - def get(system: ActorSystem[?]): DistributedData = apply(system) + def get(system: ActorSystem[_]): DistributedData = apply(system) - override def createExtension(system: ActorSystem[?]): DistributedData = + override def createExtension(system: ActorSystem[_]): DistributedData = new DistributedData(system) /** @@ -76,7 +76,7 @@ object DistributedData extends ExtensionId[DistributedData] { * [[pekko.cluster.ddata.DistributedData]] and that means that typed * and classic actors can share the same data. */ -class DistributedData(system: ActorSystem[?]) extends Extension { +class DistributedData(system: ActorSystem[_]) extends Extension { import pekko.actor.typed.scaladsl.adapter._ private val settings: ReplicatorSettings = ReplicatorSettings(system) diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/scaladsl/ReplicatorMessageAdapter.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/scaladsl/ReplicatorMessageAdapter.scala index e30ba2a1fb7..2544515e80d 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/scaladsl/ReplicatorMessageAdapter.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/scaladsl/ReplicatorMessageAdapter.scala @@ -104,7 +104,7 @@ class ReplicatorMessageAdapter[A, B <: ReplicatedData]( * `responseAdapter` function. * * Note that `createRequest` is a function that creates the `Update` message from the provided - * `ActorRef[UpdateResponse]` that the replicator will send the response message back through. + * `ActorRef[UpdateResponse]` that the the replicator will send the response message back through. * Use that `ActorRef[UpdateResponse]` as the `replyTo` parameter in the `Update` message. */ def askUpdate( @@ -123,7 +123,7 @@ class ReplicatorMessageAdapter[A, B <: ReplicatedData]( * `responseAdapter` function. * * Note that `createRequest` is a function that creates the `Get` message from the provided - * `ActorRef[GetResponse]` that the replicator will send the response message back through. + * `ActorRef[GetResponse]` that the the replicator will send the response message back through. * Use that `ActorRef[GetResponse]` as the `replyTo` parameter in the `Get` message. */ def askGet( @@ -141,7 +141,7 @@ class ReplicatorMessageAdapter[A, B <: ReplicatedData]( * `responseAdapter` function. * * Note that `createRequest` is a function that creates the `Delete` message from the provided - * `ActorRef[DeleteResponse]` that the replicator will send the response message back through. + * `ActorRef[DeleteResponse]` that the the replicator will send the response message back through. * Use that `ActorRef[DeleteResponse]` as the `replyTo` parameter in the `Delete` message. */ def askDelete( @@ -160,7 +160,7 @@ class ReplicatorMessageAdapter[A, B <: ReplicatedData]( * `responseAdapter` function. * * Note that `createRequest` is a function that creates the `GetReplicaCount` message from the provided - * `ActorRef[ReplicaCount]` that the replicator will send the response message back through. + * `ActorRef[ReplicaCount]` that the the replicator will send the response message back through. * Use that `ActorRef[ReplicaCount]` as the `replyTo` parameter in the `GetReplicaCount` message. */ def askReplicaCount( diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/scaladsl/ReplicatorSettings.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/scaladsl/ReplicatorSettings.scala index f3718c7dfaa..6931ce3ff50 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/scaladsl/ReplicatorSettings.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/ddata/typed/scaladsl/ReplicatorSettings.scala @@ -30,7 +30,7 @@ object ReplicatorSettings { * Create settings from the default configuration * `pekko.cluster.distributed-data`. */ - def apply(system: ActorSystem[?]): ReplicatorSettings = + def apply(system: ActorSystem[_]): ReplicatorSettings = dd.ReplicatorSettings(system.toClassic) /** @@ -44,6 +44,6 @@ object ReplicatorSettings { * INTERNAL API * The name of the actor used in DistributedData extensions. */ - @InternalApi private[pekko] def name(system: ActorSystem[?]): String = + @InternalApi private[pekko] def name(system: ActorSystem[_]): String = dd.ReplicatorSettings.name(system.toClassic, Some("typed")) } diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/Cluster.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/Cluster.scala index 3ce70078630..2bba6009296 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/Cluster.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/Cluster.scala @@ -213,12 +213,12 @@ case object PrepareForFullClusterShutdown extends PrepareForFullClusterShutdown */ object Cluster extends ExtensionId[Cluster] { - def createExtension(system: ActorSystem[?]): Cluster = new AdapterClusterImpl(system) + def createExtension(system: ActorSystem[_]): Cluster = new AdapterClusterImpl(system) /** * Java API */ - def get(system: ActorSystem[?]): Cluster = apply(system) + def get(system: ActorSystem[_]): Cluster = apply(system) } /** @@ -251,7 +251,7 @@ abstract class Cluster extends Extension { } object ClusterSetup { - def apply[T <: Extension](createExtension: ActorSystem[?] => Cluster): ClusterSetup = + def apply[T <: Extension](createExtension: ActorSystem[_] => Cluster): ClusterSetup = new ClusterSetup(createExtension(_)) } @@ -261,5 +261,5 @@ object ClusterSetup { * to replace the default implementation of the [[Cluster]] extension. Intended * for tests that need to replace extension with stub/mock implementations. */ -final class ClusterSetup(createExtension: java.util.function.Function[ActorSystem[?], Cluster]) +final class ClusterSetup(createExtension: java.util.function.Function[ActorSystem[_], Cluster]) extends ExtensionSetup[Cluster](Cluster, createExtension) diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/ClusterSingleton.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/ClusterSingleton.scala index 1a3b122a6c0..33d620ea75a 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/ClusterSingleton.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/ClusterSingleton.scala @@ -30,13 +30,13 @@ import pekko.coordination.lease.LeaseUsageSettings import com.typesafe.config.Config object ClusterSingletonSettings { - def apply(system: ActorSystem[?]): ClusterSingletonSettings = + def apply(system: ActorSystem[_]): ClusterSingletonSettings = fromConfig(system.settings.config.getConfig("pekko.cluster")) /** * Java API */ - def create(system: ActorSystem[?]): ClusterSingletonSettings = apply(system) + def create(system: ActorSystem[_]): ClusterSingletonSettings = apply(system) def fromConfig(config: Config): ClusterSingletonSettings = { // TODO introduce a config namespace for typed singleton and read that? @@ -134,12 +134,12 @@ final class ClusterSingletonSettings( object ClusterSingleton extends ExtensionId[ClusterSingleton] { - override def createExtension(system: ActorSystem[?]): ClusterSingleton = new AdaptedClusterSingletonImpl(system) + override def createExtension(system: ActorSystem[_]): ClusterSingleton = new AdaptedClusterSingletonImpl(system) /** * Java API: */ - def get(system: ActorSystem[?]): ClusterSingleton = apply(system) + def get(system: ActorSystem[_]): ClusterSingleton = apply(system) } /** @@ -226,7 +226,7 @@ object ClusterSingletonManagerSettings { * Create settings from the default configuration * `pekko.cluster.singleton`. */ - def apply(system: ActorSystem[?]): ClusterSingletonManagerSettings = + def apply(system: ActorSystem[_]): ClusterSingletonManagerSettings = apply(system.settings.config.getConfig("pekko.cluster.singleton")) .withRemovalMargin(pekko.cluster.Cluster(system).downingProvider.downRemovalMargin) @@ -252,7 +252,7 @@ object ClusterSingletonManagerSettings { * Java API: Create settings from the default configuration * `pekko.cluster.singleton`. */ - def create(system: ActorSystem[?]): ClusterSingletonManagerSettings = apply(system) + def create(system: ActorSystem[_]): ClusterSingletonManagerSettings = apply(system) /** * Java API: Create settings from a configuration with the same layout as @@ -324,7 +324,7 @@ final class ClusterSingletonManagerSettings( } object ClusterSingletonSetup { - def apply[T <: Extension](createExtension: ActorSystem[?] => ClusterSingleton): ClusterSingletonSetup = + def apply[T <: Extension](createExtension: ActorSystem[_] => ClusterSingleton): ClusterSingletonSetup = new ClusterSingletonSetup(createExtension(_)) } @@ -334,5 +334,5 @@ object ClusterSingletonSetup { * to replace the default implementation of the [[ClusterSingleton]] extension. Intended * for tests that need to replace extension with stub/mock implementations. */ -final class ClusterSingletonSetup(createExtension: java.util.function.Function[ActorSystem[?], ClusterSingleton]) +final class ClusterSingletonSetup(createExtension: java.util.function.Function[ActorSystem[_], ClusterSingleton]) extends ExtensionSetup[ClusterSingleton](ClusterSingleton, createExtension) diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/AdaptedClusterImpl.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/AdaptedClusterImpl.scala index 7d8974e0934..2f4dd468745 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/AdaptedClusterImpl.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/AdaptedClusterImpl.scala @@ -159,10 +159,10 @@ private[pekko] object AdapterClusterImpl { * INTERNAL API: */ @InternalApi -private[pekko] final class AdapterClusterImpl(system: ActorSystem[?]) extends Cluster { +private[pekko] final class AdapterClusterImpl(system: ActorSystem[_]) extends Cluster { import AdapterClusterImpl._ - require(system.isInstanceOf[ActorSystemAdapter[?]], "only adapted actor systems can be used for cluster features") + require(system.isInstanceOf[ActorSystemAdapter[_]], "only adapted actor systems can be used for cluster features") private val classicCluster = pekko.cluster.Cluster(system) override def selfMember: Member = classicCluster.selfMember diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/AdaptedClusterSingletonImpl.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/AdaptedClusterSingletonImpl.scala index 032400e67d8..6d67d706711 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/AdaptedClusterSingletonImpl.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/AdaptedClusterSingletonImpl.scala @@ -32,9 +32,9 @@ import pekko.cluster.typed.{ Cluster, ClusterSingleton, ClusterSingletonImpl, Cl * INTERNAL API: */ @InternalApi -private[pekko] final class AdaptedClusterSingletonImpl(system: ActorSystem[?]) extends ClusterSingleton { +private[pekko] final class AdaptedClusterSingletonImpl(system: ActorSystem[_]) extends ClusterSingleton { require( - system.isInstanceOf[ActorSystemAdapter[?]], + system.isInstanceOf[ActorSystemAdapter[_]], "only adapted actor systems can be used for the typed cluster singleton") import ClusterSingletonImpl._ @@ -44,7 +44,7 @@ private[pekko] final class AdaptedClusterSingletonImpl(system: ActorSystem[?]) e private lazy val cluster = Cluster(system) private val classicSystem = system.toClassic.asInstanceOf[ExtendedActorSystem] - private val proxies = new ConcurrentHashMap[(String, Option[DataCenter]), ActorRef[?]]() + private val proxies = new ConcurrentHashMap[(String, Option[DataCenter]), ActorRef[_]]() override def init[M](singleton: typed.SingletonActor[M]): ActorRef[M] = { val settings = singleton.settings match { @@ -79,8 +79,8 @@ private[pekko] final class AdaptedClusterSingletonImpl(system: ActorSystem[?]) e } private def getProxy[T](name: String, settings: ClusterSingletonSettings): ActorRef[T] = { - val proxyCreator = new JFunction[(String, Option[DataCenter]), ActorRef[?]] { - def apply(singletonNameAndDc: (String, Option[DataCenter])): ActorRef[?] = { + val proxyCreator = new JFunction[(String, Option[DataCenter]), ActorRef[_]] { + def apply(singletonNameAndDc: (String, Option[DataCenter])): ActorRef[_] = { val (singletonName, _) = singletonNameAndDc val proxyName = s"singletonProxy$singletonName-${settings.dataCenter.getOrElse("no-dc")}" classicSystem.systemActorOf( diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/PekkoClusterTypedSerializer.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/PekkoClusterTypedSerializer.scala index a915bed84d4..7fb850fa184 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/PekkoClusterTypedSerializer.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/PekkoClusterTypedSerializer.scala @@ -43,14 +43,14 @@ private[pekko] final class PekkoClusterTypedSerializer(override val system: Exte override def manifest(o: AnyRef): String = o match { case _: Entry => ReceptionistEntryManifest - case _: TopicImpl.MessagePublished[?] => PubSubPublishManifest + case _: TopicImpl.MessagePublished[_] => PubSubPublishManifest case _ => throw new IllegalArgumentException(s"Can't serialize object of type ${o.getClass} in [${getClass.getName}]") } override def toBinary(o: AnyRef): Array[Byte] = o match { case e: Entry => receptionistEntryToBinary(e) - case m: TopicImpl.MessagePublished[?] => pubSubPublishToBinary(m) + case m: TopicImpl.MessagePublished[_] => pubSubPublishToBinary(m) case _ => throw new IllegalArgumentException(s"Cannot serialize object of type [${o.getClass.getName}]") } @@ -63,7 +63,7 @@ private[pekko] final class PekkoClusterTypedSerializer(override val system: Exte s"Unimplemented deserialization of message with manifest [$manifest] in [${getClass.getName}]") } - private def pubSubPublishToBinary(m: TopicImpl.MessagePublished[?]): Array[Byte] = { + private def pubSubPublishToBinary(m: TopicImpl.MessagePublished[_]): Array[Byte] = { ClusterMessages.PubSubMessagePublished .newBuilder() .setMessage(payloadSupport.payloadBuilder(m.message)) @@ -83,7 +83,7 @@ private[pekko] final class PekkoClusterTypedSerializer(override val system: Exte b.build().toByteArray } - private def pubSubMessageFromBinary(bytes: Array[Byte]): TopicImpl.MessagePublished[?] = { + private def pubSubMessageFromBinary(bytes: Array[Byte]): TopicImpl.MessagePublished[_] = { val parsed = ClusterMessages.PubSubMessagePublished.parseFrom(bytes) val userMessage = payloadSupport.deserializePayload(parsed.getMessage) TopicImpl.MessagePublished(userMessage) diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/delivery/ReliableDeliverySerializer.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/delivery/ReliableDeliverySerializer.scala index 218aef6e96c..52833bab614 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/delivery/ReliableDeliverySerializer.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/delivery/ReliableDeliverySerializer.scala @@ -60,34 +60,34 @@ import pekko.serialization.SerializerWithStringManifest private val DurableQueueCleanupManifest = "i" override def manifest(o: AnyRef): String = o match { - case _: ConsumerController.SequencedMessage[?] => SequencedMessageManifest + case _: ConsumerController.SequencedMessage[_] => SequencedMessageManifest case _: ProducerControllerImpl.Ack => AckManifest case _: ProducerControllerImpl.Request => RequestManifest case _: ProducerControllerImpl.Resend => ResendManifest - case _: ProducerController.RegisterConsumer[?] => RegisterConsumerManifest - case _: DurableProducerQueue.MessageSent[?] => DurableQueueMessageSentManifest + case _: ProducerController.RegisterConsumer[_] => RegisterConsumerManifest + case _: DurableProducerQueue.MessageSent[_] => DurableQueueMessageSentManifest case _: DurableProducerQueue.Confirmed => DurableQueueConfirmedManifest - case _: DurableProducerQueue.State[?] => DurableQueueStateManifest + case _: DurableProducerQueue.State[_] => DurableQueueStateManifest case _: DurableProducerQueue.Cleanup => DurableQueueCleanupManifest case _ => throw new IllegalArgumentException(s"Can't serialize object of type ${o.getClass} in [${getClass.getName}]") } override def toBinary(o: AnyRef): Array[Byte] = o match { - case m: ConsumerController.SequencedMessage[?] => sequencedMessageToBinary(m) + case m: ConsumerController.SequencedMessage[_] => sequencedMessageToBinary(m) case m: ProducerControllerImpl.Ack => ackToBinary(m) case m: ProducerControllerImpl.Request => requestToBinary(m) case m: ProducerControllerImpl.Resend => resendToBinary(m) - case m: ProducerController.RegisterConsumer[?] => registerConsumerToBinary(m) - case m: DurableProducerQueue.MessageSent[?] => durableQueueMessageSentToBinary(m) + case m: ProducerController.RegisterConsumer[_] => registerConsumerToBinary(m) + case m: DurableProducerQueue.MessageSent[_] => durableQueueMessageSentToBinary(m) case m: DurableProducerQueue.Confirmed => durableQueueConfirmedToBinary(m) - case m: DurableProducerQueue.State[?] => durableQueueStateToBinary(m) + case m: DurableProducerQueue.State[_] => durableQueueStateToBinary(m) case m: DurableProducerQueue.Cleanup => durableQueueCleanupToBinary(m) case _ => throw new IllegalArgumentException(s"Cannot serialize object of type [${o.getClass.getName}]") } - private def sequencedMessageToBinary(m: ConsumerController.SequencedMessage[?]): Array[Byte] = { + private def sequencedMessageToBinary(m: ConsumerController.SequencedMessage[_]): Array[Byte] = { val b = ReliableDelivery.SequencedMessage.newBuilder() b.setProducerId(m.producerId) b.setSeqNr(m.seqNr) @@ -136,17 +136,17 @@ import pekko.serialization.SerializerWithStringManifest b.build().toByteArray() } - private def registerConsumerToBinary(m: ProducerController.RegisterConsumer[?]): Array[Byte] = { + private def registerConsumerToBinary(m: ProducerController.RegisterConsumer[_]): Array[Byte] = { val b = ReliableDelivery.RegisterConsumer.newBuilder() b.setConsumerControllerRef(resolver.toSerializationFormat(m.consumerController)) b.build().toByteArray() } - private def durableQueueMessageSentToBinary(m: DurableProducerQueue.MessageSent[?]): Array[Byte] = { + private def durableQueueMessageSentToBinary(m: DurableProducerQueue.MessageSent[_]): Array[Byte] = { durableQueueMessageSentToProto(m).toByteArray() } - private def durableQueueMessageSentToProto(m: DurableProducerQueue.MessageSent[?]): ReliableDelivery.MessageSent = { + private def durableQueueMessageSentToProto(m: DurableProducerQueue.MessageSent[_]): ReliableDelivery.MessageSent = { val b = ReliableDelivery.MessageSent.newBuilder() b.setSeqNr(m.seqNr) b.setQualifier(m.confirmationQualifier) @@ -180,7 +180,7 @@ import pekko.serialization.SerializerWithStringManifest b.build() } - private def durableQueueStateToBinary(m: DurableProducerQueue.State[?]): Array[Byte] = { + private def durableQueueStateToBinary(m: DurableProducerQueue.State[_]): Array[Byte] = { val b = ReliableDelivery.State.newBuilder() b.setCurrentSeqNr(m.currentSeqNr) b.setHighestConfirmedSeqNr(m.highestConfirmedSeqNr) diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/ClusterReceptionist.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/ClusterReceptionist.scala index 474d82ee948..102f3abd009 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/ClusterReceptionist.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/ClusterReceptionist.scala @@ -54,15 +54,15 @@ private[typed] object ClusterReceptionist extends ReceptionistBehaviorProvider { import ClusterReceptionistProtocol.SubscriptionsKV type SubscriptionRegistry = TypedMultiMap[AbstractServiceKey, SubscriptionsKV] - type DDataKey = ORMultiMapKey[ServiceKey[?], Entry] + type DDataKey = ORMultiMapKey[ServiceKey[_], Entry] - final val EmptyORMultiMap = ORMultiMap.empty[ServiceKey[?], Entry] + final val EmptyORMultiMap = ORMultiMap.empty[ServiceKey[_], Entry] override val name = "clusterReceptionist" // values contain system uid to make it possible to discern actors at the same // path in different incarnations of a cluster node - final case class Entry(ref: ActorRef[?], systemUid: Long)(val createdTimestamp: Long) { + final case class Entry(ref: ActorRef[_], systemUid: Long)(val createdTimestamp: Long) { def uniqueAddress(selfAddress: Address): UniqueAddress = if (ref.path.address.hasLocalScope) UniqueAddress(selfAddress, systemUid) else UniqueAddress(ref.path.address, systemUid) @@ -79,7 +79,7 @@ private[typed] object ClusterReceptionist extends ReceptionistBehaviorProvider { private final case class NodeRemoved(addresses: UniqueAddress) extends InternalCommand private final case class NodeUnreachable(addresses: UniqueAddress) extends InternalCommand private final case class NodeReachable(addresses: UniqueAddress) extends InternalCommand - private final case class ChangeFromReplicator(key: DDataKey, value: ORMultiMap[ServiceKey[?], Entry]) + private final case class ChangeFromReplicator(key: DDataKey, value: ORMultiMap[ServiceKey[_], Entry]) extends InternalCommand private case object RemoveTick extends InternalCommand private case object PruneTombstonesTick extends InternalCommand @@ -93,12 +93,12 @@ private[typed] object ClusterReceptionist extends ReceptionistBehaviorProvider { */ final case class State( registry: ShardedServiceRegistry, - servicesPerActor: Map[ActorRef[?], Set[AbstractServiceKey]], - tombstones: Map[ActorRef[?], Set[(AbstractServiceKey, Deadline)]], + servicesPerActor: Map[ActorRef[_], Set[AbstractServiceKey]], + tombstones: Map[ActorRef[_], Set[(AbstractServiceKey, Deadline)]], subscriptions: SubscriptionRegistry) { /** tombstone all services actor is registered for */ - def addTombstone(actor: ActorRef[?], deadline: Deadline): State = { + def addTombstone(actor: ActorRef[_], deadline: Deadline): State = { servicesPerActor.getOrElse(actor, Set.empty).foldLeft(this) { (state, key) => state.addTombstone(actor.asInstanceOf[ActorRef[key.Protocol]], key.asServiceKey, deadline) } @@ -116,7 +116,7 @@ private[typed] object ClusterReceptionist extends ReceptionistBehaviorProvider { def pruneTombstones(): State = { if (tombstones.isEmpty) this else { - val newTombstones: Map[ActorRef[?], Set[(AbstractServiceKey, Deadline)]] = + val newTombstones: Map[ActorRef[_], Set[(AbstractServiceKey, Deadline)]] = tombstones.foldLeft(tombstones) { case (acc, (actorRef, entries)) => val entriesToKeep = entries.filter { @@ -218,10 +218,10 @@ private[typed] object ClusterReceptionist extends ReceptionistBehaviorProvider { // subscribe to changes from other nodes val replicatorMessageAdapter: ActorRef[Replicator.ReplicatorMessage] = ctx.messageAdapter[Replicator.ReplicatorMessage] { - case changed: Replicator.Changed[?] @unchecked => + case changed: Replicator.Changed[_] @unchecked => ChangeFromReplicator( changed.key.asInstanceOf[DDataKey], - changed.dataValue.asInstanceOf[ORMultiMap[ServiceKey[?], Entry]]) + changed.dataValue.asInstanceOf[ORMultiMap[ServiceKey[_], Entry]]) case _ => throw new IllegalArgumentException() // compiler exhaustiveness check pleaser } diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/ClusterReceptionistSettings.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/ClusterReceptionistSettings.scala index c775cf8b847..b0f41a38a75 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/ClusterReceptionistSettings.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/ClusterReceptionistSettings.scala @@ -32,7 +32,7 @@ import com.typesafe.config.Config */ @InternalApi private[pekko] object ClusterReceptionistSettings { - def apply(system: ActorSystem[?]): ClusterReceptionistSettings = + def apply(system: ActorSystem[_]): ClusterReceptionistSettings = apply(system.settings.config.getConfig("pekko.cluster.typed.receptionist")) def apply(config: Config): ClusterReceptionistSettings = { diff --git a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/Registry.scala b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/Registry.scala index 4693a550ff7..3f96258eade 100644 --- a/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/Registry.scala +++ b/cluster-typed/src/main/scala/org/apache/pekko/cluster/typed/internal/receptionist/Registry.scala @@ -28,7 +28,7 @@ import pekko.cluster.typed.internal.receptionist.ClusterReceptionist.{ DDataKey, @InternalApi private[pekko] object ShardedServiceRegistry { def apply(numberOfKeys: Int): ShardedServiceRegistry = { val emptyRegistries = (0 until numberOfKeys).map { n => - val key = ORMultiMapKey[ServiceKey[?], Entry](s"ReceptionistKey_$n") + val key = ORMultiMapKey[ServiceKey[_], Entry](s"ReceptionistKey_$n") key -> new ServiceRegistry(EmptyORMultiMap) }.toMap new ShardedServiceRegistry(emptyRegistries, Set.empty, Set.empty) @@ -53,10 +53,10 @@ import pekko.cluster.typed.internal.receptionist.ClusterReceptionist.{ DDataKey, def allDdataKeys: Iterable[DDataKey] = keys - def ddataKeyFor(serviceKey: ServiceKey[?]): DDataKey = + def ddataKeyFor(serviceKey: ServiceKey[_]): DDataKey = keys(math.abs(serviceKey.id.hashCode() % serviceRegistries.size)) - def allServices: Iterator[(ServiceKey[?], Set[Entry])] = + def allServices: Iterator[(ServiceKey[_], Set[Entry])] = serviceRegistries.valuesIterator.flatMap(_.entries.entries) def allEntries: Iterator[Entry] = allServices.flatMap(_._2) @@ -113,7 +113,7 @@ import pekko.cluster.typed.internal.receptionist.ClusterReceptionist.{ DDataKey, /** * INTERNAL API */ -@InternalApi private[pekko] final case class ServiceRegistry(entries: ORMultiMap[ServiceKey[?], Entry]) extends AnyVal { +@InternalApi private[pekko] final case class ServiceRegistry(entries: ORMultiMap[ServiceKey[_], Entry]) extends AnyVal { // let's hide all the ugly casts we can in here def actorRefsFor[T](key: AbstractServiceKey): Set[ActorRef[key.Protocol]] = @@ -122,7 +122,7 @@ import pekko.cluster.typed.internal.receptionist.ClusterReceptionist.{ DDataKey, def entriesFor(key: AbstractServiceKey): Set[Entry] = entries.getOrElse(key.asServiceKey, Set.empty[Entry]) - def keysFor(address: UniqueAddress)(implicit node: SelfUniqueAddress): Set[ServiceKey[?]] = + def keysFor(address: UniqueAddress)(implicit node: SelfUniqueAddress): Set[ServiceKey[_]] = entries.entries.collect { case (key, entries) if entries.exists(_.uniqueAddress(node.uniqueAddress.address) == address) => key @@ -144,7 +144,7 @@ import pekko.cluster.typed.internal.receptionist.ClusterReceptionist.{ DDataKey, } } - def toORMultiMap: ORMultiMap[ServiceKey[?], Entry] = entries + def toORMultiMap: ORMultiMap[ServiceKey[_], Entry] = entries } diff --git a/cluster-typed/src/test/java/jdocs/org/apache/pekko/cluster/typed/SingletonCompileOnlyTest.java b/cluster-typed/src/test/java/jdocs/org/apache/pekko/cluster/typed/SingletonCompileOnlyTest.java index 3a2519563ad..3b3f6831ddd 100644 --- a/cluster-typed/src/test/java/jdocs/org/apache/pekko/cluster/typed/SingletonCompileOnlyTest.java +++ b/cluster-typed/src/test/java/jdocs/org/apache/pekko/cluster/typed/SingletonCompileOnlyTest.java @@ -85,7 +85,6 @@ private Behavior onGoodByCounter() { return this; } } - // #counter ActorSystem system = ActorSystem.create(Behaviors.empty(), "SingletonExample"); diff --git a/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/BasicClusterExampleSpec.scala b/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/BasicClusterExampleSpec.scala index 7625095790a..e994ba5f920 100644 --- a/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/BasicClusterExampleSpec.scala +++ b/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/BasicClusterExampleSpec.scala @@ -67,7 +67,7 @@ pekko { """).withFallback(configSystem1) def illustrateJoinSeedNodes(): Unit = { - val system: ActorSystem[?] = ??? + val system: ActorSystem[_] = ??? // #join-seed-nodes import pekko.actor.Address @@ -82,15 +82,15 @@ pekko { } object Backend { - def apply(): Behavior[?] = Behaviors.empty + def apply(): Behavior[_] = Behaviors.empty } object Frontend { - def apply(): Behavior[?] = Behaviors.empty + def apply(): Behavior[_] = Behaviors.empty } def illustrateRoles(): Unit = { - val context: ActorContext[?] = ??? + val context: ActorContext[_] = ??? // #hasRole val selfMember = Cluster(context.system).selfMember @@ -104,7 +104,7 @@ pekko { @nowarn("msg=never used") def illustrateDcAccess(): Unit = { - val system: ActorSystem[?] = ??? + val system: ActorSystem[_] = ??? // #dcAccess val cluster = Cluster(system) diff --git a/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/DistributedPubSubExample.scala b/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/DistributedPubSubExample.scala index 2b63a1e22fb..ca85cb8b58f 100644 --- a/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/DistributedPubSubExample.scala +++ b/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/DistributedPubSubExample.scala @@ -306,13 +306,13 @@ object DistributedPubSubExample { pekko.loggers = ["org.apache.pekko.testkit.TestEventListener"] """) - def createCluster(nodes: List[ActorSystem[?]]): Unit = { - val clusterUp = (nodes: List[ActorSystem[?]], expected: Int) => + def createCluster(nodes: List[ActorSystem[_]]): Unit = { + val clusterUp = (nodes: List[ActorSystem[_]], expected: Int) => nodes.forall { s => Cluster(s).state.members.count(_.status == MemberStatus.up) == expected } - val awaitClusterUp = (nodes: List[ActorSystem[?]], expected: Int) => + val awaitClusterUp = (nodes: List[ActorSystem[_]], expected: Int) => while (!clusterUp(nodes, expected)) { Thread.sleep(1000) } diff --git a/cluster-typed/src/test/scala/org/apache/pekko/cluster/typed/GroupRouterSpec.scala b/cluster-typed/src/test/scala/org/apache/pekko/cluster/typed/GroupRouterSpec.scala index 5eba65cfcaf..9c64b806181 100644 --- a/cluster-typed/src/test/scala/org/apache/pekko/cluster/typed/GroupRouterSpec.scala +++ b/cluster-typed/src/test/scala/org/apache/pekko/cluster/typed/GroupRouterSpec.scala @@ -49,7 +49,7 @@ object GroupRouterSpec { """) object PingActor { - case class Pong(workerActor: ActorRef[?]) extends CborSerializable + case class Pong(workerActor: ActorRef[_]) extends CborSerializable case class Ping(replyTo: ActorRef[Pong]) extends CborSerializable def apply(): Behavior[Ping] = Behaviors.receive { @@ -61,8 +61,8 @@ object GroupRouterSpec { object Pinger { sealed trait Command - private case class SawPong(worker: ActorRef[?]) extends Command - case class DonePinging(pongs: Int, uniqueWorkers: Set[ActorRef[?]]) + private case class SawPong(worker: ActorRef[_]) extends Command + case class DonePinging(pongs: Int, uniqueWorkers: Set[ActorRef[_]]) def apply( router: ActorRef[PingActor.Ping], requestedPings: Int, @@ -73,7 +73,7 @@ object GroupRouterSpec { } (0 to requestedPings).foreach(_ => router ! PingActor.Ping(pongAdapter)) var pongs = 0 - var uniqueWorkers = Set.empty[ActorRef[?]] + var uniqueWorkers = Set.empty[ActorRef[_]] Behaviors.receiveMessage { case SawPong(worker) => diff --git a/cluster/src/main/java/org/apache/pekko/cluster/protobuf/msg/ClusterMessages.java b/cluster/src/main/java/org/apache/pekko/cluster/protobuf/msg/ClusterMessages.java index 55e793583f3..78a22837381 100644 --- a/cluster/src/main/java/org/apache/pekko/cluster/protobuf/msg/ClusterMessages.java +++ b/cluster/src/main/java/org/apache/pekko/cluster/protobuf/msg/ClusterMessages.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: ClusterMessages.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package org.apache.pekko.cluster.protobuf.msg; @@ -25,8 +25,8 @@ private ClusterMessages() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ClusterMessages"); } @@ -67,8 +67,8 @@ public enum ReachabilityStatus org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ReachabilityStatus"); } @@ -210,8 +210,8 @@ public enum MemberStatus org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "MemberStatus"); } @@ -409,8 +409,8 @@ public static final class Join extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Join"); } @@ -588,8 +588,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getNode()); @@ -605,15 +610,6 @@ private int computeSerializedSize_0() { if (((bitField0_ & 0x00000002) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(3, appVersion_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -1375,8 +1371,8 @@ public static final class Welcome extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Welcome"); } @@ -1496,8 +1492,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getFrom()); @@ -1506,15 +1507,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getGossip()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2179,8 +2171,8 @@ public static final class InitJoin extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "InitJoin"); } @@ -2279,20 +2271,16 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, currentConfig_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, currentConfig_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2753,8 +2741,8 @@ public static final class InitJoinAck extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "InitJoinAck"); } @@ -2874,8 +2862,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getAddress()); @@ -2884,15 +2877,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getConfigCheck()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -3563,8 +3547,8 @@ public static final class ConfigCheck extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ConfigCheck"); } @@ -3618,8 +3602,8 @@ public enum Type org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Type"); } @@ -3803,8 +3787,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeEnumSize(1, type_); @@ -3812,15 +3801,6 @@ private int computeSerializedSize_0() { if (((bitField0_ & 0x00000002) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(2, clusterConfig_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -4356,8 +4336,8 @@ public static final class Heartbeat extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Heartbeat"); } @@ -4484,8 +4464,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getFrom()); @@ -4498,15 +4483,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeSInt64Size(3, creationTime_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -5163,8 +5139,8 @@ public static final class HeartBeatResponse extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "HeartBeatResponse"); } @@ -5291,8 +5267,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getFrom()); @@ -5305,15 +5286,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(3, creationTime_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -5972,8 +5944,8 @@ public static final class GossipEnvelope extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "GossipEnvelope"); } @@ -6120,8 +6092,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getFrom()); @@ -6134,15 +6111,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(3, serializedGossip_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -6921,8 +6889,8 @@ public static final class GossipStatus extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "GossipStatus"); } @@ -7107,8 +7075,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getFrom()); @@ -7129,15 +7102,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(4, seenDigest_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -8162,8 +8126,8 @@ public static final class Gossip extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Gossip"); } @@ -8562,8 +8526,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { final int count = allAddresses_.size(); @@ -8623,15 +8592,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getAllAppVersionsList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -10671,8 +10631,8 @@ public static final class GossipOverview extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "GossipOverview"); } @@ -10813,8 +10773,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { int dataSize = 0; for (int i = 0; i < seen_.size(); i++) { @@ -10833,15 +10798,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -11672,8 +11628,8 @@ public static final class ObserverReachability extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ObserverReachability"); } @@ -11822,8 +11778,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt32Size(1, addressIndex_); @@ -11841,15 +11802,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(4, version_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -12645,8 +12597,8 @@ public static final class SubjectReachability extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "SubjectReachability"); } @@ -12770,8 +12722,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt32Size(1, addressIndex_); @@ -12784,15 +12741,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(4, version_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -13333,8 +13281,8 @@ public static final class Tombstone extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Tombstone"); } @@ -13432,8 +13380,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt32Size(1, addressIndex_); @@ -13442,15 +13395,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(2, timestamp_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -13964,8 +13908,8 @@ public static final class Member extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Member"); } @@ -14150,8 +14094,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt32Size(1, addressIndex_); @@ -14182,15 +14131,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt32Size(5, appVersionIndex_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -14945,8 +14885,8 @@ public static final class VectorClock extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "VectorClock"); } @@ -15014,8 +14954,8 @@ public static final class Version extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Version"); } @@ -15113,8 +15053,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt32Size(1, hashIndex_); @@ -15123,15 +15068,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(2, timestamp_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -15660,8 +15596,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(1, timestamp_); @@ -15675,15 +15616,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -16399,8 +16331,8 @@ public static final class Empty extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Empty"); } @@ -16445,6 +16377,7 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu throws java.io.IOException { getUnknownFields().writeTo(output); } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; @@ -16830,8 +16763,8 @@ public static final class Address extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Address"); } @@ -17070,8 +17003,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, system_); } @@ -17085,15 +17023,6 @@ private int computeSerializedSize_0() { if (((bitField0_ & 0x00000008) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(4, protocol_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -17848,8 +17777,8 @@ public static final class UniqueAddress extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "UniqueAddress"); } @@ -17988,8 +17917,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getAddress()); @@ -18002,15 +17936,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeUInt32Size(3, uid2_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -18668,8 +18593,8 @@ public static final class ClusterRouterPool extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ClusterRouterPool"); } @@ -18789,8 +18714,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getPool()); @@ -18799,15 +18729,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getSettings()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -19484,8 +19405,8 @@ public static final class Pool extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Pool"); } @@ -19641,8 +19562,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeUInt32Size(1, serializerId_); @@ -19654,15 +19580,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(3, data_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -20291,8 +20208,8 @@ public static final class ClusterRouterPoolSettings extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ClusterRouterPoolSettings"); } @@ -20511,8 +20428,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeUInt32Size(1, totalInstances_); @@ -20536,15 +20458,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getUseRolesList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/cluster/src/main/scala/org/apache/pekko/cluster/Cluster.scala b/cluster/src/main/scala/org/apache/pekko/cluster/Cluster.scala index 2a13a1a4553..40ccac57116 100644 --- a/cluster/src/main/scala/org/apache/pekko/cluster/Cluster.scala +++ b/cluster/src/main/scala/org/apache/pekko/cluster/Cluster.scala @@ -270,7 +270,7 @@ class Cluster(val system: ExtendedActorSystem) extends Extension { * A snapshot of [[pekko.cluster.ClusterEvent.CurrentClusterState]] * will be sent to the subscriber as the first message. */ - @varargs def subscribe(subscriber: ActorRef, to: Class[?]*): Unit = + @varargs def subscribe(subscriber: ActorRef, to: Class[_]*): Unit = subscribe(subscriber, initialStateMode = InitialStateAsSnapshot, to: _*) /** @@ -288,7 +288,7 @@ class Cluster(val system: ExtendedActorSystem) extends Extension { * * Note that for large clusters it is more efficient to use `InitialStateAsSnapshot`. */ - @varargs def subscribe(subscriber: ActorRef, initialStateMode: SubscriptionInitialStateMode, to: Class[?]*): Unit = { + @varargs def subscribe(subscriber: ActorRef, initialStateMode: SubscriptionInitialStateMode, to: Class[_]*): Unit = { require(to.length > 0, "at least one `ClusterDomainEvent` class is required") require( to.forall(classOf[ClusterDomainEvent].isAssignableFrom), @@ -307,7 +307,7 @@ class Cluster(val system: ExtendedActorSystem) extends Extension { * Unsubscribe to a specific type of cluster domain events, * matching previous `subscribe` registration. */ - def unsubscribe(subscriber: ActorRef, to: Class[?]): Unit = + def unsubscribe(subscriber: ActorRef, to: Class[_]): Unit = clusterCore ! InternalClusterAction.Unsubscribe(subscriber, Some(to)) /** @@ -452,7 +452,7 @@ class Cluster(val system: ExtendedActorSystem) extends Extension { /** * The supplied thunk will be run, once, when current cluster member is `Removed`. * If the cluster has already been shutdown the thunk will run on the caller thread immediately. - * If this is called "at the same time" as `shutdown()` there is a possibility that the thunk + * If this is called "at the same time" as `shutdown()` there is a possibility that the the thunk * is not invoked. It's often better to use [[pekko.actor.CoordinatedShutdown]] for this purpose. */ def registerOnMemberRemoved[T](code: => T): Unit = @@ -461,7 +461,7 @@ class Cluster(val system: ExtendedActorSystem) extends Extension { /** * Java API: The supplied thunk will be run, once, when current cluster member is `Removed`. * If the cluster has already been shutdown the thunk will run on the caller thread immediately. - * If this is called "at the same time" as `shutdown()` there is a possibility that the thunk + * If this is called "at the same time" as `shutdown()` there is a possibility that the the thunk * is not invoked. It's often better to use [[pekko.actor.CoordinatedShutdown]] for this purpose. */ def registerOnMemberRemoved(callback: Runnable): Unit = { diff --git a/cluster/src/main/scala/org/apache/pekko/cluster/ClusterDaemon.scala b/cluster/src/main/scala/org/apache/pekko/cluster/ClusterDaemon.scala index 081b8c42163..3bc92fde56a 100644 --- a/cluster/src/main/scala/org/apache/pekko/cluster/ClusterDaemon.scala +++ b/cluster/src/main/scala/org/apache/pekko/cluster/ClusterDaemon.scala @@ -192,9 +192,9 @@ private[cluster] object InternalClusterAction { final case class AddOnMemberRemovedListener(callback: Runnable) extends NoSerializationVerificationNeeded sealed trait SubscriptionMessage - final case class Subscribe(subscriber: ActorRef, initialStateMode: SubscriptionInitialStateMode, to: Set[Class[?]]) + final case class Subscribe(subscriber: ActorRef, initialStateMode: SubscriptionInitialStateMode, to: Set[Class[_]]) extends SubscriptionMessage - final case class Unsubscribe(subscriber: ActorRef, to: Option[Class[?]]) + final case class Unsubscribe(subscriber: ActorRef, to: Option[Class[_]]) extends SubscriptionMessage with DeadLetterSuppression diff --git a/cluster/src/main/scala/org/apache/pekko/cluster/ClusterEvent.scala b/cluster/src/main/scala/org/apache/pekko/cluster/ClusterEvent.scala index 48559f31955..c8daba849f1 100644 --- a/cluster/src/main/scala/org/apache/pekko/cluster/ClusterEvent.scala +++ b/cluster/src/main/scala/org/apache/pekko/cluster/ClusterEvent.scala @@ -705,7 +705,7 @@ private[cluster] final class ClusterDomainEventPublisher receiver ! state } - def subscribe(subscriber: ActorRef, initMode: SubscriptionInitialStateMode, to: Set[Class[?]]): Unit = { + def subscribe(subscriber: ActorRef, initMode: SubscriptionInitialStateMode, to: Set[Class[_]]): Unit = { initMode match { case InitialStateAsEvents => def pub(event: AnyRef): Unit = { @@ -720,7 +720,7 @@ private[cluster] final class ClusterDomainEventPublisher to.foreach { eventStream.subscribe(subscriber, _) } } - def unsubscribe(subscriber: ActorRef, to: Option[Class[?]]): Unit = to match { + def unsubscribe(subscriber: ActorRef, to: Option[Class[_]]): Unit = to match { case None => eventStream.unsubscribe(subscriber) case Some(c) => eventStream.unsubscribe(subscriber, c) } diff --git a/cluster/src/main/scala/org/apache/pekko/cluster/CrossDcClusterHeartbeat.scala b/cluster/src/main/scala/org/apache/pekko/cluster/CrossDcClusterHeartbeat.scala index fde60828f0f..2d6ba5a23a0 100644 --- a/cluster/src/main/scala/org/apache/pekko/cluster/CrossDcClusterHeartbeat.scala +++ b/cluster/src/main/scala/org/apache/pekko/cluster/CrossDcClusterHeartbeat.scala @@ -333,10 +333,7 @@ private[cluster] final case class CrossDcHeartbeatingState( private[cluster] object CrossDcHeartbeatingState { /** Sorted by age */ - private def emptyMembersSortedSet: immutable.SortedSet[Member] = { - implicit val ord: Ordering[Member] = Member.ageOrdering - immutable.SortedSet.empty[Member] - } + private def emptyMembersSortedSet: immutable.SortedSet[Member] = immutable.SortedSet.empty[Member](Member.ageOrdering) // Since we need ordering of oldests guaranteed, we must only look at Up (or Leaving, Exiting...) nodes def atLeastInUpState(m: Member): Boolean = @@ -359,8 +356,7 @@ private[cluster] object CrossDcHeartbeatingState { // we need to enforce the ageOrdering for the SortedSet in each DC groupedByDc.map { case (dc, ms) => - implicit val ord: Ordering[Member] = Member.ageOrdering - dc -> immutable.SortedSet.empty[Member].union(ms) + dc -> immutable.SortedSet.empty[Member](Member.ageOrdering).union(ms) } } }) diff --git a/cluster/src/main/scala/org/apache/pekko/cluster/MembershipState.scala b/cluster/src/main/scala/org/apache/pekko/cluster/MembershipState.scala index 02662adf0d4..2a56bbeb3d6 100644 --- a/cluster/src/main/scala/org/apache/pekko/cluster/MembershipState.scala +++ b/cluster/src/main/scala/org/apache/pekko/cluster/MembershipState.scala @@ -128,7 +128,6 @@ import pekko.cluster.MemberStatus._ * @return Up to `crossDcConnections` oldest members for each DC */ lazy val ageSortedTopOldestMembersPerDc: Map[DataCenter, immutable.SortedSet[Member]] = { - implicit val ord: Ordering[Member] = Member.ageOrdering latestGossip.members.foldLeft(Map.empty[DataCenter, immutable.SortedSet[Member]]) { (acc, member) => acc.get(member.dataCenter) match { case Some(set) => @@ -142,7 +141,7 @@ import pekko.cluster.MemberStatus._ } } case None => - acc + (member.dataCenter -> (immutable.SortedSet.empty[Member] + member)) + acc + (member.dataCenter -> (immutable.SortedSet.empty(Member.ageOrdering) + member)) } } } diff --git a/cluster/src/main/scala/org/apache/pekko/cluster/Reachability.scala b/cluster/src/main/scala/org/apache/pekko/cluster/Reachability.scala index c2816da4f99..3df1f913f94 100644 --- a/cluster/src/main/scala/org/apache/pekko/cluster/Reachability.scala +++ b/cluster/src/main/scala/org/apache/pekko/cluster/Reachability.scala @@ -28,8 +28,8 @@ private[cluster] object Reachability { new Reachability(records, versions) def create(records: immutable.Seq[Record], versions: Map[UniqueAddress, Long]): Reachability = records match { - case r: (immutable.IndexedSeq[Record] @unchecked) => apply(r, versions) - case _ => apply(records.toVector, versions) + case r: immutable.IndexedSeq[Record] => apply(r, versions) + case _ => apply(records.toVector, versions) } @SerialVersionUID(1L) diff --git a/cluster/src/main/scala/org/apache/pekko/cluster/sbr/DowningStrategy.scala b/cluster/src/main/scala/org/apache/pekko/cluster/sbr/DowningStrategy.scala index 8f781cb27e3..4de96915bf0 100644 --- a/cluster/src/main/scala/org/apache/pekko/cluster/sbr/DowningStrategy.scala +++ b/cluster/src/main/scala/org/apache/pekko/cluster/sbr/DowningStrategy.scala @@ -85,10 +85,7 @@ import pekko.coordination.lease.scaladsl.Lease protected def ordering: Ordering[Member] = Member.ordering // all members in self DC, both joining and up. - private var _allMembers: immutable.SortedSet[Member] = { - implicit val ord: Ordering[Member] = ordering - immutable.SortedSet.empty[Member] - } + private var _allMembers: immutable.SortedSet[Member] = immutable.SortedSet.empty(ordering) def role: Option[String] @@ -395,7 +392,7 @@ import pekko.coordination.lease.scaladsl.Lease * INTERNAL API * * Down the unreachable nodes if the current node is in the majority part based the last known - * membership information. Otherwise down the reachable nodes, i.e. the own part. If the + * membership information. Otherwise down the reachable nodes, i.e. the own part. If the the * parts are of equal size the part containing the node with the lowest address is kept. * * If the `role` is defined the decision is based only on members with that `role`. diff --git a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/SurviveNetworkInstabilitySpec.scala b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/SurviveNetworkInstabilitySpec.scala index ef1d35c6054..980985de8ed 100644 --- a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/SurviveNetworkInstabilitySpec.scala +++ b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/SurviveNetworkInstabilitySpec.scala @@ -103,7 +103,7 @@ abstract class SurviveNetworkInstabilitySpec private val remoteSettings = RARP(system).provider.remoteSettings @nowarn - def quarantinedEventClass: Class[?] = + def quarantinedEventClass: Class[_] = if (remoteSettings.Artery.Enabled) classOf[QuarantinedEvent] else diff --git a/cluster/src/test/scala/org/apache/pekko/cluster/JoinConfigCompatCheckerSpec.scala b/cluster/src/test/scala/org/apache/pekko/cluster/JoinConfigCompatCheckerSpec.scala index 9677f2d4599..086a42f1e7d 100644 --- a/cluster/src/test/scala/org/apache/pekko/cluster/JoinConfigCompatCheckerSpec.scala +++ b/cluster/src/test/scala/org/apache/pekko/cluster/JoinConfigCompatCheckerSpec.scala @@ -234,7 +234,7 @@ class JoinConfigCompatCheckerSpec extends PekkoSpec with ClusterTestKit { "be allowed to join a cluster when its configuration is incompatible but it's configured to NOT enforce it" taggedAs LongRunningTest in { // this config is NOT compatible with the cluster config, - // but node will ignore the config check and join anyway + // but node will ignore the the config check and join anyway val joinNodeConfig = ConfigFactory.parseString(""" pekko.cluster { @@ -523,7 +523,7 @@ class JoinConfigCompatCheckerSpec extends PekkoSpec with ClusterTestKit { "be allowed to re-join a cluster when its configuration is incompatible but it's configured to NOT enforce it" taggedAs LongRunningTest in { // this config is NOT compatible with the cluster config, - // but node will ignore the config check and join anyway + // but node will ignore the the config check and join anyway val joinNodeConfig = ConfigFactory.parseString(""" pekko.cluster { diff --git a/cluster/src/test/scala/org/apache/pekko/cluster/ReachabilityPerfSpec.scala b/cluster/src/test/scala/org/apache/pekko/cluster/ReachabilityPerfSpec.scala index 14d5198a6b7..471fb7f8a57 100644 --- a/cluster/src/test/scala/org/apache/pekko/cluster/ReachabilityPerfSpec.scala +++ b/cluster/src/test/scala/org/apache/pekko/cluster/ReachabilityPerfSpec.scala @@ -92,7 +92,7 @@ class ReachabilityPerfSpec extends AnyWordSpec with Matchers { private def recordsFrom(r1: Reachability): Unit = { r1.allObservers.foreach { o => - r1.recordsFrom(o) should not be null + r1.recordsFrom(o) should not be be(null) } } diff --git a/coordination/src/main/scala/org/apache/pekko/coordination/lease/scaladsl/LeaseProvider.scala b/coordination/src/main/scala/org/apache/pekko/coordination/lease/scaladsl/LeaseProvider.scala index ddf770a7fbf..22c9e20484f 100644 --- a/coordination/src/main/scala/org/apache/pekko/coordination/lease/scaladsl/LeaseProvider.scala +++ b/coordination/src/main/scala/org/apache/pekko/coordination/lease/scaladsl/LeaseProvider.scala @@ -116,7 +116,7 @@ final class LeaseProvider(system: ExtendedActorSystem) extends Extension { s case Failure(_: NoSuchMethodException) => dynamicAccess.createInstanceFor[T](fqcn, immutable.Seq((classOf[LeaseSettings], leaseSettings))) - case f: Failure[?] => + case f: Failure[_] => f } diff --git a/discovery/src/main/scala/org/apache/pekko/discovery/ServiceDiscovery.scala b/discovery/src/main/scala/org/apache/pekko/discovery/ServiceDiscovery.scala index a6eeda88305..9f372b67c46 100644 --- a/discovery/src/main/scala/org/apache/pekko/discovery/ServiceDiscovery.scala +++ b/discovery/src/main/scala/org/apache/pekko/discovery/ServiceDiscovery.scala @@ -21,10 +21,9 @@ import java.util.concurrent.TimeUnit import scala.collection.immutable import scala.concurrent.Future import scala.concurrent.duration.FiniteDuration +import scala.jdk.OptionConverters._ import scala.jdk.DurationConverters._ import scala.jdk.FutureConverters._ -import scala.jdk.OptionConverters._ - import org.apache.pekko import pekko.actor.{ DeadLetterSuppression, NoSerializationVerificationNeeded } import pekko.util.HashCode diff --git a/discovery/src/test/scala/org/apache/pekko/discovery/dns/DnsDiscoverySpec.scala b/discovery/src/test/scala/org/apache/pekko/discovery/dns/DnsDiscoverySpec.scala index 75f22052309..73a9115c27f 100644 --- a/discovery/src/test/scala/org/apache/pekko/discovery/dns/DnsDiscoverySpec.scala +++ b/discovery/src/test/scala/org/apache/pekko/discovery/dns/DnsDiscoverySpec.scala @@ -115,7 +115,7 @@ class DnsDiscoverySpec extends DockerBindDnsService(DnsDiscoverySpec.config) { } "be using its own resolver" in { - // future will fail if it doesn't exist + // future will fail if it it doesn't exist system.actorSelection("/system/SD-DNS/async-dns").resolveOne(2.seconds).futureValue } diff --git a/distributed-data/src/main/java/org/apache/pekko/cluster/ddata/protobuf/msg/ReplicatedDataMessages.java b/distributed-data/src/main/java/org/apache/pekko/cluster/ddata/protobuf/msg/ReplicatedDataMessages.java index fb46f73eb39..8e901486068 100644 --- a/distributed-data/src/main/java/org/apache/pekko/cluster/ddata/protobuf/msg/ReplicatedDataMessages.java +++ b/distributed-data/src/main/java/org/apache/pekko/cluster/ddata/protobuf/msg/ReplicatedDataMessages.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: ReplicatedDataMessages.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package org.apache.pekko.cluster.ddata.protobuf.msg; @@ -25,8 +25,8 @@ private ReplicatedDataMessages() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ReplicatedDataMessages"); } @@ -62,8 +62,8 @@ public enum ORSetDeltaOp org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ORSetDeltaOp"); } @@ -180,8 +180,8 @@ public enum ORMapDeltaOp org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ORMapDeltaOp"); } @@ -416,8 +416,8 @@ public static final class GSet extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "GSet"); } @@ -690,8 +690,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { int dataSize = 0; for (int i = 0; i < stringElements_.size(); i++) { @@ -745,15 +750,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getActorRefElementsList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2097,8 +2093,8 @@ public static final class ORSet extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ORSet"); } @@ -2460,8 +2456,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getVvector()); @@ -2528,15 +2529,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getActorRefElementsList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -4214,8 +4206,8 @@ public static final class ORSetDeltaGroup extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ORSetDeltaGroup"); } @@ -4287,8 +4279,8 @@ public static final class Entry extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Entry"); } @@ -4397,8 +4389,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeEnumSize(1, operation_); @@ -4407,15 +4404,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getUnderlying()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -5016,8 +5004,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { final int count = entries_.size(); @@ -5027,15 +5020,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -5671,8 +5655,8 @@ public static final class Flag extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Flag"); } @@ -5744,21 +5728,17 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream - .computeBoolSize(1, enabled_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream + .computeBoolSize(1, enabled_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -6182,8 +6162,8 @@ public static final class LWWRegister extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "LWWRegister"); } @@ -6329,8 +6309,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeSInt64Size(1, timestamp_); @@ -6343,15 +6328,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(3, getState()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -7079,8 +7055,8 @@ public static final class GCounter extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "GCounter"); } @@ -7152,8 +7128,8 @@ public static final class Entry extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Entry"); } @@ -7263,8 +7239,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getNode()); @@ -7273,15 +7254,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(2, value_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -7876,8 +7848,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { final int count = entries_.size(); @@ -7887,15 +7864,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -8550,8 +8518,8 @@ public static final class PNCounter extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "PNCounter"); } @@ -8671,8 +8639,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getIncrements()); @@ -8681,15 +8654,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getDecrements()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -9366,8 +9330,8 @@ public static final class ORMap extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ORMap"); } @@ -9482,8 +9446,8 @@ public static final class Entry extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Entry"); } @@ -9698,8 +9662,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, stringKey_); } @@ -9719,15 +9688,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(5, getOtherKey()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -10681,8 +10641,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getKeys()); @@ -10696,15 +10661,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -11519,8 +11475,8 @@ public static final class ORMapDeltaGroup extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ORMapDeltaGroup"); } @@ -11635,8 +11591,8 @@ public static final class MapEntry extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "MapEntry"); } @@ -11849,8 +11805,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, stringKey_); } @@ -11870,15 +11831,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(5, getOtherKey()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -12804,8 +12756,8 @@ public static final class Entry extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Entry"); } @@ -12991,8 +12943,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeEnumSize(1, operation_); @@ -13014,15 +12971,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -13999,8 +13947,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { final int count = entries_.size(); @@ -14010,15 +13963,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -14682,8 +14626,8 @@ public static final class LWWMap extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "LWWMap"); } @@ -14798,8 +14742,8 @@ public static final class Entry extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Entry"); } @@ -15014,8 +14958,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, stringKey_); } @@ -15035,15 +14984,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(5, getOtherKey()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -15997,8 +15937,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getKeys()); @@ -16012,15 +15957,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -16850,8 +16786,8 @@ public static final class PNCounterMap extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "PNCounterMap"); } @@ -16966,8 +16902,8 @@ public static final class Entry extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Entry"); } @@ -17182,8 +17118,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, stringKey_); } @@ -17203,15 +17144,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(5, getOtherKey()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -18165,8 +18097,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getKeys()); @@ -18180,15 +18117,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -19029,8 +18957,8 @@ public static final class ORMultiMap extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ORMultiMap"); } @@ -19145,8 +19073,8 @@ public static final class Entry extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Entry"); } @@ -19361,8 +19289,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, stringKey_); } @@ -19382,15 +19315,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(5, getOtherKey()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -20366,8 +20290,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getKeys()); @@ -20385,15 +20314,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBoolSize(3, withValueDeltas_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/distributed-data/src/main/java/org/apache/pekko/cluster/ddata/protobuf/msg/ReplicatorMessages.java b/distributed-data/src/main/java/org/apache/pekko/cluster/ddata/protobuf/msg/ReplicatorMessages.java index ce8ec7d51e5..7603c1a49be 100644 --- a/distributed-data/src/main/java/org/apache/pekko/cluster/ddata/protobuf/msg/ReplicatorMessages.java +++ b/distributed-data/src/main/java/org/apache/pekko/cluster/ddata/protobuf/msg/ReplicatorMessages.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: ReplicatorMessages.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package org.apache.pekko.cluster.ddata.protobuf.msg; @@ -25,8 +25,8 @@ private ReplicatorMessages() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ReplicatorMessages"); } @@ -129,8 +129,8 @@ public static final class Get extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Get"); } @@ -344,8 +344,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getKey()); @@ -370,15 +375,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt32Size(6, consistencyAdditional_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -1314,8 +1310,8 @@ public static final class GetSuccess extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "GetSuccess"); } @@ -1470,8 +1466,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getKey()); @@ -1484,15 +1485,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(4, getRequest()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2317,8 +2309,8 @@ public static final class NotFound extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "NotFound"); } @@ -2436,8 +2428,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getKey()); @@ -2446,15 +2443,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getRequest()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -3121,8 +3109,8 @@ public static final class GetFailure extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "GetFailure"); } @@ -3240,8 +3228,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getKey()); @@ -3250,15 +3243,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getRequest()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -3927,8 +3911,8 @@ public static final class Subscribe extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Subscribe"); } @@ -4068,8 +4052,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getKey()); @@ -4077,15 +4066,6 @@ private int computeSerializedSize_0() { if (((bitField0_ & 0x00000002) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(2, ref_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -4704,8 +4684,8 @@ public static final class Unsubscribe extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Unsubscribe"); } @@ -4845,8 +4825,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getKey()); @@ -4854,15 +4839,6 @@ private int computeSerializedSize_0() { if (((bitField0_ & 0x00000002) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(2, ref_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -5479,8 +5455,8 @@ public static final class Changed extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Changed"); } @@ -5600,8 +5576,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getKey()); @@ -5610,15 +5591,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getData()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -6303,8 +6275,8 @@ public static final class Write extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Write"); } @@ -6479,8 +6451,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, key_); } @@ -6492,15 +6469,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(3, getFromNode()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -7244,8 +7212,8 @@ public static final class Empty extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Empty"); } @@ -7290,6 +7258,7 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu throws java.io.IOException { getUnknownFields().writeTo(output); } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; @@ -7635,8 +7604,8 @@ public static final class Read extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Read"); } @@ -7774,8 +7743,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, key_); } @@ -7783,15 +7757,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getFromNode()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -8392,8 +8357,8 @@ public static final class ReadResult extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ReadResult"); } @@ -8474,21 +8439,17 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream - .computeMessageSize(1, getEnvelope()); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream + .computeMessageSize(1, getEnvelope()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -9021,8 +8982,8 @@ public static final class DataEnvelope extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "DataEnvelope"); } @@ -9144,8 +9105,8 @@ public static final class PruningEntry extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "PruningEntry"); } @@ -9364,8 +9325,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getRemovedAddress()); @@ -9391,15 +9357,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeSInt64Size(5, obsoleteTime_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -10600,8 +10557,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getData()); @@ -10619,15 +10581,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(3, getDeltaVersions()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -11643,8 +11596,8 @@ public static final class Status extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Status"); } @@ -11729,8 +11682,8 @@ public static final class Entry extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Entry"); } @@ -11882,8 +11835,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, key_); } @@ -11895,15 +11853,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeSInt64Size(3, usedTimestamp_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -12602,8 +12551,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeUInt32Size(1, chunk_); @@ -12629,15 +12583,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeSFixed64Size(5, fromSystemUid_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -13577,8 +13522,8 @@ public static final class Gossip extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Gossip"); } @@ -13667,8 +13612,8 @@ public static final class Entry extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Entry"); } @@ -13830,8 +13775,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, key_); } @@ -13843,15 +13793,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeSInt64Size(3, usedTimestamp_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -14622,8 +14563,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBoolSize(1, sendBack_); @@ -14645,15 +14591,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeSFixed64Size(4, fromSystemUid_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -15530,8 +15467,8 @@ public static final class DeltaPropagation extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "DeltaPropagation"); } @@ -15639,8 +15576,8 @@ public static final class Entry extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Entry"); } @@ -15836,8 +15773,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, key_); } @@ -15853,15 +15795,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(4, toSeqNr_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -16711,8 +16644,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getFromNode()); @@ -16730,15 +16668,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBoolSize(3, reply_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -17653,8 +17582,8 @@ public static final class UniqueAddress extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "UniqueAddress"); } @@ -17793,8 +17722,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getAddress()); @@ -17807,15 +17741,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeSFixed32Size(3, uid2_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -18466,8 +18391,8 @@ public static final class Address extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Address"); } @@ -18596,8 +18521,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, hostname_); } @@ -18605,15 +18535,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeUInt32Size(2, port_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -19126,8 +19047,8 @@ public static final class VersionVector extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "VersionVector"); } @@ -19199,8 +19120,8 @@ public static final class Entry extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Entry"); } @@ -19309,8 +19230,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getNode()); @@ -19319,15 +19245,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(2, version_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -19923,8 +19840,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { final int count = entries_.size(); @@ -19934,15 +19856,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -20600,8 +20513,8 @@ public static final class OtherMessage extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "OtherMessage"); } @@ -20723,8 +20636,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(1, enclosedMessage_); @@ -20737,15 +20655,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(4, messageManifest_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -21279,8 +21188,8 @@ public static final class StringGSet extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "StringGSet"); } @@ -21367,8 +21276,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { int dataSize = 0; for (int i = 0; i < elements_.size(); i++) { @@ -21377,15 +21291,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getElementsList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -21877,8 +21782,8 @@ public static final class DurableDataEnvelope extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "DurableDataEnvelope"); } @@ -22012,8 +21917,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getData()); @@ -22027,15 +21937,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/distributed-data/src/main/scala-3/org/apache/pekko/cluster/ddata/GSet.scala b/distributed-data/src/main/scala-3/org/apache/pekko/cluster/ddata/GSet.scala index 18fc1eab663..d1804b5ca5e 100644 --- a/distributed-data/src/main/scala-3/org/apache/pekko/cluster/ddata/GSet.scala +++ b/distributed-data/src/main/scala-3/org/apache/pekko/cluster/ddata/GSet.scala @@ -52,7 +52,7 @@ final case class GSet[A] private (elements: Set[A])(override val delta: Option[G * Java API */ def getElements(): java.util.Set[A] = { - import scala.jdk.CollectionConverters.* + import scala.jdk.CollectionConverters._ elements.asJava } @@ -79,8 +79,8 @@ final case class GSet[A] private (elements: Set[A])(override val delta: Option[G } override def merge(that: GSet[A]): GSet[A] = - if (this eq that) || that.isAncestorOf(this) then this.clearAncestor() - else if this.isAncestorOf(that) then that.clearAncestor() + if ((this eq that) || that.isAncestorOf(this)) this.clearAncestor() + else if (this.isAncestorOf(that)) that.clearAncestor() else { clearAncestor() new GSet[A](elements.union(that.elements))(None) @@ -91,7 +91,7 @@ final case class GSet[A] private (elements: Set[A])(override val delta: Option[G override def zero: GSet[A] = GSet.empty override def resetDelta: GSet[A] = - if delta.isEmpty then this + if (delta.isEmpty) this else assignAncestor(new GSet[A](elements)(None)) override def toString: String = s"G$elements" diff --git a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/Key.scala b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/Key.scala index fecf115914b..7891b7aeabd 100644 --- a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/Key.scala +++ b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/Key.scala @@ -20,7 +20,7 @@ object Key { /** * Extract the [[Key#id]]. */ - def unapply(k: Key[?]): Option[String] = Some(k.id) + def unapply(k: Key[_]): Option[String] = Some(k.id) private[pekko] type KeyR = Key[ReplicatedData] @@ -44,7 +44,7 @@ abstract class Key[+T <: ReplicatedData](val id: Key.KeyId) extends Serializable UnspecificKey(newId) override final def equals(o: Any): Boolean = o match { - case k: Key[?] => id == k.id + case k: Key[_] => id == k.id case _ => false } diff --git a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/LWWMap.scala b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/LWWMap.scala index b95439beab6..8d029ec2f60 100644 --- a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/LWWMap.scala +++ b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/LWWMap.scala @@ -174,7 +174,7 @@ final class LWWMap[A, B] private[pekko] (private[pekko] val underlying: ORMap[A, override def toString: String = s"LWW$entries" // e.g. LWWMap(a -> 1, b -> 2) override def equals(o: Any): Boolean = o match { - case other: LWWMap[?, ?] => underlying == other.underlying + case other: LWWMap[_, _] => underlying == other.underlying case _ => false } diff --git a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/LWWRegister.scala b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/LWWRegister.scala index d9f4b341aed..9224591d4f2 100644 --- a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/LWWRegister.scala +++ b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/LWWRegister.scala @@ -182,7 +182,7 @@ final class LWWRegister[A] private[pekko] (private[pekko] val node: UniqueAddres override def toString: String = s"LWWRegister($value)" override def equals(o: Any): Boolean = o match { - case other: LWWRegister[?] => + case other: LWWRegister[_] => timestamp == other.timestamp && value == other.value && node == other.node case _ => false } diff --git a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORMap.scala b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORMap.scala index db9a5e4499c..1070ee3e638 100644 --- a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORMap.scala +++ b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORMap.scala @@ -69,7 +69,7 @@ object ORMap { def zeroTag: ZeroTag override def zero: DeltaReplicatedData = zeroTag.zero override def merge(that: DeltaOp): DeltaOp = that match { - case other: AtomicDeltaOp[?, ?] => DeltaGroup(Vector(this, other)) + case other: AtomicDeltaOp[_, _] => DeltaGroup(Vector(this, other)) case DeltaGroup(ops) => DeltaGroup(this +: ops) } override def deltaSize: Int = 1 @@ -83,9 +83,9 @@ object ORMap { zeroTag: ZeroTag) extends AtomicDeltaOp[A, B] { override def merge(that: DeltaOp): DeltaOp = that match { - case put: PutDeltaOp[?, ?] if this.value._1 == put.value._1 => + case put: PutDeltaOp[_, _] if this.value._1 == put.value._1 => new PutDeltaOp[A, B](this.underlying.merge(put.underlying), put.asInstanceOf[PutDeltaOp[A, B]].value, zeroTag) - case update: UpdateDeltaOp[?, ?] + case update: UpdateDeltaOp[_, _] if update.values.size == 1 && update.asInstanceOf[UpdateDeltaOp[A, B]].values.contains(this.value._1) => val (key, elem1) = this.value val newValue = elem1 match { @@ -97,7 +97,7 @@ object ORMap { (key, elem1.merge(elem2).asInstanceOf[B]) } new PutDeltaOp[A, B](this.underlying.merge(update.underlying), newValue, zeroTag) - case other: AtomicDeltaOp[?, ?] => DeltaGroup(Vector(this, other)) + case other: AtomicDeltaOp[_, _] => DeltaGroup(Vector(this, other)) case DeltaGroup(ops) => DeltaGroup(this +: ops) } } @@ -110,7 +110,7 @@ object ORMap { zeroTag: ZeroTag) extends AtomicDeltaOp[A, B] { override def merge(that: DeltaOp): DeltaOp = that match { - case update: UpdateDeltaOp[?, ?] => + case update: UpdateDeltaOp[_, _] => new UpdateDeltaOp[A, B]( this.underlying.merge(update.underlying), update.asInstanceOf[UpdateDeltaOp[A, B]].values.foldLeft(this.values) { (map, pair) => @@ -122,10 +122,10 @@ object ORMap { } else map + pair }, zeroTag) - case put: PutDeltaOp[?, ?] + case put: PutDeltaOp[_, _] if this.values.size == 1 && this.values.contains(put.asInstanceOf[PutDeltaOp[A, B]].value._1) => new PutDeltaOp[A, B](this.underlying.merge(put.underlying), put.asInstanceOf[PutDeltaOp[A, B]].value, zeroTag) - case other: AtomicDeltaOp[?, ?] => DeltaGroup(Vector(this, other)) + case other: AtomicDeltaOp[_, _] => DeltaGroup(Vector(this, other)) case DeltaGroup(ops) => DeltaGroup(this +: ops) } } @@ -151,18 +151,18 @@ object ORMap { extends DeltaOp with ReplicatedDeltaSize { override def merge(that: DeltaOp): DeltaOp = that match { - case that: AtomicDeltaOp[?, ?] => + case that: AtomicDeltaOp[_, _] => ops.last match { - case thisPut: PutDeltaOp[?, ?] => + case thisPut: PutDeltaOp[_, _] => val merged = thisPut.merge(that) merged match { - case op: AtomicDeltaOp[?, ?] => DeltaGroup(ops.dropRight(1) :+ op) + case op: AtomicDeltaOp[_, _] => DeltaGroup(ops.dropRight(1) :+ op) case DeltaGroup(thatOps) => DeltaGroup(ops.dropRight(1) ++ thatOps) } - case thisUpdate: UpdateDeltaOp[?, ?] => + case thisUpdate: UpdateDeltaOp[_, _] => val merged = thisUpdate.merge(that) merged match { - case op: AtomicDeltaOp[?, ?] => DeltaGroup(ops.dropRight(1) :+ op) + case op: AtomicDeltaOp[_, _] => DeltaGroup(ops.dropRight(1) :+ op) case DeltaGroup(thatOps) => DeltaGroup(ops.dropRight(1) ++ thatOps) } case _ => DeltaGroup(ops :+ that) @@ -256,7 +256,7 @@ final class ORMap[A, B <: ReplicatedData] private[pekko] ( * INTERNAL API */ @InternalApi private[pekko] def put(node: UniqueAddress, key: A, value: B): ORMap[A, B] = - if (value.isInstanceOf[ORSet[?]] && values.contains(key)) + if (value.isInstanceOf[ORSet[_]] && values.contains(key)) throw new IllegalArgumentException( "`ORMap.put` must not be used to replace an existing `ORSet` " + "value, because important history can be lost when replacing the `ORSet` and " + @@ -415,24 +415,24 @@ final class ORMap[A, B <: ReplicatedData] private[pekko] ( } val processDelta: PartialFunction[ORMap.DeltaOp, Unit] = { - case putOp: PutDeltaOp[?, ?] => + case putOp: PutDeltaOp[_, _] => val keyDelta = putOp.underlying mergedKeys = mergedKeys.mergeDelta(keyDelta) mergedValues = mergedValues + putOp .asInstanceOf[PutDeltaOp[A, B]] .value // put is destructive and propagates only full values of B! - case removeOp: RemoveDeltaOp[?, ?] => + case removeOp: RemoveDeltaOp[_, _] => val removedKey = removeOp.underlying match { // if op is RemoveDeltaOp then it must have exactly one element in the elements - case op: ORSet.RemoveDeltaOp[?] => op.underlying.elements.head.asInstanceOf[A] + case op: ORSet.RemoveDeltaOp[_] => op.underlying.elements.head.asInstanceOf[A] case _ => throw new IllegalArgumentException("ORMap.RemoveDeltaOp must contain ORSet.RemoveDeltaOp inside") } mergedValues = mergedValues - removedKey mergedKeys = mergedKeys.mergeDelta(removeOp.underlying) // please note that if RemoveDeltaOp is not preceded by update clearing the value // anomalies may result - case removeKeyOp: RemoveKeyDeltaOp[?, ?] => + case removeKeyOp: RemoveKeyDeltaOp[_, _] => // removeKeyOp tombstones values for later use if (mergedValues.contains(removeKeyOp.asInstanceOf[RemoveKeyDeltaOp[A, B]].removedKey)) { tombstonedVals = tombstonedVals + @@ -442,7 +442,7 @@ final class ORMap[A, B <: ReplicatedData] private[pekko] ( } mergedValues = mergedValues - removeKeyOp.asInstanceOf[RemoveKeyDeltaOp[A, B]].removedKey mergedKeys = mergedKeys.mergeDelta(removeKeyOp.underlying) - case updateOp: UpdateDeltaOp[?, ?] => + case updateOp: UpdateDeltaOp[_, _] => mergedKeys = mergedKeys.mergeDelta(updateOp.underlying) updateOp.asInstanceOf[UpdateDeltaOp[A, B]].values.foreach { case (key, value) => @@ -542,7 +542,7 @@ final class ORMap[A, B <: ReplicatedData] private[pekko] ( override def toString: String = s"OR$entries" override def equals(o: Any): Boolean = o match { - case other: ORMap[?, ?] => keys == other.keys && values == other.values + case other: ORMap[_, _] => keys == other.keys && values == other.values case _ => false } diff --git a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORMultiMap.scala b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORMultiMap.scala index 9068ee4249f..a582d84d3e3 100644 --- a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORMultiMap.scala +++ b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORMultiMap.scala @@ -316,7 +316,7 @@ final class ORMultiMap[A, B] private[pekko] ( override def toString: String = s"ORMulti$entries" override def equals(o: Any): Boolean = o match { - case other: ORMultiMap[?, ?] => underlying == other.underlying + case other: ORMultiMap[_, _] => underlying == other.underlying case _ => false } diff --git a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORSet.scala b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORSet.scala index 37510f72673..59212fa6a0a 100644 --- a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORSet.scala +++ b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/ORSet.scala @@ -89,7 +89,7 @@ object ORSet { // Note that we only merge deltas originating from the same node AddDeltaOp( new ORSet(concatElementsMap(u.elementsMap.asInstanceOf[Map[A, Dot]]), underlying.vvector.merge(u.vvector))) - case _: AtomicDeltaOp[?] => DeltaGroup(Vector(this, that)) + case _: AtomicDeltaOp[_] => DeltaGroup(Vector(this, that)) case DeltaGroup(ops) => DeltaGroup(this +: ops) } @@ -108,7 +108,7 @@ object ORSet { throw new IllegalArgumentException(s"RemoveDeltaOp should contain one removed element, but was $underlying") override def merge(that: DeltaOp): DeltaOp = that match { - case _: AtomicDeltaOp[?] => DeltaGroup(Vector(this, that)) // keep it simple for removals + case _: AtomicDeltaOp[_] => DeltaGroup(Vector(this, that)) // keep it simple for removals case DeltaGroup(ops) => DeltaGroup(this +: ops) } } @@ -116,7 +116,7 @@ object ORSet { /** INTERNAL API: Used for `clear` but could be used for other cases also */ @InternalApi private[pekko] final case class FullStateDeltaOp[A](underlying: ORSet[A]) extends AtomicDeltaOp[A] { override def merge(that: DeltaOp): DeltaOp = that match { - case _: AtomicDeltaOp[?] => DeltaGroup(Vector(this, that)) + case _: AtomicDeltaOp[_] => DeltaGroup(Vector(this, that)) case DeltaGroup(ops) => DeltaGroup(this +: ops) } } @@ -128,10 +128,10 @@ object ORSet { extends DeltaOp with ReplicatedDeltaSize { override def merge(that: DeltaOp): DeltaOp = that match { - case thatAdd: AddDeltaOp[?] => + case thatAdd: AddDeltaOp[_] => // merge AddDeltaOp into last AddDeltaOp in the group, if possible ops.last match { - case thisAdd: AddDeltaOp[?] => DeltaGroup(ops.dropRight(1) :+ thisAdd.merge(thatAdd)) + case thisAdd: AddDeltaOp[_] => DeltaGroup(ops.dropRight(1) :+ thisAdd.merge(thatAdd)) case _ => DeltaGroup(ops :+ thatAdd) } case DeltaGroup(thatOps) => DeltaGroup(ops ++ thatOps) @@ -363,7 +363,7 @@ final class ORSet[A] private[pekko] ( val newDelta = delta match { case None => ORSet.AddDeltaOp(new ORSet(Map(element -> newDot), newDot)) - case Some(existing: ORSet.AddDeltaOp[?]) => + case Some(existing: ORSet.AddDeltaOp[_]) => existing.merge(ORSet.AddDeltaOp(new ORSet(Map(element -> newDot), newDot))) case Some(d) => d.merge(ORSet.AddDeltaOp(new ORSet(Map(element -> newDot), newDot))) @@ -461,18 +461,18 @@ final class ORSet[A] private[pekko] ( override def mergeDelta(thatDelta: ORSet.DeltaOp): ORSet[A] = { thatDelta match { - case d: ORSet.AddDeltaOp[?] => dryMerge(d.asInstanceOf[ORSet.AddDeltaOp[A]].underlying, addDeltaOp = true) - case d: ORSet.RemoveDeltaOp[?] => mergeRemoveDelta(d.asInstanceOf[ORSet.RemoveDeltaOp[A]]) - case d: ORSet.FullStateDeltaOp[?] => + case d: ORSet.AddDeltaOp[_] => dryMerge(d.asInstanceOf[ORSet.AddDeltaOp[A]].underlying, addDeltaOp = true) + case d: ORSet.RemoveDeltaOp[_] => mergeRemoveDelta(d.asInstanceOf[ORSet.RemoveDeltaOp[A]]) + case d: ORSet.FullStateDeltaOp[_] => dryMerge(d.asInstanceOf[ORSet.FullStateDeltaOp[A]].underlying, addDeltaOp = false) case ORSet.DeltaGroup(ops) => ops.foldLeft(this) { - case (acc, op: ORSet.AddDeltaOp[?]) => + case (acc, op: ORSet.AddDeltaOp[_]) => acc.dryMerge(op.asInstanceOf[ORSet.AddDeltaOp[A]].underlying, addDeltaOp = true) - case (acc, op: ORSet.RemoveDeltaOp[?]) => acc.mergeRemoveDelta(op.asInstanceOf[ORSet.RemoveDeltaOp[A]]) - case (acc, op: ORSet.FullStateDeltaOp[?]) => + case (acc, op: ORSet.RemoveDeltaOp[_]) => acc.mergeRemoveDelta(op.asInstanceOf[ORSet.RemoveDeltaOp[A]]) + case (acc, op: ORSet.FullStateDeltaOp[_]) => acc.dryMerge(op.asInstanceOf[ORSet.FullStateDeltaOp[A]].underlying, addDeltaOp = false) - case (_, _: ORSet.DeltaGroup[?]) => + case (_, _: ORSet.DeltaGroup[_]) => throw new IllegalArgumentException("ORSet.DeltaGroup should not be nested") } } @@ -557,7 +557,7 @@ final class ORSet[A] private[pekko] ( override def toString: String = s"OR$elements" override def equals(o: Any): Boolean = o match { - case other: ORSet[?] => vvector == other.vvector && elementsMap == other.elementsMap + case other: ORSet[_] => vvector == other.vvector && elementsMap == other.elementsMap case _ => false } diff --git a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/PNCounterMap.scala b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/PNCounterMap.scala index 7293264ceaa..56d96bf0f93 100644 --- a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/PNCounterMap.scala +++ b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/PNCounterMap.scala @@ -176,7 +176,7 @@ final class PNCounterMap[A] private[pekko] (private[pekko] val underlying: ORMap override def toString: String = s"PNCounter$entries" override def equals(o: Any): Boolean = o match { - case other: PNCounterMap[?] => underlying == other.underlying + case other: PNCounterMap[_] => underlying == other.underlying case _ => false } diff --git a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/Replicator.scala b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/Replicator.scala index 35393c4cb74..45f910393d7 100644 --- a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/Replicator.scala +++ b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/Replicator.scala @@ -1101,7 +1101,7 @@ object Replicator { * * For good introduction to the CRDT subject watch the * Eventually Consistent Data Structures - * talk by Sean Cribbs and the + * talk by Sean Cribbs and and the * talk by Mark Shapiro * and read the excellent paper * A comprehensive study of Convergent and Commutative Replicated Data Types @@ -1374,10 +1374,7 @@ final class Replicator(settings: ReplicatorSettings) extends Actor with ActorLog // cluster members sorted by age, oldest first,, doesn't contain selfAddress, doesn't contain joining and weaklyUp // only used when prefer-oldest is enabled - var membersByAge: immutable.SortedSet[Member] = { - implicit val ord: Ordering[Member] = Member.ageOrdering - immutable.SortedSet.empty[Member] - } + var membersByAge: immutable.SortedSet[Member] = immutable.SortedSet.empty(Member.ageOrdering) // cluster weaklyUp nodes, doesn't contain selfAddress var weaklyUpNodes: immutable.SortedSet[UniqueAddress] = immutable.SortedSet.empty @@ -1396,10 +1393,7 @@ final class Replicator(settings: ReplicatorSettings) extends Actor with ActorLog var removedNodes: Map[UniqueAddress, Long] = Map.empty // all nodes sorted with the leader first - var leader: TreeSet[Member] = { - implicit val ord: Ordering[Member] = Member.leaderStatusOrdering - TreeSet.empty[Member] - } + var leader: TreeSet[Member] = TreeSet.empty(Member.leaderStatusOrdering) def isLeader: Boolean = leader.nonEmpty && leader.head.address == selfAddress && leader.head.status == MemberStatus.Up @@ -2770,10 +2764,10 @@ final class Replicator(settings: ReplicatorSettings) extends Actor with ActorLog // Try again with the full state sender() ! writeMsg - case _: Replicator.UpdateSuccess[?] => + case _: Replicator.UpdateSuccess[_] => gotLocalStoreReply = true if (isDone) reply(isTimeout = false) - case _: Replicator.StoreFailure[?] => + case _: Replicator.StoreFailure[_] => gotLocalStoreReply = true gotWriteNackFrom += selfUniqueAddress.address if (isDone) reply(isTimeout = false) diff --git a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/protobuf/ReplicatedDataSerializer.scala b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/protobuf/ReplicatedDataSerializer.scala index 39619435ed2..6496dab09fe 100644 --- a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/protobuf/ReplicatedDataSerializer.scala +++ b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/protobuf/ReplicatedDataSerializer.scala @@ -341,68 +341,68 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) UnspecificKeyManifest -> (bytes => Key.UnspecificKey(keyIdFromBinary(bytes)))) override def manifest(obj: AnyRef): String = obj match { - case _: ORSet[?] => ORSetManifest - case _: ORSet.AddDeltaOp[?] => ORSetAddManifest - case _: ORSet.RemoveDeltaOp[?] => ORSetRemoveManifest - case _: GSet[?] => GSetManifest + case _: ORSet[_] => ORSetManifest + case _: ORSet.AddDeltaOp[_] => ORSetAddManifest + case _: ORSet.RemoveDeltaOp[_] => ORSetRemoveManifest + case _: GSet[_] => GSetManifest case _: GCounter => GCounterManifest case _: PNCounter => PNCounterManifest case _: Flag => FlagManifest - case _: LWWRegister[?] => LWWRegisterManifest - case _: ORMap[?, ?] => ORMapManifest - case _: ORMap.PutDeltaOp[?, ?] => ORMapPutManifest - case _: ORMap.RemoveDeltaOp[?, ?] => ORMapRemoveManifest - case _: ORMap.RemoveKeyDeltaOp[?, ?] => ORMapRemoveKeyManifest - case _: ORMap.UpdateDeltaOp[?, ?] => ORMapUpdateManifest - case _: LWWMap[?, ?] => LWWMapManifest - case _: PNCounterMap[?] => PNCounterMapManifest - case _: ORMultiMap[?, ?] => ORMultiMapManifest + case _: LWWRegister[_] => LWWRegisterManifest + case _: ORMap[_, _] => ORMapManifest + case _: ORMap.PutDeltaOp[_, _] => ORMapPutManifest + case _: ORMap.RemoveDeltaOp[_, _] => ORMapRemoveManifest + case _: ORMap.RemoveKeyDeltaOp[_, _] => ORMapRemoveKeyManifest + case _: ORMap.UpdateDeltaOp[_, _] => ORMapUpdateManifest + case _: LWWMap[_, _] => LWWMapManifest + case _: PNCounterMap[_] => PNCounterMapManifest + case _: ORMultiMap[_, _] => ORMultiMapManifest case DeletedData => DeletedDataManifest case _: VersionVector => VersionVectorManifest - case _: ORSetKey[?] => ORSetKeyManifest - case _: GSetKey[?] => GSetKeyManifest + case _: ORSetKey[_] => ORSetKeyManifest + case _: GSetKey[_] => GSetKeyManifest case _: GCounterKey => GCounterKeyManifest case _: PNCounterKey => PNCounterKeyManifest case _: FlagKey => FlagKeyManifest - case _: LWWRegisterKey[?] => LWWRegisterKeyManifest - case _: ORMapKey[?, ?] => ORMapKeyManifest - case _: LWWMapKey[?, ?] => LWWMapKeyManifest - case _: PNCounterMapKey[?] => PNCounterMapKeyManifest - case _: ORMultiMapKey[?, ?] => ORMultiMapKeyManifest + case _: LWWRegisterKey[_] => LWWRegisterKeyManifest + case _: ORMapKey[_, _] => ORMapKeyManifest + case _: LWWMapKey[_, _] => LWWMapKeyManifest + case _: PNCounterMapKey[_] => PNCounterMapKeyManifest + case _: ORMultiMapKey[_, _] => ORMultiMapKeyManifest case _: Key.UnspecificKey => UnspecificKeyManifest - case _: ORSet.DeltaGroup[?] => ORSetDeltaGroupManifest - case _: ORMap.DeltaGroup[?, ?] => ORMapDeltaGroupManifest - case _: ORSet.FullStateDeltaOp[?] => ORSetFullManifest + case _: ORSet.DeltaGroup[_] => ORSetDeltaGroupManifest + case _: ORMap.DeltaGroup[_, _] => ORMapDeltaGroupManifest + case _: ORSet.FullStateDeltaOp[_] => ORSetFullManifest case _ => throw new IllegalArgumentException(s"Can't serialize object of type ${obj.getClass} in [${getClass.getName}]") } def toBinary(obj: AnyRef): Array[Byte] = obj match { - case m: ORSet[?] => compress(orsetToProto(m)) - case m: ORSet.AddDeltaOp[?] => orsetToProto(m.underlying).toByteArray - case m: ORSet.RemoveDeltaOp[?] => orsetToProto(m.underlying).toByteArray - case m: GSet[?] => gsetToProto(m).toByteArray + case m: ORSet[_] => compress(orsetToProto(m)) + case m: ORSet.AddDeltaOp[_] => orsetToProto(m.underlying).toByteArray + case m: ORSet.RemoveDeltaOp[_] => orsetToProto(m.underlying).toByteArray + case m: GSet[_] => gsetToProto(m).toByteArray case m: GCounter => gcounterToProto(m).toByteArray case m: PNCounter => pncounterToProto(m).toByteArray case m: Flag => flagToProto(m).toByteArray - case m: LWWRegister[?] => lwwRegisterToProto(m).toByteArray - case m: ORMap[?, ?] => compress(ormapToProto(m)) - case m: ORMap.PutDeltaOp[?, ?] => ormapPutToProto(m).toByteArray - case m: ORMap.RemoveDeltaOp[?, ?] => ormapRemoveToProto(m).toByteArray - case m: ORMap.RemoveKeyDeltaOp[?, ?] => ormapRemoveKeyToProto(m).toByteArray - case m: ORMap.UpdateDeltaOp[?, ?] => ormapUpdateToProto(m).toByteArray - case m: LWWMap[?, ?] => compress(lwwmapToProto(m)) - case m: PNCounterMap[?] => compress(pncountermapToProto(m)) - case m: ORMultiMap[?, ?] => compress(multimapToProto(m)) + case m: LWWRegister[_] => lwwRegisterToProto(m).toByteArray + case m: ORMap[_, _] => compress(ormapToProto(m)) + case m: ORMap.PutDeltaOp[_, _] => ormapPutToProto(m).toByteArray + case m: ORMap.RemoveDeltaOp[_, _] => ormapRemoveToProto(m).toByteArray + case m: ORMap.RemoveKeyDeltaOp[_, _] => ormapRemoveKeyToProto(m).toByteArray + case m: ORMap.UpdateDeltaOp[_, _] => ormapUpdateToProto(m).toByteArray + case m: LWWMap[_, _] => compress(lwwmapToProto(m)) + case m: PNCounterMap[_] => compress(pncountermapToProto(m)) + case m: ORMultiMap[_, _] => compress(multimapToProto(m)) case DeletedData => dm.Empty.getDefaultInstance.toByteArray case m: VersionVector => versionVectorToProto(m).toByteArray case Key(id) => keyIdToBinary(id) - case m: ORSet.DeltaGroup[?] => orsetDeltaGroupToProto(m).toByteArray - case m: ORMap.DeltaGroup[?, ?] => ormapDeltaGroupToProto(m).toByteArray - case m: ORSet.FullStateDeltaOp[?] => orsetToProto(m.underlying).toByteArray + case m: ORSet.DeltaGroup[_] => orsetDeltaGroupToProto(m).toByteArray + case m: ORMap.DeltaGroup[_, _] => ormapDeltaGroupToProto(m).toByteArray + case m: ORSet.FullStateDeltaOp[_] => orsetToProto(m.underlying).toByteArray case _ => throw new IllegalArgumentException(s"Can't serialize object of type ${obj.getClass} in [${getClass.getName}]") } @@ -415,7 +415,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) s"Unimplemented deserialization of message with manifest [$manifest] in [${getClass.getName}]") } - def gsetToProto(gset: GSet[?]): rd.GSet = { + def gsetToProto(gset: GSet[_]): rd.GSet = { val b = rd.GSet.newBuilder() // using java collections and sorting for performance (avoid conversions) val stringElements = new ArrayList[String] @@ -453,7 +453,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) b.build() } - def gsetFromBinary(bytes: Array[Byte]): GSet[?] = + def gsetFromBinary(bytes: Array[Byte]): GSet[_] = gsetFromProto(rd.GSet.parseFrom(bytes)) def gsetFromProto(gset: rd.GSet): GSet[Any] = { @@ -467,7 +467,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) GSet(elements.toSet) } - def orsetToProto(orset: ORSet[?]): rd.ORSet = + def orsetToProto(orset: ORSet[_]): rd.ORSet = orsetToProtoImpl(orset.asInstanceOf[ORSet[Any]]) private def orsetToProtoImpl(orset: ORSet[Any]): rd.ORSet = { @@ -491,7 +491,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) otherElementsMap = otherElementsMap.updated(enclosedMsg, other) } - def addDots(elements: ArrayList[?]): Unit = { + def addDots(elements: ArrayList[_]): Unit = { // add corresponding dots in same order val iter = elements.iterator while (iter.hasNext) { @@ -547,8 +547,8 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) private def orsetFullFromBinary(bytes: Array[Byte]): ORSet.FullStateDeltaOp[Any] = new ORSet.FullStateDeltaOp(orsetFromProto(rd.ORSet.parseFrom(bytes))) - private def orsetDeltaGroupToProto(deltaGroup: ORSet.DeltaGroup[?]): rd.ORSetDeltaGroup = { - def createEntry(opType: rd.ORSetDeltaOp, u: ORSet[?]) = { + private def orsetDeltaGroupToProto(deltaGroup: ORSet.DeltaGroup[_]): rd.ORSetDeltaGroup = { + def createEntry(opType: rd.ORSetDeltaOp, u: ORSet[_]) = { rd.ORSetDeltaGroup.Entry.newBuilder().setOperation(opType).setUnderlying(orsetToProto(u)) } @@ -608,7 +608,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) def flagFromProto(flag: rd.Flag): Flag = if (flag.getEnabled) Flag.Enabled else Flag.Disabled - def lwwRegisterToProto(lwwRegister: LWWRegister[?]): rd.LWWRegister = + def lwwRegisterToProto(lwwRegister: LWWRegister[_]): rd.LWWRegister = rd.LWWRegister .newBuilder() .setTimestamp(lwwRegister.timestamp) @@ -687,7 +687,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) protoEntries } - def ormapToProto(ormap: ORMap[?, ?]): rd.ORMap = { + def ormapToProto(ormap: ORMap[_, _]): rd.ORMap = { val ormapBuilder = rd.ORMap.newBuilder() val entries: jl.Iterable[rd.ORMap.Entry] = getEntries(ormap.values, rd.ORMap.Entry.newBuilder _, otherMessageToProto) @@ -744,7 +744,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) // wire protocol is always DeltaGroup private def ormapPutFromBinary(bytes: Array[Byte]): ORMap.PutDeltaOp[Any, ReplicatedData] = { val ops = ormapDeltaGroupOpsFromBinary(bytes) - if (ops.size == 1 && ops.head.isInstanceOf[ORMap.PutDeltaOp[?, ?]]) + if (ops.size == 1 && ops.head.isInstanceOf[ORMap.PutDeltaOp[_, _]]) ops.head.asInstanceOf[ORMap.PutDeltaOp[Any, ReplicatedData]] else throw new NotSerializableException("Improper ORMap delta put operation size or kind") @@ -753,7 +753,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) // wire protocol is always delta group private def ormapRemoveFromBinary(bytes: Array[Byte]): ORMap.RemoveDeltaOp[Any, ReplicatedData] = { val ops = ormapDeltaGroupOpsFromBinary(bytes) - if (ops.size == 1 && ops.head.isInstanceOf[ORMap.RemoveDeltaOp[?, ?]]) + if (ops.size == 1 && ops.head.isInstanceOf[ORMap.RemoveDeltaOp[_, _]]) ops.head.asInstanceOf[ORMap.RemoveDeltaOp[Any, ReplicatedData]] else throw new NotSerializableException("Improper ORMap delta remove operation size or kind") @@ -762,7 +762,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) // wire protocol is always delta group private def ormapRemoveKeyFromBinary(bytes: Array[Byte]): ORMap.RemoveKeyDeltaOp[Any, ReplicatedData] = { val ops = ormapDeltaGroupOpsFromBinary(bytes) - if (ops.size == 1 && ops.head.isInstanceOf[ORMap.RemoveKeyDeltaOp[?, ?]]) + if (ops.size == 1 && ops.head.isInstanceOf[ORMap.RemoveKeyDeltaOp[_, _]]) ops.head.asInstanceOf[ORMap.RemoveKeyDeltaOp[Any, ReplicatedData]] else throw new NotSerializableException("Improper ORMap delta remove key operation size or kind") @@ -771,7 +771,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) // wire protocol is always delta group private def ormapUpdateFromBinary(bytes: Array[Byte]): ORMap.UpdateDeltaOp[Any, ReplicatedDelta] = { val ops = ormapDeltaGroupOpsFromBinary(bytes) - if (ops.size == 1 && ops.head.isInstanceOf[ORMap.UpdateDeltaOp[?, ?]]) + if (ops.size == 1 && ops.head.isInstanceOf[ORMap.UpdateDeltaOp[_, _]]) ops.head.asInstanceOf[ORMap.UpdateDeltaOp[Any, ReplicatedDelta]] else throw new NotSerializableException("Improper ORMap delta update operation size or kind") @@ -830,28 +830,28 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) ops } - private def ormapPutToProto(deltaOp: ORMap.PutDeltaOp[?, ?]): rd.ORMapDeltaGroup = { + private def ormapPutToProto(deltaOp: ORMap.PutDeltaOp[_, _]): rd.ORMapDeltaGroup = { ormapDeltaGroupOpsToProto(immutable.IndexedSeq(deltaOp.asInstanceOf[ORMap.DeltaOp])) } - private def ormapRemoveToProto(deltaOp: ORMap.RemoveDeltaOp[?, ?]): rd.ORMapDeltaGroup = { + private def ormapRemoveToProto(deltaOp: ORMap.RemoveDeltaOp[_, _]): rd.ORMapDeltaGroup = { ormapDeltaGroupOpsToProto(immutable.IndexedSeq(deltaOp.asInstanceOf[ORMap.DeltaOp])) } - private def ormapRemoveKeyToProto(deltaOp: ORMap.RemoveKeyDeltaOp[?, ?]): rd.ORMapDeltaGroup = { + private def ormapRemoveKeyToProto(deltaOp: ORMap.RemoveKeyDeltaOp[_, _]): rd.ORMapDeltaGroup = { ormapDeltaGroupOpsToProto(immutable.IndexedSeq(deltaOp.asInstanceOf[ORMap.DeltaOp])) } - private def ormapUpdateToProto(deltaOp: ORMap.UpdateDeltaOp[?, ?]): rd.ORMapDeltaGroup = { + private def ormapUpdateToProto(deltaOp: ORMap.UpdateDeltaOp[_, _]): rd.ORMapDeltaGroup = { ormapDeltaGroupOpsToProto(immutable.IndexedSeq(deltaOp.asInstanceOf[ORMap.DeltaOp])) } - private def ormapDeltaGroupToProto(deltaGroup: ORMap.DeltaGroup[?, ?]): rd.ORMapDeltaGroup = { + private def ormapDeltaGroupToProto(deltaGroup: ORMap.DeltaGroup[_, _]): rd.ORMapDeltaGroup = { ormapDeltaGroupOpsToProto(deltaGroup.ops) } private def ormapDeltaGroupOpsToProto(deltaGroupOps: immutable.IndexedSeq[ORMap.DeltaOp]): rd.ORMapDeltaGroup = { - def createEntry(opType: rd.ORMapDeltaOp, u: ORSet[?], m: Map[?, ?], zt: Int) = { + def createEntry(opType: rd.ORMapDeltaOp, u: ORSet[_], m: Map[_, _], zt: Int) = { if (m.size > 1 && opType != rd.ORMapDeltaOp.ORMapUpdate) throw new IllegalArgumentException("Invalid size of ORMap delta map") else { @@ -879,7 +879,7 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) } } - def createEntryWithKey(opType: rd.ORMapDeltaOp, u: ORSet[?], k: Any, zt: Int) = { + def createEntryWithKey(opType: rd.ORMapDeltaOp, u: ORSet[_], k: Any, zt: Int) = { val entryDataBuilder = rd.ORMapDeltaGroup.MapEntry.newBuilder() k match { case key: String => entryDataBuilder.setStringKey(key) @@ -897,31 +897,31 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) deltaGroupOps.foreach { case ORMap.PutDeltaOp(op, pair, zt) => b.addEntries( - createEntry(rd.ORMapDeltaOp.ORMapPut, op.asInstanceOf[ORSet.AddDeltaOp[?]].underlying, Map(pair), zt.value)) + createEntry(rd.ORMapDeltaOp.ORMapPut, op.asInstanceOf[ORSet.AddDeltaOp[_]].underlying, Map(pair), zt.value)) case ORMap.RemoveDeltaOp(op, zt) => b.addEntries( createEntry( rd.ORMapDeltaOp.ORMapRemove, - op.asInstanceOf[ORSet.RemoveDeltaOp[?]].underlying, + op.asInstanceOf[ORSet.RemoveDeltaOp[_]].underlying, Map.empty, zt.value)) case ORMap.RemoveKeyDeltaOp(op, k, zt) => b.addEntries( createEntryWithKey( rd.ORMapDeltaOp.ORMapRemoveKey, - op.asInstanceOf[ORSet.RemoveDeltaOp[?]].underlying, + op.asInstanceOf[ORSet.RemoveDeltaOp[_]].underlying, k, zt.value)) case ORMap.UpdateDeltaOp(op, m, zt) => b.addEntries( - createEntry(rd.ORMapDeltaOp.ORMapUpdate, op.asInstanceOf[ORSet.AddDeltaOp[?]].underlying, m, zt.value)) + createEntry(rd.ORMapDeltaOp.ORMapUpdate, op.asInstanceOf[ORSet.AddDeltaOp[_]].underlying, m, zt.value)) case ORMap.DeltaGroup(_) => throw new IllegalArgumentException("ORMap.DeltaGroup should not be nested") } b.build() } - def lwwmapToProto(lwwmap: LWWMap[?, ?]): rd.LWWMap = { + def lwwmapToProto(lwwmap: LWWMap[_, _]): rd.LWWMap = { val lwwmapBuilder = rd.LWWMap.newBuilder() val entries: jl.Iterable[rd.LWWMap.Entry] = getEntries(lwwmap.underlying.entries, rd.LWWMap.Entry.newBuilder _, lwwRegisterToProto) @@ -936,22 +936,22 @@ class ReplicatedDataSerializer(val system: ExtendedActorSystem) new LWWMap(new ORMap(keys = orsetFromProto(lwwmap.getKeys), entries, LWWMap.LWWMapTag)) } - def pncountermapToProto(pncountermap: PNCounterMap[?]): rd.PNCounterMap = { + def pncountermapToProto(pncountermap: PNCounterMap[_]): rd.PNCounterMap = { val pncountermapBuilder = rd.PNCounterMap.newBuilder() val entries: jl.Iterable[rd.PNCounterMap.Entry] = getEntries(pncountermap.underlying.entries, rd.PNCounterMap.Entry.newBuilder _, pncounterToProto) pncountermapBuilder.setKeys(orsetToProto(pncountermap.underlying.keys)).addAllEntries(entries).build() } - def pncountermapFromBinary(bytes: Array[Byte]): PNCounterMap[?] = + def pncountermapFromBinary(bytes: Array[Byte]): PNCounterMap[_] = pncountermapFromProto(rd.PNCounterMap.parseFrom(decompress(bytes))) - def pncountermapFromProto(pncountermap: rd.PNCounterMap): PNCounterMap[?] = { + def pncountermapFromProto(pncountermap: rd.PNCounterMap): PNCounterMap[_] = { val entries = mapTypeFromProto(pncountermap.getEntriesList, pncounterFromProto) new PNCounterMap(new ORMap(keys = orsetFromProto(pncountermap.getKeys), entries, PNCounterMap.PNCounterMapTag)) } - def multimapToProto(multimap: ORMultiMap[?, ?]): rd.ORMultiMap = { + def multimapToProto(multimap: ORMultiMap[_, _]): rd.ORMultiMap = { val ormultimapBuilder = rd.ORMultiMap.newBuilder() val entries: jl.Iterable[rd.ORMultiMap.Entry] = getEntries(multimap.underlying.entries, rd.ORMultiMap.Entry.newBuilder _, orsetToProto) diff --git a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/protobuf/ReplicatorMessageSerializer.scala b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/protobuf/ReplicatorMessageSerializer.scala index 0840b6ad0b3..bb45747acaf 100644 --- a/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/protobuf/ReplicatorMessageSerializer.scala +++ b/distributed-data/src/main/scala/org/apache/pekko/cluster/ddata/protobuf/ReplicatorMessageSerializer.scala @@ -224,14 +224,14 @@ class ReplicatorMessageSerializer(val system: ExtendedActorSystem) case _: ReadResult => ReadResultManifest case _: DeltaPropagation => DeltaPropagationManifest case _: Status => StatusManifest - case _: Get[?] => GetManifest - case _: GetSuccess[?] => GetSuccessManifest + case _: Get[_] => GetManifest + case _: GetSuccess[_] => GetSuccessManifest case _: DurableDataEnvelope => DurableDataEnvelopeManifest - case _: Changed[?] => ChangedManifest - case _: NotFound[?] => NotFoundManifest - case _: GetFailure[?] => GetFailureManifest - case _: Subscribe[?] => SubscribeManifest - case _: Unsubscribe[?] => UnsubscribeManifest + case _: Changed[_] => ChangedManifest + case _: NotFound[_] => NotFoundManifest + case _: GetFailure[_] => GetFailureManifest + case _: Subscribe[_] => SubscribeManifest + case _: Unsubscribe[_] => UnsubscribeManifest case _: Gossip => GossipManifest case WriteNack => WriteNackManifest case DeltaNack => DeltaNackManifest @@ -247,14 +247,14 @@ class ReplicatorMessageSerializer(val system: ExtendedActorSystem) case m: ReadResult => readResultToProto(m).toByteArray case m: Status => statusToProto(m).toByteArray case m: DeltaPropagation => deltaPropagationToProto(m).toByteArray - case m: Get[?] => getToProto(m).toByteArray - case m: GetSuccess[?] => getSuccessToProto(m).toByteArray + case m: Get[_] => getToProto(m).toByteArray + case m: GetSuccess[_] => getSuccessToProto(m).toByteArray case m: DurableDataEnvelope => durableDataEnvelopeToProto(m).toByteArray - case m: Changed[?] => changedToProto(m).toByteArray - case m: NotFound[?] => notFoundToProto(m).toByteArray - case m: GetFailure[?] => getFailureToProto(m).toByteArray - case m: Subscribe[?] => subscribeToProto(m).toByteArray - case m: Unsubscribe[?] => unsubscribeToProto(m).toByteArray + case m: Changed[_] => changedToProto(m).toByteArray + case m: NotFound[_] => notFoundToProto(m).toByteArray + case m: GetFailure[_] => getFailureToProto(m).toByteArray + case m: Subscribe[_] => subscribeToProto(m).toByteArray + case m: Unsubscribe[_] => unsubscribeToProto(m).toByteArray case m: Gossip => compress(gossipToProto(m)) case WriteNack => dm.Empty.getDefaultInstance.toByteArray case DeltaNack => dm.Empty.getDefaultInstance.toByteArray @@ -362,7 +362,7 @@ class ReplicatorMessageSerializer(val system: ExtendedActorSystem) }.toMap) } - private def getToProto(get: Get[?]): dm.Get = { + private def getToProto(get: Get[_]): dm.Get = { val timoutInMillis = get.consistency.timeout.toMillis require(timoutInMillis <= 0xFFFFFFFFL, "Timeouts must fit in a 32-bit unsigned int") @@ -389,7 +389,7 @@ class ReplicatorMessageSerializer(val system: ExtendedActorSystem) b.build() } - private def getFromBinary(bytes: Array[Byte]): Get[?] = { + private def getFromBinary(bytes: Array[Byte]): Get[_] = { val get = dm.Get.parseFrom(bytes) val key = otherMessageFromProto(get.getKey).asInstanceOf[KeyR] val request = if (get.hasRequest()) Some(otherMessageFromProto(get.getRequest)) else None @@ -412,7 +412,7 @@ class ReplicatorMessageSerializer(val system: ExtendedActorSystem) Get(key, consistency, request) } - private def getSuccessToProto(getSuccess: GetSuccess[?]): dm.GetSuccess = { + private def getSuccessToProto(getSuccess: GetSuccess[_]): dm.GetSuccess = { val b = dm.GetSuccess .newBuilder() .setKey(otherMessageToProto(getSuccess.key)) @@ -422,7 +422,7 @@ class ReplicatorMessageSerializer(val system: ExtendedActorSystem) b.build() } - private def getSuccessFromBinary(bytes: Array[Byte]): GetSuccess[?] = { + private def getSuccessFromBinary(bytes: Array[Byte]): GetSuccess[_] = { val getSuccess = dm.GetSuccess.parseFrom(bytes) val key = otherMessageFromProto(getSuccess.getKey).asInstanceOf[KeyR] val request = if (getSuccess.hasRequest()) Some(otherMessageFromProto(getSuccess.getRequest)) else None @@ -430,66 +430,66 @@ class ReplicatorMessageSerializer(val system: ExtendedActorSystem) GetSuccess(key, request)(data) } - private def notFoundToProto(notFound: NotFound[?]): dm.NotFound = { + private def notFoundToProto(notFound: NotFound[_]): dm.NotFound = { val b = dm.NotFound.newBuilder().setKey(otherMessageToProto(notFound.key)) notFound.request.foreach(o => b.setRequest(otherMessageToProto(o))) b.build() } - private def notFoundFromBinary(bytes: Array[Byte]): NotFound[?] = { + private def notFoundFromBinary(bytes: Array[Byte]): NotFound[_] = { val notFound = dm.NotFound.parseFrom(bytes) val request = if (notFound.hasRequest()) Some(otherMessageFromProto(notFound.getRequest)) else None val key = otherMessageFromProto(notFound.getKey).asInstanceOf[KeyR] NotFound(key, request) } - private def getFailureToProto(getFailure: GetFailure[?]): dm.GetFailure = { + private def getFailureToProto(getFailure: GetFailure[_]): dm.GetFailure = { val b = dm.GetFailure.newBuilder().setKey(otherMessageToProto(getFailure.key)) getFailure.request.foreach(o => b.setRequest(otherMessageToProto(o))) b.build() } - private def getFailureFromBinary(bytes: Array[Byte]): GetFailure[?] = { + private def getFailureFromBinary(bytes: Array[Byte]): GetFailure[_] = { val getFailure = dm.GetFailure.parseFrom(bytes) val request = if (getFailure.hasRequest()) Some(otherMessageFromProto(getFailure.getRequest)) else None val key = otherMessageFromProto(getFailure.getKey).asInstanceOf[KeyR] GetFailure(key, request) } - private def subscribeToProto(subscribe: Subscribe[?]): dm.Subscribe = + private def subscribeToProto(subscribe: Subscribe[_]): dm.Subscribe = dm.Subscribe .newBuilder() .setKey(otherMessageToProto(subscribe.key)) .setRef(Serialization.serializedActorPath(subscribe.subscriber)) .build() - private def subscribeFromBinary(bytes: Array[Byte]): Subscribe[?] = { + private def subscribeFromBinary(bytes: Array[Byte]): Subscribe[_] = { val subscribe = dm.Subscribe.parseFrom(bytes) val key = otherMessageFromProto(subscribe.getKey).asInstanceOf[KeyR] Subscribe(key, resolveActorRef(subscribe.getRef)) } - private def unsubscribeToProto(unsubscribe: Unsubscribe[?]): dm.Unsubscribe = + private def unsubscribeToProto(unsubscribe: Unsubscribe[_]): dm.Unsubscribe = dm.Unsubscribe .newBuilder() .setKey(otherMessageToProto(unsubscribe.key)) .setRef(Serialization.serializedActorPath(unsubscribe.subscriber)) .build() - private def unsubscribeFromBinary(bytes: Array[Byte]): Unsubscribe[?] = { + private def unsubscribeFromBinary(bytes: Array[Byte]): Unsubscribe[_] = { val unsubscribe = dm.Unsubscribe.parseFrom(bytes) val key = otherMessageFromProto(unsubscribe.getKey).asInstanceOf[KeyR] Unsubscribe(key, resolveActorRef(unsubscribe.getRef)) } - private def changedToProto(changed: Changed[?]): dm.Changed = + private def changedToProto(changed: Changed[_]): dm.Changed = dm.Changed .newBuilder() .setKey(otherMessageToProto(changed.key)) .setData(otherMessageToProto(changed.dataValue)) .build() - private def changedFromBinary(bytes: Array[Byte]): Changed[?] = { + private def changedFromBinary(bytes: Array[Byte]): Changed[_] = { val changed = dm.Changed.parseFrom(bytes) val data = otherMessageFromProto(changed.getData).asInstanceOf[ReplicatedData] val key = otherMessageFromProto(changed.getKey).asInstanceOf[KeyR] diff --git a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/JepsenInspiredInsertSpec.scala b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/JepsenInspiredInsertSpec.scala index d2cd97926ee..3d3e55bdd79 100644 --- a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/JepsenInspiredInsertSpec.scala +++ b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/JepsenInspiredInsertSpec.scala @@ -135,8 +135,8 @@ class JepsenInspiredInsertSpec replicator.tell(Update(key, ORSet(), WriteLocal, Some(i))(_ :+ i), writeProbe.ref) writeProbe.receiveOne(3.seconds) } - val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[?] => success } - val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[?] => fail } + val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[_] => success } + val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[_] => fail } successWriteAcks.map(_.request.get).toSet should be(myData.toSet) successWriteAcks.size should be(myData.size) failureWriteAcks should be(Nil) @@ -168,8 +168,8 @@ class JepsenInspiredInsertSpec replicator.tell(Update(key, ORSet(), writeMajority, Some(i))(_ :+ i), writeProbe.ref) writeProbe.receiveOne(timeout + 1.second) } - val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[?] => success } - val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[?] => fail } + val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[_] => success } + val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[_] => fail } successWriteAcks.map(_.request.get).toSet should be(myData.toSet) successWriteAcks.size should be(myData.size) failureWriteAcks should be(Nil) @@ -212,8 +212,8 @@ class JepsenInspiredInsertSpec replicator.tell(Update(key, ORSet(), WriteLocal, Some(i))(_ :+ i), writeProbe.ref) writeProbe.receiveOne(3.seconds) } - val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[?] => success } - val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[?] => fail } + val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[_] => success } + val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[_] => fail } successWriteAcks.map(_.request.get).toSet should be(myData.toSet) successWriteAcks.size should be(myData.size) failureWriteAcks should be(Nil) @@ -257,8 +257,8 @@ class JepsenInspiredInsertSpec replicator.tell(Update(key, ORSet(), writeMajority, Some(i))(_ :+ i), writeProbe.ref) writeProbe.receiveOne(timeout + 1.second) } - val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[?] => success } - val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[?] => fail } + val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[_] => success } + val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[_] => fail } runOn(n1, n4, n5) { successWriteAcks.map(_.request.get).toSet should be(myData.toSet) successWriteAcks.size should be(myData.size) diff --git a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorChaosSpec.scala b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorChaosSpec.scala index 64a5185c6cd..cc0187e67a9 100644 --- a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorChaosSpec.scala +++ b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorChaosSpec.scala @@ -85,8 +85,8 @@ class ReplicatorChaosSpec extends MultiNodeSpec(ReplicatorChaosSpec) with STMult g.dataValue match { case c: GCounter => c.value case c: PNCounter => c.value - case c: GSet[?] => c.elements - case c: ORSet[?] => c.elements + case c: GSet[_] => c.elements + case c: ORSet[_] => c.elements case _ => fail() } } @@ -125,7 +125,7 @@ class ReplicatorChaosSpec extends MultiNodeSpec(ReplicatorChaosSpec) with STMult replicator ! Update(KeyB, PNCounter(), WriteLocal)(_.decrement(1)) replicator ! Update(KeyC, GCounter(), WriteAll(timeout))(_ :+ 1) } - receiveN(15).map(_.getClass).toSet should be(Set(classOf[UpdateSuccess[?]])) + receiveN(15).map(_.getClass).toSet should be(Set(classOf[UpdateSuccess[_]])) } runOn(second) { diff --git a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorDeltaSpec.scala b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorDeltaSpec.scala index c488c38e80a..fa8923857ff 100644 --- a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorDeltaSpec.scala +++ b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorDeltaSpec.scala @@ -251,8 +251,8 @@ class ReplicatorDeltaSpec extends MultiNodeSpec(ReplicatorDeltaSpec) with STMult val p1 = TestProbe() fullStateReplicator.tell(Update(KeyD, ORSet.empty[String], writeAll)(_ :+ "A"), p1.ref) deltaReplicator.tell(Update(KeyD, ORSet.empty[String], writeAll)(_ :+ "A"), p1.ref) - p1.expectMsgType[UpdateSuccess[?]] - p1.expectMsgType[UpdateSuccess[?]] + p1.expectMsgType[UpdateSuccess[_]] + p1.expectMsgType[UpdateSuccess[_]] } enterBarrier("write-1") @@ -268,9 +268,9 @@ class ReplicatorDeltaSpec extends MultiNodeSpec(ReplicatorDeltaSpec) with STMult deltaReplicator.tell(Update(KeyD, ORSet.empty[String], writeAll)(_ :+ "B"), p1.ref) deltaReplicator.tell(Update(KeyD, ORSet.empty[String], writeAll)(_ :+ "C"), p1.ref) deltaReplicator.tell(Update(KeyD, ORSet.empty[String], writeAll)(_ :+ "D"), p1.ref) - p1.expectMsgType[UpdateSuccess[?]] - p1.expectMsgType[UpdateSuccess[?]] - p1.expectMsgType[UpdateSuccess[?]] + p1.expectMsgType[UpdateSuccess[_]] + p1.expectMsgType[UpdateSuccess[_]] + p1.expectMsgType[UpdateSuccess[_]] } enterBarrier("write-2") deltaReplicator.tell(Get(KeyD, ReadLocal), p.ref) @@ -280,7 +280,7 @@ class ReplicatorDeltaSpec extends MultiNodeSpec(ReplicatorDeltaSpec) with STMult runOn(first) { val p1 = TestProbe() fullStateReplicator.tell(Update(KeyD, ORSet.empty[String], writeAll)(_ :+ "A" :+ "B" :+ "C" :+ "D"), p1.ref) - p1.expectMsgType[UpdateSuccess[?]] + p1.expectMsgType[UpdateSuccess[_]] } enterBarrier("write-3") fullStateReplicator.tell(Get(KeyD, ReadLocal), p.ref) @@ -293,7 +293,7 @@ class ReplicatorDeltaSpec extends MultiNodeSpec(ReplicatorDeltaSpec) with STMult runOn(first) { val p1 = TestProbe() deltaReplicator.tell(Update(KeyHigh, Highest(0), WriteLocal)(_.incr(1)), p1.ref) - p1.expectMsgType[UpdateSuccess[?]] + p1.expectMsgType[UpdateSuccess[_]] } enterBarrier("write-1") @@ -316,11 +316,11 @@ class ReplicatorDeltaSpec extends MultiNodeSpec(ReplicatorDeltaSpec) with STMult runOn(first) { val p1 = TestProbe() deltaReplicator.tell(Update(KeyHigh, Highest(0), writeAll)(_.incr(2)), p1.ref) - p1.expectMsgType[UpdateSuccess[?]] + p1.expectMsgType[UpdateSuccess[_]] deltaReplicator.tell(Update(KeyHigh, Highest(0), WriteLocal)(_.incrNoDelta(5)), p1.ref) deltaReplicator.tell(Update(KeyHigh, Highest(0), WriteLocal)(_.incr(10)), p1.ref) - p1.expectMsgType[UpdateSuccess[?]] - p1.expectMsgType[UpdateSuccess[?]] + p1.expectMsgType[UpdateSuccess[_]] + p1.expectMsgType[UpdateSuccess[_]] } enterBarrier("write-2") @@ -347,7 +347,7 @@ class ReplicatorDeltaSpec extends MultiNodeSpec(ReplicatorDeltaSpec) with STMult // delta versions again. Same would happen via full state gossip. // Thereafter delta can be propagated and applied again. deltaReplicator.tell(Update(KeyHigh, Highest(0), writeAll)(_.incr(100)), p1.ref) - p1.expectMsgType[UpdateSuccess[?]] + p1.expectMsgType[UpdateSuccess[_]] // Flush the deltaPropagation buffer, otherwise it will contain // NoDeltaPlaceholder from previous updates and the incr(4) delta will also // be folded into NoDeltaPlaceholder and not propagated as delta. A few DeltaPropagationTick @@ -356,7 +356,7 @@ class ReplicatorDeltaSpec extends MultiNodeSpec(ReplicatorDeltaSpec) with STMult deltaReplicator ! Replicator.Internal.DeltaPropagationTick } deltaReplicator.tell(Update(KeyHigh, Highest(0), WriteLocal)(_.incr(4)), p1.ref) - p1.expectMsgType[UpdateSuccess[?]] + p1.expectMsgType[UpdateSuccess[_]] } enterBarrier("write-3") diff --git a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorGossipSpec.scala b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorGossipSpec.scala index 50d4d885580..eaae981aced 100644 --- a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorGossipSpec.scala +++ b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorGossipSpec.scala @@ -93,11 +93,11 @@ class ReplicatorGossipSpec extends MultiNodeSpec(ReplicatorGossipSpec) with STMu runOn(first) { (0 until numberOfSmall).foreach { i => replicator ! Update(smallORSetKeys(i), ORSet.empty[String], WriteLocal)(_ :+ smallPayload()) - expectMsgType[UpdateSuccess[?]] + expectMsgType[UpdateSuccess[_]] } (0 until numberOfLarge).foreach { i => replicator ! Update(largeORSetKeys(i), ORSet.empty[String], WriteLocal)(_ :+ largePayload()) - expectMsgType[UpdateSuccess[?]] + expectMsgType[UpdateSuccess[_]] } } enterBarrier("updated-first") diff --git a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorORSetDeltaSpec.scala b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorORSetDeltaSpec.scala index bdb7a59db2a..2ad05a63d41 100644 --- a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorORSetDeltaSpec.scala +++ b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorORSetDeltaSpec.scala @@ -76,7 +76,7 @@ class ReplicatorORSetDeltaSpec val value = expectMsgPF() { case g @ GetSuccess(`key`, _) => g.dataValue match { - case c: ORSet[?] => c.elements + case c: ORSet[_] => c.elements case _ => fail() } } diff --git a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorSpec.scala b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorSpec.scala index d6dbb5b3816..aaba6a85333 100644 --- a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorSpec.scala +++ b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/ReplicatorSpec.scala @@ -205,7 +205,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec "reply with ModifyFailure if exception is thrown by modify function" in { val e = new RuntimeException("errr") replicator ! Update(KeyA, GCounter(), WriteLocal)(_ => throw e) - expectMsgType[ModifyFailure[?]].cause should be(e) + expectMsgType[ModifyFailure[_]].cause should be(e) } "replicate values to new node" in { @@ -459,7 +459,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec val probe1 = TestProbe() val probe2 = TestProbe() replicator.tell(Get(KeyE, readMajority), probe2.ref) - probe2.expectMsgType[GetSuccess[?]] + probe2.expectMsgType[GetSuccess[_]] replicator.tell(Update(KeyE, GCounter(), writeMajority, None) { data => probe1.ref ! data.value data :+ 1 @@ -478,7 +478,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec runOn(second) { val probe1 = TestProbe() replicator.tell(Get(KeyE, readMajority), probe1.ref) - probe1.expectMsgType[GetSuccess[?]] + probe1.expectMsgType[GetSuccess[_]] replicator.tell(Update(KeyE, GCounter(), writeMajority, Some(153))(_ :+ 1), probe1.ref) // verify read your own writes, without waiting for the UpdateSuccess reply // note that the order of the replies are not defined, and therefore we use separate probes @@ -527,7 +527,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec replicator ! Update(KeyF, GCounter(), writeTwo)(_ :+ 1) } val results = receiveN(100) - results.map(_.getClass).toSet should be(Set(classOf[UpdateSuccess[?]])) + results.map(_.getClass).toSet should be(Set(classOf[UpdateSuccess[_]])) } enterBarrier("100-updates-done") runOn(first, second, third) { @@ -541,7 +541,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec "read-repair happens before GetSuccess" in { runOn(first) { replicator ! Update(KeyG, ORSet(), writeTwo)(_ :+ "a" :+ "b") - expectMsgType[UpdateSuccess[?]] + expectMsgType[UpdateSuccess[_]] } enterBarrier("a-b-added-to-G") runOn(second) { diff --git a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/WildcardSubscribeSpec.scala b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/WildcardSubscribeSpec.scala index a5c115f52fa..4bd29743d74 100644 --- a/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/WildcardSubscribeSpec.scala +++ b/distributed-data/src/multi-jvm/scala/org/apache/pekko/cluster/ddata/WildcardSubscribeSpec.scala @@ -15,14 +15,14 @@ package org.apache.pekko.cluster.ddata import scala.concurrent.duration._ +import com.typesafe.config.ConfigFactory + import org.apache.pekko.cluster.Cluster import org.apache.pekko.remote.testconductor.RoleName import org.apache.pekko.remote.testkit.MultiNodeConfig import org.apache.pekko.remote.testkit.MultiNodeSpec import org.apache.pekko.testkit._ -import com.typesafe.config.ConfigFactory - object WildcardSubscribeSpec extends MultiNodeConfig { val first = role("first") val second = role("second") @@ -45,8 +45,8 @@ class WildcardSubscribeSpecMultiJvmNode1 extends WildcardSubscribeSpec class WildcardSubscribeSpecMultiJvmNode2 extends WildcardSubscribeSpec class WildcardSubscribeSpec extends MultiNodeSpec(WildcardSubscribeSpec) with STMultiNodeSpec with ImplicitSender { - import Replicator._ import WildcardSubscribeSpec._ + import Replicator._ override def initialParticipants: Int = roles.size @@ -76,26 +76,26 @@ class WildcardSubscribeSpec extends MultiNodeSpec(WildcardSubscribeSpec) with ST replicator ! Subscribe(GCounterKey("counter-*"), subscriberProbe.ref) replicator ! Update(KeyA, GCounter.empty, WriteLocal)(_ :+ 1) - expectMsgType[UpdateSuccess[?]] + expectMsgType[UpdateSuccess[_]] val chg1 = subscriberProbe.expectMsgType[Changed[GCounter]] chg1.key should ===(KeyA) chg1.key.getClass should ===(KeyA.getClass) chg1.get(KeyA).value should ===(1) replicator ! Update(KeyA, GCounter.empty, WriteLocal)(_ :+ 1) - expectMsgType[UpdateSuccess[?]] + expectMsgType[UpdateSuccess[_]] val chg2 = subscriberProbe.expectMsgType[Changed[GCounter]] chg2.key should ===(KeyA) chg2.get(KeyA).value should ===(2) replicator ! Update(KeyB, GCounter.empty, WriteLocal)(_ :+ 1) - expectMsgType[UpdateSuccess[?]] + expectMsgType[UpdateSuccess[_]] val chg3 = subscriberProbe.expectMsgType[Changed[GCounter]] chg3.key should ===(KeyB) chg3.get(KeyB).value should ===(1) replicator ! Update(KeyOtherA, GCounter.empty, WriteLocal)(_ :+ 17) - expectMsgType[UpdateSuccess[?]] + expectMsgType[UpdateSuccess[_]] subscriberProbe.expectNoMessage(200.millis) // a few more subscribers @@ -122,7 +122,7 @@ class WildcardSubscribeSpec extends MultiNodeSpec(WildcardSubscribeSpec) with ST subscriberProbeOther.expectMsgType[Changed[GCounter]].get(KeyOtherA).value should ===(17) replicator ! Update(KeyB, GCounter.empty, WriteLocal)(_ :+ 10) - expectMsgType[UpdateSuccess[?]] + expectMsgType[UpdateSuccess[_]] val chg4 = subscriberProbe.expectMsgType[Changed[GCounter]] chg4.key should ===(KeyB) chg4.get(KeyB).value should ===(11) @@ -133,7 +133,7 @@ class WildcardSubscribeSpec extends MultiNodeSpec(WildcardSubscribeSpec) with ST // unsubscribe replicator ! Unsubscribe(GCounterKey("counter-*"), subscriberProbe.ref) replicator ! Update(KeyB, GCounter.empty, WriteLocal)(_ :+ 5) - expectMsgType[UpdateSuccess[?]] + expectMsgType[UpdateSuccess[_]] subscriberProbe.expectNoMessage(200.millis) val chg6 = subscriberProbe2.expectMsgType[Changed[GCounter]] chg6.key should ===(KeyB) @@ -149,7 +149,7 @@ class WildcardSubscribeSpec extends MultiNodeSpec(WildcardSubscribeSpec) with ST replicator ! Subscribe(GCounterKey("expiry-*"), subscriberProbe.ref) replicator ! Update(KeyExpiryA, GCounter.empty, WriteLocal)(_ :+ 1) - expectMsgType[UpdateSuccess[?]] + expectMsgType[UpdateSuccess[_]] subscriberProbe.expectMsgType[Changed[GCounter]] replicator ! Get(KeyExpiryA, ReadLocal) @@ -162,7 +162,7 @@ class WildcardSubscribeSpec extends MultiNodeSpec(WildcardSubscribeSpec) with ST // same key can be used again replicator ! Update(KeyExpiryA, GCounter.empty, WriteLocal)(_ :+ 2) - expectMsgType[UpdateSuccess[?]] + expectMsgType[UpdateSuccess[_]] subscriberProbe.expectMsgType[Changed[GCounter]] replicator ! Get(KeyExpiryA, ReadLocal) expectMsgType[GetSuccess[GCounter]].get(KeyExpiryA).value should ===(2) @@ -174,7 +174,7 @@ class WildcardSubscribeSpec extends MultiNodeSpec(WildcardSubscribeSpec) with ST "notify when changed from another node" in { runOn(first) { replicator ! Update(KeyOtherA, GCounter.empty, WriteLocal)(_ :+ 1) - expectMsgType[UpdateSuccess[?]] + expectMsgType[UpdateSuccess[_]] enterBarrier("updated-1") enterBarrier("second-joined") @@ -182,7 +182,7 @@ class WildcardSubscribeSpec extends MultiNodeSpec(WildcardSubscribeSpec) with ST enterBarrier("received-1") replicator ! Update(KeyOtherA, GCounter.empty, WriteLocal)(_ :+ 1) - expectMsgType[UpdateSuccess[?]] + expectMsgType[UpdateSuccess[_]] enterBarrier("updated-2") enterBarrier("received-2") diff --git a/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/LocalConcurrencySpec.scala b/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/LocalConcurrencySpec.scala index 15803d8b2e1..3f7d66abe76 100644 --- a/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/LocalConcurrencySpec.scala +++ b/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/LocalConcurrencySpec.scala @@ -88,7 +88,7 @@ class LocalConcurrencySpec(_system: ActorSystem) val expected = ((1 to numMessages).map("a" + _) ++ (1 to numMessages).map("b" + _)).toSet awaitAssert { replicator ! Replicator.Get(Updater.key, Replicator.ReadLocal) - val elements = expectMsgType[Replicator.GetSuccess[?]].get(Updater.key) match { + val elements = expectMsgType[Replicator.GetSuccess[_]].get(Updater.key) match { case ORSet(e) => e case _ => fail() } diff --git a/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/LotsOfDataBot.scala b/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/LotsOfDataBot.scala index c88fd80f14c..7e5bb5b0298 100644 --- a/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/LotsOfDataBot.scala +++ b/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/LotsOfDataBot.scala @@ -122,7 +122,7 @@ class LotsOfDataBot extends Actor with ActorLogging { } } - case _: UpdateResponse[?] => // ignore + case _: UpdateResponse[_] => // ignore case c @ Changed(ORSetKey(id)) => val elements = c.dataValue match { case ORSet(e) => e diff --git a/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/ReplicatorWildcardSubscriptionSpec.scala b/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/ReplicatorWildcardSubscriptionSpec.scala index 2c87aaacc8e..11816597b9a 100644 --- a/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/ReplicatorWildcardSubscriptionSpec.scala +++ b/distributed-data/src/test/scala/org/apache/pekko/cluster/ddata/ReplicatorWildcardSubscriptionSpec.scala @@ -66,7 +66,7 @@ class ReplicatorWildcardSubscriptionSpec(_system: ActorSystem) // Update a matching key replicator ! Update(KeyA1, GCounter.empty, WriteLocal)(_ :+ 1) - expectMsgType[UpdateSuccess[?]] + expectMsgType[UpdateSuccess[_]] val changed1 = probe.expectMsgType[Changed[GCounter]](5.seconds) changed1.key.id should ===("notif-counter-a1") @@ -74,7 +74,7 @@ class ReplicatorWildcardSubscriptionSpec(_system: ActorSystem) // Update another matching key replicator ! Update(KeyA2, GCounter.empty, WriteLocal)(_ :+ 2) - expectMsgType[UpdateSuccess[?]] + expectMsgType[UpdateSuccess[_]] val changed2 = probe.expectMsgType[Changed[GCounter]](5.seconds) changed2.key.id should ===("notif-counter-a2") @@ -82,7 +82,7 @@ class ReplicatorWildcardSubscriptionSpec(_system: ActorSystem) // Update a non-matching key - no notification expected replicator ! Update(KeyB, GCounter.empty, WriteLocal)(_ :+ 1) - expectMsgType[UpdateSuccess[?]] + expectMsgType[UpdateSuccess[_]] probe.expectNoMessage(500.millis) } @@ -92,7 +92,7 @@ class ReplicatorWildcardSubscriptionSpec(_system: ActorSystem) val WildcardKey = GCounterKey("current-counter-*") replicator ! Update(KeyA, GCounter.empty, WriteLocal)(_ :+ 10) - expectMsgType[UpdateSuccess[?]] + expectMsgType[UpdateSuccess[_]] // Subscribe after the key already exists val subscribeProbe = TestProbe() @@ -109,7 +109,7 @@ class ReplicatorWildcardSubscriptionSpec(_system: ActorSystem) val WildcardKey = GCounterKey("unsub-counter-*") replicator ! Update(KeyA, GCounter.empty, WriteLocal)(_ :+ 1) - expectMsgType[UpdateSuccess[?]] + expectMsgType[UpdateSuccess[_]] val probe = TestProbe() replicator ! Subscribe(WildcardKey, probe.ref) @@ -122,7 +122,7 @@ class ReplicatorWildcardSubscriptionSpec(_system: ActorSystem) // Update a matching key - no notification expected after unsubscribe replicator ! Update(KeyA, GCounter.empty, WriteLocal)(_ :+ 100) - expectMsgType[UpdateSuccess[?]] + expectMsgType[UpdateSuccess[_]] probe.expectNoMessage(500.millis) } diff --git a/docs/src/main/java/docs/ddata/protobuf/msg/TwoPhaseSetMessages.java b/docs/src/main/java/docs/ddata/protobuf/msg/TwoPhaseSetMessages.java index 4134e3d8ebb..04d2c89e2c5 100644 --- a/docs/src/main/java/docs/ddata/protobuf/msg/TwoPhaseSetMessages.java +++ b/docs/src/main/java/docs/ddata/protobuf/msg/TwoPhaseSetMessages.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: TwoPhaseSetMessages.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package docs.ddata.protobuf.msg; @@ -25,8 +25,8 @@ private TwoPhaseSetMessages() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "TwoPhaseSetMessages"); } @@ -105,8 +105,8 @@ public static final class TwoPhaseSet extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "TwoPhaseSet"); } @@ -235,8 +235,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { int dataSize = 0; for (int i = 0; i < adds_.size(); i++) { @@ -253,15 +258,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getRemovalsList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -878,8 +874,8 @@ public static final class TwoPhaseSet2 extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "TwoPhaseSet2"); } @@ -971,8 +967,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(1, adds_); @@ -981,15 +982,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(2, removals_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/docs/src/main/java/docs/persistence/proto/FlightAppModels.java b/docs/src/main/java/docs/persistence/proto/FlightAppModels.java index 6c52f0cc14d..1b3e24db80d 100644 --- a/docs/src/main/java/docs/persistence/proto/FlightAppModels.java +++ b/docs/src/main/java/docs/persistence/proto/FlightAppModels.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: FlightAppModels.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package docs.persistence.proto; @@ -25,8 +25,8 @@ private FlightAppModels() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "FlightAppModels"); } @@ -112,8 +112,8 @@ public static final class SeatReserved extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "SeatReserved"); } @@ -307,8 +307,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, letter_); } @@ -319,15 +324,6 @@ private int computeSerializedSize_0() { if (((bitField0_ & 0x00000004) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(3, seatType_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/docs/src/main/paradox/discovery/index.md b/docs/src/main/paradox/discovery/index.md index fda23ccbdcc..96653141742 100644 --- a/docs/src/main/paradox/discovery/index.md +++ b/docs/src/main/paradox/discovery/index.md @@ -74,7 +74,7 @@ Pekko Discovery with DNS does always use the @ref[Pekko-native "async-dns" imple DNS discovery maps `Lookup` queries as follows: * `serviceName`, `portName` and `protocol` set: SRV query in the form: `_port._protocol.name` Where the `_`s are added. -* Any query missing any of the fields is mapped to a A/AAAA query for the `serviceName` +* Any query missing any of the fields is mapped to a A/AAAA query for the `serviceName` The mapping between Pekko service discovery terminology and SRV terminology: diff --git a/docs/src/main/paradox/release-notes/releases-2.0.md b/docs/src/main/paradox/release-notes/releases-2.0.md index 2b52c42a297..84ab1f3455f 100644 --- a/docs/src/main/paradox/release-notes/releases-2.0.md +++ b/docs/src/main/paradox/release-notes/releases-2.0.md @@ -2,19 +2,6 @@ Apache Pekko 2.0.x releases support Java 17 and above. -## 2.0.0-M3 - -This is milestone release and is aimed at testing this new major version -by early adopters. This is experimental. This release should not be used in production. - -We recommend that anyone using previous 2.0.0 milestones upgrade to this release due to some important bug fixes. - -See the [GitHub Milestone for 2.0.0-M3](https://github.com/apache/pekko/milestone/28?closed=1) for a fuller list of changes. - -### Bug fix - -* The existing 2.0.0 milestones have issues related to high concurrency introduced when we switched away from sun.misc.Unsafe to using Var Handles. - ## 2.0.0-M2 This is milestone release and is aimed at testing this new major version diff --git a/docs/src/main/paradox/serialization-jackson.md b/docs/src/main/paradox/serialization-jackson.md index b5d8fa5271c..108a7530439 100644 --- a/docs/src/main/paradox/serialization-jackson.md +++ b/docs/src/main/paradox/serialization-jackson.md @@ -18,7 +18,7 @@ To use Jackson Serialization, you must add the following dependency in your proj ## Introduction -You find general concepts for Pekko serialization in the @ref:[Serialization](serialization.md) section. +You find general concepts for for Pekko serialization in the @ref:[Serialization](serialization.md) section. This section describes how to use the Jackson serializer for application specific messages and persistent events and snapshots. diff --git a/docs/src/main/paradox/stream/operators/Source-or-Flow/alsoToAll.md b/docs/src/main/paradox/stream/operators/Source-or-Flow/alsoToAll.md index b2650a8c6c1..29951f9ed66 100644 --- a/docs/src/main/paradox/stream/operators/Source-or-Flow/alsoToAll.md +++ b/docs/src/main/paradox/stream/operators/Source-or-Flow/alsoToAll.md @@ -24,7 +24,7 @@ will also be sent to all those @apidoc[Sink]s. **completes** when upstream completes -**cancels** when downstream or any of the @apidoc[Sink]s cancels +**cancels** when downstream or or any of the @apidoc[Sink]s cancels @@@ diff --git a/docs/src/main/paradox/stream/operators/index.md b/docs/src/main/paradox/stream/operators/index.md index 011a1e1cf76..f39c251bb8f 100644 --- a/docs/src/main/paradox/stream/operators/index.md +++ b/docs/src/main/paradox/stream/operators/index.md @@ -121,7 +121,7 @@ For example, following snippet will fall with timeout exception: |StreamConverters|@ref[fromInputStream](StreamConverters/fromInputStream.md)|Create a source that wraps an `InputStream`.| |StreamConverters|@ref[fromJavaStream](StreamConverters/fromJavaStream.md)|Create a source that wraps a Java 8 `java.util.stream.Stream`.| |StreamConverters|@ref[fromOutputStream](StreamConverters/fromOutputStream.md)|Create a sink that wraps an `OutputStream`.| -|StreamConverters|@ref[javaCollector](StreamConverters/javaCollector.md)|Create a sink which materializes into a @scala[`Future`] @java[`CompletionStage`] which will be completed with a result of the Java `Collector` transformation and reduction operations.| +|StreamConverters|@ref[javaCollector](StreamConverters/javaCollector.md)|Create a sink which materializes into a @scala[`Future`] @java[`CompletionStage`] which will be completed with a result of the Java 8 `Collector` transformation and reduction operations.| |StreamConverters|@ref[javaCollectorParallelUnordered](StreamConverters/javaCollectorParallelUnordered.md)|Create a sink which materializes into a @scala[`Future`] @java[`CompletionStage`] which will be completed with a result of the Java 8 `Collector` transformation and reduction operations.| ## File IO Sinks and Sources diff --git a/docs/src/main/paradox/stream/stream-refs.md b/docs/src/main/paradox/stream/stream-refs.md index 1f3e5d795c9..40d5f5e0196 100644 --- a/docs/src/main/paradox/stream/stream-refs.md +++ b/docs/src/main/paradox/stream/stream-refs.md @@ -158,7 +158,7 @@ Stream refs utilise normal actor messaging for their transport, and therefore pr - messages are sent over actor remoting - which relies on TCP (classic remoting or Artery TCP) or Aeron UDP for basic redelivery mechanisms -- messages are guaranteed to be in-order +- messages are guaranteed to to be in-order - messages can be lost, however: - a *dropped demand signal* will be re-delivered automatically (similar to system messages) - a *dropped element signal* will cause the stream to *fail* diff --git a/docs/src/main/paradox/typed/cluster-sharding.md b/docs/src/main/paradox/typed/cluster-sharding.md index 1192a2ce5e7..7a442e1cefd 100644 --- a/docs/src/main/paradox/typed/cluster-sharding.md +++ b/docs/src/main/paradox/typed/cluster-sharding.md @@ -776,7 +776,7 @@ Reasons for how this can happen: A lease can be a final backup that means that each shard won't create child entity actors unless it has the lease. To use a lease for sharding set `pekko.cluster.sharding.use-lease` to the configuration location -of the lease to use. Each shard will try and acquire a lease with the name `-shard--` and +of the lease to use. Each shard will try and acquire a lease with with the name `-shard--` and the owner is set to the `Cluster(system).selfAddress.hostPort`. If a shard can't acquire a lease it will remain uninitialized so messages for entities it owns will diff --git a/docs/src/main/paradox/typed/cluster-singleton.md b/docs/src/main/paradox/typed/cluster-singleton.md index e6c482d313d..c705ad94034 100644 --- a/docs/src/main/paradox/typed/cluster-singleton.md +++ b/docs/src/main/paradox/typed/cluster-singleton.md @@ -38,7 +38,7 @@ instance will eventually be started. @@@ warning Make sure to not use a Cluster downing strategy that may split the cluster into several separate clusters in -case of network problems or system overload (long GC pauses), since that will result in *multiple Singletons* +case of network problems or system overload (long GC pauses), since that will result in in *multiple Singletons* being started, one in each separate cluster! See @ref:[Downing](cluster.md#downing). @@ -106,7 +106,7 @@ This pattern may seem to be very tempting to use at first, but it has several dr @@@ warning Make sure to not use a Cluster downing strategy that may split the cluster into several separate clusters in -case of network problems or system overload (long GC pauses), since that will result in *multiple Singletons* +case of network problems or system overload (long GC pauses), since that will result in in *multiple Singletons* being started, one in each separate cluster! See @ref:[Downing](cluster.md#downing). @@ -175,7 +175,7 @@ A lease can be a final backup that means that the singleton actor won't be creat the lease can be acquired. To use a lease for singleton set `pekko.cluster.singleton.use-lease` to the configuration location -of the lease to use. A lease with the name `-singleton-` is used and +of the lease to use. A lease with with the name `-singleton-` is used and the owner is set to the @scala[`Cluster(system).selfAddress.hostPort`]@java[`Cluster.get(system).selfAddress().hostPort()`]. If the cluster singleton manager can't acquire the lease it will keep retrying while it is the oldest node in the cluster. diff --git a/docs/src/main/paradox/typed/distributed-data.md b/docs/src/main/paradox/typed/distributed-data.md index b87ee838223..84a4104bad8 100644 --- a/docs/src/main/paradox/typed/distributed-data.md +++ b/docs/src/main/paradox/typed/distributed-data.md @@ -561,7 +561,7 @@ Note that the full state is occasionally also replicated for delta-CRDTs, for ex new nodes are added to the cluster or when deltas could not be propagated because of network partitions or similar problems. -The delta propagation can be disabled with configuration property: +The the delta propagation can be disabled with configuration property: ``` pekko.cluster.distributed-data.delta-crdt.enabled=off diff --git a/docs/src/main/paradox/typed/persistence-snapshot.md b/docs/src/main/paradox/typed/persistence-snapshot.md index 799a0932c8e..bfc2112d238 100644 --- a/docs/src/main/paradox/typed/persistence-snapshot.md +++ b/docs/src/main/paradox/typed/persistence-snapshot.md @@ -52,7 +52,7 @@ events. This can be useful if snapshot serialization format has changed in an in not be used when events have been deleted. In order to use snapshots, a default snapshot-store (`pekko.persistence.snapshot-store.plugin`) must be configured, -or you can pick a snapshot store for a specific `EventSourcedBehavior` by +or you can pick a snapshot store for for a specific `EventSourcedBehavior` by @scala[defining it with `withSnapshotPluginId` of the `EventSourcedBehavior`]@java[overriding `snapshotPluginId` in the `EventSourcedBehavior`]. diff --git a/docs/src/main/paradox/typed/persistence-testing.md b/docs/src/main/paradox/typed/persistence-testing.md index 17fe88475f9..17ecd576f4b 100644 --- a/docs/src/main/paradox/typed/persistence-testing.md +++ b/docs/src/main/paradox/typed/persistence-testing.md @@ -59,7 +59,7 @@ Java `PersistenceProbeBehavior` does not require any configuration. It therefore does not verify the serialization of commands, events, or state. If using this style, it is advised to independently test serialization for those classes. -## Unit testing with the ActorTestKit and EventSourcedBehaviorTestKit +## Unit testing with the the ActorTestKit and EventSourcedBehaviorTestKit **Note!** The `EventSourcedBehaviorTestKit` is a new feature: the API may have changes breaking source compatibility in future versions. diff --git a/docs/src/main/paradox/typed/style-guide.md b/docs/src/main/paradox/typed/style-guide.md index 1a23d977286..0b90acf6c90 100644 --- a/docs/src/main/paradox/typed/style-guide.md +++ b/docs/src/main/paradox/typed/style-guide.md @@ -45,7 +45,7 @@ A few differences to note: * There is no class in the functional style, but that is not strictly a requirement and sometimes it's convenient to use a class also with the functional style to reduce number of parameters in the methods. * Mutable state, such as the @scala[`var n`]@java[`int n`] is typically used in the object-oriented style. -* In the functional style the state is updated by returning a new behavior that holds the new immutable state, +* In the functional style the state is is updated by returning a new behavior that holds the new immutable state, the @scala[`n: Int`]@java[`final int n`] parameter of the `counter` method. * The object-oriented style must use a new instance of the initial `Behavior` for each spawned actor instance, since the state in `AbstractBehavior` instance must not be shared between actor instances. diff --git a/docs/src/test/java/jdocs/actor/ActorDocTest.java b/docs/src/test/java/jdocs/actor/ActorDocTest.java index d6f8e51ea4c..4cac762e6fd 100644 --- a/docs/src/test/java/jdocs/actor/ActorDocTest.java +++ b/docs/src/test/java/jdocs/actor/ActorDocTest.java @@ -58,7 +58,6 @@ // #import-gracefulStop // #import-terminated import org.apache.pekko.actor.Terminated; - // #import-terminated public class ActorDocTest extends AbstractJavaTest { @@ -95,7 +94,6 @@ public Receive createReceive() { } // #plus-some-behavior } - // #context-actorOf public static class SomeActor extends AbstractActor { @@ -138,7 +136,6 @@ private void receiveMsg3(Msg3 msg) { // actual work } } - // #well-structured public @@ -171,7 +168,6 @@ private void receiveMsg3(Msg3 msg) { // actual work } } - // #optimized public static class ActorWithArgs extends AbstractActor { @@ -227,7 +223,6 @@ public Receive createReceive() { static class SomeOtherActor extends AbstractActor { // Props(new DemoActor(42)) would not be safe ActorRef demoActor = getContext().actorOf(DemoActor.props(42), "demo"); - // ... // #props-factory @Override @@ -236,7 +231,6 @@ public Receive createReceive() { } // #props-factory } - // #props-factory public @@ -266,7 +260,6 @@ public Receive createReceive() { .build(); } } - // #messages-in-companion public static class LifecycleMethods extends AbstractActor { @@ -314,7 +307,6 @@ public Receive createReceive() { public void preStart() { target = getContext().actorOf(Props.create(MyActor.class, "target")); } - // #preStart // #postStop @Override @@ -332,7 +324,6 @@ public void postStop() { target = null; // #clean-up-some-resources } - // #postStop // compilation test only @@ -419,7 +410,6 @@ private AbstractActor.Receive shuttingDown() { .build(); } } - // #gracefulStop-actor @Test @@ -487,7 +477,6 @@ public static void main(String[] args) { system.terminate(); } } - // #swapper @Test @@ -560,7 +549,6 @@ public void creatingPropsIllegal() { static class ReceiveTimeoutActor extends AbstractActor { // #receive-timeout ActorRef target = getContext().getSystem().deadLetters(); - // #receive-timeout public ReceiveTimeoutActor() { // To set an initial delay @@ -592,7 +580,6 @@ public Receive createReceive() { .build(); } } - // #receive-timeout @Test @@ -691,7 +678,6 @@ public Receive createReceive() { .build(); } } - // #hot-swap-actor @Test @@ -744,7 +730,6 @@ public Receive createReceive() { .build(); } } - // #stash @Test @@ -780,7 +765,6 @@ public Receive createReceive() { .build(); } } - // #watch @Test @@ -832,7 +816,6 @@ final AbstractActor.Receive active(final ActorRef another) { .build(); } } - // #identify @Test diff --git a/docs/src/test/java/jdocs/actor/ByteBufferSerializerDocTest.java b/docs/src/test/java/jdocs/actor/ByteBufferSerializerDocTest.java index 474054f5b75..7e5b6f97629 100644 --- a/docs/src/test/java/jdocs/actor/ByteBufferSerializerDocTest.java +++ b/docs/src/test/java/jdocs/actor/ByteBufferSerializerDocTest.java @@ -64,7 +64,6 @@ public Object fromBinary(ByteBuffer buf, String manifest) { return null; } } - // #bytebufserializer-with-manifest static class OnlyForDocInclude { diff --git a/docs/src/test/java/jdocs/actor/DependencyInjectionDocTest.java b/docs/src/test/java/jdocs/actor/DependencyInjectionDocTest.java index 682314f4d71..7f11da71927 100644 --- a/docs/src/test/java/jdocs/actor/DependencyInjectionDocTest.java +++ b/docs/src/test/java/jdocs/actor/DependencyInjectionDocTest.java @@ -27,7 +27,6 @@ // #import import org.apache.pekko.actor.Actor; import org.apache.pekko.actor.IndirectActorProducer; - // #import public class DependencyInjectionDocTest extends AbstractJavaTest { @@ -94,7 +93,6 @@ public TheActor produce() { return result; } } - // #creating-indirectly @Test diff --git a/docs/src/test/java/jdocs/actor/SchedulerDocTest.java b/docs/src/test/java/jdocs/actor/SchedulerDocTest.java index b5b654e58bf..0fa606f104d 100644 --- a/docs/src/test/java/jdocs/actor/SchedulerDocTest.java +++ b/docs/src/test/java/jdocs/actor/SchedulerDocTest.java @@ -29,6 +29,8 @@ import org.apache.pekko.testkit.PekkoSpec; import org.apache.pekko.testkit.PekkoJUnitJupiterActorSystemResource; import org.junit.jupiter.api.extension.RegisterExtension; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; public class SchedulerDocTest extends AbstractJavaTest { diff --git a/docs/src/test/java/jdocs/actor/fsm/Buncher.java b/docs/src/test/java/jdocs/actor/fsm/Buncher.java index 54acf9a7f4b..470e5a1d01d 100644 --- a/docs/src/test/java/jdocs/actor/fsm/Buncher.java +++ b/docs/src/test/java/jdocs/actor/fsm/Buncher.java @@ -27,7 +27,6 @@ import org.apache.pekko.actor.AbstractFSM; import org.apache.pekko.actor.ActorRef; import org.apache.pekko.japi.pf.UnitMatch; - // #simple-imports // #simple-fsm diff --git a/docs/src/test/java/jdocs/actor/typed/CoordinatedActorShutdownTest.java b/docs/src/test/java/jdocs/actor/typed/CoordinatedActorShutdownTest.java index c3079d3b23a..141a6c68174 100644 --- a/docs/src/test/java/jdocs/actor/typed/CoordinatedActorShutdownTest.java +++ b/docs/src/test/java/jdocs/actor/typed/CoordinatedActorShutdownTest.java @@ -44,7 +44,6 @@ static final class Stop implements Messages { this.replyTo = replyTo; } } - // #coordinated-shutdown-addTask public static Behavior create() { diff --git a/docs/src/test/java/jdocs/cluster/singleton/ClusterSingletonSupervision.java b/docs/src/test/java/jdocs/cluster/singleton/ClusterSingletonSupervision.java index 1522c11c7b6..a9ae8cb606f 100644 --- a/docs/src/test/java/jdocs/cluster/singleton/ClusterSingletonSupervision.java +++ b/docs/src/test/java/jdocs/cluster/singleton/ClusterSingletonSupervision.java @@ -23,7 +23,6 @@ import org.apache.pekko.actor.Props; import org.apache.pekko.cluster.singleton.ClusterSingletonManager; import org.apache.pekko.cluster.singleton.ClusterSingletonManagerSettings; - // #singleton-supervisor-actor-usage-imports abstract class ClusterSingletonSupervision extends AbstractActor { diff --git a/docs/src/test/java/jdocs/dispatcher/DispatcherDocTest.java b/docs/src/test/java/jdocs/dispatcher/DispatcherDocTest.java index 37ed490ef2f..248dd80b5e7 100644 --- a/docs/src/test/java/jdocs/dispatcher/DispatcherDocTest.java +++ b/docs/src/test/java/jdocs/dispatcher/DispatcherDocTest.java @@ -244,13 +244,11 @@ else if (message.equals(PoisonPill.getInstance())) }); } } - // #prio-mailbox public // #control-aware-mailbox-messages static class MyControlMessage implements ControlMessage {} - // #control-aware-mailbox-messages @Test @@ -271,7 +269,6 @@ public Receive createReceive() { // #require-mailbox-on-actor // ... } - // #require-mailbox-on-actor @Test diff --git a/docs/src/test/java/jdocs/event/EventBusDocTest.java b/docs/src/test/java/jdocs/event/EventBusDocTest.java index 3b32f325245..bec9602ae77 100644 --- a/docs/src/test/java/jdocs/event/EventBusDocTest.java +++ b/docs/src/test/java/jdocs/event/EventBusDocTest.java @@ -145,7 +145,6 @@ public int mapSize() { return 128; } } - // #lookup-bus public @@ -192,7 +191,6 @@ public void publish(MsgEnvelope event, ActorRef subscriber) { subscriber.tell(event.payload, ActorRef.noSender()); } } - // #subchannel-bus public @@ -230,7 +228,6 @@ public void publish(String event, ActorRef subscriber) { subscriber.tell(event, ActorRef.noSender()); } } - // #scanning-bus public @@ -269,7 +266,6 @@ public int mapSize() { return 128; } } - // #actor-bus @RegisterExtension diff --git a/docs/src/test/java/jdocs/event/LoggingDocTest.java b/docs/src/test/java/jdocs/event/LoggingDocTest.java index 9a7f2702828..1b7e7eae070 100644 --- a/docs/src/test/java/jdocs/event/LoggingDocTest.java +++ b/docs/src/test/java/jdocs/event/LoggingDocTest.java @@ -43,7 +43,6 @@ // #imports-deadletter import org.apache.pekko.actor.ActorRef; import org.apache.pekko.actor.ActorSystem; - // #imports-deadletter public class LoggingDocTest extends AbstractJavaTest { @@ -106,7 +105,6 @@ public Receive createReceive() { .build(); } } - // #superclass-subscription-eventstream @Test @@ -253,7 +251,6 @@ public Receive createReceive() { .build(); } } - // #my-event-listener public diff --git a/docs/src/test/java/jdocs/extension/SettingsExtensionDocTest.java b/docs/src/test/java/jdocs/extension/SettingsExtensionDocTest.java index 2d01eab44b6..86cfc70bfdd 100644 --- a/docs/src/test/java/jdocs/extension/SettingsExtensionDocTest.java +++ b/docs/src/test/java/jdocs/extension/SettingsExtensionDocTest.java @@ -85,7 +85,6 @@ public Receive createReceive() { } // #extension-usage-actor } - // #extension-usage-actor public static class Connection {} diff --git a/docs/src/test/java/jdocs/future/FutureDocTest.java b/docs/src/test/java/jdocs/future/FutureDocTest.java index 5edc99a59a1..4e15109aded 100644 --- a/docs/src/test/java/jdocs/future/FutureDocTest.java +++ b/docs/src/test/java/jdocs/future/FutureDocTest.java @@ -47,36 +47,34 @@ public class FutureDocTest extends AbstractJavaTest { @Test @SuppressWarnings("deprecation") public void useAfter() { - Assertions.assertThrows( - IllegalStateException.class, - () -> { - // #after - CompletionStage failWithException = - CompletableFuture.supplyAsync( - () -> { - throw new IllegalStateException("OHNOES1"); - }); - CompletionStage delayed = - Patterns.after(Duration.ofMillis(200), system, () -> failWithException); - // #after - CompletionStage future = - CompletableFuture.supplyAsync( - () -> { - try { - Thread.sleep(1000); - } catch (Throwable ex) { - // ignore - } - return "foo"; - }); - CompletionStage result = - CompletionStages.firstCompletedOf(Arrays.asList(future, delayed)); - try { - result.toCompletableFuture().get(2, SECONDS); - } catch (Throwable ex) { - throw (Exception) ex.getCause(); - } - }); + Assertions.assertThrows(IllegalStateException.class, () -> { + // #after + CompletionStage failWithException = + CompletableFuture.supplyAsync( + () -> { + throw new IllegalStateException("OHNOES1"); + }); + CompletionStage delayed = + Patterns.after(Duration.ofMillis(200), system, () -> failWithException); + // #after + CompletionStage future = + CompletableFuture.supplyAsync( + () -> { + try { + Thread.sleep(1000); + } catch (Throwable ex) { + // ignore + } + return "foo"; + }); + CompletionStage result = + CompletionStages.firstCompletedOf(Arrays.asList(future, delayed)); + try { + result.toCompletableFuture().get(2, SECONDS); + } catch (Throwable ex) { + throw (Exception) ex.getCause(); + } + }); } @Test @@ -104,21 +102,21 @@ public void useRetryWithPredicate() throws Exception { retriedFuture.toCompletableFuture().get(2, SECONDS); } - @Test - public void useRetryWithPredicateWithIntFunction() throws Exception { - // #retry - Callable> attempt = () -> CompletableFuture.completedFuture("test"); - - CompletionStage retriedFuture = - Patterns.retry( - attempt, - (notUsed, e) -> e != null, - 3, - current -> Optional.of(java.time.Duration.ofMillis(200)), - system.classicSystem().scheduler(), - system.executionContext()); - // #retry - - retriedFuture.toCompletableFuture().get(2, SECONDS); - } + @Test + public void useRetryWithPredicateWithIntFunction() throws Exception { + // #retry + Callable> attempt = () -> CompletableFuture.completedFuture("test"); + + CompletionStage retriedFuture = + Patterns.retry( + attempt, + (notUsed, e) -> e != null, + 3, + current -> Optional.of(java.time.Duration.ofMillis(200)), + system.classicSystem().scheduler(), + system.executionContext()); + // #retry + + retriedFuture.toCompletableFuture().get(2, SECONDS); + } } diff --git a/docs/src/test/java/jdocs/io/UdpConnectedDocTest.java b/docs/src/test/java/jdocs/io/UdpConnectedDocTest.java index acd68034d76..6cc02166459 100644 --- a/docs/src/test/java/jdocs/io/UdpConnectedDocTest.java +++ b/docs/src/test/java/jdocs/io/UdpConnectedDocTest.java @@ -33,6 +33,7 @@ // #imports import org.junit.jupiter.api.Test; + public class UdpConnectedDocTest { public static class Demo extends AbstractActor { diff --git a/docs/src/test/java/jdocs/io/japi/IODocTest.java b/docs/src/test/java/jdocs/io/japi/IODocTest.java index a39d238f595..a6c77550692 100644 --- a/docs/src/test/java/jdocs/io/japi/IODocTest.java +++ b/docs/src/test/java/jdocs/io/japi/IODocTest.java @@ -86,7 +86,6 @@ public Receive createReceive() { .build(); } } - // #server public @@ -110,7 +109,6 @@ public Receive createReceive() { .build(); } } - // #simplistic-handler public @@ -181,7 +179,6 @@ private Receive connected(final ActorRef connection) { .build(); } } - // #client @RegisterExtension diff --git a/docs/src/test/java/jdocs/persistence/testkit/PersistenceInitTest.java b/docs/src/test/java/jdocs/persistence/testkit/PersistenceInitTest.java index 0aa453b4879..8acc1a15ddf 100644 --- a/docs/src/test/java/jdocs/persistence/testkit/PersistenceInitTest.java +++ b/docs/src/test/java/jdocs/persistence/testkit/PersistenceInitTest.java @@ -38,19 +38,16 @@ @ExtendWith(TestKitJUnitJupiterExtension.class) public class PersistenceInitTest extends AbstractJavaTest { @JUnitJupiterTestKit - public ActorTestKit testKit = - new JUnitJupiterTestKitBuilder() - .withCustomConfig( - ConfigFactory.parseString( - "pekko.persistence.journal.plugin = \"pekko.persistence.journal.inmem\" \n" - + "pekko.persistence.journal.inmem.test-serialization = on \n" - + "pekko.persistence.snapshot-store.plugin =" - + " \"pekko.persistence.snapshot-store.local\" \n" - + "pekko.persistence.snapshot-store.local.dir = \"target/snapshot-" - + UUID.randomUUID().toString() - + "\" \n") - .withFallback(ConfigFactory.defaultApplication())) - .build(); + public ActorTestKit testKit = new JUnitJupiterTestKitBuilder() + .withCustomConfig(ConfigFactory.parseString( + "pekko.persistence.journal.plugin = \"pekko.persistence.journal.inmem\" \n" + + "pekko.persistence.journal.inmem.test-serialization = on \n" + + "pekko.persistence.snapshot-store.plugin = \"pekko.persistence.snapshot-store.local\" \n" + + "pekko.persistence.snapshot-store.local.dir = \"target/snapshot-" + + UUID.randomUUID().toString() + + "\" \n") + .withFallback(ConfigFactory.defaultApplication())) + .build(); @Test public void testInit() throws Exception { diff --git a/docs/src/test/java/jdocs/routing/ConsistentHashingRouterDocTest.java b/docs/src/test/java/jdocs/routing/ConsistentHashingRouterDocTest.java index d66a994952e..00de90656a8 100644 --- a/docs/src/test/java/jdocs/routing/ConsistentHashingRouterDocTest.java +++ b/docs/src/test/java/jdocs/routing/ConsistentHashingRouterDocTest.java @@ -37,7 +37,6 @@ import org.apache.pekko.routing.ConsistentHashingPool; import org.apache.pekko.routing.ConsistentHashingRouter.ConsistentHashMapper; import org.apache.pekko.routing.ConsistentHashingRouter.ConsistentHashableEnvelope; - // #imports2 public class ConsistentHashingRouterDocTest extends AbstractJavaTest { @@ -122,7 +121,6 @@ public Entry(String key, String value) { public // #cache-actor static final String NOT_FOUND = "NOT_FOUND"; - // #cache-actor @Test diff --git a/docs/src/test/java/jdocs/routing/CustomRouterDocTest.java b/docs/src/test/java/jdocs/routing/CustomRouterDocTest.java index 1387f319589..02fa549b616 100644 --- a/docs/src/test/java/jdocs/routing/CustomRouterDocTest.java +++ b/docs/src/test/java/jdocs/routing/CustomRouterDocTest.java @@ -39,6 +39,7 @@ import org.junit.jupiter.api.Test; import scala.collection.immutable.IndexedSeq; + public class CustomRouterDocTest extends AbstractJavaTest { @RegisterExtension diff --git a/docs/src/test/java/jdocs/routing/RouterDocTest.java b/docs/src/test/java/jdocs/routing/RouterDocTest.java index c375fb85d2d..6bb67194efd 100644 --- a/docs/src/test/java/jdocs/routing/RouterDocTest.java +++ b/docs/src/test/java/jdocs/routing/RouterDocTest.java @@ -173,7 +173,6 @@ public void preStart() { getContext().actorOf(Props.create(Worker.class), "w2"); getContext().actorOf(Props.create(Worker.class), "w3"); } - // ... // #create-worker-actors @@ -358,7 +357,6 @@ public static class Parent extends AbstractActor { ActorRef router31 = getContext() .actorOf(FromConfig.getInstance().props(Props.create(Worker.class)), "router31"); - // #optimal-size-exploring-resize-pool @Override diff --git a/docs/src/test/java/jdocs/serialization/SerializationDocTest.java b/docs/src/test/java/jdocs/serialization/SerializationDocTest.java index df3ae8cf17a..937d5bc8029 100644 --- a/docs/src/test/java/jdocs/serialization/SerializationDocTest.java +++ b/docs/src/test/java/jdocs/serialization/SerializationDocTest.java @@ -71,7 +71,6 @@ public Object fromBinaryJava(byte[] bytes, Class clazz) { // #... } } - // #my-own-serializer static class Customer { @@ -132,7 +131,6 @@ public Object fromBinary(byte[] bytes, String manifest) { else throw new IllegalArgumentException("Unknown manifest: " + manifest); } } - // #my-own-serializer2 @Test diff --git a/docs/src/test/java/jdocs/sharding/ClusterShardingTest.java b/docs/src/test/java/jdocs/sharding/ClusterShardingTest.java index 7db1c69131f..6b7305b69b7 100644 --- a/docs/src/test/java/jdocs/sharding/ClusterShardingTest.java +++ b/docs/src/test/java/jdocs/sharding/ClusterShardingTest.java @@ -56,13 +56,15 @@ public void demonstrateUsage() { public String entityId(Object message) { if (message instanceof Counter.EntityEnvelope envelope) return String.valueOf(envelope.id); - else if (message instanceof Counter.Get get) return String.valueOf(get.counterId); + else if (message instanceof Counter.Get get) + return String.valueOf(get.counterId); else return null; } @Override public Object entityMessage(Object message) { - if (message instanceof Counter.EntityEnvelope envelope) return envelope.payload; + if (message instanceof Counter.EntityEnvelope envelope) + return envelope.payload; else return message; } @@ -123,13 +125,15 @@ public void demonstrateUsage2() { public String entityId(Object message) { if (message instanceof Counter.EntityEnvelope envelope) return String.valueOf(envelope.id); - else if (message instanceof Counter.Get get) return String.valueOf(get.counterId); + else if (message instanceof Counter.Get get) + return String.valueOf(get.counterId); else return null; } @Override public Object entityMessage(Object message) { - if (message instanceof Counter.EntityEnvelope envelope) return envelope.payload; + if (message instanceof Counter.EntityEnvelope envelope) + return envelope.payload; else return message; } diff --git a/docs/src/test/java/jdocs/stream/operators/BroadcastDocExample.java b/docs/src/test/java/jdocs/stream/operators/BroadcastDocExample.java index b7ab096f627..f7c92c7abae 100644 --- a/docs/src/test/java/jdocs/stream/operators/BroadcastDocExample.java +++ b/docs/src/test/java/jdocs/stream/operators/BroadcastDocExample.java @@ -28,7 +28,6 @@ import org.apache.pekko.stream.javadsl.Sink; import org.apache.pekko.stream.javadsl.Source; import java.util.concurrent.CompletionStage; - // #import public class BroadcastDocExample { diff --git a/docs/src/test/java/jdocs/stream/operators/MergeSequenceDocExample.java b/docs/src/test/java/jdocs/stream/operators/MergeSequenceDocExample.java index b0fc3fdf2ef..f94d0ebd277 100644 --- a/docs/src/test/java/jdocs/stream/operators/MergeSequenceDocExample.java +++ b/docs/src/test/java/jdocs/stream/operators/MergeSequenceDocExample.java @@ -28,7 +28,6 @@ import org.apache.pekko.stream.javadsl.RunnableGraph; import org.apache.pekko.stream.javadsl.Sink; import org.apache.pekko.stream.javadsl.Source; - // #import public class MergeSequenceDocExample { diff --git a/docs/src/test/java/jdocs/stream/operators/PartitionDocExample.java b/docs/src/test/java/jdocs/stream/operators/PartitionDocExample.java index 395d2bab362..609481215c9 100644 --- a/docs/src/test/java/jdocs/stream/operators/PartitionDocExample.java +++ b/docs/src/test/java/jdocs/stream/operators/PartitionDocExample.java @@ -26,7 +26,6 @@ import org.apache.pekko.stream.javadsl.RunnableGraph; import org.apache.pekko.stream.javadsl.Sink; import org.apache.pekko.stream.javadsl.Source; - // #import public class PartitionDocExample { diff --git a/docs/src/test/java/jdocs/stream/operators/SourceOrFlow.java b/docs/src/test/java/jdocs/stream/operators/SourceOrFlow.java index 333d27e9f89..1a46e7fe1db 100644 --- a/docs/src/test/java/jdocs/stream/operators/SourceOrFlow.java +++ b/docs/src/test/java/jdocs/stream/operators/SourceOrFlow.java @@ -327,7 +327,6 @@ void scanExample() { CompletionStage asyncFunction(int acc, int next) { return CompletableFuture.supplyAsync(() -> acc + next); } - // #scan-async void scanAsyncExample() { @@ -356,7 +355,6 @@ public Summed sum(Summed other) { return new Summed(this.el + other.el); } } - // #conflateWithSeed-type void conflateWithSeedExample() { @@ -387,7 +385,6 @@ static class Pong { this.id = id; } } - // #collect-elements void collectExample() { @@ -519,7 +516,6 @@ public Histogram add(int number) { return new Histogram(low, high + 1L); } } - // #fold // #foldAsync @@ -532,7 +528,6 @@ public CompletionStage addAsync(Integer n) { } // #fold } - // #fold // #foldAsync void foldExample() { @@ -602,8 +597,8 @@ void filterExample() { Source words = Source.from( Arrays.asList( - ("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor" - + " incididunt ut labore et dolore magna aliqua") + ("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt " + + "ut labore et dolore magna aliqua") .split(" "))); Source longWords = words.filter(w -> w.length() > 6); @@ -621,8 +616,8 @@ void filterNotExample() { Source words = Source.from( Arrays.asList( - ("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor" - + " incididunt ut labore et dolore magna aliqua") + ("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt " + + "ut labore et dolore magna aliqua") .split(" "))); Source longWords = words.filterNot(w -> w.length() <= 6); diff --git a/docs/src/test/java/jdocs/stream/operators/source/AsSubscriber.java b/docs/src/test/java/jdocs/stream/operators/source/AsSubscriber.java index 638d13ac31f..aa0a7d8702e 100644 --- a/docs/src/test/java/jdocs/stream/operators/source/AsSubscriber.java +++ b/docs/src/test/java/jdocs/stream/operators/source/AsSubscriber.java @@ -24,7 +24,7 @@ public interface AsSubscriber { // We are 'faking' the JavaFlowSupport API here so we can include the signature as a snippet in // the API, - // because we're not publishing those (java.util.concurrent.Flow) classes in our API docs yet. + // because we're not publishing those (jdk9+) classes in our API docs yet. static class JavaFlowSupport { public static final class Source { public diff --git a/docs/src/test/java/jdocs/stream/operators/source/FromPublisher.java b/docs/src/test/java/jdocs/stream/operators/source/FromPublisher.java index 0c6e1c873cc..ee4594b66cc 100644 --- a/docs/src/test/java/jdocs/stream/operators/source/FromPublisher.java +++ b/docs/src/test/java/jdocs/stream/operators/source/FromPublisher.java @@ -24,7 +24,7 @@ public interface FromPublisher { // We are 'faking' the JavaFlowSupport API here so we can include the signature as a snippet in // the API, - // because we're not publishing those (java.util.concurrent.Flow) classes in our API docs yet. + // because we're not publishing those (jdk9+) classes in our API docs yet. static class JavaFlowSupport { public static final class Source { public diff --git a/docs/src/test/java/jdocs/typed/tutorial_1/ActorHierarchyExperiments.java b/docs/src/test/java/jdocs/typed/tutorial_1/ActorHierarchyExperiments.java index 6d41163e882..60b85d1e49f 100644 --- a/docs/src/test/java/jdocs/typed/tutorial_1/ActorHierarchyExperiments.java +++ b/docs/src/test/java/jdocs/typed/tutorial_1/ActorHierarchyExperiments.java @@ -54,7 +54,6 @@ private Behavior printIt() { return this; } } - // #print-refs // #start-stop @@ -106,7 +105,6 @@ private Behavior onPostStop() { return this; } } - // #start-stop // #supervise @@ -172,7 +170,6 @@ private Behavior postStop() { return this; } } - // #supervise // #print-refs @@ -207,7 +204,6 @@ public static void main(String[] args) { testSystem.tell("start"); } } - // #print-refs class StartingActorHierarchyActors { diff --git a/docs/src/test/scala/docs/actor/SharedMutableStateDocSpec.scala b/docs/src/test/scala/docs/actor/SharedMutableStateDocSpec.scala index 3c1da099514..f61aa1145a6 100644 --- a/docs/src/test/scala/docs/actor/SharedMutableStateDocSpec.scala +++ b/docs/src/test/scala/docs/actor/SharedMutableStateDocSpec.scala @@ -33,7 +33,7 @@ class SharedMutableStateDocSpec { class CleanUpActor extends Actor { def receive = { - case set: mutable.Set[?] => set.clear() + case set: mutable.Set[_] => set.clear() } } diff --git a/docs/src/test/scala/docs/ddata/DistributedDataDocSpec.scala b/docs/src/test/scala/docs/ddata/DistributedDataDocSpec.scala index 8f45d39994c..81c5e8c68fc 100644 --- a/docs/src/test/scala/docs/ddata/DistributedDataDocSpec.scala +++ b/docs/src/test/scala/docs/ddata/DistributedDataDocSpec.scala @@ -95,7 +95,7 @@ object DistributedDataDocSpec { replicator ! Update(DataKey, ORSet.empty[String], WriteLocal)(_.remove(s)) } - case _: UpdateResponse[?] => // ignore + case _: UpdateResponse[_] => // ignore case c @ Changed(DataKey) => val data = c.get(DataKey) log.info("Current elements: {}", data.elements) @@ -136,14 +136,14 @@ class DistributedDataDocSpec extends PekkoSpec(DistributedDataDocSpec.config) { replicator ! Update(ActiveFlagKey, Flag.Disabled, writeAll)(_.switchOn) // #update - probe.expectMsgType[UpdateResponse[?]] match { + probe.expectMsgType[UpdateResponse[_]] match { // #update-response1 case UpdateSuccess(Counter1Key, req) => // ok // #update-response1 case unexpected => fail("Unexpected response: " + unexpected) } - probe.expectMsgType[UpdateResponse[?]] match { + probe.expectMsgType[UpdateResponse[_]] match { // #update-response2 case UpdateSuccess(Set1Key, req) => // ok case UpdateTimeout(Set1Key, req) => @@ -203,7 +203,7 @@ class DistributedDataDocSpec extends PekkoSpec(DistributedDataDocSpec.config) { replicator ! Get(ActiveFlagKey, readAll) // #get - probe.expectMsgType[GetResponse[?]] match { + probe.expectMsgType[GetResponse[_]] match { // #get-response1 case g @ GetSuccess(Counter1Key, req) => val value = g.get(Counter1Key).value @@ -212,7 +212,7 @@ class DistributedDataDocSpec extends PekkoSpec(DistributedDataDocSpec.config) { case unexpected => fail("Unexpected response: " + unexpected) } - probe.expectMsgType[GetResponse[?]] match { + probe.expectMsgType[GetResponse[_]] match { // #get-response2 case g @ GetSuccess(Set1Key, req) => val elements = g.get(Set1Key).elements diff --git a/docs/src/test/scala/docs/ddata/ShoppingCart.scala b/docs/src/test/scala/docs/ddata/ShoppingCart.scala index d0ef12f8c6f..ffb9c2e65ab 100644 --- a/docs/src/test/scala/docs/ddata/ShoppingCart.scala +++ b/docs/src/test/scala/docs/ddata/ShoppingCart.scala @@ -118,9 +118,9 @@ class ShoppingCart(userId: String) extends Actor { // #remove-item def receiveOther: Receive = { - case _: UpdateSuccess[?] | _: UpdateTimeout[?] => + case _: UpdateSuccess[_] | _: UpdateTimeout[_] => // UpdateTimeout, will eventually be replicated - case e: UpdateFailure[?] => throw new IllegalStateException("Unexpected failure: " + e) + case e: UpdateFailure[_] => throw new IllegalStateException("Unexpected failure: " + e) } } diff --git a/docs/src/test/scala/docs/ddata/protobuf/TwoPhaseSetSerializer.scala b/docs/src/test/scala/docs/ddata/protobuf/TwoPhaseSetSerializer.scala index 379657b413d..249b72cc4db 100644 --- a/docs/src/test/scala/docs/ddata/protobuf/TwoPhaseSetSerializer.scala +++ b/docs/src/test/scala/docs/ddata/protobuf/TwoPhaseSetSerializer.scala @@ -36,7 +36,7 @@ class TwoPhaseSetSerializer(val system: ExtendedActorSystem) extends Serializer case _ => throw new IllegalArgumentException(s"Can't serialize object of type ${obj.getClass}") } - override def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = { + override def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = { twoPhaseSetFromBinary(bytes) } @@ -78,7 +78,7 @@ class TwoPhaseSetSerializerWithCompression(system: ExtendedActorSystem) extends case _ => throw new IllegalArgumentException(s"Can't serialize object of type ${obj.getClass}") } - override def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = { + override def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = { twoPhaseSetFromBinary(decompress(bytes)) } // #compression diff --git a/docs/src/test/scala/docs/ddata/protobuf/TwoPhaseSetSerializer2.scala b/docs/src/test/scala/docs/ddata/protobuf/TwoPhaseSetSerializer2.scala index 2760a7c33eb..89eae2ae9f5 100644 --- a/docs/src/test/scala/docs/ddata/protobuf/TwoPhaseSetSerializer2.scala +++ b/docs/src/test/scala/docs/ddata/protobuf/TwoPhaseSetSerializer2.scala @@ -33,7 +33,7 @@ class TwoPhaseSetSerializer2(val system: ExtendedActorSystem) extends Serializer case _ => throw new IllegalArgumentException(s"Can't serialize object of type ${obj.getClass}") } - override def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = { + override def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = { twoPhaseSetFromBinary(bytes) } diff --git a/docs/src/test/scala/docs/event/LoggingDocSpec.scala b/docs/src/test/scala/docs/event/LoggingDocSpec.scala index 6dafb0db6d8..cc36f7957f1 100644 --- a/docs/src/test/scala/docs/event/LoggingDocSpec.scala +++ b/docs/src/test/scala/docs/event/LoggingDocSpec.scala @@ -112,7 +112,7 @@ object LoggingDocSpec { object MyType { implicit val logSource: LogSource[AnyRef] = new LogSource[AnyRef] { def genString(o: AnyRef): String = o.getClass.getName - override def getClazz(o: AnyRef): Class[?] = o.getClass + override def getClazz(o: AnyRef): Class[_] = o.getClass } } diff --git a/docs/src/test/scala/docs/io/EchoServer.scala b/docs/src/test/scala/docs/io/EchoServer.scala index 8382a21e2b0..83076bcffeb 100644 --- a/docs/src/test/scala/docs/io/EchoServer.scala +++ b/docs/src/test/scala/docs/io/EchoServer.scala @@ -37,7 +37,7 @@ object EchoServer extends App { system.terminate() } -class EchoManager(handlerClass: Class[?]) extends Actor with ActorLogging { +class EchoManager(handlerClass: Class[_]) extends Actor with ActorLogging { import Tcp._ import context.system diff --git a/docs/src/test/scala/docs/persistence/PersistenceSerializerDocSpec.scala b/docs/src/test/scala/docs/persistence/PersistenceSerializerDocSpec.scala index b41f8fedb7b..819151b36b6 100644 --- a/docs/src/test/scala/docs/persistence/PersistenceSerializerDocSpec.scala +++ b/docs/src/test/scala/docs/persistence/PersistenceSerializerDocSpec.scala @@ -54,12 +54,12 @@ class MyPayloadSerializer extends Serializer { def identifier: Int = 77124 def includeManifest: Boolean = false def toBinary(o: AnyRef): Array[Byte] = ??? - def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = ??? + def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = ??? } class MySnapshotSerializer extends Serializer { def identifier: Int = 77125 def includeManifest: Boolean = false def toBinary(o: AnyRef): Array[Byte] = ??? - def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = ??? + def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = ??? } diff --git a/docs/src/test/scala/docs/serialization/SerializationDocSpec.scala b/docs/src/test/scala/docs/serialization/SerializationDocSpec.scala index fc5ca47363e..ab58efde98c 100644 --- a/docs/src/test/scala/docs/serialization/SerializationDocSpec.scala +++ b/docs/src/test/scala/docs/serialization/SerializationDocSpec.scala @@ -53,7 +53,7 @@ package docs.serialization { // "fromBinary" deserializes the given array, // using the type hint (if any, see "includeManifest" above) - def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = { + def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = { // Put your code that deserializes here // #... null diff --git a/docs/src/test/scala/docs/stream/GraphDSLDocSpec.scala b/docs/src/test/scala/docs/stream/GraphDSLDocSpec.scala index bd63246f623..5d7c2045d12 100644 --- a/docs/src/test/scala/docs/stream/GraphDSLDocSpec.scala +++ b/docs/src/test/scala/docs/stream/GraphDSLDocSpec.scala @@ -110,9 +110,9 @@ class GraphDSLDocSpec extends PekkoSpec { // It is important to provide the list of all input and output // ports with a stable order. Duplicates are not allowed. - override val inlets: immutable.Seq[Inlet[?]] = + override val inlets: immutable.Seq[Inlet[_]] = jobsIn :: priorityJobsIn :: Nil - override val outlets: immutable.Seq[Outlet[?]] = + override val outlets: immutable.Seq[Outlet[_]] = resultsOut :: Nil // A Shape must be able to create a copy of itself. Basically diff --git a/docs/src/test/scala/docs/stream/cookbook/RecipeAdhocSource.scala b/docs/src/test/scala/docs/stream/cookbook/RecipeAdhocSource.scala index b90fb3f054a..a1b4fa38774 100644 --- a/docs/src/test/scala/docs/stream/cookbook/RecipeAdhocSource.scala +++ b/docs/src/test/scala/docs/stream/cookbook/RecipeAdhocSource.scala @@ -27,7 +27,7 @@ import scala.concurrent.duration._ class RecipeAdhocSource extends RecipeSpec { // #adhoc-source - def adhocSource[T](source: Source[T, ?], timeout: FiniteDuration, maxRetries: Int): Source[T, ?] = + def adhocSource[T](source: Source[T, _], timeout: FiniteDuration, maxRetries: Int): Source[T, _] = Source.lazySource(() => source .backpressureTimeout(timeout) diff --git a/docs/src/test/scala/docs/stream/operators/JavaCollectorDocExample.scala b/docs/src/test/scala/docs/stream/operators/JavaCollectorDocExample.scala index b13829e5f30..29bfcd1b4c2 100644 --- a/docs/src/test/scala/docs/stream/operators/JavaCollectorDocExample.scala +++ b/docs/src/test/scala/docs/stream/operators/JavaCollectorDocExample.scala @@ -30,7 +30,7 @@ object JavaCollectorDocExample { val source: Source[String, NotUsed] = Source(List("Apache", "Pekko", "Streams")) - val sink: Sink[String, ?] = + val sink: Sink[String, _] = StreamConverters.javaCollector(() => Collectors.toList[String]()) // #javaCollector } diff --git a/docs/src/test/scala/docs/stream/operators/source/Zip.scala b/docs/src/test/scala/docs/stream/operators/source/Zip.scala index 1a6056522eb..14b67bb03ee 100644 --- a/docs/src/test/scala/docs/stream/operators/source/Zip.scala +++ b/docs/src/test/scala/docs/stream/operators/source/Zip.scala @@ -18,7 +18,7 @@ import org.apache.pekko.stream.scaladsl.Source object Zip { - implicit val system: ActorSystem[?] = ??? + implicit val system: ActorSystem[_] = ??? def zipN(): Unit = { // #zipN-simple diff --git a/docs/src/test/scala/docs/stream/operators/sourceorflow/Limit.scala b/docs/src/test/scala/docs/stream/operators/sourceorflow/Limit.scala index 1bfdd2e8a60..159ba26f014 100644 --- a/docs/src/test/scala/docs/stream/operators/sourceorflow/Limit.scala +++ b/docs/src/test/scala/docs/stream/operators/sourceorflow/Limit.scala @@ -22,7 +22,7 @@ import scala.concurrent.Future object Limit { - implicit val system: ActorSystem[?] = ??? + implicit val system: ActorSystem[_] = ??? def simple(): Unit = { // #simple diff --git a/docs/src/test/scala/docs/stream/operators/sourceorflow/LimitWeighted.scala b/docs/src/test/scala/docs/stream/operators/sourceorflow/LimitWeighted.scala index e2c3ed83841..c604a2322c2 100644 --- a/docs/src/test/scala/docs/stream/operators/sourceorflow/LimitWeighted.scala +++ b/docs/src/test/scala/docs/stream/operators/sourceorflow/LimitWeighted.scala @@ -22,7 +22,7 @@ import scala.concurrent.Future object LimitWeighted { - implicit val system: ActorSystem[?] = ??? + implicit val system: ActorSystem[_] = ??? def simple(): Unit = { // #simple diff --git a/multi-node-testkit/src/main/java/org/apache/pekko/remote/testconductor/TestConductorProtocol.java b/multi-node-testkit/src/main/java/org/apache/pekko/remote/testconductor/TestConductorProtocol.java index b2aebbdcea6..20fb34befb6 100644 --- a/multi-node-testkit/src/main/java/org/apache/pekko/remote/testconductor/TestConductorProtocol.java +++ b/multi-node-testkit/src/main/java/org/apache/pekko/remote/testconductor/TestConductorProtocol.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: TestConductorProtocol.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package org.apache.pekko.remote.testconductor; @@ -25,8 +25,8 @@ private TestConductorProtocol() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "TestConductorProtocol"); } @@ -66,8 +66,8 @@ public enum BarrierOp org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "BarrierOp"); } @@ -197,8 +197,8 @@ public enum FailType org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "FailType"); } @@ -326,8 +326,8 @@ public enum Direction org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Direction"); } @@ -510,8 +510,8 @@ public static final class Wrapper extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Wrapper"); } @@ -750,8 +750,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getHello()); @@ -771,15 +776,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(5, getAddr()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -1865,8 +1861,8 @@ public static final class Hello extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Hello"); } @@ -2006,8 +2002,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, name_); } @@ -2015,15 +2016,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getAddress()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2649,8 +2641,8 @@ public static final class EnterBarrier extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "EnterBarrier"); } @@ -2801,8 +2793,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, name_); } @@ -2814,15 +2811,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(3, timeout_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -3412,8 +3400,8 @@ public static final class AddressRequest extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "AddressRequest"); } @@ -3551,8 +3539,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, node_); } @@ -3560,15 +3553,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getAddr()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -4216,8 +4200,8 @@ public static final class Address extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Address"); } @@ -4460,8 +4444,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, protocol_); } @@ -4475,15 +4464,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt32Size(4, port_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -5245,8 +5225,8 @@ public static final class InjectFailure extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "InjectFailure"); } @@ -5419,8 +5399,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeEnumSize(1, failure_); @@ -5441,15 +5426,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt32Size(7, exitValue_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/multi-node-testkit/src/main/scala/org/apache/pekko/remote/testconductor/Player.scala b/multi-node-testkit/src/main/scala/org/apache/pekko/remote/testconductor/Player.scala index 0e525dbb5dd..443f3609e48 100644 --- a/multi-node-testkit/src/main/scala/org/apache/pekko/remote/testconductor/Player.scala +++ b/multi-node-testkit/src/main/scala/org/apache/pekko/remote/testconductor/Player.scala @@ -54,11 +54,11 @@ object Player { case Transition(_, f: ClientFSM.State, t: ClientFSM.State) if f == AwaitDone && t == Connected => // SI-5900 workaround waiting ! Done; context.stop(self) - case t: Transition[?] => + case t: Transition[_] => waiting ! Status.Failure(new RuntimeException("unexpected transition: " + t)); context.stop(self) case CurrentState(_, s: ClientFSM.State) if s == Connected => // SI-5900 workaround waiting ! Done; context.stop(self) - case _: CurrentState[?] => + case _: CurrentState[_] => } } @@ -313,8 +313,7 @@ private[pekko] class ClientFSM(name: RoleName, controllerAddr: InetSocketAddress } catch { case NonFatal(ex) => // silence this one to not make tests look like they failed, it's not really critical - if (log.isDebugEnabled) - log.debug("Failed closing channel with {} {}", ex.getClass.getName, ex.getMessage) + log.debug(s"Failed closing channel with ${ex.getClass.getName} ${ex.getMessage}") } } diff --git a/multi-node-testkit/src/main/scala/org/apache/pekko/remote/testkit/MultiNodeSpec.scala b/multi-node-testkit/src/main/scala/org/apache/pekko/remote/testkit/MultiNodeSpec.scala index cb14584c5e0..a69e5097806 100644 --- a/multi-node-testkit/src/main/scala/org/apache/pekko/remote/testkit/MultiNodeSpec.scala +++ b/multi-node-testkit/src/main/scala/org/apache/pekko/remote/testkit/MultiNodeSpec.scala @@ -342,7 +342,7 @@ abstract class MultiNodeSpec( } }) - val log: LoggingAdapter = Logging(system, classOf[MultiNodeSpec]) + val log: LoggingAdapter = Logging(system, this)(_.getClass.getName) /** * Enrich `.await()` onto all Awaitables, using remaining duration from the innermost @@ -465,9 +465,9 @@ abstract class MultiNodeSpec( */ def node(role: RoleName): ActorPath = RootActorPath(testConductor.getAddressFor(role).await) - def muteDeadLetters(messageClasses: Class[?]*)(sys: ActorSystem = system): Unit = + def muteDeadLetters(messageClasses: Class[_]*)(sys: ActorSystem = system): Unit = if (!sys.log.isDebugEnabled) { - def mute(clazz: Class[?]): Unit = + def mute(clazz: Class[_]): Unit = sys.eventStream.publish(Mute(DeadLettersFilter(clazz)(occurrences = Int.MaxValue))) if (messageClasses.isEmpty) mute(classOf[AnyRef]) else messageClasses.foreach(mute) diff --git a/osgi/src/main/scala/org/apache/pekko/osgi/ActorSystemActivator.scala b/osgi/src/main/scala/org/apache/pekko/osgi/ActorSystemActivator.scala index d246a8bfe6a..9ce75fb961a 100644 --- a/osgi/src/main/scala/org/apache/pekko/osgi/ActorSystemActivator.scala +++ b/osgi/src/main/scala/org/apache/pekko/osgi/ActorSystemActivator.scala @@ -37,7 +37,7 @@ import com.typesafe.config.{ Config, ConfigFactory } abstract class ActorSystemActivator extends BundleActivator { private var system: Option[ActorSystem] = None - private var registration: Option[ServiceRegistration[?]] = None + private var registration: Option[ServiceRegistration[_]] = None /** * Implement this method to add your own actors to the ActorSystem. If you want to share the actor @@ -90,7 +90,7 @@ abstract class ActorSystemActivator extends BundleActivator { /** * Convenience method to find a service by its reference. */ - def serviceForReference[T](context: BundleContext, reference: ServiceReference[?]): T = + def serviceForReference[T](context: BundleContext, reference: ServiceReference[_]): T = context.getService(reference).asInstanceOf[T] /** diff --git a/osgi/src/main/scala/org/apache/pekko/osgi/BundleDelegatingClassLoader.scala b/osgi/src/main/scala/org/apache/pekko/osgi/BundleDelegatingClassLoader.scala index baf32fef869..2423fd1e41d 100644 --- a/osgi/src/main/scala/org/apache/pekko/osgi/BundleDelegatingClassLoader.scala +++ b/osgi/src/main/scala/org/apache/pekko/osgi/BundleDelegatingClassLoader.scala @@ -49,8 +49,8 @@ class BundleDelegatingClassLoader(bundle: Bundle, fallBackClassLoader: ClassLoad private val bundles = findTransitiveBundles(bundle).toList - override def findClass(name: String): Class[?] = { - @tailrec def find(remaining: List[Bundle]): Class[?] = { + override def findClass(name: String): Class[_] = { + @tailrec def find(remaining: List[Bundle]): Class[_] = { if (remaining.isEmpty) throw new ClassNotFoundException(name) else Try { remaining.head.loadClass(name) } match { diff --git a/osgi/src/test/scala/org/apache/pekko/osgi/PojoSRTestSupport.scala b/osgi/src/test/scala/org/apache/pekko/osgi/PojoSRTestSupport.scala index 49f45d5b99d..5469a3facf5 100644 --- a/osgi/src/test/scala/org/apache/pekko/osgi/PojoSRTestSupport.scala +++ b/osgi/src/test/scala/org/apache/pekko/osgi/PojoSRTestSupport.scala @@ -150,7 +150,7 @@ class BundleDescriptorBuilder(name: String) { /** * Add a Bundle activator to our test bundle */ - def withActivator(activator: Class[? <: BundleActivator]): BundleDescriptorBuilder = { + def withActivator(activator: Class[_ <: BundleActivator]): BundleDescriptorBuilder = { tinybundle.setHeader(Constants.BUNDLE_ACTIVATOR, activator.getName) this } diff --git a/persistence-query/src/main/java/org/apache/pekko/persistence/query/internal/protobuf/QueryMessages.java b/persistence-query/src/main/java/org/apache/pekko/persistence/query/internal/protobuf/QueryMessages.java index 2b23ee1d073..32ffcaee5e8 100644 --- a/persistence-query/src/main/java/org/apache/pekko/persistence/query/internal/protobuf/QueryMessages.java +++ b/persistence-query/src/main/java/org/apache/pekko/persistence/query/internal/protobuf/QueryMessages.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: QueryMessages.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.0 package org.apache.pekko.persistence.query.internal.protobuf; @@ -26,7 +26,7 @@ private QueryMessages() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, + /* minor= */ 34, /* patch= */ 0, /* suffix= */ "", "QueryMessages"); @@ -291,7 +291,7 @@ public static final class EventEnvelope org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, + /* minor= */ 34, /* patch= */ 0, /* suffix= */ "", "EventEnvelope"); @@ -309,7 +309,7 @@ private EventEnvelope() { offset_ = ""; offsetManifest_ = ""; source_ = ""; - tags_ = org.apache.pekko.protobufv3.internal.LazyStringArrayList.emptyList(); + tags_ = org.apache.pekko.protobufv3.internal.LazyStringArrayList.EMPTY; } public static final org.apache.pekko.protobufv3.internal.Descriptors.Descriptor @@ -766,10 +766,7 @@ public org.apache.pekko.protobufv3.internal.ByteString getSourceBytes() { } public static final int TAGS_FIELD_NUMBER = 12; - - @SuppressWarnings("serial") - private org.apache.pekko.protobufv3.internal.LazyStringArrayList tags_ = - org.apache.pekko.protobufv3.internal.LazyStringArrayList.emptyList(); + private org.apache.pekko.protobufv3.internal.LazyStringList tags_; /** * repeated string tags = 12; @@ -906,8 +903,12 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize( @@ -962,16 +963,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getTagsList().size(); } - return size; - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -1289,7 +1280,8 @@ public Builder clear() { } filtered_ = false; source_ = ""; - tags_ = org.apache.pekko.protobufv3.internal.LazyStringArrayList.emptyList(); + tags_ = org.apache.pekko.protobufv3.internal.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000800); return this; } @@ -1379,9 +1371,10 @@ private void buildPartial0( to_bitField0_ |= 0x00000400; } if (((from_bitField0_ & 0x00000800) != 0)) { - tags_.makeImmutable(); - result.tags_ = tags_; + tags_ = tags_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000800); } + result.tags_ = tags_; result.bitField0_ |= to_bitField0_; } @@ -1450,7 +1443,7 @@ public Builder mergeFrom( if (!other.tags_.isEmpty()) { if (tags_.isEmpty()) { tags_ = other.tags_; - bitField0_ |= 0x00000800; + bitField0_ = (bitField0_ & ~0x00000800); } else { ensureTagsIsMutable(); tags_.addAll(other.tags_); @@ -1583,9 +1576,9 @@ public Builder mergeFrom( } // case 90 case 98: { - org.apache.pekko.protobufv3.internal.ByteString bs = input.readBytes(); + java.lang.String s = input.readStringRequireUtf8(); ensureTagsIsMutable(); - tags_.add(bs); + tags_.add(s); break; } // case 98 default: @@ -2514,14 +2507,14 @@ public Builder setSourceBytes(org.apache.pekko.protobufv3.internal.ByteString va return this; } - private org.apache.pekko.protobufv3.internal.LazyStringArrayList tags_ = - org.apache.pekko.protobufv3.internal.LazyStringArrayList.emptyList(); + private org.apache.pekko.protobufv3.internal.LazyStringList tags_ = + org.apache.pekko.protobufv3.internal.LazyStringArrayList.EMPTY; private void ensureTagsIsMutable() { - if (!tags_.isModifiable()) { + if (!((bitField0_ & 0x00000800) != 0)) { tags_ = new org.apache.pekko.protobufv3.internal.LazyStringArrayList(tags_); + bitField0_ |= 0x00000800; } - bitField0_ |= 0x00000800; } /** @@ -2530,8 +2523,7 @@ private void ensureTagsIsMutable() { * @return A list containing the tags. */ public org.apache.pekko.protobufv3.internal.ProtocolStringList getTagsList() { - tags_.makeImmutable(); - return tags_; + return tags_.getUnmodifiableView(); } /** @@ -2576,7 +2568,6 @@ public Builder setTags(int index, java.lang.String value) { } ensureTagsIsMutable(); tags_.set(index, value); - bitField0_ |= 0x00000800; onChanged(); return this; } @@ -2593,7 +2584,6 @@ public Builder addTags(java.lang.String value) { } ensureTagsIsMutable(); tags_.add(value); - bitField0_ |= 0x00000800; onChanged(); return this; } @@ -2607,7 +2597,6 @@ public Builder addTags(java.lang.String value) { public Builder addAllTags(java.lang.Iterable values) { ensureTagsIsMutable(); org.apache.pekko.protobufv3.internal.AbstractMessageLite.Builder.addAll(values, tags_); - bitField0_ |= 0x00000800; onChanged(); return this; } @@ -2618,9 +2607,8 @@ public Builder addAllTags(java.lang.Iterable values) { * @return This builder for chaining. */ public Builder clearTags() { - tags_ = org.apache.pekko.protobufv3.internal.LazyStringArrayList.emptyList(); + tags_ = org.apache.pekko.protobufv3.internal.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000800); - ; onChanged(); return this; } @@ -2637,7 +2625,6 @@ public Builder addTagsBytes(org.apache.pekko.protobufv3.internal.ByteString valu } ensureTagsIsMutable(); tags_.add(value); - bitField0_ |= 0x00000800; onChanged(); return this; } diff --git a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/internal/QuerySerializer.scala b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/internal/QuerySerializer.scala index bbd1780560c..25ffdeabc14 100644 --- a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/internal/QuerySerializer.scala +++ b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/internal/QuerySerializer.scala @@ -62,14 +62,14 @@ import pekko.serialization.Serializers private val timestampOffsetSeparator = ';' override def manifest(o: AnyRef): String = o match { - case _: EventEnvelope[?] => EventEnvelopeManifest + case _: EventEnvelope[_] => EventEnvelopeManifest case offset: Offset => toStorageRepresentation(offset)._2 case _ => throw new IllegalArgumentException(s"Can't serialize object of type ${o.getClass} in [${getClass.getName}]") } override def toBinary(o: AnyRef): Array[Byte] = o match { - case env: EventEnvelope[?] => + case env: EventEnvelope[_] => val builder = QueryMessages.EventEnvelope.newBuilder() val (offset, offsetManifest) = toStorageRepresentation(env.offset) diff --git a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/AllPersistenceIdsStage.scala b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/AllPersistenceIdsStage.scala index 011853a8b63..e008b1abcb8 100644 --- a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/AllPersistenceIdsStage.scala +++ b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/AllPersistenceIdsStage.scala @@ -46,7 +46,7 @@ final private[pekko] class AllPersistenceIdsStage(liveQuery: Boolean, writeJourn val journal: ActorRef = Persistence(mat.system).journalFor(writeJournalPluginId) var initialResponseReceived = false - override protected def logSource: Class[?] = classOf[AllPersistenceIdsStage] + override protected def logSource: Class[_] = classOf[AllPersistenceIdsStage] override def preStart(): Unit = { journal.tell(LeveldbJournal.SubscribeAllPersistenceIds, getStageActor(journalInteraction).ref) diff --git a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/EventsByPersistenceIdStage.scala b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/EventsByPersistenceIdStage.scala index 614811f9688..e351830a1dd 100644 --- a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/EventsByPersistenceIdStage.scala +++ b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/EventsByPersistenceIdStage.scala @@ -73,7 +73,7 @@ final private[pekko] class EventsByPersistenceIdStage( var nextSequenceNr = fromSequenceNr var toSequenceNr = initialToSequenceNr - override protected def logSource: Class[?] = classOf[EventsByPersistenceIdStage] + override protected def logSource: Class[_] = classOf[EventsByPersistenceIdStage] override def preStart(): Unit = { stageActorRef = getStageActor(journalInteraction).ref diff --git a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/EventsByTagStage.scala b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/EventsByTagStage.scala index 4ab38707f67..32261327e9e 100644 --- a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/EventsByTagStage.scala +++ b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/journal/leveldb/EventsByTagStage.scala @@ -73,7 +73,7 @@ final private[leveldb] class EventsByTagStage( var replayInProgress = false var outstandingReplay = false - override protected def logSource: Class[?] = classOf[EventsByTagStage] + override protected def logSource: Class[_] = classOf[EventsByTagStage] override def preStart(): Unit = { stageActorRef = getStageActor(journalInteraction).ref diff --git a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/typed/EventEnvelope.scala b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/typed/EventEnvelope.scala index 6cbb7e53355..23cdbea46d6 100644 --- a/persistence-query/src/main/scala/org/apache/pekko/persistence/query/typed/EventEnvelope.scala +++ b/persistence-query/src/main/scala/org/apache/pekko/persistence/query/typed/EventEnvelope.scala @@ -13,8 +13,8 @@ package org.apache.pekko.persistence.query.typed -import java.util.{ Set => JSet } import java.util.Optional +import java.util.{ Set => JSet } import org.apache.pekko import pekko.annotation.ApiMayChange @@ -235,7 +235,7 @@ final class EventEnvelope[Event]( } override def equals(obj: Any): Boolean = obj match { - case other: EventEnvelope[?] => + case other: EventEnvelope[_] => offset == other.offset && persistenceId == other.persistenceId && sequenceNr == other.sequenceNr && eventOption == other.eventOption && timestamp == other.timestamp && eventMetadata == other.eventMetadata && entityType == other.entityType && slice == other.slice && filtered == other.filtered && diff --git a/persistence-shared/src/test/scala/org/apache/pekko/persistence/serialization/SerializerSpec.scala b/persistence-shared/src/test/scala/org/apache/pekko/persistence/serialization/SerializerSpec.scala index a591ecb4bfc..834fd124be1 100644 --- a/persistence-shared/src/test/scala/org/apache/pekko/persistence/serialization/SerializerSpec.scala +++ b/persistence-shared/src/test/scala/org/apache/pekko/persistence/serialization/SerializerSpec.scala @@ -394,7 +394,7 @@ class MyPayloadSerializer extends Serializer { case x => throw new NotSerializableException(s"Unexpected object: $x") } - def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = manifest match { + def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = manifest match { case Some(MyPayloadClass) => MyPayload(s"${new String(bytes, UTF_8)}.") case Some(c) => throw new Exception(s"unexpected manifest $c") case None => throw new Exception("no manifest") @@ -438,7 +438,7 @@ class MySnapshotSerializer extends Serializer { case x => throw new NotSerializableException(s"Unexpected object: $x") } - def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = manifest match { + def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = manifest match { case Some(MySnapshotClass) => MySnapshot(s"${new String(bytes, UTF_8)}.") case Some(c) => throw new Exception(s"unexpected manifest $c") case None => throw new Exception("no manifest") diff --git a/persistence-tck/src/main/scala/org/apache/pekko/persistence/journal/JournalSpec.scala b/persistence-tck/src/main/scala/org/apache/pekko/persistence/journal/JournalSpec.scala index 64b683204d6..5388c353519 100644 --- a/persistence-tck/src/main/scala/org/apache/pekko/persistence/journal/JournalSpec.scala +++ b/persistence-tck/src/main/scala/org/apache/pekko/persistence/journal/JournalSpec.scala @@ -247,56 +247,6 @@ abstract class JournalSpec(config: Config) journal ! ReplayMessages(0, Long.MaxValue, Long.MaxValue, pid, receiverProbe.ref) receiverProbe.expectMsg(RecoverySuccess(highestSequenceNr = 5L)) } - - "replay all surviving messages when the lower bound equals the last deleted sequence number" in { - val deleteProbe = TestProbe() - journal ! DeleteMessagesTo(pid, 3L, deleteProbe.ref) - deleteProbe.expectMsg(DeleteMessagesSuccess(3L)) - - journal ! ReplayMessages(3L, Long.MaxValue, Long.MaxValue, pid, receiverProbe.ref) - receiverProbe.expectMsg(replayedMessage(4)) - receiverProbe.expectMsg(replayedMessage(5)) - receiverProbe.expectMsg(RecoverySuccess(highestSequenceNr = 5L)) - } - - "replay surviving messages within bounds when the replay window spans a deleted prefix" in { - val deleteProbe = TestProbe() - journal ! DeleteMessagesTo(pid, 3L, deleteProbe.ref) - deleteProbe.expectMsg(DeleteMessagesSuccess(3L)) - - journal ! ReplayMessages(1, 4, Long.MaxValue, pid, receiverProbe.ref) - receiverProbe.expectMsg(replayedMessage(4)) - receiverProbe.expectMsg(RecoverySuccess(highestSequenceNr = 5L)) - } - - "return only recovery success when the upper bound falls within a deleted prefix" in { - val deleteProbe = TestProbe() - journal ! DeleteMessagesTo(pid, 3L, deleteProbe.ref) - deleteProbe.expectMsg(DeleteMessagesSuccess(3L)) - - journal ! ReplayMessages(1, 2, Long.MaxValue, pid, receiverProbe.ref) - receiverProbe.expectMsg(RecoverySuccess(highestSequenceNr = 5L)) - } - - "return only recovery success when the upper bound equals the last deleted sequence number" in { - val deleteProbe = TestProbe() - journal ! DeleteMessagesTo(pid, 3L, deleteProbe.ref) - deleteProbe.expectMsg(DeleteMessagesSuccess(3L)) - - journal ! ReplayMessages(1, 3, Long.MaxValue, pid, receiverProbe.ref) - receiverProbe.expectMsg(RecoverySuccess(highestSequenceNr = 5L)) - } - - "replay from the first surviving message when the lower bound equals the first surviving sequence number" in { - val deleteProbe = TestProbe() - journal ! DeleteMessagesTo(pid, 3L, deleteProbe.ref) - deleteProbe.expectMsg(DeleteMessagesSuccess(3L)) - - journal ! ReplayMessages(4, Long.MaxValue, Long.MaxValue, pid, receiverProbe.ref) - receiverProbe.expectMsg(replayedMessage(4)) - receiverProbe.expectMsg(replayedMessage(5)) - receiverProbe.expectMsg(RecoverySuccess(highestSequenceNr = 5L)) - } } "A Journal optionally".may { diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/SnapshotStorage.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/SnapshotStorage.scala index 6258688da57..438a9df6876 100644 --- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/SnapshotStorage.scala +++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/SnapshotStorage.scala @@ -13,6 +13,8 @@ package org.apache.pekko.persistence.testkit +import scala.util.Success + import org.apache.pekko import pekko.actor.Extension import pekko.annotation.InternalApi @@ -40,6 +42,7 @@ private[testkit] trait SnapshotStorage WriteSnapshot(SnapshotMeta(meta.sequenceNr, meta.timestamp), payload)) match { case ProcessingSuccess => add(meta.persistenceId, (meta, payload)) + Success(()) case f: ProcessingFailure => throw f.error } diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/internal/EventSourcedBehaviorTestKitImpl.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/internal/EventSourcedBehaviorTestKitImpl.scala index 791392446e8..654408a7ee8 100644 --- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/internal/EventSourcedBehaviorTestKitImpl.scala +++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/internal/EventSourcedBehaviorTestKitImpl.scala @@ -98,7 +98,7 @@ import pekko.stream.scaladsl.Sink import EventSourcedBehaviorTestKitImpl._ - private def system: ActorSystem[?] = actorTestKit.system + private def system: ActorSystem[_] = actorTestKit.system if (system.settings.config.getBoolean("pekko.persistence.testkit.events.serialize") || system.settings.config.getBoolean("pekko.persistence.testkit.snapshots.serialize")) { system.log.warn( @@ -177,7 +177,7 @@ import pekko.stream.scaladsl.Sink } private def getHighestSeqNr(): Long = { - implicit val sys: ActorSystem[?] = system + implicit val sys: ActorSystem[_] = system val result = queries.currentEventsByPersistenceId(persistenceId.id, 0L, toSequenceNr = Long.MaxValue).runWith(Sink.lastOption) @@ -188,7 +188,7 @@ import pekko.stream.scaladsl.Sink } private def getEvents(fromSeqNr: Long): immutable.Seq[Event] = { - implicit val sys: ActorSystem[?] = system + implicit val sys: ActorSystem[_] = system val result = queries.currentEventsByPersistenceId(persistenceId.id, fromSeqNr, toSequenceNr = Long.MaxValue).runWith(Sink.seq) diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/internal/PersistenceProbeImpl.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/internal/PersistenceProbeImpl.scala index 637d5f2e82e..d7ddd690439 100644 --- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/internal/PersistenceProbeImpl.scala +++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/internal/PersistenceProbeImpl.scala @@ -46,7 +46,7 @@ private[pekko] object PersistenceProbeImpl { b: Behavior[Command], context: ActorContext[Command]): Option[EventSourcedBehaviorImpl[Command, Event, State]] = { b match { - case es: EventSourcedBehaviorImpl[Command, ?, ?] => + case es: EventSourcedBehaviorImpl[Command, _, _] => Some(es.asInstanceOf[EventSourcedBehaviorImpl[Command, Event, State]]) case deferred: DeferredBehavior[Command] => @@ -74,7 +74,7 @@ private[pekko] object PersistenceProbeImpl { b: Behavior[Command], context: ActorContext[Command]): Option[DurableStateBehaviorImpl[Command, State]] = b match { - case ds: DurableStateBehaviorImpl[Command, ?] => + case ds: DurableStateBehaviorImpl[Command, _] => Some(ds.asInstanceOf[DurableStateBehaviorImpl[Command, State]]) case deferred: DeferredBehavior[Command] => findDurableStateBehavior(deferred(context), context) @@ -186,7 +186,7 @@ private[pekko] object PersistenceProbeImpl { effect match { case _: Stop.type => shouldStop = true case _: UnstashAll.type => shouldUnstash = true - case cb: Callback[?] => cb.sideEffect(state) + case cb: Callback[_] => cb.sideEffect(state) } } @@ -256,7 +256,7 @@ private[pekko] object PersistenceProbeImpl { @tailrec def applyEffects(curEffect: EffectImpl[State], sideEffects: immutable.Seq[SideEffect[State]]): Unit = curEffect match { - case CompositeEffect(eff: EffectImpl[?], se) => + case CompositeEffect(eff: EffectImpl[_], se) => applyEffects(eff.asInstanceOf[EffectImpl[State]], se ++ sideEffects) case Persist(st) => @@ -280,7 +280,7 @@ private[pekko] object PersistenceProbeImpl { effect match { case _: Stop.type => shouldStop = true case _: UnstashAll.type => shouldUnstash = true - case cb: Callback[?] => cb.sideEffect(state) + case cb: Callback[_] => cb.sideEffect(state) } } diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/internal/SnapshotStorageEmulatorExtension.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/internal/SnapshotStorageEmulatorExtension.scala index 99f92f8d6ed..fa86080279e 100644 --- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/internal/SnapshotStorageEmulatorExtension.scala +++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/internal/SnapshotStorageEmulatorExtension.scala @@ -34,7 +34,7 @@ private[testkit] object SnapshotStorageEmulatorExtension extends ExtensionId[Sna override def createExtension(system: ExtendedActorSystem): SnapshotStorageEmulatorExtension = new SnapshotStorageEmulatorExtension(system) - override def lookup: ExtensionId[? <: Extension] = + override def lookup: ExtensionId[_ <: Extension] = SnapshotStorageEmulatorExtension } diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/EventSourcedBehaviorTestKit.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/EventSourcedBehaviorTestKit.scala index 3695c8ef304..ca7b94031f7 100644 --- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/EventSourcedBehaviorTestKit.scala +++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/EventSourcedBehaviorTestKit.scala @@ -103,7 +103,7 @@ object EventSourcedBehaviorTestKit { * Factory method to create a new EventSourcedBehaviorTestKit. */ def create[Command, Event, State]( - system: ActorSystem[?], + system: ActorSystem[_], behavior: Behavior[Command]): EventSourcedBehaviorTestKit[Command, Event, State] = create(system, behavior, enabledSerializationSettings) @@ -113,7 +113,7 @@ object EventSourcedBehaviorTestKit { * Note that `equals` must be implemented in the commands, events and state if `verifyEquality` is enabled. */ def create[Command, Event, State]( - system: ActorSystem[?], + system: ActorSystem[_], behavior: Behavior[Command], serializationSettings: SerializationSettings): EventSourcedBehaviorTestKit[Command, Event, State] = { val scaladslSettings = new scaladsl.EventSourcedBehaviorTestKit.SerializationSettings( diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/PersistenceProbeBehavior.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/PersistenceProbeBehavior.scala index b459142cb97..1d5898d8ee9 100644 --- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/PersistenceProbeBehavior.scala +++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/PersistenceProbeBehavior.scala @@ -17,13 +17,12 @@ import java.util.{ List, Set } import scala.collection.immutable.{ Set => ScalaSet } -import org.jspecify.annotations.Nullable - import org.apache.pekko import pekko.actor.testkit.typed.javadsl.BehaviorTestKit import pekko.actor.typed.Behavior import pekko.annotation.DoNotInherit import pekko.persistence.testkit.internal.PersistenceProbeImpl +import org.jspecify.annotations.Nullable /** * Factory methods to create PersistenceProbeBehavior instances for testing. diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/PersistenceTestKit.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/PersistenceTestKit.scala index 86d526c4e47..4d404281565 100644 --- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/PersistenceTestKit.scala +++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/PersistenceTestKit.scala @@ -452,6 +452,6 @@ object PersistenceTestKit { def create(system: ActorSystem): PersistenceTestKit = new PersistenceTestKit(system) - def create(system: TypedActorSystem[?]): PersistenceTestKit = create(system.classicSystem) + def create(system: TypedActorSystem[_]): PersistenceTestKit = create(system.classicSystem) } diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/SnapshotTestKit.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/SnapshotTestKit.scala index a5bb6b703fb..62bcccaf0b7 100644 --- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/SnapshotTestKit.scala +++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/javadsl/SnapshotTestKit.scala @@ -279,6 +279,6 @@ object SnapshotTestKit { def create(system: ActorSystem): SnapshotTestKit = new SnapshotTestKit(system) - def create(system: TypedActorSystem[?]): SnapshotTestKit = create(system.classicSystem) + def create(system: TypedActorSystem[_]): SnapshotTestKit = create(system.classicSystem) } diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/query/scaladsl/PersistenceTestKitReadJournal.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/query/scaladsl/PersistenceTestKitReadJournal.scala index cfd08ebf980..4d7d6e8e705 100644 --- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/query/scaladsl/PersistenceTestKitReadJournal.scala +++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/query/scaladsl/PersistenceTestKitReadJournal.scala @@ -14,7 +14,6 @@ package org.apache.pekko.persistence.testkit.query.scaladsl import java.time.Instant import java.time.temporal.ChronoUnit - import scala.annotation.nowarn import scala.collection.immutable diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/EventSourcedBehaviorTestKit.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/EventSourcedBehaviorTestKit.scala index d063c5024e9..65d1ef6bf93 100644 --- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/EventSourcedBehaviorTestKit.scala +++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/EventSourcedBehaviorTestKit.scala @@ -107,7 +107,7 @@ object EventSourcedBehaviorTestKit { * Factory method to create a new EventSourcedBehaviorTestKit. */ def apply[Command, Event, State]( - system: ActorSystem[?], + system: ActorSystem[_], behavior: Behavior[Command]): EventSourcedBehaviorTestKit[Command, Event, State] = apply(system, behavior, SerializationSettings.enabled) @@ -118,7 +118,7 @@ object EventSourcedBehaviorTestKit { * `verifyEquality` is enabled. */ def apply[Command, Event, State]( - system: ActorSystem[?], + system: ActorSystem[_], behavior: Behavior[Command], serializationSettings: SerializationSettings): EventSourcedBehaviorTestKit[Command, Event, State] = new EventSourcedBehaviorTestKitImpl(ActorTestKit(system), behavior, serializationSettings) diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/PersistenceTestKit.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/PersistenceTestKit.scala index 20ea868cf83..d3f084cbe83 100644 --- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/PersistenceTestKit.scala +++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/PersistenceTestKit.scala @@ -413,7 +413,7 @@ object SnapshotTestKit { def apply(implicit system: ActorSystem): SnapshotTestKit = new SnapshotTestKit(system) - def apply(implicit system: TypedActorSystem[?]): SnapshotTestKit = apply(system.classicSystem) + def apply(implicit system: TypedActorSystem[_]): SnapshotTestKit = apply(system.classicSystem) object Settings extends ExtensionId[Settings] { diff --git a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/TestOps.scala b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/TestOps.scala index 24a61d90e63..960a747688c 100644 --- a/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/TestOps.scala +++ b/persistence-testkit/src/main/scala/org/apache/pekko/persistence/testkit/scaladsl/TestOps.scala @@ -26,7 +26,7 @@ import pekko.util import pekko.util.BoxedType private[testkit] trait RejectSupport[U] { - this: PolicyOpsTestKit[U] with HasStorage[U, ?] => + this: PolicyOpsTestKit[U] with HasStorage[U, _] => /** * Reject `n` following journal operations depending on the condition `cond`. @@ -67,7 +67,7 @@ private[testkit] trait RejectSupport[U] { } private[testkit] trait PolicyOpsTestKit[P] { - this: HasStorage[P, ?] => + this: HasStorage[P, _] => private[testkit] val Policies: DefaultPolicies[P] @@ -124,7 +124,7 @@ private[testkit] trait PolicyOpsTestKit[P] { } private[testkit] trait ExpectOps[U] { - this: HasStorage[?, U] => + this: HasStorage[_, U] => private[testkit] val probe: TestKitBase @@ -265,7 +265,7 @@ private[testkit] trait ExpectOps[U] { } private[testkit] trait ClearOps { - this: HasStorage[?, ?] => + this: HasStorage[_, _] => /** * Clear all data from the storage. @@ -294,7 +294,7 @@ private[testkit] trait ClearOps { } private[testkit] trait ClearPreservingSeqNums { - this: HasStorage[?, ?] => + this: HasStorage[_, _] => /** * Clear all data in the storage preserving sequence numbers. diff --git a/persistence-typed-tests/src/test/java/org/apache/pekko/persistence/typed/state/javadsl/RuntimeDurableStateStoreTest.java b/persistence-typed-tests/src/test/java/org/apache/pekko/persistence/typed/state/javadsl/RuntimeDurableStateStoreTest.java deleted file mode 100644 index 49b2c7f8af6..00000000000 --- a/persistence-typed-tests/src/test/java/org/apache/pekko/persistence/typed/state/javadsl/RuntimeDurableStateStoreTest.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.pekko.persistence.typed.state.javadsl; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import com.typesafe.config.Config; -import com.typesafe.config.ConfigFactory; -import java.util.Optional; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.pekko.Done; -import org.apache.pekko.actor.testkit.typed.annotations.JUnitJupiterTestKit; -import org.apache.pekko.actor.testkit.typed.javadsl.ActorTestKit; -import org.apache.pekko.actor.testkit.typed.javadsl.JUnitJupiterTestKitBuilder; -import org.apache.pekko.actor.testkit.typed.javadsl.LogCapturingExtension; -import org.apache.pekko.actor.testkit.typed.javadsl.TestKitJUnitJupiterExtension; -import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe; -import org.apache.pekko.actor.typed.ActorRef; -import org.apache.pekko.actor.typed.Behavior; -import org.apache.pekko.persistence.state.DurableStateStoreRegistry; -import org.apache.pekko.persistence.state.javadsl.DurableStateUpdateStore; -import org.apache.pekko.persistence.state.javadsl.GetObjectResult; -import org.apache.pekko.persistence.testkit.state.PersistenceTestKitDurableStateStoreProvider; -import org.apache.pekko.persistence.typed.PersistenceId; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; - -@ExtendWith(TestKitJUnitJupiterExtension.class) -@ExtendWith(LogCapturingExtension.class) -public class RuntimeDurableStateStoreTest { - - @JUnitJupiterTestKit public ActorTestKit testKit = new JUnitJupiterTestKitBuilder().build(); - - static Config config(String store) { - return ConfigFactory.parseString( - store - + " {\n" - + " state.class = \"" - + PersistenceTestKitDurableStateStoreProvider.class.getName() - + "\"\n" - + "}\n"); - } - - interface Command {} - - static final class Save implements Command { - final String text; - final ActorRef replyTo; - - Save(String text, ActorRef replyTo) { - this.text = text; - this.replyTo = replyTo; - } - } - - static final class ShowMeWhatYouGot implements Command { - final ActorRef replyTo; - - ShowMeWhatYouGot(ActorRef replyTo) { - this.replyTo = replyTo; - } - } - - enum Stop implements Command { - INSTANCE - } - - static final class Actor extends DurableStateBehavior { - private final String store; - - static Behavior create(String persistenceId, String store) { - return new Actor(persistenceId, store); - } - - private Actor(String persistenceId, String store) { - super(PersistenceId.ofUniqueId(persistenceId)); - this.store = store; - } - - @Override - public String emptyState() { - return ""; - } - - @Override - public CommandHandler commandHandler() { - return newCommandHandlerBuilder() - .forAnyState() - .onCommand(Save.class, this::onSave) - .onCommand(ShowMeWhatYouGot.class, this::onShow) - .onCommand(Stop.class, (state, cmd) -> Effect().stop()) - .build(); - } - - private Effect onSave(String state, Save cmd) { - String newState = - Stream.of(state, cmd.text).filter(s -> !s.isEmpty()).collect(Collectors.joining("|")); - return Effect().persist(newState).thenRun(() -> cmd.replyTo.tell(Done.getInstance())); - } - - private Effect onShow(String state, ShowMeWhatYouGot cmd) { - cmd.replyTo.tell(state); - return Effect().none(); - } - - @Override - public String durableStateStorePluginId() { - return store + ".state"; - } - - @Override - public Optional durableStateStorePluginConfig() { - return Optional.of(config(store)); - } - } - - @Test - public void configureAtRuntimeInIsolatedInstances() throws Exception { - TestProbe probe = testKit.createTestProbe(); - - // one actor in each store with same id - ActorRef s1 = testKit.spawn(Actor.create("id1", "store1")); - ActorRef s2 = testKit.spawn(Actor.create("id1", "store2")); - s1.tell(new Save("s1m1", probe.ref())); - probe.receiveMessage(); - s2.tell(new Save("s2m1", probe.ref())); - probe.receiveMessage(); - - assertStore("store1", "s1m1"); - assertStore("store2", "s2m1"); - } - - private void assertStore(String store, String expectedState) throws Exception { - @SuppressWarnings("unchecked") - DurableStateUpdateStore durableStateStore = - DurableStateStoreRegistry.get(testKit.system()) - .getDurableStateStoreFor( - DurableStateUpdateStore.class, store + ".state", config(store)); - GetObjectResult result = - durableStateStore.getObject("id1").toCompletableFuture().get(3, TimeUnit.SECONDS); - assertEquals(Optional.of(expectedState), result.value()); - } -} diff --git a/persistence-typed-tests/src/test/scala/docs/org/apache/pekko/persistence/typed/ReplicatedEventSourcingCompileOnlySpec.scala b/persistence-typed-tests/src/test/scala/docs/org/apache/pekko/persistence/typed/ReplicatedEventSourcingCompileOnlySpec.scala index bdf8ea46acc..5e4215390bd 100644 --- a/persistence-typed-tests/src/test/scala/docs/org/apache/pekko/persistence/typed/ReplicatedEventSourcingCompileOnlySpec.scala +++ b/persistence-typed-tests/src/test/scala/docs/org/apache/pekko/persistence/typed/ReplicatedEventSourcingCompileOnlySpec.scala @@ -40,7 +40,7 @@ object ReplicatedEventSourcingCompileOnlySpec { object Shared { // #factory-shared def apply( - system: ActorSystem[?], + system: ActorSystem[_], entityId: String, replicaId: ReplicaId): EventSourcedBehavior[Command, State, Event] = { ReplicatedEventSourcing.commonJournalConfig( @@ -56,7 +56,7 @@ object ReplicatedEventSourcingCompileOnlySpec { object PerReplica { // #factory def apply( - system: ActorSystem[?], + system: ActorSystem[_], entityId: String, replicaId: ReplicaId): EventSourcedBehavior[Command, State, Event] = { ReplicatedEventSourcing.perReplicaJournalConfig( diff --git a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorReplySpec.scala b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorReplySpec.scala index 80c98720c2a..6ab5b4db20b 100644 --- a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorReplySpec.scala +++ b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorReplySpec.scala @@ -41,13 +41,13 @@ object EventSourcedBehaviorReplySpec { final case class State(value: Int, history: Vector[Int]) extends CborSerializable - def counter(persistenceId: PersistenceId): Behavior[Command[?]] = + def counter(persistenceId: PersistenceId): Behavior[Command[_]] = Behaviors.setup(ctx => counter(ctx, persistenceId)) def counter( - ctx: ActorContext[Command[?]], - persistenceId: PersistenceId): EventSourcedBehavior[Command[?], Event, State] = { - EventSourcedBehavior.withEnforcedReplies[Command[?], Event, State]( + ctx: ActorContext[Command[_]], + persistenceId: PersistenceId): EventSourcedBehavior[Command[_], Event, State] = { + EventSourcedBehavior.withEnforcedReplies[Command[_], Event, State]( persistenceId, emptyState = State(0, Vector.empty), commandHandler = (state, command) => diff --git a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorRetentionOnlyOneSnapshotSpec.scala b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorRetentionOnlyOneSnapshotSpec.scala index c814e483835..7d3bd63743c 100644 --- a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorRetentionOnlyOneSnapshotSpec.scala +++ b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorRetentionOnlyOneSnapshotSpec.scala @@ -18,6 +18,9 @@ import java.util.concurrent.atomic.AtomicInteger import scala.util.Success import scala.util.Try +import com.typesafe.config.ConfigFactory +import org.scalatest.wordspec.AnyWordSpecLike + import org.apache.pekko import pekko.actor.testkit.typed.scaladsl._ import pekko.actor.typed.scaladsl.Behaviors @@ -27,10 +30,6 @@ import pekko.persistence.typed.DeleteEventsCompleted import pekko.persistence.typed.EventSourcedSignal import pekko.persistence.typed.PersistenceId -import org.scalatest.wordspec.AnyWordSpecLike - -import com.typesafe.config.ConfigFactory - object EventSourcedBehaviorRetentionOnlyOneSnapshotSpec { private val config = ConfigFactory.parseString(s""" ${PersistenceTestKitSnapshotPlugin.PluginId} { diff --git a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorSpec.scala b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorSpec.scala index 0a65ea96455..6e3ad666142 100644 --- a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorSpec.scala +++ b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorSpec.scala @@ -131,15 +131,15 @@ object EventSourcedBehaviorSpec { val firstLogging = "first logging" val secondLogging = "second logging" - def counter(persistenceId: PersistenceId)(implicit system: ActorSystem[?]): Behavior[Command] = + def counter(persistenceId: PersistenceId)(implicit system: ActorSystem[_]): Behavior[Command] = Behaviors.setup(ctx => counter(ctx, persistenceId)) def counter(persistenceId: PersistenceId, logging: ActorRef[String])( - implicit system: ActorSystem[?]): Behavior[Command] = + implicit system: ActorSystem[_]): Behavior[Command] = Behaviors.setup(ctx => counter(ctx, persistenceId, logging)) def counter(ctx: ActorContext[Command], persistenceId: PersistenceId)( - implicit system: ActorSystem[?]): EventSourcedBehavior[Command, Event, State] = + implicit system: ActorSystem[_]): EventSourcedBehavior[Command, Event, State] = counter( ctx, persistenceId, @@ -148,7 +148,7 @@ object EventSourcedBehaviorSpec { snapshotProbe = TestProbe[Try[SnapshotMetadata]]().ref) def counter(ctx: ActorContext[Command], persistenceId: PersistenceId, logging: ActorRef[String])( - implicit system: ActorSystem[?]): EventSourcedBehavior[Command, Event, State] = + implicit system: ActorSystem[_]): EventSourcedBehavior[Command, Event, State] = counter( ctx, persistenceId, @@ -161,18 +161,18 @@ object EventSourcedBehaviorSpec { persistenceId: PersistenceId, probe: ActorRef[(State, Event)], snapshotProbe: ActorRef[Try[SnapshotMetadata]])( - implicit system: ActorSystem[?]): EventSourcedBehavior[Command, Event, State] = + implicit system: ActorSystem[_]): EventSourcedBehavior[Command, Event, State] = counter(ctx, persistenceId, TestProbe[String]().ref, probe, snapshotProbe) def counterWithProbe(ctx: ActorContext[Command], persistenceId: PersistenceId, probe: ActorRef[(State, Event)])( - implicit system: ActorSystem[?]): EventSourcedBehavior[Command, Event, State] = + implicit system: ActorSystem[_]): EventSourcedBehavior[Command, Event, State] = counter(ctx, persistenceId, TestProbe[String]().ref, probe, TestProbe[Try[SnapshotMetadata]]().ref) def counterWithSnapshotProbe( ctx: ActorContext[Command], persistenceId: PersistenceId, probe: ActorRef[Try[SnapshotMetadata]])( - implicit system: ActorSystem[?]): EventSourcedBehavior[Command, Event, State] = + implicit system: ActorSystem[_]): EventSourcedBehavior[Command, Event, State] = counter(ctx, persistenceId, TestProbe[String]().ref, TestProbe[(State, Event)]().ref, snapshotProbe = probe) def counter( @@ -753,7 +753,7 @@ class EventSourcedBehaviorSpec firstThree ++ others should contain theSameElementsInOrderAs all } - def watcher(toWatch: ActorRef[?]): TestProbe[String] = { + def watcher(toWatch: ActorRef[_]): TestProbe[String] = { val probe = TestProbe[String]() val w = Behaviors.setup[Any] { ctx => ctx.watch(toWatch) diff --git a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorStashSpec.scala b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorStashSpec.scala index 25477a51628..dd85814d557 100644 --- a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorStashSpec.scala +++ b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorStashSpec.scala @@ -82,18 +82,18 @@ object EventSourcedBehaviorStashSpec { final case class State(value: Int, active: Boolean) - def counter(persistenceId: PersistenceId, signalProbe: Option[ActorRef[String]] = None): Behavior[Command[?]] = + def counter(persistenceId: PersistenceId, signalProbe: Option[ActorRef[String]] = None): Behavior[Command[_]] = Behaviors - .supervise[Command[?]] { + .supervise[Command[_]] { Behaviors.setup(_ => eventSourcedCounter(persistenceId, signalProbe)) } .onFailure(SupervisorStrategy.restart.withLoggingEnabled(enabled = false)) def eventSourcedCounter( persistenceId: PersistenceId, - signalProbe: Option[ActorRef[String]]): EventSourcedBehavior[Command[?], Event, State] = { + signalProbe: Option[ActorRef[String]]): EventSourcedBehavior[Command[_], Event, State] = { EventSourcedBehavior - .withEnforcedReplies[Command[?], Event, State]( + .withEnforcedReplies[Command[_], Event, State]( persistenceId, emptyState = State(0, active = true), commandHandler = (state, command) => { @@ -123,7 +123,7 @@ object EventSourcedBehaviorStashSpec { } } - private def active(state: State, command: Command[?]): ReplyEffect[Event, State] = { + private def active(state: State, command: Command[_]): ReplyEffect[Event, State] = { command match { case Increment(id, replyTo) => Effect.persist(Incremented(1)).thenReply(replyTo)(_ => Ack(id)) @@ -149,7 +149,7 @@ object EventSourcedBehaviorStashSpec { } } - private def inactive(state: State, command: Command[?]): ReplyEffect[Event, State] = { + private def inactive(state: State, command: Command[_]): ReplyEffect[Event, State] = { command match { case _: Increment => Effect.stash() diff --git a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorWatchSpec.scala b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorWatchSpec.scala index 48364c644b4..5556f79f121 100644 --- a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorWatchSpec.scala +++ b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorWatchSpec.scala @@ -46,7 +46,7 @@ object EventSourcedBehaviorWatchSpec { case object Fail extends Command case object Stop extends Command final case class ChildHasFailed(t: pekko.actor.typed.ChildFailed) - final case class HasTerminated(ref: ActorRef[?]) + final case class HasTerminated(ref: ActorRef[_]) } class EventSourcedBehaviorWatchSpec @@ -67,7 +67,7 @@ class EventSourcedBehaviorWatchSpec private def setup( pf: PartialFunction[(String, Signal), Unit], settings: EventSourcedSettings, - context: ActorContext[?]): BehaviorSetup[Command, String, String] = + context: ActorContext[_]): BehaviorSetup[Command, String, String] = new BehaviorSetup[Command, String, String]( context.asInstanceOf[ActorContext[InternalProtocol]], nextPid, diff --git a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehaviorReplySpec.scala b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehaviorReplySpec.scala index 109249cb234..ecc1ceae627 100644 --- a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehaviorReplySpec.scala +++ b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehaviorReplySpec.scala @@ -47,11 +47,11 @@ object DurableStateBehaviorReplySpec { final case class State(value: Int) extends CborSerializable - def counter(persistenceId: PersistenceId): Behavior[Command[?]] = + def counter(persistenceId: PersistenceId): Behavior[Command[_]] = Behaviors.setup(ctx => counter(ctx, persistenceId)) - def counter(ctx: ActorContext[Command[?]], persistenceId: PersistenceId): DurableStateBehavior[Command[?], State] = { - DurableStateBehavior.withEnforcedReplies[Command[?], State]( + def counter(ctx: ActorContext[Command[_]], persistenceId: PersistenceId): DurableStateBehavior[Command[_], State] = { + DurableStateBehavior.withEnforcedReplies[Command[_], State]( persistenceId, emptyState = State(0), commandHandler = (state, command) => diff --git a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehaviorStashOverflowSpec.scala b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehaviorStashOverflowSpec.scala index 64866b40c85..e710612d590 100644 --- a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehaviorStashOverflowSpec.scala +++ b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehaviorStashOverflowSpec.scala @@ -43,8 +43,8 @@ object DurableStateBehaviorStashOverflowSpec { } object TestDurableStateStorePlugin { - @volatile var instance: Option[TestDurableStateStorePlugin[?]] = None - def getInstance(): TestDurableStateStorePlugin[?] = instance.get + @volatile var instance: Option[TestDurableStateStorePlugin[_]] = None + def getInstance(): TestDurableStateStorePlugin[_] = instance.get } class TestDurableStateStorePlugin[A] extends DurableStateUpdateStore[A] { diff --git a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/state/scaladsl/RuntimeDurableStateStoreSpec.scala b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/state/scaladsl/RuntimeDurableStateStoreSpec.scala deleted file mode 100644 index 4dc4bdb9e48..00000000000 --- a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/state/scaladsl/RuntimeDurableStateStoreSpec.scala +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.pekko.persistence.typed.state.scaladsl - -import org.apache.pekko -import pekko.Done -import pekko.actor.testkit.typed.scaladsl.LogCapturing -import pekko.actor.testkit.typed.scaladsl.ScalaTestWithActorTestKit -import pekko.actor.typed.ActorRef -import pekko.actor.typed.Behavior -import pekko.persistence.state.DurableStateStoreRegistry -import pekko.persistence.state.scaladsl.DurableStateUpdateStore -import pekko.persistence.testkit.state.PersistenceTestKitDurableStateStoreProvider -import pekko.persistence.typed.PersistenceId - -import com.typesafe.config.Config -import com.typesafe.config.ConfigFactory -import org.scalatest.wordspec.AnyWordSpecLike - -object RuntimeDurableStateStoreSpec { - - private object Actor { - sealed trait Command - final case class Save(text: String, replyTo: ActorRef[Done]) extends Command - final case class ShowMeWhatYouGot(replyTo: ActorRef[String]) extends Command - case object Stop extends Command - - def apply(persistenceId: String, store: String): Behavior[Command] = - DurableStateBehavior[Command, String]( - PersistenceId.ofUniqueId(persistenceId), - "", - (state, cmd) => - cmd match { - case Save(text, replyTo) => - Effect.persist(Seq(state, text).filter(_.nonEmpty).mkString("|")).thenRun(_ => replyTo ! Done) - case ShowMeWhatYouGot(replyTo) => - replyTo ! state - Effect.none - case Stop => - Effect.stop() - }) - .withDurableStateStorePluginId(s"$store.state") - .withDurableStateStorePluginConfig(Some(config(store))) - } - - private def config(store: String): Config = - ConfigFactory.parseString(s""" - $store { - state.class = "${classOf[PersistenceTestKitDurableStateStoreProvider].getName}" - } - """) -} - -class RuntimeDurableStateStoreSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike with LogCapturing { - - import RuntimeDurableStateStoreSpec._ - - "The durable state store plugin" must { - - "be possible to configure at runtime and use in multiple isolated instances" in { - val probe = createTestProbe[Any]() - - { - // one actor in each store with same id - val s1 = spawn(Actor("id1", "store1")) - val s2 = spawn(Actor("id1", "store2")) - s1 ! Actor.Save("s1m1", probe.ref) - probe.receiveMessage() - s2 ! Actor.Save("s2m1", probe.ref) - probe.receiveMessage() - } - - { - def assertStore(store: String, expectedState: String) = { - val durableStateStore = DurableStateStoreRegistry(system) - .durableStateStoreFor[DurableStateUpdateStore[String]](s"$store.state", config(store)) - durableStateStore.getObject("id1").futureValue.value shouldBe Some(expectedState) - } - - assertStore("store1", "s1m1") - assertStore("store2", "s2m1") - } - } - } -} diff --git a/persistence-typed/src/main/java/org/apache/pekko/persistence/typed/serialization/ReplicatedEventSourcing.java b/persistence-typed/src/main/java/org/apache/pekko/persistence/typed/serialization/ReplicatedEventSourcing.java index 0f62e9ffe52..e68d86b4bef 100644 --- a/persistence-typed/src/main/java/org/apache/pekko/persistence/typed/serialization/ReplicatedEventSourcing.java +++ b/persistence-typed/src/main/java/org/apache/pekko/persistence/typed/serialization/ReplicatedEventSourcing.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: ReplicatedEventSourcing.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package org.apache.pekko.persistence.typed.serialization; @@ -27,8 +27,8 @@ private ReplicatedEventSourcing() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ReplicatedEventSourcing"); } @@ -55,8 +55,8 @@ public enum ORSetDeltaOp implements org.apache.pekko.protobufv3.internal.Protoco org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ORSetDeltaOp"); } @@ -180,8 +180,8 @@ public static final class Counter extends org.apache.pekko.protobufv3.internal.G org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Counter"); } @@ -269,21 +269,15 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream.computeBytesSize(1, value_); - } - return size; - } - @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream.computeBytesSize(1, value_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -745,8 +739,8 @@ public static final class CounterUpdate org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "CounterUpdate"); } @@ -835,21 +829,15 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream.computeBytesSize(1, delta_); - } - return size; - } - @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream.computeBytesSize(1, delta_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -1470,8 +1458,8 @@ public static final class ORSet extends org.apache.pekko.protobufv3.internal.Gen org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ORSet"); } @@ -1879,8 +1867,12 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, originDc_); @@ -1950,16 +1942,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -3754,8 +3736,8 @@ public static final class ORSetDeltaGroup org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ORSetDeltaGroup"); } @@ -3845,8 +3827,8 @@ public static final class Entry extends org.apache.pekko.protobufv3.internal.Gen org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Entry"); } @@ -3990,8 +3972,12 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream.computeEnumSize(1, operation_); @@ -4001,16 +3987,6 @@ private int computeSerializedSize_0() { org.apache.pekko.protobufv3.internal.CodedOutputStream.computeMessageSize( 2, getUnderlying()); } - return size; - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -4758,8 +4734,12 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { final int count = entries_.size(); @@ -4770,16 +4750,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -5560,8 +5530,8 @@ public static final class VersionVector org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "VersionVector"); } @@ -5652,8 +5622,8 @@ public static final class Entry extends org.apache.pekko.protobufv3.internal.Gen org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Entry"); } @@ -5801,8 +5771,12 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, key_); } @@ -5810,16 +5784,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream.computeInt64Size(2, version_); } - return size; - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -6476,8 +6440,12 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { final int count = entries_.size(); @@ -6488,16 +6456,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -7315,8 +7273,8 @@ public static final class ReplicatedEventMetadata org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ReplicatedEventMetadata"); } @@ -7546,8 +7504,12 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize( @@ -7567,16 +7529,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream.computeBoolSize(4, concurrent_); } - return size; - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -8492,8 +8444,8 @@ public static final class ReplicatedSnapshotMetadata org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ReplicatedSnapshotMetadata"); } @@ -8584,8 +8536,8 @@ public static final class Seen extends org.apache.pekko.protobufv3.internal.Gene org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Seen"); } @@ -8733,8 +8685,12 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize( @@ -8745,16 +8701,6 @@ private int computeSerializedSize_0() { org.apache.pekko.protobufv3.internal.CodedOutputStream.computeInt64Size( 2, sequenceNr_); } - return size; - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -9464,8 +9410,12 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream.computeMessageSize( @@ -9481,16 +9431,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -10496,8 +10436,8 @@ public static final class ReplicatedPublishedEventMetaData org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ReplicatedPublishedEventMetaData"); } @@ -10660,8 +10600,12 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, replicaId_); @@ -10671,16 +10615,6 @@ private int computeSerializedSize_0() { org.apache.pekko.protobufv3.internal.CodedOutputStream.computeMessageSize( 2, getVersionVector()); } - return size; - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -11509,8 +11443,8 @@ public static final class PublishedEvent org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "PublishedEvent"); } @@ -11828,8 +11762,12 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize( @@ -11857,16 +11795,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(6, replyTo_); } - return size; - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/persistence-typed/src/main/mima-filters/2.0.x.backwards.excludes/durablestate-runtime-config.excludes b/persistence-typed/src/main/mima-filters/2.0.x.backwards.excludes/durablestate-runtime-config.excludes deleted file mode 100644 index b86dd3685cd..00000000000 --- a/persistence-typed/src/main/mima-filters/2.0.x.backwards.excludes/durablestate-runtime-config.excludes +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Add DurableStateBehavior.withDurableStateStorePluginConfig -ProblemFilters.exclude[ReversedMissingMethodProblem]("org.apache.pekko.persistence.typed.state.scaladsl.DurableStateBehavior.withDurableStateStorePluginConfig") diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/crdt/ORSet.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/crdt/ORSet.scala index 938d4f7b856..8bc193c9b19 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/crdt/ORSet.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/crdt/ORSet.scala @@ -496,7 +496,7 @@ final class ORSet[A] private[pekko] ( override def toString: String = s"OR$elements" override def equals(o: Any): Boolean = o match { - case other: ORSet[?] => + case other: ORSet[_] => originReplica == other.originReplica && vvector == other.vvector && elementsMap == other.elementsMap case _ => false } diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/delivery/EventSourcedProducerQueue.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/delivery/EventSourcedProducerQueue.scala index 1a948591731..5fc74e95be7 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/delivery/EventSourcedProducerQueue.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/delivery/EventSourcedProducerQueue.scala @@ -52,7 +52,7 @@ object EventSourcedProducerQueue { * Scala API: Factory method from config `pekko.reliable-delivery.producer-controller.event-sourced-durable-queue` * of the `ActorSystem`. */ - def apply(system: ActorSystem[?]): Settings = + def apply(system: ActorSystem[_]): Settings = apply(system.settings.config.getConfig("pekko.reliable-delivery.producer-controller.event-sourced-durable-queue")) /** @@ -74,7 +74,7 @@ object EventSourcedProducerQueue { * Java API: Factory method from config `pekko.reliable-delivery.producer-controller.event-sourced-durable-queue` * of the `ActorSystem`. */ - def create(system: ActorSystem[?]): Settings = + def create(system: ActorSystem[_]): Settings = apply(system) /** @@ -274,7 +274,7 @@ private class EventSourcedProducerQueue[A]( case LoadState(replyTo) => Effect.reply(replyTo)(state) - case _: CleanupTick[?] => + case _: CleanupTick[_] => onCleanupTick(state) case cmd => @@ -307,7 +307,7 @@ private class EventSourcedProducerQueue[A]( def onCommandBeforeInitialCleanup(state: State[A], command: Command[A]): Effect[Event, State[A]] = { command match { - case _: CleanupTick[?] => + case _: CleanupTick[_] => val old = oldUnconfirmedToCleanup(state) val stateWithoutPartialChunkedMessages = state.cleanupPartialChunkedMessages() initialCleanupDone = true diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/EventSourcedBehaviorImpl.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/EventSourcedBehaviorImpl.scala index 494ee17d4ad..060e10f4b27 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/EventSourcedBehaviorImpl.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/EventSourcedBehaviorImpl.scala @@ -106,7 +106,7 @@ private[pekko] final case class EventSourcedBehaviorImpl[Command, Event, State]( emptyState: State, commandHandler: EventSourcedBehavior.CommandHandler[Command, Event, State], eventHandler: EventSourcedBehavior.EventHandler[State, Event], - loggerClass: Class[?], + loggerClass: Class[_], journalPluginId: Option[String] = None, snapshotPluginId: Option[String] = None, journalPluginConfig: Option[Config] = None, @@ -135,7 +135,7 @@ private[pekko] final case class EventSourcedBehaviorImpl[Command, Event, State]( override def apply(context: typed.TypedActorContext[Command]): Behavior[Command] = { val ctx = context.asScala val hasCustomLoggerName = ctx match { - case internalCtx: ActorContextImpl[?] => internalCtx.hasCustomLoggerName + case internalCtx: ActorContextImpl[_] => internalCtx.hasCustomLoggerName case _ => false } if (!hasCustomLoggerName) ctx.setLoggerName(loggerClass) @@ -254,7 +254,7 @@ private[pekko] final case class EventSourcedBehaviorImpl[Command, Event, State]( } @InternalStableApi - private[pekko] def initialize(@nowarn("msg=never used") context: ActorContext[?]): Unit = () + private[pekko] def initialize(@nowarn("msg=never used") context: ActorContext[_]): Unit = () override def receiveSignal( handler: PartialFunction[(State, Signal), Unit]): EventSourcedBehavior[Command, Event, State] = @@ -290,7 +290,7 @@ private[pekko] final case class EventSourcedBehaviorImpl[Command, Event, State]( override def withTaggerForState(tagger: (State, Event) => Set[String]): EventSourcedBehavior[Command, Event, State] = copy(tagger = tagger) - override def eventAdapter(adapter: EventAdapter[Event, ?]): EventSourcedBehavior[Command, Event, State] = + override def eventAdapter(adapter: EventAdapter[Event, _]): EventSourcedBehavior[Command, Event, State] = copy(eventAdapter = adapter.asInstanceOf[EventAdapter[Event, Any]]) override def snapshotAdapter(adapter: SnapshotAdapter[State]): EventSourcedBehavior[Command, Event, State] = diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/EventSourcedSettings.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/EventSourcedSettings.scala index 786212d0703..ec35f4d57d2 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/EventSourcedSettings.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/EventSourcedSettings.scala @@ -25,7 +25,7 @@ import com.typesafe.config.Config @InternalApi private[pekko] object EventSourcedSettings { def apply( - system: ActorSystem[?], + system: ActorSystem[_], journalPluginId: String, snapshotPluginId: String, customStashCapacity: Option[Int] @@ -33,7 +33,7 @@ import com.typesafe.config.Config apply(system.settings.config, journalPluginId, snapshotPluginId, None, None, customStashCapacity) def apply( - system: ActorSystem[?], + system: ActorSystem[_], journalPluginId: String, snapshotPluginId: String, journalPluginConfig: Option[Config], diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ExternalInteractions.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ExternalInteractions.scala index 10f8b6e4977..5477ca5b679 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ExternalInteractions.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ExternalInteractions.scala @@ -54,7 +54,7 @@ private[pekko] trait JournalInteractions[C, E, S] { def setup: BehaviorSetup[C, E, S] protected def internalPersist( - ctx: ActorContext[?], + ctx: ActorContext[_], cmd: Any, state: Running.RunningState[S, C], event: EventOrTaggedOrReplicated, @@ -88,12 +88,12 @@ private[pekko] trait JournalInteractions[C, E, S] { @InternalStableApi private[pekko] def onWriteInitiated( - @nowarn("msg=never used") ctx: ActorContext[?], + @nowarn("msg=never used") ctx: ActorContext[_], @nowarn("msg=never used") cmd: Any, @nowarn("msg=never used") repr: PersistentRepr): Unit = () protected def internalPersistAll( - ctx: ActorContext[?], + ctx: ActorContext[_], cmd: Any, state: Running.RunningState[S, C], events: immutable.Seq[EventToPersist]): Running.RunningState[S, C] = { @@ -129,7 +129,7 @@ private[pekko] trait JournalInteractions[C, E, S] { @InternalStableApi private[pekko] def onWritesInitiated( - @nowarn("msg=never used") ctx: ActorContext[?], + @nowarn("msg=never used") ctx: ActorContext[_], @nowarn("msg=never used") cmd: Any, @nowarn("msg=never used") repr: immutable.Seq[PersistentRepr]): Unit = () diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ReplayingEvents.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ReplayingEvents.scala index db902d9bb6b..74fc40f86c2 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ReplayingEvents.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ReplayingEvents.scala @@ -97,11 +97,11 @@ private[pekko] final class ReplayingEvents[C, E, S]( onRecoveryStart(setup.context) @InternalStableApi - def onRecoveryStart(@nowarn("msg=never used") context: ActorContext[?]): Unit = () + def onRecoveryStart(@nowarn("msg=never used") context: ActorContext[_]): Unit = () @InternalStableApi - def onRecoveryComplete(@nowarn("msg=never used") context: ActorContext[?]): Unit = () + def onRecoveryComplete(@nowarn("msg=never used") context: ActorContext[_]): Unit = () @InternalStableApi - def onRecoveryFailed(@nowarn("msg=never used") context: ActorContext[?], @nowarn("msg=never used") reason: Throwable, + def onRecoveryFailed(@nowarn("msg=never used") context: ActorContext[_], @nowarn("msg=never used") reason: Throwable, @nowarn("msg=never used") event: Option[Any]): Unit = () @@ -205,7 +205,7 @@ private[pekko] final class ReplayingEvents[C, E, S]( Behaviors.unhandled } } catch { - case ex: UnstashException[?] => + case ex: UnstashException[_] => // let supervisor handle it, don't treat it as recovery failure throw ex case NonFatal(cause) => diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ReplayingSnapshot.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ReplayingSnapshot.scala index 21342625411..8dc7bd71e18 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ReplayingSnapshot.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/ReplayingSnapshot.scala @@ -120,9 +120,9 @@ private[pekko] class ReplayingSnapshot[C, E, S](override val setup: BehaviorSetu } @InternalStableApi - def onRecoveryStart(@nowarn("msg=never used") context: ActorContext[?]): Unit = () + def onRecoveryStart(@nowarn("msg=never used") context: ActorContext[_]): Unit = () @InternalStableApi - def onRecoveryFailed(@nowarn("msg=never used") context: ActorContext[?], @nowarn("msg=never used") reason: Throwable) + def onRecoveryFailed(@nowarn("msg=never used") context: ActorContext[_], @nowarn("msg=never used") reason: Throwable) : Unit = () private def onRecoveryTick(snapshot: Boolean): Behavior[InternalProtocol] = diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/RequestingRecoveryPermit.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/RequestingRecoveryPermit.scala index 4f00e28cfe5..eddad5da655 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/RequestingRecoveryPermit.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/RequestingRecoveryPermit.scala @@ -79,7 +79,7 @@ private[pekko] class RequestingRecoveryPermit[C, E, S](override val setup: Behav } @InternalStableApi - def onRequestingRecoveryPermit(@nowarn("msg=never used") context: ActorContext[?]): Unit = () + def onRequestingRecoveryPermit(@nowarn("msg=never used") context: ActorContext[_]): Unit = () private def becomeReplaying(receivedPoisonPill: Boolean): Behavior[InternalProtocol] = { setup.internalLogger.debug(s"Initializing snapshot recovery: {}", setup.recovery) diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/Running.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/Running.scala index 0b8f4bd3422..e2c88ee1ab3 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/Running.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/Running.scala @@ -262,7 +262,7 @@ private[pekko] object Running { _currentSequenceNumber = state.seqNr - private def alreadySeen(e: ReplicatedEvent[?]): Boolean = { + private def alreadySeen(e: ReplicatedEvent[_]): Boolean = { e.originSequenceNr <= state.seenPerReplica.getOrElse(e.originReplica, 0L) } @@ -665,7 +665,7 @@ private[pekko] object Running { state: RunningState[S, C], effect: Effect[E, S], sideEffects: immutable.Seq[SideEffect[S]] = Nil): (Behavior[InternalProtocol], Boolean) = { - if (setup.internalLogger.isDebugEnabled && !effect.isInstanceOf[CompositeEffect[?, ?]]) + if (setup.internalLogger.isDebugEnabled && !effect.isInstanceOf[CompositeEffect[_, _]]) setup.internalLogger.debugN( s"Handled command [{}], resulting effect: [{}], side effects: [{}]", msg.getClass.getName, @@ -1036,7 +1036,7 @@ private[pekko] object Running { unstashAll() behavior - case callback: Callback[?] => + case callback: Callback[_] => callback.sideEffect(state.state) behavior } @@ -1110,18 +1110,18 @@ private[pekko] object Running { @InternalStableApi private[pekko] def onWriteFailed( - @nowarn("msg=never used") ctx: ActorContext[?], + @nowarn("msg=never used") ctx: ActorContext[_], @nowarn("msg=never used") reason: Throwable, @nowarn("msg=never used") event: PersistentRepr): Unit = () @InternalStableApi private[pekko] def onWriteRejected( - @nowarn("msg=never used") ctx: ActorContext[?], + @nowarn("msg=never used") ctx: ActorContext[_], @nowarn("msg=never used") reason: Throwable, @nowarn("msg=never used") event: PersistentRepr): Unit = () @InternalStableApi - private[pekko] def onWriteSuccess(@nowarn("msg=never used") ctx: ActorContext[?], + private[pekko] def onWriteSuccess(@nowarn("msg=never used") ctx: ActorContext[_], @nowarn("msg=never used") event: PersistentRepr): Unit = () @InternalStableApi - private[pekko] def onWriteDone(@nowarn("msg=never used") ctx: ActorContext[?], + private[pekko] def onWriteDone(@nowarn("msg=never used") ctx: ActorContext[_], @nowarn("msg=never used") event: PersistentRepr): Unit = () } diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/javadsl/EventSourcedBehavior.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/javadsl/EventSourcedBehavior.scala index 3e4d61b9b3c..811ea8465e4 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/javadsl/EventSourcedBehavior.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/javadsl/EventSourcedBehavior.scala @@ -19,8 +19,6 @@ import java.util.Optional import scala.annotation.nowarn import scala.jdk.OptionConverters._ -import org.jspecify.annotations.Nullable - import org.apache.pekko import pekko.actor.typed import pekko.actor.typed.BackoffSupervisorStrategy @@ -33,6 +31,7 @@ import pekko.persistence.typed.EventAdapter import pekko.persistence.typed.internal._ import com.typesafe.config.Config +import org.jspecify.annotations.Nullable abstract class EventSourcedBehavior[Command, Event, State] private[pekko] ( val persistenceId: PersistenceId, @@ -197,7 +196,7 @@ abstract class EventSourcedBehavior[Command, Event, State] private[pekko] ( * Transform the event in another type before giving to the journal. Can be used to wrap events * in types Journals understand but is of a different type than `Event`. */ - def eventAdapter(): EventAdapter[Event, ?] = NoOpEventAdapter.instance[Event] + def eventAdapter(): EventAdapter[Event, _] = NoOpEventAdapter.instance[Event] /** * Transform the state into another type before giving it to and from the journal. Can be used @@ -265,7 +264,7 @@ abstract class EventSourcedBehavior[Command, Event, State] private[pekko] ( /** * The last sequence number that was persisted, can only be called from inside the handlers of an `EventSourcedBehavior` */ - final def lastSequenceNumber(ctx: ActorContext[?]): Long = { + final def lastSequenceNumber(ctx: ActorContext[_]): Long = { scaladsl.EventSourcedBehavior.lastSequenceNumber(ctx.asScala) } diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/javadsl/PersistentFSMMigration.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/javadsl/PersistentFSMMigration.scala index 0d6266bf381..e97c1894b2f 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/javadsl/PersistentFSMMigration.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/javadsl/PersistentFSMMigration.scala @@ -32,7 +32,7 @@ object PersistentFSMMigration { * Create a snapshot adapter that will adapt snapshots created by a PersistentFSM into * the correct State type of a [[EventSourcedBehavior]] * @param adapt Takes in the state identifier, snapshot persisted by the PersistentFSM and the state timeout and - * returns the `State` that should be given to the [[EventSourcedBehavior]] + * returns the `State` that should be given to the the [[EventSourcedBehavior]] * @tparam State State type of the [[EventSourcedBehavior]] * @return A [[SnapshotAdapter]] to be used with a [[EventSourcedBehavior]] */ diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehavior.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehavior.scala index c6dd56cbd03..23184348ff1 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehavior.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehavior.scala @@ -53,7 +53,7 @@ object EventSourcedBehavior { */ type EventHandler[State, Event] = (State, Event) => State - private val logPrefixSkipList = classOf[EventSourcedBehavior[?, ?, ?]].getName :: Nil + private val logPrefixSkipList = classOf[EventSourcedBehavior[_, _, _]].getName :: Nil /** * Create a `Behavior` for a persistent actor. @@ -68,7 +68,7 @@ object EventSourcedBehavior { emptyState: State, commandHandler: (State, Command) => Effect[Event, State], eventHandler: (State, Event) => State): EventSourcedBehavior[Command, Event, State] = { - val loggerClass = LoggerClass.detectLoggerClassFromStack(classOf[EventSourcedBehavior[?, ?, ?]], logPrefixSkipList) + val loggerClass = LoggerClass.detectLoggerClassFromStack(classOf[EventSourcedBehavior[_, _, _]], logPrefixSkipList) EventSourcedBehaviorImpl(persistenceId, emptyState, commandHandler, eventHandler, loggerClass) } @@ -82,7 +82,7 @@ object EventSourcedBehavior { emptyState: State, commandHandler: (State, Command) => ReplyEffect[Event, State], eventHandler: (State, Event) => State): EventSourcedBehavior[Command, Event, State] = { - val loggerClass = LoggerClass.detectLoggerClassFromStack(classOf[EventSourcedBehavior[?, ?, ?]], logPrefixSkipList) + val loggerClass = LoggerClass.detectLoggerClassFromStack(classOf[EventSourcedBehavior[_, _, _]], logPrefixSkipList) EventSourcedBehaviorImpl(persistenceId, emptyState, commandHandler, eventHandler, loggerClass) } @@ -113,11 +113,11 @@ object EventSourcedBehavior { /** * The last sequence number that was persisted, can only be called from inside the handlers of an `EventSourcedBehavior` */ - def lastSequenceNumber(context: ActorContext[?]): Long = { + def lastSequenceNumber(context: ActorContext[_]): Long = { @tailrec - def extractConcreteBehavior(beh: Behavior[?]): Behavior[?] = + def extractConcreteBehavior(beh: Behavior[_]): Behavior[_] = beh match { - case interceptor: InterceptorImpl[?, ?] => extractConcreteBehavior(interceptor.nestedBehavior) + case interceptor: InterceptorImpl[_, _] => extractConcreteBehavior(interceptor.nestedBehavior) case concrete => concrete } @@ -215,7 +215,7 @@ object EventSourcedBehavior { * Transform the event to another type before giving to the journal. Can be used to wrap events * in types Journals understand but is of a different type than `Event`. */ - def eventAdapter(adapter: EventAdapter[Event, ?]): EventSourcedBehavior[Command, Event, State] + def eventAdapter(adapter: EventAdapter[Event, _]): EventSourcedBehavior[Command, Event, State] /** * Transform the state to another type before giving to the journal. Can be used to transform older diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/scaladsl/PersistentFSMMigration.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/scaladsl/PersistentFSMMigration.scala index 1cbf6197010..dda90f75e26 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/scaladsl/PersistentFSMMigration.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/scaladsl/PersistentFSMMigration.scala @@ -28,7 +28,7 @@ object PersistentFSMMigration { * Create a snapshot adapter that will adapt snapshots created by a PersistentFSM into * the correct State type of a [[EventSourcedBehavior]] * @param adapt Takes in the state identifier, snapshot persisted by the PersistentFSM and the state timeout and - * returns the `State` that should be given to the [[EventSourcedBehavior]] + * returns the `State` that should be given to the the [[EventSourcedBehavior]] * @tparam State State type of the [[EventSourcedBehavior]] * @return A [[SnapshotAdapter]] to be used with a [[EventSourcedBehavior]] */ diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/serialization/ReplicatedEventSourcingSerializer.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/serialization/ReplicatedEventSourcingSerializer.scala index f4c30fa1a3d..fbf3b650ef7 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/serialization/ReplicatedEventSourcingSerializer.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/serialization/ReplicatedEventSourcingSerializer.scala @@ -97,11 +97,11 @@ import pekko.serialization.{ BaseSerializer, SerializerWithStringManifest } private val PublishedEventManifest = "PA" def manifest(o: AnyRef) = o match { - case _: ORSet[?] => ORSetManifest - case _: ORSet.AddDeltaOp[?] => ORSetAddManifest - case _: ORSet.RemoveDeltaOp[?] => ORSetRemoveManifest - case _: ORSet.DeltaGroup[?] => ORSetDeltaGroupManifest - case _: ORSet.FullStateDeltaOp[?] => ORSetFullManifest + case _: ORSet[_] => ORSetManifest + case _: ORSet.AddDeltaOp[_] => ORSetAddManifest + case _: ORSet.RemoveDeltaOp[_] => ORSetRemoveManifest + case _: ORSet.DeltaGroup[_] => ORSetDeltaGroupManifest + case _: ORSet.FullStateDeltaOp[_] => ORSetFullManifest case _: Counter => CrdtCounterManifest case _: Counter.Updated => CrdtCounterUpdatedManifest @@ -122,11 +122,11 @@ import pekko.serialization.{ BaseSerializer, SerializerWithStringManifest } case m: VersionVector => versionVectorToProto(m).toByteArray - case m: ORSet[?] => orsetToProto(m).toByteArray - case m: ORSet.AddDeltaOp[?] => orsetToProto(m.underlying).toByteArray - case m: ORSet.RemoveDeltaOp[?] => orsetToProto(m.underlying).toByteArray - case m: ORSet.DeltaGroup[?] => orsetDeltaGroupToProto(m).toByteArray - case m: ORSet.FullStateDeltaOp[?] => orsetToProto(m.underlying).toByteArray + case m: ORSet[_] => orsetToProto(m).toByteArray + case m: ORSet.AddDeltaOp[_] => orsetToProto(m.underlying).toByteArray + case m: ORSet.RemoveDeltaOp[_] => orsetToProto(m.underlying).toByteArray + case m: ORSet.DeltaGroup[_] => orsetDeltaGroupToProto(m).toByteArray + case m: ORSet.FullStateDeltaOp[_] => orsetToProto(m.underlying).toByteArray case m: Counter => counterToProtoByteArray(m) case m: Counter.Updated => counterUpdatedToProtoBufByteArray(m) @@ -225,7 +225,7 @@ import pekko.serialization.{ BaseSerializer, SerializerWithStringManifest } .build() .toByteArray - def orsetToProto(orset: ORSet[?]): ReplicatedEventSourcing.ORSet = + def orsetToProto(orset: ORSet[_]): ReplicatedEventSourcing.ORSet = orsetToProtoImpl(orset.asInstanceOf[ORSet[Any]]) private def orsetToProtoImpl(orset: ORSet[Any]): ReplicatedEventSourcing.ORSet = { @@ -251,7 +251,7 @@ import pekko.serialization.{ BaseSerializer, SerializerWithStringManifest } otherElementsMap = otherElementsMap.updated(enclosedMsg, other) } - def addDots(elements: ArrayList[?]): Unit = { + def addDots(elements: ArrayList[_]): Unit = { // add corresponding dots in same order val iter = elements.iterator while (iter.hasNext) { @@ -326,8 +326,8 @@ import pekko.serialization.{ BaseSerializer, SerializerWithStringManifest } private def orsetFullFromBinary(bytes: Array[Byte]): ORSet.FullStateDeltaOp[Any] = new ORSet.FullStateDeltaOp(orsetFromProto(ReplicatedEventSourcing.ORSet.parseFrom(bytes))) - private def orsetDeltaGroupToProto(deltaGroup: ORSet.DeltaGroup[?]): ReplicatedEventSourcing.ORSetDeltaGroup = { - def createEntry(opType: ReplicatedEventSourcing.ORSetDeltaOp, u: ORSet[?]) = { + private def orsetDeltaGroupToProto(deltaGroup: ORSet.DeltaGroup[_]): ReplicatedEventSourcing.ORSetDeltaGroup = { + def createEntry(opType: ReplicatedEventSourcing.ORSetDeltaOp, u: ORSet[_]) = { ReplicatedEventSourcing.ORSetDeltaGroup.Entry.newBuilder().setOperation(opType).setUnderlying(orsetToProto(u)) } diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/BehaviorSetup.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/BehaviorSetup.scala index 332bc62e258..c74421ab208 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/BehaviorSetup.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/BehaviorSetup.scala @@ -30,8 +30,6 @@ import pekko.persistence.typed.state.internal.InternalProtocol.RecoveryTimeout import pekko.persistence.typed.state.scaladsl.DurableStateBehavior import pekko.util.OptionVal -import com.typesafe.config.ConfigFactory - import org.slf4j.Logger import org.slf4j.MDC @@ -59,9 +57,7 @@ private[pekko] final class BehaviorSetup[C, S]( // Any instead S because adapter may change the type val durableStateStore: DurableStateUpdateStore[Any] = DurableStateStoreRegistry(context.system.toClassic) - .durableStateStoreFor[DurableStateUpdateStore[Any]]( - settings.durableStateStorePluginId, - settings.durableStateStorePluginConfig.getOrElse(ConfigFactory.empty)) + .durableStateStoreFor[DurableStateUpdateStore[Any]](settings.durableStateStorePluginId) def selfClassic: ClassicActorRef = context.self.toClassic diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateBehaviorImpl.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateBehaviorImpl.scala index bb6662d07d1..cbdd6701944 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateBehaviorImpl.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateBehaviorImpl.scala @@ -35,8 +35,6 @@ import pekko.persistence.typed.PersistenceId import pekko.persistence.typed.SnapshotAdapter import pekko.persistence.typed.state.scaladsl._ -import com.typesafe.config.Config - import org.slf4j.LoggerFactory @InternalApi @@ -60,9 +58,8 @@ private[pekko] final case class DurableStateBehaviorImpl[Command, State]( persistenceId: PersistenceId, emptyState: State, commandHandler: DurableStateBehavior.CommandHandler[Command, State], - loggerClass: Class[?], + loggerClass: Class[_], durableStateStorePluginId: Option[String] = None, - durableStateStorePluginConfig: Option[Config] = None, tag: String = "", snapshotAdapter: SnapshotAdapter[State] = NoOpSnapshotAdapter.instance[State], supervisionStrategy: SupervisorStrategy = SupervisorStrategy.stop, @@ -79,15 +76,11 @@ private[pekko] final case class DurableStateBehaviorImpl[Command, State]( override def apply(context: typed.TypedActorContext[Command]): Behavior[Command] = { val ctx = context.asScala val hasCustomLoggerName = ctx match { - case internalCtx: ActorContextImpl[?] => internalCtx.hasCustomLoggerName + case internalCtx: ActorContextImpl[_] => internalCtx.hasCustomLoggerName case _ => false } if (!hasCustomLoggerName) ctx.setLoggerName(loggerClass) - val settings = DurableStateSettings( - ctx.system, - durableStateStorePluginId.getOrElse(""), - durableStateStorePluginConfig, - customStashCapacity) + val settings = DurableStateSettings(ctx.system, durableStateStorePluginId.getOrElse(""), customStashCapacity) // stashState outside supervise because StashState should survive restarts due to persist failures val stashState = new StashState(ctx.asInstanceOf[ActorContext[InternalProtocol]], settings) @@ -167,7 +160,7 @@ private[pekko] final case class DurableStateBehaviorImpl[Command, State]( } @InternalStableApi - private[pekko] def initialize(@nowarn("msg=never used") context: ActorContext[?]): Unit = () + private[pekko] def initialize(@nowarn("msg=never used") context: ActorContext[_]): Unit = () override def receiveSignal(handler: PartialFunction[(State, Signal), Unit]): DurableStateBehavior[Command, State] = copy(signalHandler = handler) @@ -177,9 +170,6 @@ private[pekko] final case class DurableStateBehaviorImpl[Command, State]( copy(durableStateStorePluginId = if (id != "") Some(id) else None) } - override def withDurableStateStorePluginConfig(config: Option[Config]): DurableStateBehavior[Command, State] = - copy(durableStateStorePluginConfig = config) - override def withTag(tag: String): DurableStateBehavior[Command, State] = copy(tag = tag) diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateSettings.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateSettings.scala index 5071c659a78..442e1e09030 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateSettings.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateSettings.scala @@ -31,28 +31,14 @@ import com.typesafe.config.Config @InternalApi private[pekko] object DurableStateSettings { def apply( - system: ActorSystem[?], + system: ActorSystem[_], durableStateStorePluginId: String, customStashCapacity: Option[Int]): DurableStateSettings = - apply(system, durableStateStorePluginId, None, customStashCapacity) - - def apply( - system: ActorSystem[?], - durableStateStorePluginId: String, - durableStateStorePluginConfig: Option[Config], - customStashCapacity: Option[Int]): DurableStateSettings = - apply(system.settings.config, durableStateStorePluginId, durableStateStorePluginConfig, customStashCapacity) + apply(system.settings.config, durableStateStorePluginId, customStashCapacity) def apply( config: Config, durableStateStorePluginId: String, - customStashCapacity: Option[Int]): DurableStateSettings = - apply(config, durableStateStorePluginId, None, customStashCapacity) - - def apply( - config: Config, - durableStateStorePluginId: String, - durableStateStorePluginConfig: Option[Config], customStashCapacity: Option[Int]): DurableStateSettings = { val typedConfig = config.getConfig("pekko.persistence.typed") @@ -68,8 +54,7 @@ import com.typesafe.config.Config val logOnStashing = typedConfig.getBoolean("log-stashing") - val durableStateStoreConfig = - durableStateStoreConfigFor(config, durableStateStorePluginId, durableStateStorePluginConfig) + val durableStateStoreConfig = durableStateStoreConfigFor(config, durableStateStorePluginId) val recoveryTimeout: FiniteDuration = durableStateStoreConfig.getDuration("recovery-timeout", TimeUnit.MILLISECONDS).millis @@ -84,26 +69,20 @@ import com.typesafe.config.Config logOnStashing = logOnStashing, recoveryTimeout, durableStateStorePluginId, - durableStateStorePluginConfig, useContextLoggerForInternalLogging, recurseWhenUnstashingReadOnlyCommands) } - private def durableStateStoreConfigFor( - config: Config, - pluginId: String, - pluginConfig: Option[Config]): Config = { - val mergedConfig = pluginConfig.map(_.withFallback(config)).getOrElse(config) - + private def durableStateStoreConfigFor(config: Config, pluginId: String): Config = { def defaultPluginId = { - val configPath = mergedConfig.getString("pekko.persistence.state.plugin") + val configPath = config.getString("pekko.persistence.state.plugin") Persistence.verifyPluginConfigIsDefined(configPath, "Default DurableStateStore") configPath } val configPath = if (pluginId == "") defaultPluginId else pluginId - Persistence.verifyPluginConfigExists(mergedConfig, configPath, "DurableStateStore") - mergedConfig.getConfig(configPath).withFallback(mergedConfig.getConfig("pekko.persistence.state-plugin-fallback")) + Persistence.verifyPluginConfigExists(config, configPath, "DurableStateStore") + config.getConfig(configPath).withFallback(config.getConfig("pekko.persistence.state-plugin-fallback")) } } @@ -118,7 +97,6 @@ private[pekko] final case class DurableStateSettings( logOnStashing: Boolean, recoveryTimeout: FiniteDuration, durableStateStorePluginId: String, - durableStateStorePluginConfig: Option[Config], useContextLoggerForInternalLogging: Boolean, recurseWhenUnstashingReadOnlyCommands: Boolean) { diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateStoreInteractions.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateStoreInteractions.scala index 18b75e64169..dcd52ff68ab 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateStoreInteractions.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/DurableStateStoreInteractions.scala @@ -86,7 +86,7 @@ private[pekko] trait DurableStateStoreInteractions[C, S] { // TODO These hook methods are for Telemetry. What more parameters are needed? persistenceId? @InternalStableApi - private[pekko] def onWriteInitiated(@nowarn("msg=never used") ctx: ActorContext[?], + private[pekko] def onWriteInitiated(@nowarn("msg=never used") ctx: ActorContext[_], @nowarn("msg=never used") cmd: Any): Unit = () protected def requestRecoveryPermit(): Unit = { diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/Recovering.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/Recovering.scala index a81a6668991..016282d7965 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/Recovering.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/Recovering.scala @@ -136,11 +136,11 @@ private[pekko] class Recovering[C, S]( } @InternalStableApi - def onRecoveryStart(@nowarn("msg=never used") context: ActorContext[?]): Unit = () + def onRecoveryStart(@nowarn("msg=never used") context: ActorContext[_]): Unit = () @InternalStableApi - def onRecoveryComplete(@nowarn("msg=never used") context: ActorContext[?]): Unit = () + def onRecoveryComplete(@nowarn("msg=never used") context: ActorContext[_]): Unit = () @InternalStableApi - def onRecoveryFailed(@nowarn("msg=never used") context: ActorContext[?], @nowarn("msg=never used") reason: Throwable) + def onRecoveryFailed(@nowarn("msg=never used") context: ActorContext[_], @nowarn("msg=never used") reason: Throwable) : Unit = () private def onRecoveryTimeout(): Behavior[InternalProtocol] = { diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/RequestingRecoveryPermit.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/RequestingRecoveryPermit.scala index 3bae69c202d..9ae42829005 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/RequestingRecoveryPermit.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/RequestingRecoveryPermit.scala @@ -78,7 +78,7 @@ private[pekko] class RequestingRecoveryPermit[C, S](override val setup: Behavior } @InternalStableApi - def onRequestingRecoveryPermit(@nowarn("msg=never used") context: ActorContext[?]): Unit = () + def onRequestingRecoveryPermit(@nowarn("msg=never used") context: ActorContext[_]): Unit = () private def becomeRecovering(receivedPoisonPill: Boolean): Behavior[InternalProtocol] = { setup.internalLogger.debug(s"Initializing recovery") diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/Running.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/Running.scala index 7d8d005acf6..4a3f73bad89 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/Running.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/internal/Running.scala @@ -210,7 +210,7 @@ private[pekko] object Running { state: RunningState[S, C], effect: Effect[S], sideEffects: immutable.Seq[SideEffect[S]] = Nil): (Behavior[InternalProtocol], Boolean) = { - if (setup.internalLogger.isDebugEnabled && !effect.isInstanceOf[CompositeEffect[?]]) + if (setup.internalLogger.isDebugEnabled && !effect.isInstanceOf[CompositeEffect[_]]) setup.internalLogger.debugN( s"Handled command [{}], resulting effect: [{}], side effects: [{}]", msg.getClass.getName, @@ -228,7 +228,7 @@ private[pekko] object Running { case _: PersistNothing.type => (applySideEffects(sideEffects, state), true) - case _: Delete[?] => + case _: Delete[_] => handleDelete(msg, sideEffects) case _: Unhandled.type => @@ -284,7 +284,7 @@ private[pekko] object Running { case DeleteFailure(exc) => onDeleteFailed(exc) case RecoveryTimeout => Behaviors.unhandled case RecoveryPermitGranted => Behaviors.unhandled - case _: GetSuccess[?] => Behaviors.unhandled + case _: GetSuccess[_] => Behaviors.unhandled case _: GetFailure => Behaviors.unhandled } } @@ -381,16 +381,16 @@ private[pekko] object Running { unstashAll() behavior - case callback: Callback[?] => + case callback: Callback[_] => callback.sideEffect(state.state) behavior } } @InternalStableApi - private[pekko] def onWriteFailed(@nowarn("msg=never used") ctx: ActorContext[?], + private[pekko] def onWriteFailed(@nowarn("msg=never used") ctx: ActorContext[_], @nowarn("msg=never used") reason: Throwable): Unit = () @InternalStableApi - private[pekko] def onWriteSuccess(@nowarn("msg=never used") ctx: ActorContext[?]): Unit = () + private[pekko] def onWriteSuccess(@nowarn("msg=never used") ctx: ActorContext[_]): Unit = () } diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/javadsl/DurableStateBehavior.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/javadsl/DurableStateBehavior.scala index b94ae192593..90f93253502 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/javadsl/DurableStateBehavior.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/javadsl/DurableStateBehavior.scala @@ -15,8 +15,6 @@ package org.apache.pekko.persistence.typed.state.javadsl import java.util.Optional -import org.jspecify.annotations.Nullable - import org.apache.pekko import pekko.actor.typed import pekko.actor.typed.BackoffSupervisorStrategy @@ -30,10 +28,7 @@ import pekko.persistence.typed.SnapshotAdapter import pekko.persistence.typed.state.internal import pekko.persistence.typed.state.internal._ import pekko.persistence.typed.state.scaladsl - -import scala.jdk.OptionConverters._ - -import com.typesafe.config.Config +import org.jspecify.annotations.Nullable /** * A `Behavior` for a persistent actor with durable storage of its state. @@ -119,14 +114,6 @@ abstract class DurableStateBehavior[Command, State] private[pekko] ( */ def durableStateStorePluginId: String = "" - /** - * Override and define the `DurableStateStore` plugin config that this actor should use instead of the default. - * This is useful when the same plugin class is configured for multiple, isolated stores at runtime. - * - * @since 2.0.0 - */ - def durableStateStorePluginConfig: Optional[Config] = Optional.empty() - /** * The tag that can be used in persistence query. */ @@ -153,11 +140,7 @@ abstract class DurableStateBehavior[Command, State] private[pekko] ( persistenceId, emptyState, (state, cmd) => commandHandler()(state, cmd).asInstanceOf[EffectImpl[State]], - getClass) - .withTag(tag) - .snapshotAdapter(snapshotAdapter()) - .withDurableStateStorePluginId(durableStateStorePluginId) - .withDurableStateStorePluginConfig(durableStateStorePluginConfig.toScala) + getClass).withTag(tag).snapshotAdapter(snapshotAdapter()).withDurableStateStorePluginId(durableStateStorePluginId) val handler = signalHandler() val behaviorWithSignalHandler = @@ -173,7 +156,7 @@ abstract class DurableStateBehavior[Command, State] private[pekko] ( /** * The last sequence number that was persisted, can only be called from inside the handlers of a `DurableStateBehavior` */ - final def lastSequenceNumber(ctx: ActorContext[?]): Long = { + final def lastSequenceNumber(ctx: ActorContext[_]): Long = { scaladsl.DurableStateBehavior.lastSequenceNumber(ctx.asScala) } diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehavior.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehavior.scala index 3a014744bfd..2de01499d7d 100644 --- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehavior.scala +++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/scaladsl/DurableStateBehavior.scala @@ -15,8 +15,6 @@ package org.apache.pekko.persistence.typed.state.scaladsl import scala.annotation.tailrec -import com.typesafe.config.Config - import org.apache.pekko import pekko.actor.typed.BackoffSupervisorStrategy import pekko.actor.typed.Behavior @@ -46,7 +44,7 @@ object DurableStateBehavior { */ type CommandHandler[Command, State] = (State, Command) => Effect[State] - private val logPrefixSkipList = classOf[DurableStateBehavior[?, ?]].getName :: Nil + private val logPrefixSkipList = classOf[DurableStateBehavior[_, _]].getName :: Nil /** * Create a `Behavior` for a persistent actor with durable storage of its state. @@ -59,7 +57,7 @@ object DurableStateBehavior { persistenceId: PersistenceId, emptyState: State, commandHandler: (State, Command) => Effect[State]): DurableStateBehavior[Command, State] = { - val loggerClass = LoggerClass.detectLoggerClassFromStack(classOf[DurableStateBehavior[?, ?]], logPrefixSkipList) + val loggerClass = LoggerClass.detectLoggerClassFromStack(classOf[DurableStateBehavior[_, _]], logPrefixSkipList) DurableStateBehaviorImpl(persistenceId, emptyState, commandHandler, loggerClass) } @@ -72,7 +70,7 @@ object DurableStateBehavior { persistenceId: PersistenceId, emptyState: State, commandHandler: (State, Command) => ReplyEffect[State]): DurableStateBehavior[Command, State] = { - val loggerClass = LoggerClass.detectLoggerClassFromStack(classOf[DurableStateBehavior[?, ?]], logPrefixSkipList) + val loggerClass = LoggerClass.detectLoggerClassFromStack(classOf[DurableStateBehavior[_, _]], logPrefixSkipList) DurableStateBehaviorImpl(persistenceId, emptyState, commandHandler, loggerClass) } @@ -102,11 +100,11 @@ object DurableStateBehavior { /** * The last sequence number that was persisted, can only be called from inside the handlers of a `DurableStateBehavior` */ - def lastSequenceNumber(context: ActorContext[?]): Long = { + def lastSequenceNumber(context: ActorContext[_]): Long = { @tailrec - def extractConcreteBehavior(beh: Behavior[?]): Behavior[?] = + def extractConcreteBehavior(beh: Behavior[_]): Behavior[_] = beh match { - case interceptor: InterceptorImpl[?, ?] => extractConcreteBehavior(interceptor.nestedBehavior) + case interceptor: InterceptorImpl[_, _] => extractConcreteBehavior(interceptor.nestedBehavior) case concrete => concrete } @@ -148,14 +146,6 @@ object DurableStateBehavior { */ def withDurableStateStorePluginId(id: String): DurableStateBehavior[Command, State] - /** - * Change the `DurableStateStore` plugin config that this actor should use. - * This is useful when the same plugin class is configured for multiple, isolated stores at runtime. - * - * @since 2.0.0 - */ - def withDurableStateStorePluginConfig(config: Option[Config]): DurableStateBehavior[Command, State] - /** * The tag that can used in persistence query */ diff --git a/persistence-typed/src/test/java/jdocs/org/apache/pekko/persistence/typed/BasicPersistentBehaviorTest.java b/persistence-typed/src/test/java/jdocs/org/apache/pekko/persistence/typed/BasicPersistentBehaviorTest.java index f336d93943e..79f16eb8d2a 100644 --- a/persistence-typed/src/test/java/jdocs/org/apache/pekko/persistence/typed/BasicPersistentBehaviorTest.java +++ b/persistence-typed/src/test/java/jdocs/org/apache/pekko/persistence/typed/BasicPersistentBehaviorTest.java @@ -121,7 +121,6 @@ public Added(String data) { public enum Cleared implements Event { INSTANCE } - // #command // #state @@ -144,7 +143,6 @@ public State addItem(String data) { return new State(latest); } } - // #state // #behavior @@ -172,7 +170,6 @@ public CommandHandler commandHandler() { .onCommand(Clear.class, command -> Effect().persist(Cleared.INSTANCE)) .build(); } - // #command-handler // #event-handler @@ -309,7 +306,6 @@ interface Command {} interface Event {} public static class State {} - // #supervision public static Behavior create(PersistenceId persistenceId) { @@ -356,7 +352,6 @@ public SignalHandler signalHandler() { }) .build(); } - // #recovery // #recovery-disabled @@ -364,7 +359,6 @@ public SignalHandler signalHandler() { public Recovery recovery() { return Recovery.disabled(); } - // #recovery-disabled // #tagging @@ -394,7 +388,6 @@ interface Command {} interface Event {} public static class State {} - // #wrapPersistentBehavior public static Behavior create(PersistenceId persistenceId) { @@ -436,7 +429,6 @@ public EventHandler eventHandler() { public Optional stashCapacity() { return Optional.of(100); } - // #custom-stash-buffer // #wrapPersistentBehavior @@ -533,7 +525,6 @@ public EventHandler eventHandler() { public boolean shouldSnapshot(State state, Event event, long sequenceNr) { return event instanceof BookingCompleted; } - // #snapshottingPredicate // #retentionCriteria @@ -541,7 +532,6 @@ public boolean shouldSnapshot(State state, Event event, long sequenceNr) { public RetentionCriteria retentionCriteria() { return RetentionCriteria.snapshotEvery(100, 2); } - // #retentionCriteria // #retentionCriteriaWithSignals @@ -610,7 +600,6 @@ interface Command {} interface Event {} public static class State {} - // #actor-context public static Behavior create(PersistenceId persistenceId) { diff --git a/persistence-typed/src/test/java/jdocs/org/apache/pekko/persistence/typed/DurableStatePersistentBehaviorTest.java b/persistence-typed/src/test/java/jdocs/org/apache/pekko/persistence/typed/DurableStatePersistentBehaviorTest.java index d30deaf6c0a..eca52277def 100644 --- a/persistence-typed/src/test/java/jdocs/org/apache/pekko/persistence/typed/DurableStatePersistentBehaviorTest.java +++ b/persistence-typed/src/test/java/jdocs/org/apache/pekko/persistence/typed/DurableStatePersistentBehaviorTest.java @@ -119,7 +119,6 @@ public int get() { return value; } } - // #state // #behavior @@ -235,7 +234,6 @@ public class MyPersistentBehavior interface Command {} public static class State {} - // #actor-context public static Behavior create(PersistenceId persistenceId) { @@ -281,7 +279,6 @@ public class MyPersistentBehavior interface Command {} public static class State {} - // #supervision public static Behavior create(PersistenceId persistenceId) { @@ -330,7 +327,6 @@ public class MyPersistentBehavior interface Command {} public static class State {} - // #wrapPersistentBehavior public static Behavior create(PersistenceId persistenceId) { diff --git a/persistence-typed/src/test/scala/docs/org/apache/pekko/persistence/typed/DurableStatePersistentBehaviorCompileOnly.scala b/persistence-typed/src/test/scala/docs/org/apache/pekko/persistence/typed/DurableStatePersistentBehaviorCompileOnly.scala index bf22675da38..d481e1029a4 100644 --- a/persistence-typed/src/test/scala/docs/org/apache/pekko/persistence/typed/DurableStatePersistentBehaviorCompileOnly.scala +++ b/persistence-typed/src/test/scala/docs/org/apache/pekko/persistence/typed/DurableStatePersistentBehaviorCompileOnly.scala @@ -51,7 +51,7 @@ object DurableStatePersistentBehaviorCompileOnly { // #command-handler import pekko.persistence.typed.state.scaladsl.Effect - val commandHandler: (State, Command[?]) => Effect[State] = (state, command) => + val commandHandler: (State, Command[_]) => Effect[State] = (state, command) => command match { case Increment => Effect.persist(state.copy(value = state.value + 1)) case IncrementBy(by) => Effect.persist(state.copy(value = state.value + by)) @@ -61,8 +61,8 @@ object DurableStatePersistentBehaviorCompileOnly { // #command-handler // #behavior - def counter(id: String): DurableStateBehavior[Command[?], State] = { - DurableStateBehavior.apply[Command[?], State]( + def counter(id: String): DurableStateBehavior[Command[_], State] = { + DurableStateBehavior.apply[Command[_], State]( persistenceId = PersistenceId.ofUniqueId(id), emptyState = State(0), commandHandler = commandHandler) @@ -76,8 +76,8 @@ object DurableStatePersistentBehaviorCompileOnly { final case class State(value: Int) extends CborSerializable - def counter(persistenceId: PersistenceId): DurableStateBehavior[Command[?], State] = { - DurableStateBehavior.apply[Command[?], State]( + def counter(persistenceId: PersistenceId): DurableStateBehavior[Command[_], State] = { + DurableStateBehavior.apply[Command[_], State]( persistenceId, emptyState = State(0), commandHandler = @@ -97,8 +97,8 @@ object DurableStatePersistentBehaviorCompileOnly { final case class State(value: Int) extends CborSerializable - def counter(persistenceId: PersistenceId): DurableStateBehavior[Command[?], State] = { - DurableStateBehavior.withEnforcedReplies[Command[?], State]( + def counter(persistenceId: PersistenceId): DurableStateBehavior[Command[_], State] = { + DurableStateBehavior.withEnforcedReplies[Command[_], State]( persistenceId, emptyState = State(0), commandHandler = (state, command) => @@ -134,9 +134,9 @@ object DurableStatePersistentBehaviorCompileOnly { } object TaggingBehavior { - def apply(): Behavior[Command[?]] = + def apply(): Behavior[Command[_]] = // #tagging - DurableStateBehavior[Command[?], State]( + DurableStateBehavior[Command[_], State]( persistenceId = PersistenceId.ofUniqueId("abc"), emptyState = State(0), commandHandler = (state, cmd) => throw new NotImplementedError("TODO: process the command & return an Effect")) @@ -148,10 +148,10 @@ object DurableStatePersistentBehaviorCompileOnly { import pekko.persistence.typed.state.scaladsl.Effect import pekko.persistence.typed.state.scaladsl.DurableStateBehavior.CommandHandler - def apply(): Behavior[Command[?]] = + def apply(): Behavior[Command[_]] = // #wrapPersistentBehavior - Behaviors.setup[Command[?]] { context => - DurableStateBehavior[Command[?], State]( + Behaviors.setup[Command[_]] { context => + DurableStateBehavior[Command[_], State]( persistenceId = PersistenceId.ofUniqueId("abc"), emptyState = State(0), commandHandler = CommandHandler.command { cmd => diff --git a/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/StashingWhenSnapshottingSpec.scala b/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/StashingWhenSnapshottingSpec.scala index a47d75b3ceb..404746b9b3b 100644 --- a/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/StashingWhenSnapshottingSpec.scala +++ b/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/StashingWhenSnapshottingSpec.scala @@ -41,7 +41,7 @@ import com.typesafe.config.ConfigFactory object StashingWhenSnapshottingSpec { object ControllableSnapshotStoreExt extends ExtensionId[ControllableSnapshotStoreExt] { - override def createExtension(system: ActorSystem[?]): ControllableSnapshotStoreExt = + override def createExtension(system: ActorSystem[_]): ControllableSnapshotStoreExt = new ControllableSnapshotStoreExt() } diff --git a/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/internal/StashStateSpec.scala b/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/internal/StashStateSpec.scala index 63faa0aae36..3695d9692d1 100644 --- a/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/internal/StashStateSpec.scala +++ b/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/internal/StashStateSpec.scala @@ -58,7 +58,7 @@ class StashStateSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike with stashState.internalStashBuffer.stash(RecoveryPermitGranted) probe.ref ! stashState.internalStashBuffer.size Behaviors.same[InternalProtocol] - case _: IncomingCommand[?] => Behaviors.stopped + case _: IncomingCommand[_] => Behaviors.stopped } .receiveSignal { case (_, _) => diff --git a/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/PersistentActorCompileOnlyTest.scala b/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/PersistentActorCompileOnlyTest.scala index 6dab33570fa..a7d76389648 100644 --- a/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/PersistentActorCompileOnlyTest.scala +++ b/persistence-typed/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/PersistentActorCompileOnlyTest.scala @@ -76,7 +76,7 @@ object PersistentActorCompileOnlyTest { def performSideEffect(sender: ActorRef[AcknowledgeSideEffect], correlationId: Int, data: String): Unit = { import pekko.actor.typed.scaladsl.AskPattern._ implicit val timeout: pekko.util.Timeout = 1.second - implicit val system: ActorSystem[?] = ??? + implicit val system: ActorSystem[_] = ??? implicit val ec: ExecutionContext = ??? val response: Future[RecoveryComplete.Response] = diff --git a/persistence/src/main/java/org/apache/pekko/persistence/serialization/MessageFormats.java b/persistence/src/main/java/org/apache/pekko/persistence/serialization/MessageFormats.java index afa6f32a5e3..9f2d0380c32 100644 --- a/persistence/src/main/java/org/apache/pekko/persistence/serialization/MessageFormats.java +++ b/persistence/src/main/java/org/apache/pekko/persistence/serialization/MessageFormats.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: MessageFormats.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package org.apache.pekko.persistence.serialization; @@ -25,8 +25,8 @@ private MessageFormats() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "MessageFormats"); } @@ -218,8 +218,8 @@ public static final class PersistentMessage extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "PersistentMessage"); } @@ -645,8 +645,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getPayload()); @@ -679,15 +684,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(15, getMetadata()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2025,8 +2021,8 @@ public static final class PersistentPayload extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "PersistentPayload"); } @@ -2148,8 +2144,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt32Size(1, serializerId_); @@ -2162,15 +2163,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(3, payloadManifest_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2703,8 +2695,8 @@ public static final class AtomicWrite extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "AtomicWrite"); } @@ -2800,8 +2792,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; { final int count = payload_.size(); @@ -2811,15 +2808,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -3479,8 +3467,8 @@ public static final class AtLeastOnceDeliverySnapshot extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "AtLeastOnceDeliverySnapshot"); } @@ -3569,8 +3557,8 @@ public static final class UnconfirmedDelivery extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "UnconfirmedDelivery"); } @@ -3736,8 +3724,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(1, deliveryId_); @@ -3749,15 +3742,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(3, getPayload()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -4487,8 +4471,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(1, currentDeliveryId_); @@ -4502,15 +4491,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -5260,8 +5240,8 @@ public static final class PersistentStateChangeEvent extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "PersistentStateChangeEvent"); } @@ -5451,8 +5431,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, stateIdentifier_); } @@ -5463,15 +5448,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(3, timeoutNanos_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -6129,8 +6105,8 @@ public static final class PersistentFSMSnapshot extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "PersistentFSMSnapshot"); } @@ -6292,8 +6268,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, stateIdentifier_); } @@ -6305,15 +6286,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(3, timeoutNanos_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/persistence/src/main/scala-2/org/apache/pekko/persistence/TraitOrder.scala b/persistence/src/main/scala-2/org/apache/pekko/persistence/TraitOrder.scala index aa0854ad208..75ccd19c30e 100644 --- a/persistence/src/main/scala-2/org/apache/pekko/persistence/TraitOrder.scala +++ b/persistence/src/main/scala-2/org/apache/pekko/persistence/TraitOrder.scala @@ -22,7 +22,7 @@ import org.apache.pekko.annotation.InternalApi private[persistence] object TraitOrder { val canBeChecked = true - def checkBefore(clazz: Class[?], one: Class[?], other: Class[?]): Unit = { + def checkBefore(clazz: Class[_], one: Class[_], other: Class[_]): Unit = { val interfaces = clazz.getInterfaces val i = interfaces.indexOf(other) val j = interfaces.indexOf(one) diff --git a/persistence/src/main/scala-3/org/apache/pekko/persistence/TraitOrder.scala b/persistence/src/main/scala-3/org/apache/pekko/persistence/TraitOrder.scala index a45b43c8f12..d347e7ca82a 100644 --- a/persistence/src/main/scala-3/org/apache/pekko/persistence/TraitOrder.scala +++ b/persistence/src/main/scala-3/org/apache/pekko/persistence/TraitOrder.scala @@ -23,6 +23,6 @@ private[persistence] object TraitOrder { val canBeChecked = false // No-op on Scala 3 - def checkBefore(clazz: Class[?], one: Class[?], other: Class[?]): Unit = + def checkBefore(clazz: Class[_], one: Class[_], other: Class[_]): Unit = () } diff --git a/persistence/src/main/scala/org/apache/pekko/persistence/Persistence.scala b/persistence/src/main/scala/org/apache/pekko/persistence/Persistence.scala index 66dacddf0e1..6ea1d98ab18 100644 --- a/persistence/src/main/scala/org/apache/pekko/persistence/Persistence.scala +++ b/persistence/src/main/scala/org/apache/pekko/persistence/Persistence.scala @@ -270,7 +270,7 @@ class Persistence(val system: ExtendedActorSystem) extends Extension { .getStringList("journal.auto-start-journals") .forEach(new Consumer[String] { override def accept(id: String): Unit = { - log.info("Auto-starting journal plugin `{}`", id) + log.info(s"Auto-starting journal plugin `$id`") journalFor(id) } }) @@ -278,7 +278,7 @@ class Persistence(val system: ExtendedActorSystem) extends Extension { .getStringList("snapshot-store.auto-start-snapshot-stores") .forEach(new Consumer[String] { override def accept(id: String): Unit = { - log.info("Auto-starting snapshot store `{}`", id) + log.info(s"Auto-starting snapshot store `$id`") snapshotStoreFor(id) } }) @@ -409,7 +409,7 @@ class Persistence(val system: ExtendedActorSystem) extends Extension { val pluginClassName = pluginConfig.getString("class") if (isEmpty(pluginClassName)) throw new IllegalArgumentException(s"Plugin class name must be defined in config property [$configPath.class]") - log.debug("Create plugin: {} {}", pluginActorName, pluginClassName) + log.debug(s"Create plugin: $pluginActorName $pluginClassName") val pluginClass = system.dynamicAccess.getClassFor[Any](pluginClassName).get val pluginDispatcherId = pluginConfig.getString("plugin-dispatcher") val pluginActorArgs: List[AnyRef] = diff --git a/persistence/src/main/scala/org/apache/pekko/persistence/PersistencePlugin.scala b/persistence/src/main/scala/org/apache/pekko/persistence/PersistencePlugin.scala index 85e23d44e1d..e125a96ca11 100644 --- a/persistence/src/main/scala/org/apache/pekko/persistence/PersistencePlugin.scala +++ b/persistence/src/main/scala/org/apache/pekko/persistence/PersistencePlugin.scala @@ -55,7 +55,7 @@ private[pekko] abstract class PersistencePlugin[ScalaDsl, JavaDsl, T: ClassTag]( implicit ev: PluginProvider[T, ScalaDsl, JavaDsl]) { private val plugins = new AtomicReference[Map[String, ExtensionId[PluginHolder[ScalaDsl, JavaDsl]]]](Map.empty) - private val log = Logging(system, classOf[PersistencePlugin[?, ?, ?]]) + private val log = Logging(system, classOf[PersistencePlugin[_, _, _]]) @tailrec final protected def pluginFor(pluginId: String, readJournalPluginConfig: Config): PluginHolder[ScalaDsl, JavaDsl] = { @@ -83,10 +83,10 @@ private[pekko] abstract class PersistencePlugin[ScalaDsl, JavaDsl, T: ClassTag]( s"'reference.conf' is missing persistence plugin config path: '$configPath'") val pluginConfig = mergedConfig.getConfig(configPath) val pluginClassName = pluginConfig.getString("class") - log.debug("Create plugin: {} {}", configPath, pluginClassName) + log.debug(s"Create plugin: $configPath $pluginClassName") val pluginClass = system.dynamicAccess.getClassFor[AnyRef](pluginClassName).get - def instantiate(args: collection.immutable.Seq[(Class[?], AnyRef)]) = + def instantiate(args: collection.immutable.Seq[(Class[_], AnyRef)]) = system.dynamicAccess.createInstanceFor[T](pluginClass, args) instantiate( diff --git a/persistence/src/main/scala/org/apache/pekko/persistence/journal/EventAdapters.scala b/persistence/src/main/scala/org/apache/pekko/persistence/journal/EventAdapters.scala index ff89dd410cc..b2d55379fe6 100644 --- a/persistence/src/main/scala/org/apache/pekko/persistence/journal/EventAdapters.scala +++ b/persistence/src/main/scala/org/apache/pekko/persistence/journal/EventAdapters.scala @@ -31,8 +31,8 @@ import com.typesafe.config.Config * `EventAdapters` serves as a per-journal collection of bound event adapters. */ class EventAdapters( - map: ConcurrentHashMap[Class[?], EventAdapter], - bindings: immutable.Seq[(Class[?], EventAdapter)], + map: ConcurrentHashMap[Class[_], EventAdapter], + bindings: immutable.Seq[(Class[_], EventAdapter)], log: LoggingAdapter) { /** @@ -41,7 +41,7 @@ class EventAdapters( * * Falls back to [[IdentityEventAdapter]] if no adapter was defined for the given class. */ - def get(clazz: Class[?]): EventAdapter = { + def get(clazz: Class[_]): EventAdapter = { map.get(clazz) match { case null => // bindings are ordered from most specific to least specific val value = bindings.filter { @@ -52,8 +52,7 @@ class EventAdapters( } map.putIfAbsent(clazz, value) match { case null => - if (log.isDebugEnabled) - log.debug("Using EventAdapter: {} for event [{}]", value.getClass.getName, clazz.getName) + log.debug(s"Using EventAdapter: {} for event [{}]", value.getClass.getName, clazz.getName) value case some => some } @@ -71,7 +70,7 @@ private[pekko] object EventAdapters { type Name = String type BoundAdapters = immutable.Seq[String] type FQN = String - type ClassHandler = (Class[?], EventAdapter) + type ClassHandler = (Class[_], EventAdapter) def apply(system: ExtendedActorSystem, config: Config): EventAdapters = { val adapters = configToMap(config, "event-adapters") @@ -115,7 +114,7 @@ private[pekko] object EventAdapters { sort(bs) } - val backing = bindings.foldLeft(new ConcurrentHashMap[Class[?], EventAdapter]) { + val backing = bindings.foldLeft(new ConcurrentHashMap[Class[_], EventAdapter]) { case (map, (c, s)) => map.put(c, s); map } @@ -161,8 +160,8 @@ private[pekko] object EventAdapters { * Sort so that subtypes always precede their supertypes, but without * obeying any order between unrelated subtypes (insert sort). */ - private def sort[T](in: Iterable[(Class[?], T)]): immutable.Seq[(Class[?], T)] = - in.foldLeft(new ArrayBuffer[(Class[?], T)](in.size)) { (buf, ca) => + private def sort[T](in: Iterable[(Class[_], T)]): immutable.Seq[(Class[_], T)] = + in.foldLeft(new ArrayBuffer[(Class[_], T)](in.size)) { (buf, ca) => buf.indexWhere(_._1.isAssignableFrom(ca._1)) match { case -1 => buf.append(ca) case x => buf.insert(x, ca) @@ -182,7 +181,7 @@ private[pekko] object EventAdapters { import scala.jdk.CollectionConverters._ if (config.hasPath(path)) { config.getConfig(path).root.unwrapped.asScala.toMap.map { - case (k, v: util.ArrayList[?]) if v.isInstanceOf[util.ArrayList[?]] => k -> v.asScala.map(_.toString).toList + case (k, v: util.ArrayList[_]) if v.isInstanceOf[util.ArrayList[_]] => k -> v.asScala.map(_.toString).toList case (k, v) => k -> List(v.toString) } } else Map.empty @@ -191,6 +190,6 @@ private[pekko] object EventAdapters { } private[pekko] case object IdentityEventAdapters extends EventAdapters(null, null, null) { - override def get(clazz: Class[?]): EventAdapter = IdentityEventAdapter + override def get(clazz: Class[_]): EventAdapter = IdentityEventAdapter override def toString = Logging.simpleName(IdentityEventAdapters) } diff --git a/persistence/src/main/scala/org/apache/pekko/persistence/journal/PersistencePluginProxy.scala b/persistence/src/main/scala/org/apache/pekko/persistence/journal/PersistencePluginProxy.scala index c06b4b376d8..01b2fe8b90a 100644 --- a/persistence/src/main/scala/org/apache/pekko/persistence/journal/PersistencePluginProxy.scala +++ b/persistence/src/main/scala/org/apache/pekko/persistence/journal/PersistencePluginProxy.scala @@ -77,7 +77,7 @@ object PersistencePluginProxyExtension with ExtensionIdProvider { override def createExtension(system: ExtendedActorSystem): PersistencePluginProxyExtensionImpl = new PersistencePluginProxyExtensionImpl(system) - override def lookup: ExtensionId[? <: Extension] = PersistencePluginProxyExtension + override def lookup: ExtensionId[_ <: Extension] = PersistencePluginProxyExtension override def get(system: ActorSystem): PersistencePluginProxyExtensionImpl = super.get(system) override def get(system: ClassicActorSystemProvider): PersistencePluginProxyExtensionImpl = super.get(system) } diff --git a/persistence/src/main/scala/org/apache/pekko/persistence/serialization/MessageSerializer.scala b/persistence/src/main/scala/org/apache/pekko/persistence/serialization/MessageSerializer.scala index c2060d72827..ffc49637745 100644 --- a/persistence/src/main/scala/org/apache/pekko/persistence/serialization/MessageSerializer.scala +++ b/persistence/src/main/scala/org/apache/pekko/persistence/serialization/MessageSerializer.scala @@ -71,7 +71,7 @@ class MessageSerializer(val system: ExtendedActorSystem) extends BaseSerializer * Deserializes persistent messages. Delegates deserialization of a persistent * message's payload to a matching `org.apache.pekko.serialization.Serializer`. */ - def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): Message = manifest match { + def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): Message = manifest match { case None => persistent(mf.PersistentMessage.parseFrom(bytes)) case Some(c) => c match { diff --git a/persistence/src/main/scala/org/apache/pekko/persistence/serialization/SnapshotSerializer.scala b/persistence/src/main/scala/org/apache/pekko/persistence/serialization/SnapshotSerializer.scala index d60b314a623..3539ce85fb3 100644 --- a/persistence/src/main/scala/org/apache/pekko/persistence/serialization/SnapshotSerializer.scala +++ b/persistence/src/main/scala/org/apache/pekko/persistence/serialization/SnapshotSerializer.scala @@ -77,7 +77,7 @@ class SnapshotSerializer(val system: ExtendedActorSystem) extends BaseSerializer * Deserializes a [[Snapshot]]. Delegates deserialization of snapshot `data` to a matching * `org.apache.pekko.serialization.Serializer`. */ - def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = + def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = Snapshot(snapshotFromBinary(bytes)) private def headerToBinary(snapshot: AnyRef, snapshotSerializer: Serializer): Array[Byte] = { diff --git a/persistence/src/main/scala/org/apache/pekko/persistence/state/DurableStateStoreRegistry.scala b/persistence/src/main/scala/org/apache/pekko/persistence/state/DurableStateStoreRegistry.scala index bc6704ebb0d..c8d88f4d7c9 100644 --- a/persistence/src/main/scala/org/apache/pekko/persistence/state/DurableStateStoreRegistry.scala +++ b/persistence/src/main/scala/org/apache/pekko/persistence/state/DurableStateStoreRegistry.scala @@ -30,7 +30,6 @@ import pekko.persistence.PluginProvider import pekko.persistence.state.scaladsl.DurableStateStore import com.typesafe.config.Config -import com.typesafe.config.ConfigFactory /** * Persistence extension for queries. @@ -46,16 +45,16 @@ object DurableStateStoreRegistry extends ExtensionId[DurableStateStoreRegistry] @InternalApi private[pekko] val pluginProvider - : PluginProvider[DurableStateStoreProvider, DurableStateStore[?], javadsl.DurableStateStore[?]] = - new PluginProvider[DurableStateStoreProvider, scaladsl.DurableStateStore[?], javadsl.DurableStateStore[?]] { - override def scalaDsl(t: DurableStateStoreProvider): DurableStateStore[?] = t.scaladslDurableStateStore() - override def javaDsl(t: DurableStateStoreProvider): javadsl.DurableStateStore[?] = t.javadslDurableStateStore() + : PluginProvider[DurableStateStoreProvider, DurableStateStore[_], javadsl.DurableStateStore[_]] = + new PluginProvider[DurableStateStoreProvider, scaladsl.DurableStateStore[_], javadsl.DurableStateStore[_]] { + override def scalaDsl(t: DurableStateStoreProvider): DurableStateStore[_] = t.scaladslDurableStateStore() + override def javaDsl(t: DurableStateStoreProvider): javadsl.DurableStateStore[_] = t.javadslDurableStateStore() } } class DurableStateStoreRegistry(system: ExtendedActorSystem) - extends PersistencePlugin[scaladsl.DurableStateStore[?], javadsl.DurableStateStore[?], DurableStateStoreProvider]( + extends PersistencePlugin[scaladsl.DurableStateStore[_], javadsl.DurableStateStore[_], DurableStateStoreProvider]( system)(ClassTag(classOf[DurableStateStoreProvider]), DurableStateStoreRegistry.pluginProvider) with Extension { @@ -68,12 +67,9 @@ class DurableStateStoreRegistry(system: ExtendedActorSystem) configPath } - private def pluginIdOrDefault(pluginId: String): String = - pluginIdOrDefault(pluginId, ConfigFactory.empty) - - private def pluginIdOrDefault(pluginId: String, pluginConfig: Config): String = { + private def pluginIdOrDefault(pluginId: String): String = { val configPath = if (isEmpty(pluginId)) defaultPluginId else pluginId - Persistence.verifyPluginConfigExists(pluginConfig.withFallback(systemConfig), configPath, "DurableStateStore") + Persistence.verifyPluginConfigExists(systemConfig, configPath, "DurableStateStore") configPath } @@ -91,43 +87,18 @@ class DurableStateStoreRegistry(system: ExtendedActorSystem) * Scala API: Returns the [[pekko.persistence.state.scaladsl.DurableStateStore]] specified by the given * configuration entry. */ - final def durableStateStoreFor[T <: scaladsl.DurableStateStore[?]](pluginId: String): T = { + final def durableStateStoreFor[T <: scaladsl.DurableStateStore[_]](pluginId: String): T = { pluginFor(pluginIdOrDefault(pluginId), pluginConfig(pluginId)).scaladslPlugin.asInstanceOf[T] } - /** - * Scala API: Returns the [[pekko.persistence.state.scaladsl.DurableStateStore]] specified by the given - * configuration entry. The provided `runtimeConfig` is used to configure the plugin at runtime, taking - * precedence over the plugin configuration defined in the actor system configuration. - * - * @since 2.0.0 - */ - final def durableStateStoreFor[T <: scaladsl.DurableStateStore[?]](pluginId: String, runtimeConfig: Config): T = { - pluginFor(pluginIdOrDefault(pluginId, runtimeConfig), runtimeConfig).scaladslPlugin.asInstanceOf[T] - } - /** * Java API: Returns the [[pekko.persistence.state.javadsl.DurableStateStore]] specified by the given * configuration entry. */ - final def getDurableStateStoreFor[T <: javadsl.DurableStateStore[?]]( + final def getDurableStateStoreFor[T <: javadsl.DurableStateStore[_]]( @nowarn("msg=never used") clazz: Class[T], // FIXME generic Class could be problematic in Java pluginId: String): T = { pluginFor(pluginIdOrDefault(pluginId), pluginConfig(pluginId)).javadslPlugin.asInstanceOf[T] } - /** - * Java API: Returns the [[pekko.persistence.state.javadsl.DurableStateStore]] specified by the given - * configuration entry. The provided `runtimeConfig` is used to configure the plugin at runtime, taking - * precedence over the plugin configuration defined in the actor system configuration. - * - * @since 2.0.0 - */ - final def getDurableStateStoreFor[T <: javadsl.DurableStateStore[?]]( - @nowarn("msg=never used") clazz: Class[T], // FIXME generic Class could be problematic in Java - pluginId: String, - runtimeConfig: Config): T = { - pluginFor(pluginIdOrDefault(pluginId, runtimeConfig), runtimeConfig).javadslPlugin.asInstanceOf[T] - } - } diff --git a/persistence/src/test/scala/org/apache/pekko/persistence/AtLeastOnceDeliverySpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/AtLeastOnceDeliverySpec.scala index 84759118f23..9753c9e08eb 100644 --- a/persistence/src/test/scala/org/apache/pekko/persistence/AtLeastOnceDeliverySpec.scala +++ b/persistence/src/test/scala/org/apache/pekko/persistence/AtLeastOnceDeliverySpec.scala @@ -257,7 +257,7 @@ class AtLeastOnceDeliverySpec "not allow using actorSelection with wildcards" in { system.actorOf(Props(classOf[DeliverToStarSelection], name)) ! "anything, really." - expectMsgType[Failure[?]].toString should include("not supported") + expectMsgType[Failure[_]].toString should include("not supported") } "re-deliver lost messages after restart" taggedAs TimingTest in { diff --git a/persistence/src/test/scala/org/apache/pekko/persistence/PersistentActorSpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/PersistentActorSpec.scala index 31f5a2238d2..75d666bbd74 100644 --- a/persistence/src/test/scala/org/apache/pekko/persistence/PersistentActorSpec.scala +++ b/persistence/src/test/scala/org/apache/pekko/persistence/PersistentActorSpec.scala @@ -217,7 +217,7 @@ object PersistentActorSpec { class SnapshottingPersistentActor(name: String, probe: ActorRef) extends ExamplePersistentActor(name) { override def receiveRecover = super.receiveRecover.orElse { - case SnapshotOffer(_, events: List[?]) => + case SnapshotOffer(_, events: List[_]) => probe ! "offered" this.events = events } diff --git a/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotRecoveryWithEmptyJournalSpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotRecoveryWithEmptyJournalSpec.scala index ec05eaf48d5..e45ffb2f04f 100644 --- a/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotRecoveryWithEmptyJournalSpec.scala +++ b/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotRecoveryWithEmptyJournalSpec.scala @@ -33,7 +33,7 @@ object SnapshotRecoveryWithEmptyJournalSpec { override def receiveRecover: Receive = { case payload: String => state = s"$payload-$lastSequenceNr" :: state - case SnapshotOffer(_, snapshot: List[?]) => state = snapshot.asInstanceOf[List[String]] + case SnapshotOffer(_, snapshot: List[_]) => state = snapshot.asInstanceOf[List[String]] } override def receiveCommand: PartialFunction[Any, Unit] = { diff --git a/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotSerializationSpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotSerializationSpec.scala index 4ce46493e4d..0a401cbb926 100644 --- a/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotSerializationSpec.scala +++ b/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotSerializationSpec.scala @@ -51,7 +51,7 @@ object SnapshotSerializationSpec { bStream.toByteArray } - def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = { + def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = { val bStream = new ByteArrayInputStream(bytes) val reader = new BufferedReader(new InputStreamReader(bStream)) new MySnapshot(reader.readLine()) diff --git a/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotSpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotSpec.scala index b1c40a3b755..c065eb141df 100644 --- a/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotSpec.scala +++ b/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotSpec.scala @@ -25,7 +25,7 @@ object SnapshotSpec { override def receiveRecover: Receive = { case payload: String => state = s"$payload-$lastSequenceNr" :: state - case SnapshotOffer(_, snapshot: List[?]) => state = snapshot.asInstanceOf[List[String]] + case SnapshotOffer(_, snapshot: List[_]) => state = snapshot.asInstanceOf[List[String]] } override def receiveCommand = { diff --git a/persistence/src/test/scala/org/apache/pekko/persistence/journal/AsyncWriteJournalResponseOrderSpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/journal/AsyncWriteJournalResponseOrderSpec.scala index 1b8097e003f..3f3537c0eec 100644 --- a/persistence/src/test/scala/org/apache/pekko/persistence/journal/AsyncWriteJournalResponseOrderSpec.scala +++ b/persistence/src/test/scala/org/apache/pekko/persistence/journal/AsyncWriteJournalResponseOrderSpec.scala @@ -17,12 +17,12 @@ package org.apache.pekko.persistence.journal +import org.apache.pekko.persistence.journal.AsyncWriteJournalResponseOrderSpec._ + import scala.collection.{ immutable, mutable } import scala.concurrent.{ ExecutionContext, Future, Promise } import scala.util.Try - import org.apache.pekko.persistence.{ AtomicWrite, JournalProtocol, PersistenceSpec, PersistentRepr } -import org.apache.pekko.persistence.journal.AsyncWriteJournalResponseOrderSpec._ import org.apache.pekko.testkit.ImplicitSender /** diff --git a/persistence/src/test/scala/org/apache/pekko/persistence/serialization/SnapshotSerializerMigrationAkkaSpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/serialization/SnapshotSerializerMigrationAkkaSpec.scala index 6a8b761435d..edc1e263a19 100644 --- a/persistence/src/test/scala/org/apache/pekko/persistence/serialization/SnapshotSerializerMigrationAkkaSpec.scala +++ b/persistence/src/test/scala/org/apache/pekko/persistence/serialization/SnapshotSerializerMigrationAkkaSpec.scala @@ -40,8 +40,8 @@ class SnapshotSerializerMigrationAkkaSpec extends PekkoSpec( val bytes = Base64.getDecoder.decode(akkaSnapshotData) val result = serialization.deserialize(bytes, classOf[Snapshot]).get val deserialized = result.data - deserialized shouldBe a[PersistentFSMSnapshot[?]] - val persistentFSMSnapshot = deserialized.asInstanceOf[PersistentFSMSnapshot[?]] + deserialized shouldBe a[PersistentFSMSnapshot[_]] + val persistentFSMSnapshot = deserialized.asInstanceOf[PersistentFSMSnapshot[_]] persistentFSMSnapshot shouldEqual fsmSnapshot } "deserialize pekko snapshots" in { @@ -49,8 +49,8 @@ class SnapshotSerializerMigrationAkkaSpec extends PekkoSpec( val bytes = serialization.serialize(Snapshot(fsmSnapshot)).get val result = serialization.deserialize(bytes, classOf[Snapshot]).get val deserialized = result.data - deserialized shouldBe a[PersistentFSMSnapshot[?]] - val persistentFSMSnapshot = deserialized.asInstanceOf[PersistentFSMSnapshot[?]] + deserialized shouldBe a[PersistentFSMSnapshot[_]] + val persistentFSMSnapshot = deserialized.asInstanceOf[PersistentFSMSnapshot[_]] persistentFSMSnapshot shouldEqual fsmSnapshot } "serialize snapshot with Akka class name" in { diff --git a/persistence/src/test/scala/org/apache/pekko/persistence/serialization/SnapshotSerializerNoMigrationSpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/serialization/SnapshotSerializerNoMigrationSpec.scala index 6ac992daabb..695e23e2213 100644 --- a/persistence/src/test/scala/org/apache/pekko/persistence/serialization/SnapshotSerializerNoMigrationSpec.scala +++ b/persistence/src/test/scala/org/apache/pekko/persistence/serialization/SnapshotSerializerNoMigrationSpec.scala @@ -37,8 +37,8 @@ class SnapshotSerializerNoMigrationSpec extends PekkoSpec( val bytes = serialization.serialize(Snapshot(fsmSnapshot)).get val result = serialization.deserialize(bytes, classOf[Snapshot]).get val deserialized = result.data - deserialized shouldBe a[PersistentFSMSnapshot[?]] - val persistentFSMSnapshot = deserialized.asInstanceOf[PersistentFSMSnapshot[?]] + deserialized shouldBe a[PersistentFSMSnapshot[_]] + val persistentFSMSnapshot = deserialized.asInstanceOf[PersistentFSMSnapshot[_]] persistentFSMSnapshot shouldEqual fsmSnapshot } "fail to deserialize akka snapshots" in { diff --git a/persistence/src/test/scala/org/apache/pekko/persistence/serialization/SnapshotSerializerSpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/serialization/SnapshotSerializerSpec.scala index 8d7726986e2..e8aaada8549 100644 --- a/persistence/src/test/scala/org/apache/pekko/persistence/serialization/SnapshotSerializerSpec.scala +++ b/persistence/src/test/scala/org/apache/pekko/persistence/serialization/SnapshotSerializerSpec.scala @@ -46,8 +46,8 @@ class SnapshotSerializerSpec extends PekkoSpec { val bytes = Base64.getDecoder.decode(akkaSnapshotData) val result = serialization.deserialize(bytes, classOf[Snapshot]).get val deserialized = result.data - deserialized shouldBe a[PersistentFSMSnapshot[?]] - val persistentFSMSnapshot = deserialized.asInstanceOf[PersistentFSMSnapshot[?]] + deserialized shouldBe a[PersistentFSMSnapshot[_]] + val persistentFSMSnapshot = deserialized.asInstanceOf[PersistentFSMSnapshot[_]] persistentFSMSnapshot shouldEqual fsmSnapshot } "deserialize pekko snapshots" in { @@ -55,8 +55,8 @@ class SnapshotSerializerSpec extends PekkoSpec { val bytes = serialization.serialize(Snapshot(fsmSnapshot)).get val result = serialization.deserialize(bytes, classOf[Snapshot]).get val deserialized = result.data - deserialized shouldBe a[PersistentFSMSnapshot[?]] - val persistentFSMSnapshot = deserialized.asInstanceOf[PersistentFSMSnapshot[?]] + deserialized shouldBe a[PersistentFSMSnapshot[_]] + val persistentFSMSnapshot = deserialized.asInstanceOf[PersistentFSMSnapshot[_]] persistentFSMSnapshot shouldEqual fsmSnapshot } "deserialize pre-saved pekko snapshots" in { @@ -67,8 +67,8 @@ class SnapshotSerializerSpec extends PekkoSpec { val bytes = Base64.getDecoder.decode(pekkoSnapshotData) val result = serialization.deserialize(bytes, classOf[Snapshot]).get val deserialized = result.data - deserialized shouldBe a[PersistentFSMSnapshot[?]] - val persistentFSMSnapshot = deserialized.asInstanceOf[PersistentFSMSnapshot[?]] + deserialized shouldBe a[PersistentFSMSnapshot[_]] + val persistentFSMSnapshot = deserialized.asInstanceOf[PersistentFSMSnapshot[_]] persistentFSMSnapshot shouldEqual fsmSnapshot } "produce binary format with header length in first 4 bytes (little-endian)" in { diff --git a/persistence/src/test/scala/org/apache/pekko/persistence/state/exception/DurableStateExceptionsSpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/state/exception/DurableStateExceptionsSpec.scala index 1a37d0c4744..bac0b475a98 100644 --- a/persistence/src/test/scala/org/apache/pekko/persistence/state/exception/DurableStateExceptionsSpec.scala +++ b/persistence/src/test/scala/org/apache/pekko/persistence/state/exception/DurableStateExceptionsSpec.scala @@ -39,7 +39,7 @@ class DurableStateExceptionsSpec extends AnyWordSpecLike "DurableStateException support" must { "allow creating DeleteRevisionException using MethodHandle" in { - val exceptionClassOpt: Option[Class[?]] = Try(Class.forName( + val exceptionClassOpt: Option[Class[_]] = Try(Class.forName( "org.apache.pekko.persistence.state.exception.DeleteRevisionException")).toOption exceptionClassOpt should not be empty val constructorOpt = exceptionClassOpt.map { clz => diff --git a/project/AddLogTimestamps.scala b/project/AddLogTimestamps.scala index ace4ea9d204..4a0269e3801 100644 --- a/project/AddLogTimestamps.scala +++ b/project/AddLogTimestamps.scala @@ -28,7 +28,7 @@ object AddLogTimestamps extends AutoPlugin { private val UTC = ZoneId.of("UTC") - override lazy val projectSettings: Seq[Def.Setting[?]] = { + override lazy val projectSettings: Seq[Def.Setting[_]] = { logManager := { val original = logManager.value diff --git a/project/CopyrightHeaderForBoilerplate.scala b/project/CopyrightHeaderForBoilerplate.scala index 3e91671e706..e162a945fdb 100644 --- a/project/CopyrightHeaderForBoilerplate.scala +++ b/project/CopyrightHeaderForBoilerplate.scala @@ -21,7 +21,7 @@ object CopyrightHeaderForBoilerplate extends AutoPlugin { override lazy val requires: Plugins = BoilerplatePlugin && CopyrightHeader override lazy val trigger: PluginTrigger = allRequirements - override lazy val projectSettings: Seq[Def.Setting[?]] = { + override lazy val projectSettings: Seq[Def.Setting[_]] = { Seq(Compile, Test).flatMap { config => inConfig(config) { Seq( diff --git a/project/CopyrightHeaderForBuild.scala b/project/CopyrightHeaderForBuild.scala index 2ab945e1429..ce92ad5bb64 100644 --- a/project/CopyrightHeaderForBuild.scala +++ b/project/CopyrightHeaderForBuild.scala @@ -20,7 +20,7 @@ object CopyrightHeaderForBuild extends AutoPlugin { override lazy val requires: Plugins = CopyrightHeader override lazy val trigger: PluginTrigger = noTrigger - override lazy val projectSettings: Seq[Def.Setting[?]] = { + override lazy val projectSettings: Seq[Def.Setting[_]] = { Seq(Compile, Test).flatMap { config => inConfig(config) { Seq( diff --git a/project/CopyrightHeaderForJdk21.scala b/project/CopyrightHeaderForJdk9.scala similarity index 82% rename from project/CopyrightHeaderForJdk21.scala rename to project/CopyrightHeaderForJdk9.scala index a104693f513..726ad48951e 100644 --- a/project/CopyrightHeaderForJdk21.scala +++ b/project/CopyrightHeaderForJdk9.scala @@ -14,13 +14,13 @@ import sbtheader.HeaderPlugin.autoImport.headerSources import sbt.{ Compile, Def, Test, _ } -object CopyrightHeaderForJdk21 extends AutoPlugin { +object CopyrightHeaderForJdk9 extends AutoPlugin { - override lazy val requires = CopyrightHeader && Jdk21 + override lazy val requires = CopyrightHeader && Jdk9 override lazy val trigger = allRequirements private lazy val additionalFiles = Def.setting { - import Jdk21._ + import Jdk9._ for { dir <- additionalSourceDirectories.value ++ additionalTestSourceDirectories.value language <- List("java", "scala") @@ -28,7 +28,7 @@ object CopyrightHeaderForJdk21 extends AutoPlugin { } yield file } - override lazy val projectSettings: Seq[Def.Setting[?]] = { + override lazy val projectSettings: Seq[Def.Setting[_]] = { Seq(Compile / headerSources ++= additionalFiles.value, Test / headerSources ++= additionalFiles.value) diff --git a/project/CopyrightHeaderForProtobuf.scala b/project/CopyrightHeaderForProtobuf.scala index f18723a60b7..8e302637519 100644 --- a/project/CopyrightHeaderForProtobuf.scala +++ b/project/CopyrightHeaderForProtobuf.scala @@ -21,7 +21,7 @@ object CopyrightHeaderForProtobuf extends AutoPlugin { override lazy val requires = CopyrightHeader override lazy val trigger = allRequirements - override lazy val projectSettings: Seq[Def.Setting[?]] = { + override lazy val projectSettings: Seq[Def.Setting[_]] = { Seq(Compile, Test).flatMap { config => inConfig(config) { Seq( diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 68673d2f446..8b881ecf140 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -22,28 +22,28 @@ object Dependencies { // https://protobuf.dev/support/version-support/ // The protoc version can be inferred from the Protobuf Java minor version number. // Example: Protobuf Java version 3.25.x uses protoc version 25.x. - val protobufJavaVersion = "4.35.1" - val protocVersion = "35.0" + val protobufJavaVersion = "4.35.0" + val protocVersion = "34.1" } val junitVersion = "4.13.2" val junit6Version = "6.1.0" val slf4jVersion = "2.0.18" // also update agrona version when updating aeron: - val aeronVersion = "1.51.0" + val aeronVersion = "1.50.4" // Use the major+minor agrona versions matching aeron at // https://github.com/aeron-io/aeron/blob/1.x.y/gradle/libs.versions.toml // (remember to also update the scala-steward pin) val agronaVersion = "2.4.1" - val nettyVersion = "4.2.15.Final" - val logbackVersion = "1.5.34" + val nettyVersion = "4.2.14.Final" + val logbackVersion = "1.5.33" val jacksonAnnotationsVersion = "2.21" - val jacksonVersion2 = "2.22.0" - val jacksonVersion3 = "3.2.0" + val jacksonVersion2 = "2.21.4" + val jacksonVersion3 = "3.1.4" val scala213Version = "2.13.18" - val scala3Version = "3.3.8" + val scala3Version = "3.3.7" val allScalaVersions = Seq(scala213Version, scala3Version) val reactiveStreamsVersion = "1.0.4" @@ -57,7 +57,7 @@ object Dependencies { object Compile { // Compile - val config = "com.typesafe" % "config" % "1.4.9" + val config = "com.typesafe" % "config" % "1.4.8" val `netty-transport` = "io.netty" % "netty-transport" % nettyVersion val `netty-handler` = "io.netty" % "netty-handler" % nettyVersion @@ -142,7 +142,7 @@ object Dependencies { val pojosr = "com.googlecode.pojosr" % "de.kalpatec.pojosr.framework" % "0.2.1" % Test val tinybundles = "org.ops4j.pax.tinybundles" % "tinybundles" % "4.0.1" % Test - val bndlib = "biz.aQute.bnd" % "biz.aQute.bndlib" % "7.3.0" % Test + val bndlib = "biz.aQute.bnd" % "biz.aQute.bndlib" % "7.2.3" % Test val `pax-exam` = "org.ops4j.pax.exam" % "pax-exam" % "4.14.0" % Test val `pax-exam-cm` = "org.ops4j.pax.exam" % "pax-exam-cm" % "4.14.0" % Test val `pax-exam-container-forked` = "org.ops4j.pax.exam" % "pax-exam-container-forked" % "4.14.0" % Test diff --git a/project/JavaFormatter.scala b/project/JavaFormatter.scala index f48d36e2203..f842266dee6 100644 --- a/project/JavaFormatter.scala +++ b/project/JavaFormatter.scala @@ -28,7 +28,7 @@ object JavaFormatter extends AutoPlugin { import sbt._ import sbt.io._ - override lazy val projectSettings: Seq[Def.Setting[?]] = + override lazy val projectSettings: Seq[Def.Setting[_]] = Seq( // below is for sbt java formatter javafmt / excludeFilter := { diff --git a/project/Jdk21.scala b/project/Jdk9.scala similarity index 63% rename from project/Jdk21.scala rename to project/Jdk9.scala index e6cafa0f3df..12275d13bc6 100644 --- a/project/Jdk21.scala +++ b/project/Jdk9.scala @@ -14,14 +14,15 @@ import sbt.Keys._ import sbt._ -object Jdk21 extends AutoPlugin { +object Jdk9 extends AutoPlugin { import JdkOptions.JavaVersion._ + // The version 21 is special for any Java versions >= 21 private val supportedJavaLTSVersions = List("21") - lazy val CompileJdk21 = config("CompileJdk21").extend(Compile) + lazy val CompileJdk9 = config("CompileJdk9").extend(Compile) - lazy val TestJdk21 = config("TestJdk21").extend(Test).extend(CompileJdk21) + lazy val TestJdk9 = config("TestJdk9").extend(Test).extend(CompileJdk9) lazy val ScalaSourceDirectories: Seq[String] = getAdditionalSourceDirectoryNames("scala") lazy val ScalaTestSourceDirectories: Seq[String] = getAdditionalSourceDirectoryNames("scala", isTest = true) @@ -52,34 +53,43 @@ object Jdk21 extends AutoPlugin { yield (task / sourceDirectory).value / sourceDirectoryName } - lazy val compileJdk21Settings = Seq( + lazy val compileJdk9Settings = Seq( + // following the scala-2.12, scala-sbt-1.0, ... convention unmanagedSourceDirectories := additionalSourceDirectories.value, scalacOptions := PekkoBuild.DefaultScalacOptions.value ++ Seq("-release", majorVersion.toString), javacOptions := PekkoBuild.DefaultJavacOptions ++ Seq("--release", majorVersion.toString)) - lazy val testJdk21Settings = Seq( + lazy val testJdk9Settings = Seq( + // following the scala-2.12, scala-sbt-1.0, ... convention unmanagedSourceDirectories := additionalTestSourceDirectories.value, scalacOptions := PekkoBuild.DefaultScalacOptions.value ++ Seq("-release", majorVersion.toString), javacOptions := PekkoBuild.DefaultJavacOptions ++ Seq("--release", majorVersion.toString), - compile := compile.dependsOn(CompileJdk21 / compile).value, - classpathConfiguration := TestJdk21, + compile := compile.dependsOn(CompileJdk9 / compile).value, + classpathConfiguration := TestJdk9, externalDependencyClasspath := (Test / externalDependencyClasspath).value) lazy val compileSettings = Seq( - Compile / dependencyClasspathAsJars ++= (CompileJdk21 / exportedProducts).value) + // It might have been more 'neat' to add the jdk9 products to the jar via packageBin/mappings, but that doesn't work with the OSGi plugin, + // so we add them to the fullClasspath instead. + // Compile / packageBin / mappings + // ++= (CompileJdk9 / products).value.flatMap(Path.allSubpaths), + // Since sbt-osgi upgrade to 0.9.5, the fullClasspath is no longer used on packaging when use sbt-osgi, so we have to + // add jdk9 products to dependencyClasspathAsJars instead. + // Compile / fullClasspath ++= (CompileJdk9 / exportedProducts).value) + Compile / dependencyClasspathAsJars ++= (CompileJdk9 / exportedProducts).value) lazy val testSettings = Seq((Test / test) := { (Test / test).value - (TestJdk21 / test).value + (TestJdk9 / test).value }) override lazy val trigger = noTrigger - override lazy val projectConfigurations = Seq(CompileJdk21) + override lazy val projectConfigurations = Seq(CompileJdk9) override lazy val projectSettings = - inConfig(CompileJdk21)(Defaults.compileSettings) ++ - inConfig(CompileJdk21)(compileJdk21Settings) ++ + inConfig(CompileJdk9)(Defaults.compileSettings) ++ + inConfig(CompileJdk9)(compileJdk9Settings) ++ compileSettings ++ - inConfig(TestJdk21)(Defaults.testSettings) ++ - inConfig(TestJdk21)(testJdk21Settings) ++ + inConfig(TestJdk9)(Defaults.testSettings) ++ + inConfig(TestJdk9)(testJdk9Settings) ++ testSettings } diff --git a/project/MultiNode.scala b/project/MultiNode.scala index 61d73d87bdb..00214872866 100644 --- a/project/MultiNode.scala +++ b/project/MultiNode.scala @@ -49,7 +49,7 @@ object MultiNode extends AutoPlugin { override lazy val trigger = noTrigger override lazy val requires = plugins.JvmPlugin && MultiJvmPlugin - override lazy val projectSettings: Seq[Def.Setting[?]] = multiJvmSettings + override lazy val projectSettings: Seq[Def.Setting[_]] = multiJvmSettings private lazy val defaultMultiJvmOptions: Seq[String] = { import scala.jdk.CollectionConverters._ diff --git a/project/PekkoBuild.scala b/project/PekkoBuild.scala index 887a7fda1e7..bff7ab34bf3 100644 --- a/project/PekkoBuild.scala +++ b/project/PekkoBuild.scala @@ -97,8 +97,7 @@ object PekkoBuild { "-feature", "-unchecked", // 'blessed' since 2.13.1 - "-language:higherKinds", - "-Yfuture-lazy-vals") + "-language:higherKinds") } else { Seq( "-encoding", @@ -115,7 +114,7 @@ object PekkoBuild { final val DefaultJavacOptions = Seq("-encoding", "UTF-8", "-Xlint:unchecked") - lazy val defaultSettings: Seq[Setting[?]] = Def.settings( + lazy val defaultSettings: Seq[Setting[_]] = Def.settings( projectInfoVersion := (if (isSnapshot.value) "snapshot" else version.value), Dependencies.Versions, resolverSettings, @@ -255,7 +254,7 @@ object PekkoBuild { } }) - lazy val welcomeSettings: Seq[Setting[?]] = Def.settings { + lazy val welcomeSettings: Seq[Setting[_]] = Def.settings { import sbtwelcome._ Seq( logo := { @@ -276,7 +275,7 @@ object PekkoBuild { UsefulTask("testQuick", "Runs all the tests. When run multiple times will only run previously failing tests (shell mode only)"), UsefulTask("testOnly *.AnySpec", "Only run a selected test"), - UsefulTask("TestJdk21 / testOnly *.AnySpec", "Only run a Jdk21+ selected test"), + UsefulTask("TestJdk9 / testOnly *.AnySpec", "Only run a Jdk9+ selected test"), UsefulTask("testQuick *.AnySpec", "Only run a selected test. When run multiple times will only run previously failing tests (shell mode only)"), UsefulTask("testQuickUntilPassed", "Runs all tests in a continuous loop until all tests pass"), diff --git a/project/PekkoDevelocityPlugin.scala b/project/PekkoDevelocityPlugin.scala index 4c257f02512..01a0602847e 100644 --- a/project/PekkoDevelocityPlugin.scala +++ b/project/PekkoDevelocityPlugin.scala @@ -34,7 +34,7 @@ object PekkoDevelocityPlugin extends AutoPlugin { override lazy val trigger: PluginTrigger = allRequirements override lazy val requires: Plugins = DevelocityPlugin - override lazy val buildSettings: Seq[Setting[?]] = Def.settings( + override lazy val buildSettings: Seq[Setting[_]] = Def.settings( develocityConfiguration := { val isInsideCI = insideCI.value @@ -70,12 +70,12 @@ object PekkoDevelocityPlugin extends AutoPlugin { } /** - * An AutoPlugin to add Develocity test configuration to the TestJdk21 configuration. + * An AutoPlugin to add Develocity test configuration to the TestJdk9 configuration. */ -object PekkoDevelocityJdk21TestSettingsPlugin extends AutoPlugin { +object PekkoDevelocityJdk9TestSettingsPlugin extends AutoPlugin { override lazy val trigger: PluginTrigger = allRequirements - override lazy val requires: Plugins = DevelocityPlugin && Jdk21 + override lazy val requires: Plugins = DevelocityPlugin && Jdk9 // See https://docs.gradle.com/develocity/sbt-plugin/#enabling_build_cache_in_a_custom_sbt_configuration - override lazy val projectSettings = DevelocityPlugin.develocitySettings(Jdk21.TestJdk21) + override lazy val projectSettings = DevelocityPlugin.develocitySettings(Jdk9.TestJdk9) } diff --git a/project/ProjectFileIgnoreSupport.scala b/project/ProjectFileIgnoreSupport.scala index 0388b9844a2..641135f9b2c 100644 --- a/project/ProjectFileIgnoreSupport.scala +++ b/project/ProjectFileIgnoreSupport.scala @@ -19,9 +19,9 @@ import sbt.ConsoleLogger class ProjectFileIgnoreSupport(ignoreConfigFile: File, descriptor: String) { private lazy val stdoutLogger = ConsoleLogger(System.out) - private val javaSourceDirectories = Set("java") ++ Jdk21.JavaSourceDirectories ++ Jdk21.JavaTestSourceDirectories + private val javaSourceDirectories = Set("java") ++ Jdk9.JavaSourceDirectories ++ Jdk9.JavaTestSourceDirectories - private val scalaSourceDirectories = Set("scala") ++ Jdk21.ScalaSourceDirectories ++ Jdk21.ScalaTestSourceDirectories + private val scalaSourceDirectories = Set("scala") ++ Jdk9.ScalaSourceDirectories ++ Jdk9.ScalaTestSourceDirectories private lazy val ignoreConfig = { require( diff --git a/project/Protobuf.scala b/project/Protobuf.scala index d74994468a6..0028f249033 100644 --- a/project/Protobuf.scala +++ b/project/Protobuf.scala @@ -33,7 +33,7 @@ object Protobuf { lazy val protocVersion = SettingKey[String]("protobuf-protoc-version", "The version of the protoc executable.") lazy val protobufGenerate = TaskKey[Unit]("protobufGenerate", "Compile the protobuf sources and do all processing.") - lazy val settings: Seq[Setting[?]] = Seq( + lazy val settings: Seq[Setting[_]] = Seq( paths := Seq((Compile / sourceDirectory).value, (Test / sourceDirectory).value).map(_ / "protobuf"), outputPaths := Seq((Compile / sourceDirectory).value, (Test / sourceDirectory).value).map(_ / "java"), importPath := None, diff --git a/project/SbtMultiJvmPlugin.scala b/project/SbtMultiJvmPlugin.scala index 01c484f9865..c07b27ac99f 100644 --- a/project/SbtMultiJvmPlugin.scala +++ b/project/SbtMultiJvmPlugin.scala @@ -84,10 +84,10 @@ object MultiJvmPlugin extends AutoPlugin { override lazy val projectSettings = multiJvmSettings - private[this] def noTestsMessage(scoped: ScopedKey[?])(implicit display: Show[ScopedKey[?]]): String = + private[this] def noTestsMessage(scoped: ScopedKey[_])(implicit display: Show[ScopedKey[_]]): String = "No tests to run for " + display.show(scoped) - lazy val multiJvmSettings: Seq[Def.Setting[?]] = + lazy val multiJvmSettings: Seq[Def.Setting[_]] = inConfig(MultiJvm)(Defaults.configSettings ++ internalMultiJvmSettings) // https://github.com/sbt/sbt/blob/v0.13.15/main/actions/src/main/scala/sbt/Tests.scala#L296-L298 diff --git a/project/ScalaFixExtraRulesPlugin.scala b/project/ScalaFixExtraRulesPlugin.scala index a2bb844d596..a87a2aa8120 100644 --- a/project/ScalaFixExtraRulesPlugin.scala +++ b/project/ScalaFixExtraRulesPlugin.scala @@ -21,7 +21,7 @@ object ScalaFixExtraRulesPlugin extends AutoPlugin with ScalafixSupport { import sbt._ import scalafix.sbt.ScalafixPlugin.autoImport.scalafixDependencies - override lazy val projectSettings: Seq[Def.Setting[?]] = super.projectSettings ++ { + override lazy val projectSettings: Seq[Def.Setting[_]] = super.projectSettings ++ { ThisBuild / scalafixDependencies ++= Seq( "com.nequissimus" %% "sort-imports" % "0.6.1") } diff --git a/project/ScalaFixForJdk21Plugin.scala b/project/ScalaFixForJdk9Plugin.scala similarity index 70% rename from project/ScalaFixForJdk21Plugin.scala rename to project/ScalaFixForJdk9Plugin.scala index 53408377af8..b0dfa05e1b4 100644 --- a/project/ScalaFixForJdk21Plugin.scala +++ b/project/ScalaFixForJdk9Plugin.scala @@ -14,18 +14,18 @@ import sbt.{ AutoPlugin, PluginTrigger, Plugins } import scalafix.sbt.ScalafixPlugin -object ScalaFixForJdk21Plugin extends AutoPlugin with ScalafixSupport { +object ScalaFixForJdk9Plugin extends AutoPlugin with ScalafixSupport { override lazy val trigger: PluginTrigger = allRequirements - import Jdk21._ - override lazy val requires: Plugins = Jdk21 && ScalafixPlugin + import Jdk9._ + override lazy val requires: Plugins = Jdk9 && ScalafixPlugin import ScalafixPlugin.autoImport.scalafixConfigSettings import sbt._ - lazy val scalafixIgnoredSetting: Seq[Setting[?]] = Seq(ignore(TestJdk21)) + lazy val scalafixIgnoredSetting: Seq[Setting[_]] = Seq(ignore(TestJdk9)) - override lazy val projectSettings: Seq[Def.Setting[?]] = - Seq(CompileJdk21, TestJdk21).flatMap(c => inConfig(c)(scalafixConfigSettings(c))) ++ + override lazy val projectSettings: Seq[Def.Setting[_]] = + Seq(CompileJdk9, TestJdk9).flatMap(c => inConfig(c)(scalafixConfigSettings(c))) ++ scalafixIgnoredSetting ++ Seq( updateProjectCommands( alias = "fixall", diff --git a/project/ScalafixForMultiNodePlugin.scala b/project/ScalafixForMultiNodePlugin.scala index 1ba402d636e..97fc92753d1 100644 --- a/project/ScalafixForMultiNodePlugin.scala +++ b/project/ScalafixForMultiNodePlugin.scala @@ -22,9 +22,9 @@ object ScalafixForMultiNodePlugin extends AutoPlugin with ScalafixSupport { import MultiJvmPlugin.autoImport._ - lazy val scalafixIgnoredSetting: Seq[Setting[?]] = Seq(ignore(MultiJvm)) + lazy val scalafixIgnoredSetting: Seq[Setting[_]] = Seq(ignore(MultiJvm)) - override lazy val projectSettings: Seq[Def.Setting[?]] = + override lazy val projectSettings: Seq[Def.Setting[_]] = Seq(MultiJvm).flatMap(c => inConfig(c)(scalafixConfigSettings(c))) ++ scalafixIgnoredSetting ++ Seq( updateProjectCommands(alias = "fixall", value = ";scalafixEnable;scalafixAll;scalafmtAll"), diff --git a/project/ScalafixIgnoreFilePlugin.scala b/project/ScalafixIgnoreFilePlugin.scala index bd11b27b5f6..2e404cdad0f 100644 --- a/project/ScalafixIgnoreFilePlugin.scala +++ b/project/ScalafixIgnoreFilePlugin.scala @@ -20,9 +20,9 @@ object ScalafixIgnoreFilePlugin extends AutoPlugin with ScalafixSupport { override lazy val requires: Plugins = JvmPlugin && ScalafixPlugin import sbt._ - lazy val scalafixIgnoredSetting: Seq[Setting[?]] = if (ScalafixSupport.fixTestScope) Nil else Seq(ignore(Test)) + lazy val scalafixIgnoredSetting: Seq[Setting[_]] = if (ScalafixSupport.fixTestScope) Nil else Seq(ignore(Test)) - override lazy val projectSettings: Seq[Def.Setting[?]] = + override lazy val projectSettings: Seq[Def.Setting[_]] = scalafixIgnoredSetting ++ Seq( addProjectCommandsIfAbsent(alias = "fixall", value = ";scalafixEnable;scalafixAll;test:compile;reload")) } diff --git a/project/StreamOperatorsIndexGenerator.scala b/project/StreamOperatorsIndexGenerator.scala index 1dcce006985..4da0cf2b3ce 100644 --- a/project/StreamOperatorsIndexGenerator.scala +++ b/project/StreamOperatorsIndexGenerator.scala @@ -21,7 +21,7 @@ import scala.util.control.NonFatal */ object StreamOperatorsIndexGenerator extends AutoPlugin { - override val projectSettings: Seq[Setting[?]] = inConfig(Compile)( + override val projectSettings: Seq[Setting[_]] = inConfig(Compile)( Seq( resourceGenerators += generateAlphabeticalIndex(sourceDirectory, _ / "paradox" / "stream" / "operators" / "index.md"))) diff --git a/project/TestExtras.scala b/project/TestExtras.scala index ca17497cdf1..c53ed776ca8 100644 --- a/project/TestExtras.scala +++ b/project/TestExtras.scala @@ -63,13 +63,15 @@ object TestExtras { val baseList = List( "The java JavaExtension.java" -> - "actor-tests/target/test-reports/TEST-org.apache.pekko.actor.JavaExtension.xml", - "FlowPublisherSinkSpec.scala" -> - "stream-tests/target/test-reports/TEST-org.apache.pekko.stream.scaladsl.FlowPublisherSinkSpec.xml", - "JavaFlowSupportCompileTest.java" -> - "stream-tests/target/test-reports/TEST-org.apache.pekko.stream.javadsl.JavaFlowSupportCompileTest.xml") + "actor-tests/target/test-reports/TEST-org.apache.pekko.actor.JavaExtension.xml") + val jdk9Only = List( + "The jdk9-only FlowPublisherSinkSpec.scala" -> + "stream-tests/target/test-reports/TEST-org.apache.pekko.stream.scaladsl.FlowPublisherSinkSpec.xml", + "The jdk9-only JavaFlowSupportCompileTest.java" -> + "stream-tests/target/test-reports/TEST-org.apache.pekko.stream.javadsl.JavaFlowSupportCompileTest.xml") - val testsToCheck = baseList + val testsToCheck = + baseList ::: jdk9Only testsToCheck.foreach((shouldExist _).tupled) }) diff --git a/project/ValidatePullRequest.scala b/project/ValidatePullRequest.scala index 246e98b6f3d..39321729492 100644 --- a/project/ValidatePullRequest.scala +++ b/project/ValidatePullRequest.scala @@ -36,7 +36,7 @@ object PekkoValidatePullRequest extends AutoPlugin { override lazy val projectConfigurations = Seq(ValidatePR) - lazy val additionalTasks = settingKey[Seq[TaskKey[?]]]("Additional tasks for pull request validation") + lazy val additionalTasks = settingKey[Seq[TaskKey[_]]]("Additional tasks for pull request validation") override lazy val globalSettings = Seq(credentials ++= { // todo this should probably be supplied properly diff --git a/project/VersionGenerator.scala b/project/VersionGenerator.scala index af60d14669c..7b5d2073d36 100644 --- a/project/VersionGenerator.scala +++ b/project/VersionGenerator.scala @@ -19,7 +19,7 @@ import sbt.Keys._ */ object VersionGenerator { - lazy val settings: Seq[Setting[?]] = inConfig(Compile)( + lazy val settings: Seq[Setting[_]] = inConfig(Compile)( Seq( resourceGenerators += generateVersion( resourceManaged, _ / "version.conf", diff --git a/project/build.properties b/project/build.properties index 12583871e05..b844dc5ca42 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1,2 +1,2 @@ -sbt.version=1.12.12 +sbt.version=1.12.11 diff --git a/project/plugins.sbt b/project/plugins.sbt index 4fbd04fd9b7..0fd782c7910 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -9,15 +9,15 @@ addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.2.0") -addSbtPlugin("com.github.sbt" % "sbt-java-formatter" % "0.12.0") +addSbtPlugin("com.github.sbt" % "sbt-java-formatter" % "0.11.0") addSbtPlugin("com.github.sbt.junit" % "sbt-jupiter-interface" % "0.19.0") addSbtPlugin("com.lightbend.sbt" % "sbt-bill-of-materials" % "1.0.2") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.6.1") -addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.14.7") +addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.14.6") addSbtPlugin("com.github.sbt" % "sbt-osgi" % "0.10.0") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.5") addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.6.1") -addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings" % "3.0.3") +addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings" % "3.0.2") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.8") addSbtPlugin("com.github.sbt" % "sbt-boilerplate" % "0.8.0") diff --git a/remote-tests/src/test/java/org/apache/pekko/remote/artery/protobuf/TestMessages.java b/remote-tests/src/test/java/org/apache/pekko/remote/artery/protobuf/TestMessages.java index 9020ee85ba4..5f0ff1ff6e3 100644 --- a/remote-tests/src/test/java/org/apache/pekko/remote/artery/protobuf/TestMessages.java +++ b/remote-tests/src/test/java/org/apache/pekko/remote/artery/protobuf/TestMessages.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: TestMessages.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package org.apache.pekko.remote.artery.protobuf; @@ -25,8 +25,8 @@ private TestMessages() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "TestMessages"); } @@ -146,8 +146,8 @@ public static final class TestMessage extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "TestMessage"); } @@ -429,8 +429,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeUInt64Size(1, id_); @@ -458,15 +463,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -1526,8 +1522,8 @@ public static final class Item extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Item"); } @@ -1656,8 +1652,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeUInt64Size(1, id_); @@ -1665,15 +1666,6 @@ private int computeSerializedSize_0() { if (((bitField0_ & 0x00000002) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(2, name_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/remote/src/main/java/org/apache/pekko/remote/ArteryControlFormats.java b/remote/src/main/java/org/apache/pekko/remote/ArteryControlFormats.java index 5d380485db3..e72f8b0f308 100644 --- a/remote/src/main/java/org/apache/pekko/remote/ArteryControlFormats.java +++ b/remote/src/main/java/org/apache/pekko/remote/ArteryControlFormats.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: ArteryControlFormats.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package org.apache.pekko.remote; @@ -25,8 +25,8 @@ private ArteryControlFormats() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ArteryControlFormats"); } @@ -85,8 +85,8 @@ public static final class Quarantined extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Quarantined"); } @@ -206,8 +206,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getFrom()); @@ -216,15 +221,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getTo()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -885,8 +881,8 @@ public static final class MessageWithAddress extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "MessageWithAddress"); } @@ -969,21 +965,17 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream - .computeMessageSize(1, getAddress()); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream + .computeMessageSize(1, getAddress()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -1501,8 +1493,8 @@ public static final class HandshakeReq extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "HandshakeReq"); } @@ -1622,8 +1614,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getFrom()); @@ -1632,15 +1629,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getTo()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2386,8 +2374,8 @@ public static final class CompressionTableAdvertisement extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "CompressionTableAdvertisement"); } @@ -2621,8 +2609,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getFrom()); @@ -2652,15 +2645,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getValuesList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -3621,8 +3605,8 @@ public static final class CompressionTableAdvertisementAck extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "CompressionTableAdvertisementAck"); } @@ -3731,8 +3715,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getFrom()); @@ -3741,15 +3730,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeUInt32Size(2, version_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -4362,8 +4342,8 @@ public static final class SystemMessageEnvelope extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "SystemMessageEnvelope"); } @@ -4548,8 +4528,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(1, message_); @@ -4570,15 +4555,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(5, getAckReplyTo()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -5351,8 +5327,8 @@ public static final class SystemMessageDeliveryAck extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "SystemMessageDeliveryAck"); } @@ -5461,8 +5437,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeUInt64Size(1, seqNo_); @@ -5471,15 +5452,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getFrom()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -6097,8 +6069,8 @@ public static final class Address extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Address"); } @@ -6341,8 +6313,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, protocol_); } @@ -6356,15 +6333,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeUInt32Size(4, port_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -7103,8 +7071,8 @@ public static final class UniqueAddress extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "UniqueAddress"); } @@ -7213,8 +7181,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getAddress()); @@ -7223,15 +7196,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeUInt64Size(2, uid_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -7798,8 +7762,8 @@ public static final class ArteryHeartbeatRsp extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ArteryHeartbeatRsp"); } @@ -7871,21 +7835,17 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream - .computeUInt64Size(1, uid_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream + .computeUInt64Size(1, uid_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -8284,8 +8244,8 @@ public static final class FlushAck extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "FlushAck"); } @@ -8353,21 +8313,17 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream - .computeInt32Size(1, expectedAcks_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream + .computeInt32Size(1, expectedAcks_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/remote/src/main/java/org/apache/pekko/remote/ContainerFormats.java b/remote/src/main/java/org/apache/pekko/remote/ContainerFormats.java index 3be129c2273..b2e28b4be3c 100644 --- a/remote/src/main/java/org/apache/pekko/remote/ContainerFormats.java +++ b/remote/src/main/java/org/apache/pekko/remote/ContainerFormats.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: ContainerFormats.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package org.apache.pekko.remote; @@ -25,8 +25,8 @@ private ContainerFormats() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ContainerFormats"); } @@ -62,8 +62,8 @@ public enum PatternType org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "PatternType"); } @@ -245,8 +245,8 @@ public static final class SelectionEnvelope extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "SelectionEnvelope"); } @@ -449,8 +449,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(1, enclosedMessage_); @@ -476,15 +481,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBoolSize(5, wildcardFanOut_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -1410,8 +1406,8 @@ public static final class Selection extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Selection"); } @@ -1536,8 +1532,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeEnumSize(1, type_); @@ -1545,15 +1546,6 @@ private int computeSerializedSize_0() { if (((bitField0_ & 0x00000002) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(2, matcher_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2060,8 +2052,8 @@ public static final class Identify extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Identify"); } @@ -2144,21 +2136,17 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream - .computeMessageSize(1, getMessageId()); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream + .computeMessageSize(1, getMessageId()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2668,8 +2656,8 @@ public static final class ActorIdentity extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ActorIdentity"); } @@ -2787,8 +2775,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getCorrelationId()); @@ -2797,15 +2790,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getRef()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -3459,8 +3443,8 @@ public static final class ActorRef extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ActorRef"); } @@ -3563,20 +3547,16 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, path_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, path_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -4015,8 +3995,8 @@ public static final class Option extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Option"); } @@ -4097,21 +4077,17 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream - .computeMessageSize(1, getValue()); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream + .computeMessageSize(1, getValue()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -4623,8 +4599,8 @@ public static final class Payload extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Payload"); } @@ -4746,8 +4722,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(1, enclosedMessage_); @@ -4760,15 +4741,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(4, messageManifest_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -5288,8 +5260,8 @@ public static final class WatcherHeartbeatResponse extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "WatcherHeartbeatResponse"); } @@ -5361,21 +5333,17 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream - .computeUInt64Size(1, uid_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream + .computeUInt64Size(1, uid_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -5831,8 +5799,8 @@ public static final class Throwable extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Throwable"); } @@ -6074,8 +6042,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, className_); } @@ -6095,15 +6068,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -7155,8 +7119,8 @@ public static final class ThrowableNotSerializable extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ThrowableNotSerializable"); } @@ -7373,8 +7337,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, message_); } @@ -7384,15 +7353,6 @@ private int computeSerializedSize_0() { if (((bitField0_ & 0x00000004) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(3, originalClassName_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -8077,8 +8037,8 @@ public static final class ActorInitializationException extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ActorInitializationException"); } @@ -8253,8 +8213,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getActor()); @@ -8266,15 +8231,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(3, getCause()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -9080,8 +9036,8 @@ public static final class StackTraceElement extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "StackTraceElement"); } @@ -9324,8 +9280,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, className_); } @@ -9339,15 +9300,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt32Size(4, lineNumber_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -10071,8 +10023,8 @@ public static final class StatusReplyErrorMessage extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "StatusReplyErrorMessage"); } @@ -10175,20 +10127,16 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, errorMessage_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, errorMessage_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/remote/src/main/java/org/apache/pekko/remote/SystemMessageFormats.java b/remote/src/main/java/org/apache/pekko/remote/SystemMessageFormats.java index cea426bef4a..8d47cabe269 100644 --- a/remote/src/main/java/org/apache/pekko/remote/SystemMessageFormats.java +++ b/remote/src/main/java/org/apache/pekko/remote/SystemMessageFormats.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: SystemMessageFormats.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package org.apache.pekko.remote; @@ -25,8 +25,8 @@ private SystemMessageFormats() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "SystemMessageFormats"); } @@ -141,8 +141,8 @@ public static final class SystemMessage extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "SystemMessage"); } @@ -223,8 +223,8 @@ public enum Type org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Type"); } @@ -566,8 +566,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeEnumSize(1, type_); @@ -592,15 +597,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(7, getDwNotificationData()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -1808,8 +1804,8 @@ public static final class WatchData extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "WatchData"); } @@ -1929,8 +1925,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getWatchee()); @@ -1939,15 +1940,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getWatcher()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2611,8 +2603,8 @@ public static final class SuperviseData extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "SuperviseData"); } @@ -2721,8 +2713,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getChild()); @@ -2731,15 +2728,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBoolSize(2, async_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -3311,8 +3299,8 @@ public static final class FailedData extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "FailedData"); } @@ -3421,8 +3409,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getChild()); @@ -3431,15 +3424,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeUInt64Size(2, uid_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -4022,8 +4006,8 @@ public static final class DeathWatchNotificationData extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "DeathWatchNotificationData"); } @@ -4158,8 +4142,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getActor()); @@ -4172,15 +4161,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBoolSize(3, addressTerminated_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/remote/src/main/java/org/apache/pekko/remote/WireFormats.java b/remote/src/main/java/org/apache/pekko/remote/WireFormats.java index fc310029bce..9ff9f0a08b2 100644 --- a/remote/src/main/java/org/apache/pekko/remote/WireFormats.java +++ b/remote/src/main/java/org/apache/pekko/remote/WireFormats.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: WireFormats.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package org.apache.pekko.remote; @@ -25,8 +25,8 @@ private WireFormats() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "WireFormats"); } @@ -83,8 +83,8 @@ public enum CommandType org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "CommandType"); } @@ -236,8 +236,8 @@ public enum TimeUnit org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "TimeUnit"); } @@ -393,8 +393,8 @@ public static final class AckAndEnvelopeContainer extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "AckAndEnvelopeContainer"); } @@ -510,8 +510,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getAck()); @@ -520,15 +525,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getEnvelope()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -1225,8 +1221,8 @@ public static final class RemoteEnvelope extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "RemoteEnvelope"); } @@ -1403,8 +1399,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getRecipient()); @@ -1421,15 +1422,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeFixed64Size(5, seq_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2320,8 +2312,8 @@ public static final class AcknowledgementInfo extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "AcknowledgementInfo"); } @@ -2426,8 +2418,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeFixed64Size(1, cumulativeAck_); @@ -2438,15 +2435,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getNacksList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2981,8 +2969,8 @@ public static final class ActorRefData extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ActorRefData"); } @@ -3085,20 +3073,16 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, path_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, path_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -3566,8 +3550,8 @@ public static final class SerializedMessage extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "SerializedMessage"); } @@ -3689,8 +3673,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(1, message_); @@ -3703,15 +3692,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(3, messageManifest_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -4292,8 +4272,8 @@ public static final class DaemonMsgCreateData extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "DaemonMsgCreateData"); } @@ -4507,8 +4487,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getProps()); @@ -4524,15 +4509,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(4, getSupervisor()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -5604,8 +5580,8 @@ public static final class PropsData extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "PropsData"); } @@ -5937,8 +5913,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getDeploy()); @@ -5978,15 +5959,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getHasManifestList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -7387,8 +7359,8 @@ public static final class DeployData extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "DeployData"); } @@ -7890,8 +7862,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, path_); } @@ -7939,15 +7916,6 @@ private int computeSerializedSize_0() { size += dataSize; size += 1 * getTagsList().size(); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -9354,8 +9322,8 @@ public static final class PekkoProtocolMessage extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "PekkoProtocolMessage"); } @@ -9459,8 +9427,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(1, payload_); @@ -9469,15 +9442,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getInstruction()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -10055,8 +10019,8 @@ public static final class PekkoControlMessage extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "PekkoControlMessage"); } @@ -10163,8 +10127,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeEnumSize(1, commandType_); @@ -10173,15 +10142,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getHandshakeInfo()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -10779,8 +10739,8 @@ public static final class PekkoHandshakeInfo extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "PekkoHandshakeInfo"); } @@ -10942,8 +10902,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getOrigin()); @@ -10955,15 +10920,6 @@ private int computeSerializedSize_0() { if (((bitField0_ & 0x00000004) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(3, cookie_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -11635,8 +11591,8 @@ public static final class FiniteDuration extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "FiniteDuration"); } @@ -11734,8 +11690,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(1, value_); @@ -11744,15 +11705,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeEnumSize(2, unit_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -12221,8 +12173,8 @@ public static final class RemoteScope extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "RemoteScope"); } @@ -12305,21 +12257,17 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream - .computeMessageSize(1, getNode()); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream + .computeMessageSize(1, getNode()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -12876,8 +12824,8 @@ public static final class DefaultResizer extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "DefaultResizer"); } @@ -13105,8 +13053,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeUInt32Size(1, lowerBound_); @@ -13135,15 +13088,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeUInt32Size(7, messagesPerResize_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -13953,8 +13897,8 @@ public static final class FromConfig extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "FromConfig"); } @@ -14088,8 +14032,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getResizer()); @@ -14097,15 +14046,6 @@ private int computeSerializedSize_0() { if (((bitField0_ & 0x00000002) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(2, routerDispatcher_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -14742,8 +14682,8 @@ public static final class GenericRoutingPool extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "GenericRoutingPool"); } @@ -14929,8 +14869,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeUInt32Size(1, nrOfInstances_); @@ -14946,15 +14891,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(4, getResizer()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -15698,8 +15634,8 @@ public static final class ScatterGatherPool extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ScatterGatherPool"); } @@ -15819,8 +15755,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getGeneric()); @@ -15829,15 +15770,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getWithin()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -16520,8 +16452,8 @@ public static final class TailChoppingPool extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "TailChoppingPool"); } @@ -16678,8 +16610,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getGeneric()); @@ -16692,15 +16629,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(3, getInterval()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -17563,8 +17491,8 @@ public static final class AddressData extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "AddressData"); } @@ -17803,8 +17731,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, system_); } @@ -17818,15 +17751,6 @@ private int computeSerializedSize_0() { if (((bitField0_ & 0x00000008) != 0)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(4, protocol_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -18570,8 +18494,8 @@ public static final class RemoteRouterConfig extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "RemoteRouterConfig"); } @@ -18705,8 +18629,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(1, getLocal()); @@ -18720,15 +18649,6 @@ private int computeSerializedSize_0() { } size += 1 * count; } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/remote/src/main/mima-filters/2.0.x.backwards.excludes/future-lazy-vals.excludes b/remote/src/main/mima-filters/2.0.x.backwards.excludes/future-lazy-vals.excludes deleted file mode 100644 index 113e1cfc66d..00000000000 --- a/remote/src/main/mima-filters/2.0.x.backwards.excludes/future-lazy-vals.excludes +++ /dev/null @@ -1,21 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# -Yfuture-lazy-vals changes the generated bytecode for companion objects -# containing lazy vals: the static initializer that was produced -# by the old sun.misc.Unsafe-based implementation is no longer emitted. -ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.remote.RemoteWatcher#Stats.") diff --git a/remote/src/main/resources/reference.conf b/remote/src/main/resources/reference.conf index b4bf9bac8e1..2741292ad9e 100644 --- a/remote/src/main/resources/reference.conf +++ b/remote/src/main/resources/reference.conf @@ -1235,7 +1235,7 @@ pekko { # at least one common subject name (CN or SAN). # The Key setup this implementation supports has some limitations: # 1. the private key must be provided on a PKCS#1 or a non-encrypted PKCS#8 PEM-formatted file - # 2. the private key must be of an algorithm supported by `pekko-pki` tools (e.g. "RSA", not "EC") + # 2. the private key must be be of an algorithm supported by `pekko-pki` tools (e.g. "RSA", not "EC") # 3. the node certificate must be issued by a root CA (not an intermediate CA) # 4. both the node and the CA certificates must be provided in PEM-formatted files rotating-keys-engine { diff --git a/remote/src/main/scala/org/apache/pekko/remote/Endpoint.scala b/remote/src/main/scala/org/apache/pekko/remote/Endpoint.scala index 88e68e5270e..c6b379685d7 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/Endpoint.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/Endpoint.scala @@ -81,7 +81,7 @@ private[remote] class DefaultMessageDispatcher( import provider.remoteSettings._ lazy val payload: AnyRef = MessageSerializer.deserialize(system, serializedMessage) - def payloadClass: Class[?] = if (payload eq null) null else payload.getClass + def payloadClass: Class[_] = if (payload eq null) null else payload.getClass val sender: ActorRef = senderOption.getOrElse(system.deadLetters) val originalReceiver = recipient.path diff --git a/remote/src/main/scala/org/apache/pekko/remote/RemoteDaemon.scala b/remote/src/main/scala/org/apache/pekko/remote/RemoteDaemon.scala index 34ac5b41e54..01509ec4b3a 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/RemoteDaemon.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/RemoteDaemon.scala @@ -285,7 +285,7 @@ private[pekko] class RemoteSystemDaemon( } /** INTERNAL API */ -final class NotAllowedClassRemoteDeploymentAttemptException(illegal: Class[?], allowedClassNames: immutable.Set[String]) +final class NotAllowedClassRemoteDeploymentAttemptException(illegal: Class[_], allowedClassNames: immutable.Set[String]) extends RuntimeException( s"Attempted to deploy Actor class: " + s"[$illegal], " + diff --git a/remote/src/main/scala/org/apache/pekko/remote/RemoteMetricsExtension.scala b/remote/src/main/scala/org/apache/pekko/remote/RemoteMetricsExtension.scala index 92910370dec..529a8d3b40f 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/RemoteMetricsExtension.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/RemoteMetricsExtension.scala @@ -77,7 +77,7 @@ private[pekko] class RemoteMetricsOn(system: ExtendedActorSystem) extends Remote private val logFrameSizeExceeding: Int = RARP(system).provider.remoteSettings.LogFrameSizeExceeding.getOrElse(Int.MaxValue) private val log = Logging(system, classOf[RemoteMetrics]) - private val maxPayloadBytes: ConcurrentHashMap[Class[?], Integer] = new ConcurrentHashMap + private val maxPayloadBytes: ConcurrentHashMap[Class[_], Integer] = new ConcurrentHashMap override def logPayloadBytes(msg: Any, payloadBytes: Int): Unit = if (payloadBytes >= logFrameSizeExceeding) { diff --git a/remote/src/main/scala/org/apache/pekko/remote/artery/ArteryTransport.scala b/remote/src/main/scala/org/apache/pekko/remote/artery/ArteryTransport.scala index b9bcfd45ef7..f453a14044a 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/artery/ArteryTransport.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/artery/ArteryTransport.scala @@ -599,7 +599,7 @@ private[remote] abstract class ArteryTransport(_system: ExtendedActorSystem, _pr case _: AeronTerminated => // shutdown already in progress case cause if isShutdown => // don't restart after shutdown, but log some details so we notice - log.warning("{} failed after shutdown. {}: {}", streamName, cause.getClass.getName, cause.getMessage) + log.warning(s"{} failed after shutdown. {}: {}", streamName, cause.getClass.getName, cause.getMessage) case _: AbruptTerminationException => // ActorSystem shutdown case cause => if (restartCounter.restart()) { @@ -630,7 +630,7 @@ private[remote] abstract class ArteryTransport(_system: ExtendedActorSystem, _pr else { val flushingPromise = Promise[Done]() if (log.isDebugEnabled) - log.debug("Flushing associations [{}]", allAssociations.map(_.remoteAddress).mkString(", ")) + log.debug(s"Flushing associations [{}]", allAssociations.map(_.remoteAddress).mkString(", ")) system.systemActorOf( FlushOnShutdown .props(flushingPromise, settings.Advanced.ShutdownFlushTimeout, allAssociations) diff --git a/remote/src/main/scala/org/apache/pekko/remote/artery/Handshake.scala b/remote/src/main/scala/org/apache/pekko/remote/artery/Handshake.scala index 0c4c3c3deb3..c169056805c 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/artery/Handshake.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/artery/Handshake.scala @@ -93,7 +93,7 @@ private[remote] class OutboundHandshake( private val uniqueRemoteAddressListener: UniqueAddress => Unit = peer => uniqueRemoteAddressAsyncCallback.invoke(peer) - override protected def logSource: Class[?] = classOf[OutboundHandshake] + override protected def logSource: Class[_] = classOf[OutboundHandshake] override def preStart(): Unit = { scheduleOnce(HandshakeTimeout, timeout) diff --git a/remote/src/main/scala/org/apache/pekko/remote/artery/ImmutableLongMap.scala b/remote/src/main/scala/org/apache/pekko/remote/artery/ImmutableLongMap.scala index 2b3d7f70aca..ddc703fd178 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/artery/ImmutableLongMap.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/artery/ImmutableLongMap.scala @@ -128,7 +128,7 @@ private[pekko] class ImmutableLongMap[A >: Null] private (private val keys: Arra } override def equals(obj: Any): Boolean = obj match { - case other: ImmutableLongMap[?] => + case other: ImmutableLongMap[_] => if (other eq this) true else if (size != other.size) false else if (size == 0 && other.size == 0) true diff --git a/remote/src/main/scala/org/apache/pekko/remote/artery/RemoteInstrument.scala b/remote/src/main/scala/org/apache/pekko/remote/artery/RemoteInstrument.scala index 8315921c5ab..4b97a7776e5 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/artery/RemoteInstrument.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/artery/RemoteInstrument.scala @@ -109,7 +109,7 @@ abstract class RemoteInstrument { private val log = Logging(system, classOf[LoggingRemoteInstrument]) - private val maxPayloadBytes: ConcurrentHashMap[Class[?], Integer] = new ConcurrentHashMap + private val maxPayloadBytes: ConcurrentHashMap[Class[_], Integer] = new ConcurrentHashMap override def identifier: Byte = 1 // Cinnamon is using 0 diff --git a/remote/src/main/scala/org/apache/pekko/remote/artery/RemotingFlightRecorder.scala b/remote/src/main/scala/org/apache/pekko/remote/artery/RemotingFlightRecorder.scala index 02cf0a72833..feb97080119 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/artery/RemotingFlightRecorder.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/artery/RemotingFlightRecorder.scala @@ -37,7 +37,7 @@ object RemotingFlightRecorder extends ExtensionId[RemotingFlightRecorder] with E "org.apache.pekko.remote.artery.jfr.JFRRemotingFlightRecorder", NoOpRemotingFlightRecorder) - override def lookup: ExtensionId[? <: Extension] = this + override def lookup: ExtensionId[_ <: Extension] = this } /** diff --git a/remote/src/main/scala/org/apache/pekko/remote/artery/SystemMessageDelivery.scala b/remote/src/main/scala/org/apache/pekko/remote/artery/SystemMessageDelivery.scala index e9a59b743d7..d13e6dc0a97 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/artery/SystemMessageDelivery.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/artery/SystemMessageDelivery.scala @@ -111,7 +111,7 @@ import pekko.util.PrettyDuration.PrettyPrintableDuration private def remoteAddressLogParam: String = outboundContext.associationState.uniqueRemoteAddress().getOrElse(remoteAddress).toString - override protected def logSource: Class[?] = classOf[SystemMessageDelivery] + override protected def logSource: Class[_] = classOf[SystemMessageDelivery] override def preStart(): Unit = { val callback = getAsyncCallback[Done] { _ => @@ -351,7 +351,7 @@ import pekko.util.PrettyDuration.PrettyPrintableDuration def localAddress = inboundContext.localAddress - override protected def logSource: Class[?] = classOf[SystemMessageAcker] + override protected def logSource: Class[_] = classOf[SystemMessageAcker] // InHandler override def onPush(): Unit = { diff --git a/remote/src/main/scala/org/apache/pekko/remote/artery/aeron/ArteryAeronUdpTransport.scala b/remote/src/main/scala/org/apache/pekko/remote/artery/aeron/ArteryAeronUdpTransport.scala index be3f89c477c..e18953e0ea4 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/artery/aeron/ArteryAeronUdpTransport.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/artery/aeron/ArteryAeronUdpTransport.scala @@ -190,13 +190,13 @@ private[remote] class ArteryAeronUdpTransport(_system: ExtendedActorSystem, _pro ctx.availableImageHandler(new AvailableImageHandler { override def onAvailableImage(img: Image): Unit = { if (log.isDebugEnabled) - log.debug("onAvailableImage from {} session {}", img.sourceIdentity, img.sessionId) + log.debug(s"onAvailableImage from ${img.sourceIdentity} session ${img.sessionId}") } }) ctx.unavailableImageHandler(new UnavailableImageHandler { override def onUnavailableImage(img: Image): Unit = { if (log.isDebugEnabled) - log.debug("onUnavailableImage from {} session {}", img.sourceIdentity, img.sessionId) + log.debug(s"onUnavailableImage from ${img.sourceIdentity} session ${img.sessionId}") // freeSessionBuffer in AeronSource FragmentAssembler streamMatValues.get.valuesIterator.foreach { diff --git a/remote/src/main/scala/org/apache/pekko/remote/artery/compress/CompressionTable.scala b/remote/src/main/scala/org/apache/pekko/remote/artery/compress/CompressionTable.scala index 56a1aec8aab..7da34aa2ae2 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/artery/compress/CompressionTable.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/artery/compress/CompressionTable.scala @@ -91,7 +91,7 @@ private[remote] final class CompressionTable[T]( } override def equals(obj: Any): Boolean = obj match { - case other: CompressionTable[?] => + case other: CompressionTable[_] => originUid == other.originUid && version == other.version && _dictionary == other._dictionary case _ => false } diff --git a/remote/src/main/scala/org/apache/pekko/remote/artery/tcp/ssl/X509Readers.scala b/remote/src/main/scala/org/apache/pekko/remote/artery/tcp/ssl/X509Readers.scala index fb03aeacbd6..0b43e9f6417 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/artery/tcp/ssl/X509Readers.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/artery/tcp/ssl/X509Readers.scala @@ -35,7 +35,7 @@ private[pekko] object X509Readers { attr.getValue.toString } - val iterable: Iterable[util.List[?]] = Option(cert.getSubjectAlternativeNames).map(_.asScala).getOrElse(Nil) + val iterable: Iterable[util.List[_]] = Option(cert.getSubjectAlternativeNames).map(_.asScala).getOrElse(Nil) val alternates = iterable.collect { // See the javadocs of cert.getSubjectAlternativeNames for what this list contains, // first element should be an integer, if that integer is 2, then the second element diff --git a/remote/src/main/scala/org/apache/pekko/remote/serialization/DaemonMsgCreateSerializer.scala b/remote/src/main/scala/org/apache/pekko/remote/serialization/DaemonMsgCreateSerializer.scala index e619eb29ecf..a68f7ad1a69 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/serialization/DaemonMsgCreateSerializer.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/serialization/DaemonMsgCreateSerializer.scala @@ -106,7 +106,7 @@ private[pekko] final class DaemonMsgCreateSerializer(val system: ExtendedActorSy "Can't serialize a non-DaemonMsgCreate message using DaemonMsgCreateSerializer [%s]".format(obj)) } - def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = { + def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = { val proto = DaemonMsgCreateData.parseFrom(bytes) def deploy(protoDeploy: DeployData): Deploy = { diff --git a/remote/src/main/scala/org/apache/pekko/remote/serialization/MessageContainerSerializer.scala b/remote/src/main/scala/org/apache/pekko/remote/serialization/MessageContainerSerializer.scala index 118d6cb6e34..35acd38a811 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/serialization/MessageContainerSerializer.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/serialization/MessageContainerSerializer.scala @@ -72,7 +72,7 @@ class MessageContainerSerializer(val system: ExtendedActorSystem) extends BaseSe builder } - def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = { + def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = { val selectionEnvelope = ContainerFormats.SelectionEnvelope.parseFrom(bytes) val manifest = if (selectionEnvelope.hasMessageManifest) selectionEnvelope.getMessageManifest.toStringUtf8 else "" val msg = serialization diff --git a/remote/src/main/scala/org/apache/pekko/remote/serialization/MiscMessageSerializer.scala b/remote/src/main/scala/org/apache/pekko/remote/serialization/MiscMessageSerializer.scala index bb28c9573b5..a74d60d9eb4 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/serialization/MiscMessageSerializer.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/serialization/MiscMessageSerializer.scala @@ -49,7 +49,7 @@ class MiscMessageSerializer(val system: ExtendedActorSystem) extends SerializerW case identity: ActorIdentity => serializeActorIdentity(identity) case Some(value) => serializeSome(value) case None => ParameterlessSerializedMessage - case o: Optional[?] => serializeOptional(o) + case o: Optional[_] => serializeOptional(o) case r: ActorRef => serializeActorRef(r) case s: Status.Success => serializeStatusSuccess(s) case f: Status.Failure => serializeStatusFailure(f) @@ -105,7 +105,7 @@ class MiscMessageSerializer(val system: ExtendedActorSystem) extends SerializerW private def serializeSome(someValue: Any): Array[Byte] = ContainerFormats.Option.newBuilder().setValue(payloadSupport.payloadBuilder(someValue)).build().toByteArray - private def serializeOptional(opt: Optional[?]): Array[Byte] = { + private def serializeOptional(opt: Optional[_]): Array[Byte] = { if (opt.isPresent) ContainerFormats.Option.newBuilder().setValue(payloadSupport.payloadBuilder(opt.get)).build().toByteArray else @@ -138,7 +138,7 @@ class MiscMessageSerializer(val system: ExtendedActorSystem) extends SerializerW // no specific message, serialized id and manifest together with payload is enough (no wrapping overhead) payloadSupport.payloadBuilder(r.getValue).build().toByteArray - def serializeStatusReplyError(r: StatusReply[?]): Array[Byte] = { + def serializeStatusReplyError(r: StatusReply[_]): Array[Byte] = { r.getError match { case em: StatusReply.ErrorMessage => // somewhat optimized for the recommended usage, avoiding the additional payload metadata @@ -388,7 +388,7 @@ class MiscMessageSerializer(val system: ExtendedActorSystem) extends SerializerW case _: Identify => IdentifyManifest case _: ActorIdentity => ActorIdentityManifest case _: Option[Any] => OptionManifest - case _: Optional[?] => OptionalManifest + case _: Optional[_] => OptionalManifest case _: ActorRef => ActorRefManifest case _: Status.Success => StatusSuccessManifest case _: Status.Failure => StatusFailureManifest @@ -479,13 +479,13 @@ class MiscMessageSerializer(val system: ExtendedActorSystem) extends SerializerW private def deserializeStatusFailure(bytes: Array[Byte]): Status.Failure = Status.Failure(payloadSupport.deserializePayload(ContainerFormats.Payload.parseFrom(bytes)).asInstanceOf[Throwable]) - private def deserializeStatusReplySuccess(bytes: Array[Byte]): StatusReply[?] = + private def deserializeStatusReplySuccess(bytes: Array[Byte]): StatusReply[_] = StatusReply.success(payloadSupport.deserializePayload(ContainerFormats.Payload.parseFrom(bytes))) - private def deserializeStatusReplyErrorMessage(bytes: Array[Byte]): StatusReply[?] = + private def deserializeStatusReplyErrorMessage(bytes: Array[Byte]): StatusReply[_] = StatusReply.error(ContainerFormats.StatusReplyErrorMessage.parseFrom(bytes).getErrorMessage) - private def deserializeStatusReplyErrorException(bytes: Array[Byte]): StatusReply[?] = + private def deserializeStatusReplyErrorException(bytes: Array[Byte]): StatusReply[_] = StatusReply.error( payloadSupport.deserializePayload(ContainerFormats.Payload.parseFrom(bytes)).asInstanceOf[Throwable]) diff --git a/remote/src/main/scala/org/apache/pekko/remote/serialization/ProtobufSerializer.scala b/remote/src/main/scala/org/apache/pekko/remote/serialization/ProtobufSerializer.scala index c11a4d43f01..1b67aac0920 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/serialization/ProtobufSerializer.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/serialization/ProtobufSerializer.scala @@ -28,7 +28,7 @@ import pekko.serialization.{ BaseSerializer, Serialization } import pekko.serialization.SerializationExtension object ProtobufSerializer { - private val ARRAY_OF_BYTE_ARRAY = Array[Class[?]](classOf[Array[Byte]]) + private val ARRAY_OF_BYTE_ARRAY = Array[Class[_]](classOf[Array[Byte]]) /** * Helper to serialize a [[pekko.actor.ActorRef]] to Pekko's @@ -56,8 +56,8 @@ object ProtobufSerializer { */ class ProtobufSerializer(val system: ExtendedActorSystem) extends BaseSerializer { - private val parsingMethodBindingRef = new AtomicReference[Map[Class[?], Method]](Map.empty) - private val toByteArrayMethodBindingRef = new AtomicReference[Map[Class[?], Method]](Map.empty) + private val parsingMethodBindingRef = new AtomicReference[Map[Class[_], Method]](Map.empty) + private val toByteArrayMethodBindingRef = new AtomicReference[Map[Class[_], Method]](Map.empty) private val allowedClassNames: Set[String] = { import scala.jdk.CollectionConverters._ @@ -71,7 +71,7 @@ class ProtobufSerializer(val system: ExtendedActorSystem) extends BaseSerializer override def includeManifest: Boolean = true - override def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = { + override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = { manifest match { case Some(clazz) => @tailrec @@ -121,7 +121,7 @@ class ProtobufSerializer(val system: ExtendedActorSystem) extends BaseSerializer toByteArrayMethod().invoke(obj).asInstanceOf[Array[Byte]] } - private def checkAllowedClass(clazz: Class[?]): Unit = { + private def checkAllowedClass(clazz: Class[_]): Unit = { if (!isInAllowList(clazz)) { val warnMsg = s"Can't deserialize object of type [${clazz.getName}] in [${getClass.getName}]. " + "Only classes that are on the allow list are allowed for security reasons. " + @@ -147,11 +147,11 @@ class ProtobufSerializer(val system: ExtendedActorSystem) extends BaseSerializer * That is also possible when changing a binding from a ProtobufSerializer to another serializer (e.g. Jackson) * and still bind with the same class (interface). */ - private def isInAllowList(clazz: Class[?]): Boolean = { + private def isInAllowList(clazz: Class[_]): Boolean = { isBoundToProtobufSerializer(clazz) || isInAllowListClassName(clazz) } - private def isBoundToProtobufSerializer(clazz: Class[?]): Boolean = { + private def isBoundToProtobufSerializer(clazz: Class[_]): Boolean = { try { val boundSerializer = serialization.serializerFor(clazz) boundSerializer.isInstanceOf[ProtobufSerializer] @@ -160,7 +160,7 @@ class ProtobufSerializer(val system: ExtendedActorSystem) extends BaseSerializer } } - private def isInAllowListClassName(clazz: Class[?]): Boolean = { + private def isInAllowListClassName(clazz: Class[_]): Boolean = { allowedClassNames(clazz.getName) || allowedClassNames(clazz.getSuperclass.getName) || clazz.getInterfaces.exists(c => allowedClassNames(c.getName)) diff --git a/remote/src/main/scala/org/apache/pekko/remote/serialization/SystemMessageSerializer.scala b/remote/src/main/scala/org/apache/pekko/remote/serialization/SystemMessageSerializer.scala index 714fecc91a1..58bd95d3924 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/serialization/SystemMessageSerializer.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/serialization/SystemMessageSerializer.scala @@ -97,7 +97,7 @@ class SystemMessageSerializer(val system: ExtendedActorSystem) extends BaseSeria builder.build().toByteArray } - override def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef = { + override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = { deserializeSystemMessage(SystemMessageFormats.SystemMessage.parseFrom(bytes)) } diff --git a/remote/src/test/java/org/apache/pekko/remote/ProtobufProtocol.java b/remote/src/test/java/org/apache/pekko/remote/ProtobufProtocol.java index 201461a9b19..43ba374624a 100644 --- a/remote/src/test/java/org/apache/pekko/remote/ProtobufProtocol.java +++ b/remote/src/test/java/org/apache/pekko/remote/ProtobufProtocol.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: ProtobufProtocol.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package org.apache.pekko.remote; @@ -25,8 +25,8 @@ private ProtobufProtocol() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ProtobufProtocol"); } @@ -94,8 +94,8 @@ public static final class MyMessage extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "MyMessage"); } @@ -250,8 +250,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeUInt64Size(1, id_); @@ -263,15 +268,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBoolSize(3, status_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/remote/src/test/java/org/apache/pekko/remote/protobuf/v3/ProtobufProtocolV3.java b/remote/src/test/java/org/apache/pekko/remote/protobuf/v3/ProtobufProtocolV3.java index 7466a373241..99519f33d10 100644 --- a/remote/src/test/java/org/apache/pekko/remote/protobuf/v3/ProtobufProtocolV3.java +++ b/remote/src/test/java/org/apache/pekko/remote/protobuf/v3/ProtobufProtocolV3.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: ProtobufProtocolV3.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package org.apache.pekko.remote.protobuf.v3; @@ -26,8 +26,8 @@ private ProtobufProtocolV3() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ProtobufProtocolV3"); } @@ -86,8 +86,8 @@ public static final class MyMessageV3 org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "MyMessageV3"); } @@ -218,8 +218,12 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (!org.apache.pekko.protobufv3.internal.GeneratedMessage.isStringEmpty(query_)) { size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, query_); } @@ -232,16 +236,6 @@ private int computeSerializedSize_0() { org.apache.pekko.protobufv3.internal.CodedOutputStream.computeInt32Size( 3, resultPerPage_); } - return size; - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/remote/src/test/scala/org/apache/pekko/remote/DaemonicSpec.scala b/remote/src/test/scala/org/apache/pekko/remote/DaemonicSpec.scala index 3737c920f49..80a255f7069 100644 --- a/remote/src/test/scala/org/apache/pekko/remote/DaemonicSpec.scala +++ b/remote/src/test/scala/org/apache/pekko/remote/DaemonicSpec.scala @@ -54,12 +54,7 @@ class DaemonicSpec extends PekkoSpec { awaitAssert({ val newNonDaemons: Set[Thread] = Thread.getAllStackTraces.keySet().asScala.filter(t => !origThreads(t) && !t.isDaemon).to(Set) - // Aeron 1.51.0 introduced its own non-daemon thread, so we have to ignore it here - // https://github.com/apache/pekko/issues/2939 - if (newNonDaemons.nonEmpty) { - newNonDaemons should have size 1 - newNonDaemons.head.getName should include("aeron") - } + newNonDaemons should ===(Set.empty[Thread]) }, 4.seconds) } finally { diff --git a/remote/src/test/scala/org/apache/pekko/remote/artery/RemoteInstrumentsSerializationSpec.scala b/remote/src/test/scala/org/apache/pekko/remote/artery/RemoteInstrumentsSerializationSpec.scala index 31c1ebcf304..14f14db8667 100644 --- a/remote/src/test/scala/org/apache/pekko/remote/artery/RemoteInstrumentsSerializationSpec.scala +++ b/remote/src/test/scala/org/apache/pekko/remote/artery/RemoteInstrumentsSerializationSpec.scala @@ -140,13 +140,13 @@ object RemoteInstrumentsSerializationSpec { class Filter(@nowarn("msg=never used") settings: ActorSystem.Settings, stream: EventStream) extends LoggingFilter { stream.publish(Mute(EventFilter.debug())) - override def isErrorEnabled(logClass: Class[?], logSource: String): Boolean = true + override def isErrorEnabled(logClass: Class[_], logSource: String): Boolean = true - override def isWarningEnabled(logClass: Class[?], logSource: String): Boolean = true + override def isWarningEnabled(logClass: Class[_], logSource: String): Boolean = true - override def isInfoEnabled(logClass: Class[?], logSource: String): Boolean = true + override def isInfoEnabled(logClass: Class[_], logSource: String): Boolean = true - override def isDebugEnabled(logClass: Class[?], logSource: String): Boolean = logSource == "DebugSource" + override def isDebugEnabled(logClass: Class[_], logSource: String): Boolean = logSource == "DebugSource" } def testInstrument( diff --git a/remote/src/test/scala/org/apache/pekko/remote/artery/RemoteSendConsistencySpec.scala b/remote/src/test/scala/org/apache/pekko/remote/artery/RemoteSendConsistencySpec.scala index 91f7b71f162..69590cab692 100644 --- a/remote/src/test/scala/org/apache/pekko/remote/artery/RemoteSendConsistencySpec.scala +++ b/remote/src/test/scala/org/apache/pekko/remote/artery/RemoteSendConsistencySpec.scala @@ -176,7 +176,7 @@ abstract class AbstractRemoteSendConsistencySpec(config: Config) system.actorOf(senderProps(remoteRefC)) system.actorOf(senderProps(remoteRefA)) - within(30.seconds) { + within(10.seconds) { expectMsg("success") expectMsg("success") expectMsg("success") @@ -216,7 +216,7 @@ abstract class AbstractRemoteSendConsistencySpec(config: Config) system.actorOf(senderProps(selC)) system.actorOf(senderProps(selA)) - within(30.seconds) { + within(10.seconds) { expectMsg("success2") expectMsg("success2") expectMsg("success2") diff --git a/remote/src/test/scala/org/apache/pekko/remote/artery/tcp/ssl/RotatingKeysSSLEngineProviderSpec.scala b/remote/src/test/scala/org/apache/pekko/remote/artery/tcp/ssl/RotatingKeysSSLEngineProviderSpec.scala index 670e0a33919..2cda6257f63 100644 --- a/remote/src/test/scala/org/apache/pekko/remote/artery/tcp/ssl/RotatingKeysSSLEngineProviderSpec.scala +++ b/remote/src/test/scala/org/apache/pekko/remote/artery/tcp/ssl/RotatingKeysSSLEngineProviderSpec.scala @@ -45,9 +45,8 @@ import pekko.testkit.TestActors import pekko.testkit.TestProbe import pekko.util.JavaVersion -import org.scalatest.Outcome - import com.typesafe.config.ConfigFactory +import org.scalatest.Outcome // This is a simplification Spec. It doesn't rely on changing files. class RotatingProviderWithStaticKeysSpec diff --git a/remote/src/test/scala/org/apache/pekko/remote/classic/RemotingSpec.scala b/remote/src/test/scala/org/apache/pekko/remote/classic/RemotingSpec.scala index 0fb42195e85..335af689dd8 100644 --- a/remote/src/test/scala/org/apache/pekko/remote/classic/RemotingSpec.scala +++ b/remote/src/test/scala/org/apache/pekko/remote/classic/RemotingSpec.scala @@ -836,10 +836,17 @@ class RemotingSpec extends PekkoSpec(RemotingSpec.cfg) with ImplicitSender with try { muteSystem(thisSystem) val thisProbe = new TestProbe(thisSystem) + val thisSender = thisProbe.ref thisSystem.actorOf(Props[Echo2](), "echo") - // selectionAndBind retries on a fresh port, since the temporaryServerAddress can be taken - // by the time the new actor system binds (see #1679) - val (otherSystem, _) = selectionAndBind(config, thisSystem, thisProbe) + val otherAddress = temporaryServerAddress() + val otherConfig = ConfigFactory.parseString(s""" + pekko.remote.classic.netty.tcp.port = ${otherAddress.getPort} + """).withFallback(config) + val otherSelection = + thisSystem.actorSelection(s"pekko.tcp://other-system@localhost:${otherAddress.getPort}/user/echo") + otherSelection.tell("ping", thisSender) + thisProbe.expectNoMessage(1.seconds) + val otherSystem = ActorSystem("other-system", otherConfig) try { muteSystem(otherSystem) thisProbe.expectNoMessage(2.seconds) diff --git a/remote/src/test/scala/org/apache/pekko/remote/serialization/DaemonMsgCreateSerializerAllowJavaSerializationSpec.scala b/remote/src/test/scala/org/apache/pekko/remote/serialization/DaemonMsgCreateSerializerAllowJavaSerializationSpec.scala index d294371287e..f243b00e38c 100644 --- a/remote/src/test/scala/org/apache/pekko/remote/serialization/DaemonMsgCreateSerializerAllowJavaSerializationSpec.scala +++ b/remote/src/test/scala/org/apache/pekko/remote/serialization/DaemonMsgCreateSerializerAllowJavaSerializationSpec.scala @@ -66,8 +66,8 @@ private[pekko] trait SerializationVerification { self: PekkoSpec => got.props.args.length should ===(expected.props.args.length) got.props.args.zip(expected.props.args).foreach { case (g, e) => - if (e.isInstanceOf[Function0[?]]) () - else if (e.isInstanceOf[Function1[?, ?]]) () + if (e.isInstanceOf[Function0[_]]) () + else if (e.isInstanceOf[Function1[_, _]]) () else g should ===(e) } got.props.deploy should ===(expected.props.deploy) diff --git a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonModule.scala b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonModule.scala index 4fb52d3ff8a..cbb0a2dae3c 100644 --- a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonModule.scala +++ b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonModule.scala @@ -43,12 +43,12 @@ import pekko.annotation.InternalApi VersionUtil.parseVersion(version, groupId, artifactId) } - class SerializerResolverByClass(clazz: Class[?], deserializer: () => JsonSerializer[?]) extends Serializers.Base { + class SerializerResolverByClass(clazz: Class[_], deserializer: () => JsonSerializer[_]) extends Serializers.Base { override def findSerializer( config: SerializationConfig, javaType: JavaType, - beanDesc: BeanDescription): JsonSerializer[?] = { + beanDesc: BeanDescription): JsonSerializer[_] = { if (clazz.isAssignableFrom(javaType.getRawClass)) deserializer() else @@ -57,12 +57,12 @@ import pekko.annotation.InternalApi } - class DeserializerResolverByClass(clazz: Class[?], serializer: () => JsonDeserializer[?]) extends Deserializers.Base { + class DeserializerResolverByClass(clazz: Class[_], serializer: () => JsonDeserializer[_]) extends Deserializers.Base { override def findBeanDeserializer( javaType: JavaType, config: DeserializationConfig, - beanDesc: BeanDescription): JsonDeserializer[?] = { + beanDesc: BeanDescription): JsonDeserializer[_] = { if (clazz.isAssignableFrom(javaType.getRawClass)) serializer() else @@ -94,9 +94,9 @@ import pekko.annotation.InternalApi } def addSerializer( - clazz: Class[?], - serializer: () => JsonSerializer[?], - deserializer: () => JsonDeserializer[?]): this.type = { + clazz: Class[_], + serializer: () => JsonSerializer[_], + deserializer: () => JsonDeserializer[_]): this.type = { this += { ctx => ctx.addSerializers(new SerializerResolverByClass(clazz, serializer)) ctx.addDeserializers(new DeserializerResolverByClass(clazz, deserializer)) diff --git a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonSerializer.scala b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonSerializer.scala index 7c3aac20308..689f5f89b90 100644 --- a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonSerializer.scala +++ b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonSerializer.scala @@ -62,14 +62,14 @@ import pekko.util.OptionVal true } - def isAllowedClass(clazz: Class[?]): Boolean = { + def isAllowedClass(clazz: Class[_]): Boolean = { if (clazz.getName.startsWith(prefixSpring)) { isAllowedSpringClass(clazz) } else true } - @tailrec private def isAllowedSpringClass(clazz: Class[?]): Boolean = { + @tailrec private def isAllowedSpringClass(clazz: Class[_]): Boolean = { if ((clazz eq null) || clazz.equals(classOf[java.lang.Object])) true else { @@ -85,8 +85,8 @@ import pekko.util.OptionVal } } - val disallowedSerializationBindings: Set[Class[?]] = - Set(classOf[java.io.Serializable], classOf[java.io.Serializable], classOf[java.lang.Comparable[?]]) + val disallowedSerializationBindings: Set[Class[_]] = + Set(classOf[java.io.Serializable], classOf[java.io.Serializable], classOf[java.lang.Comparable[_]]) def isGZipped(bytes: Array[Byte]): Boolean = { (bytes ne null) && (bytes.length >= 2) && @@ -175,7 +175,7 @@ import pekko.util.OptionVal * Configuration in `pekko.serialization.jackson` section. * It will load Jackson modules defined in configuration `jackson-modules`. * - * It will compress the payload if the compression `algorithm` is enabled and the + * It will compress the payload if the compression `algorithm` is enabled and the the * payload is larger than the configured `compress-larger-than` value. */ @InternalApi private[pekko] abstract class JacksonSerializer( @@ -222,7 +222,7 @@ import pekko.util.OptionVal } private val typeInManifest: Boolean = conf.getBoolean("type-in-manifest") // Calculated eagerly so as to fail fast - private val configuredDeserializationType: Option[Class[? <: AnyRef]] = conf.getString("deserialization-type") match { + private val configuredDeserializationType: Option[Class[_ <: AnyRef]] = conf.getString("deserialization-type") match { case "" => None case className => system.dynamicAccess.getClassFor[AnyRef](className) match { @@ -237,7 +237,7 @@ import pekko.util.OptionVal private lazy val serialization = SerializationExtension(system) // This must be lazy since it depends on serialization above - private lazy val deserializationType: Option[Class[? <: AnyRef]] = if (typeInManifest) { + private lazy val deserializationType: Option[Class[_ <: AnyRef]] = if (typeInManifest) { None } else { configuredDeserializationType.orElse { @@ -396,7 +396,7 @@ import pekko.util.OptionVal bytes: Array[Byte], decompressBytes: Array[Byte], startTime: Long, - clazz: Class[? <: AnyRef]): Unit = { + clazz: Class[_ <: AnyRef]): Unit = { if (isDebugEnabled) { val durationMicros = (System.nanoTime - startTime) / 1000 if (bytes.length == decompressBytes.length) @@ -427,7 +427,7 @@ import pekko.util.OptionVal } } - private def checkAllowedClass(clazz: Class[?]): Unit = { + private def checkAllowedClass(clazz: Class[_]): Unit = { if (!denyList.isAllowedClass(clazz)) { val warnMsg = s"Can't serialize/deserialize object of type [${clazz.getName}] in [${getClass.getName}]. " + s"Not allowed for security reasons." @@ -458,11 +458,11 @@ import pekko.util.OptionVal * That is also possible when changing a binding from a JacksonSerializer to another serializer (e.g. protobuf) * and still bind with the same class (interface). */ - private def isInAllowList(clazz: Class[?]): Boolean = { + private def isInAllowList(clazz: Class[_]): Boolean = { isBoundToJacksonSerializer(clazz) || hasAllowedClassPrefix(clazz.getName) } - private def isBoundToJacksonSerializer(clazz: Class[?]): Boolean = { + private def isBoundToJacksonSerializer(clazz: Class[_]): Boolean = { try { // The reason for using isInstanceOf rather than `eq this` is to allow change of // serializer within the Jackson family, but we don't trust other serializers @@ -486,7 +486,7 @@ import pekko.util.OptionVal */ private def checkAllowedSerializationBindings(): Unit = { if (!serializationBindingsCheckedOk) { - def isBindingOk(clazz: Class[?]): Boolean = + def isBindingOk(clazz: Class[_]): Boolean = try { serialization.serializerFor(clazz) ne this } catch { diff --git a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/StreamRefModule.scala b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/StreamRefModule.scala index 59cd8a56ad8..3d588271e11 100644 --- a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/StreamRefModule.scala +++ b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/StreamRefModule.scala @@ -33,8 +33,8 @@ import pekko.stream.StreamRefResolver * INTERNAL API: Adds support for serializing and deserializing [[pekko.stream.SourceRef]] and [[pekko.stream.SinkRef]]. */ @InternalApi private[pekko] trait StreamRefModule extends JacksonModule { - addSerializer(classOf[SourceRef[?]], () => SourceRefSerializer.instance, () => SourceRefDeserializer.instance) - addSerializer(classOf[SinkRef[?]], () => SinkRefSerializer.instance, () => SinkRefDeserializer.instance) + addSerializer(classOf[SourceRef[_]], () => SourceRefSerializer.instance, () => SourceRefDeserializer.instance) + addSerializer(classOf[SinkRef[_]], () => SinkRefSerializer.instance, () => SinkRefDeserializer.instance) } /** @@ -48,10 +48,10 @@ import pekko.stream.StreamRefResolver * INTERNAL API */ @InternalApi private[pekko] class SourceRefSerializer - extends StdScalarSerializer[SourceRef[?]](classOf[SourceRef[?]]) + extends StdScalarSerializer[SourceRef[_]](classOf[SourceRef[_]]) with ActorSystemAccess { - override def serialize(value: SourceRef[?], jgen: JsonGenerator, provider: SerializerProvider): Unit = { + override def serialize(value: SourceRef[_], jgen: JsonGenerator, provider: SerializerProvider): Unit = { val resolver = StreamRefResolver(currentSystem()) val serializedSourceRef = resolver.toSerializationFormat(value) jgen.writeString(serializedSourceRef) @@ -69,15 +69,15 @@ import pekko.stream.StreamRefResolver * INTERNAL API */ @InternalApi private[pekko] class SourceRefDeserializer - extends StdScalarDeserializer[SourceRef[?]](classOf[SourceRef[?]]) + extends StdScalarDeserializer[SourceRef[_]](classOf[SourceRef[_]]) with ActorSystemAccess { - def deserialize(jp: JsonParser, ctxt: DeserializationContext): SourceRef[?] = { + def deserialize(jp: JsonParser, ctxt: DeserializationContext): SourceRef[_] = { if (jp.currentTokenId() == JsonTokenId.ID_STRING) { val serializedSourceRef = jp.getText() StreamRefResolver(currentSystem()).resolveSourceRef(serializedSourceRef) } else - ctxt.handleUnexpectedToken(handledType(), jp).asInstanceOf[SourceRef[?]] + ctxt.handleUnexpectedToken(handledType(), jp).asInstanceOf[SourceRef[_]] } } @@ -92,10 +92,10 @@ import pekko.stream.StreamRefResolver * INTERNAL API */ @InternalApi private[pekko] class SinkRefSerializer - extends StdScalarSerializer[SinkRef[?]](classOf[SinkRef[?]]) + extends StdScalarSerializer[SinkRef[_]](classOf[SinkRef[_]]) with ActorSystemAccess { - override def serialize(value: SinkRef[?], jgen: JsonGenerator, provider: SerializerProvider): Unit = { + override def serialize(value: SinkRef[_], jgen: JsonGenerator, provider: SerializerProvider): Unit = { val resolver = StreamRefResolver(currentSystem()) val serializedSinkRef = resolver.toSerializationFormat(value) jgen.writeString(serializedSinkRef) @@ -113,14 +113,14 @@ import pekko.stream.StreamRefResolver * INTERNAL API */ @InternalApi private[pekko] class SinkRefDeserializer - extends StdScalarDeserializer[SinkRef[?]](classOf[SinkRef[?]]) + extends StdScalarDeserializer[SinkRef[_]](classOf[SinkRef[_]]) with ActorSystemAccess { - def deserialize(jp: JsonParser, ctxt: DeserializationContext): SinkRef[?] = { + def deserialize(jp: JsonParser, ctxt: DeserializationContext): SinkRef[_] = { if (jp.currentTokenId() == JsonTokenId.ID_STRING) { val serializedSinkref = jp.getText() StreamRefResolver(currentSystem()).resolveSinkRef(serializedSinkref) } else - ctxt.handleUnexpectedToken(handledType(), jp).asInstanceOf[SinkRef[?]] + ctxt.handleUnexpectedToken(handledType(), jp).asInstanceOf[SinkRef[_]] } } diff --git a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/TypedActorRefModule.scala b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/TypedActorRefModule.scala index 0862ded911b..7d73b1c944e 100644 --- a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/TypedActorRefModule.scala +++ b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/TypedActorRefModule.scala @@ -31,7 +31,7 @@ import pekko.annotation.InternalApi * INTERNAL API: Adds support for serializing and deserializing [[pekko.actor.typed.ActorRef]]. */ @InternalApi private[pekko] trait TypedActorRefModule extends JacksonModule { - addSerializer(classOf[ActorRef[?]], () => TypedActorRefSerializer.instance, () => TypedActorRefDeserializer.instance) + addSerializer(classOf[ActorRef[_]], () => TypedActorRefSerializer.instance, () => TypedActorRefDeserializer.instance) } /** @@ -45,9 +45,9 @@ import pekko.annotation.InternalApi * INTERNAL API */ @InternalApi private[pekko] class TypedActorRefSerializer - extends StdScalarSerializer[ActorRef[?]](classOf[ActorRef[?]]) + extends StdScalarSerializer[ActorRef[_]](classOf[ActorRef[_]]) with ActorSystemAccess { - override def serialize(value: ActorRef[?], jgen: JsonGenerator, provider: SerializerProvider): Unit = { + override def serialize(value: ActorRef[_], jgen: JsonGenerator, provider: SerializerProvider): Unit = { val serializedActorRef = ActorRefResolver(currentSystem().toTyped).toSerializationFormat(value) jgen.writeString(serializedActorRef) } @@ -64,14 +64,14 @@ import pekko.annotation.InternalApi * INTERNAL API */ @InternalApi private[pekko] class TypedActorRefDeserializer - extends StdScalarDeserializer[ActorRef[?]](classOf[ActorRef[?]]) + extends StdScalarDeserializer[ActorRef[_]](classOf[ActorRef[_]]) with ActorSystemAccess { - def deserialize(jp: JsonParser, ctxt: DeserializationContext): ActorRef[?] = { + def deserialize(jp: JsonParser, ctxt: DeserializationContext): ActorRef[_] = { if (jp.currentTokenId() == JsonTokenId.ID_STRING) { val serializedActorRef = jp.getText() ActorRefResolver(currentSystem().toTyped).resolveActorRef(serializedActorRef) } else - ctxt.handleUnexpectedToken(handledType(), jp).asInstanceOf[ActorRef[?]] + ctxt.handleUnexpectedToken(handledType(), jp).asInstanceOf[ActorRef[_]] } } diff --git a/serialization-jackson3/src/main/scala/org/apache/pekko/serialization/jackson3/JacksonModule.scala b/serialization-jackson3/src/main/scala/org/apache/pekko/serialization/jackson3/JacksonModule.scala index 41256ad2e67..ef02a795b12 100644 --- a/serialization-jackson3/src/main/scala/org/apache/pekko/serialization/jackson3/JacksonModule.scala +++ b/serialization-jackson3/src/main/scala/org/apache/pekko/serialization/jackson3/JacksonModule.scala @@ -43,13 +43,13 @@ import pekko.annotation.InternalApi VersionUtil.parseVersion(version, groupId, artifactId) } - class SerializerResolverByClass(clazz: Class[?], deserializer: () => ValueSerializer[?]) extends Serializers.Base { + class SerializerResolverByClass(clazz: Class[_], deserializer: () => ValueSerializer[_]) extends Serializers.Base { override def findSerializer( config: SerializationConfig, javaType: JavaType, beanDesc: BeanDescription.Supplier, - formatOverrides: JsonFormat.Value): ValueSerializer[?] = { + formatOverrides: JsonFormat.Value): ValueSerializer[_] = { if (clazz.isAssignableFrom(javaType.getRawClass)) deserializer() else @@ -58,20 +58,20 @@ import pekko.annotation.InternalApi } - class DeserializerResolverByClass(clazz: Class[?], serializer: () => ValueDeserializer[?]) + class DeserializerResolverByClass(clazz: Class[_], serializer: () => ValueDeserializer[_]) extends Deserializers.Base { override def findBeanDeserializer( javaType: JavaType, config: DeserializationConfig, - beanDesc: BeanDescription.Supplier): ValueDeserializer[?] = { + beanDesc: BeanDescription.Supplier): ValueDeserializer[_] = { if (clazz.isAssignableFrom(javaType.getRawClass)) serializer() else super.findBeanDeserializer(javaType, config, beanDesc) } - override def hasDeserializerFor(config: DeserializationConfig, valueType: Class[?]): Boolean = + override def hasDeserializerFor(config: DeserializationConfig, valueType: Class[_]): Boolean = clazz.isAssignableFrom(valueType) } } @@ -98,9 +98,9 @@ import pekko.annotation.InternalApi } def addSerializer( - clazz: Class[?], - serializer: () => ValueSerializer[?], - deserializer: () => ValueDeserializer[?]): this.type = { + clazz: Class[_], + serializer: () => ValueSerializer[_], + deserializer: () => ValueDeserializer[_]): this.type = { this += { ctx => ctx.addSerializers(new SerializerResolverByClass(clazz, serializer)) ctx.addDeserializers(new DeserializerResolverByClass(clazz, deserializer)) diff --git a/serialization-jackson3/src/main/scala/org/apache/pekko/serialization/jackson3/JacksonObjectMapperProvider.scala b/serialization-jackson3/src/main/scala/org/apache/pekko/serialization/jackson3/JacksonObjectMapperProvider.scala index 7dbe434ab7a..ae83185ba21 100644 --- a/serialization-jackson3/src/main/scala/org/apache/pekko/serialization/jackson3/JacksonObjectMapperProvider.scala +++ b/serialization-jackson3/src/main/scala/org/apache/pekko/serialization/jackson3/JacksonObjectMapperProvider.scala @@ -320,9 +320,9 @@ object JacksonObjectMapperProvider extends ExtensionId[JacksonObjectMapperProvid private def configureObjectVisibility( bindingName: String, - builder: MapperBuilder[ObjectMapper, ?], + builder: MapperBuilder[ObjectMapper, _], objectMapperFactory: JacksonObjectMapperFactory, - config: Config): MapperBuilder[ObjectMapper, ?] = { + config: Config): MapperBuilder[ObjectMapper, _] = { val configuredVisibility: immutable.Seq[(PropertyAccessor, JsonAutoDetect.Visibility)] = configPairs(config, "visibility").map { @@ -340,17 +340,17 @@ object JacksonObjectMapperProvider extends ExtensionId[JacksonObjectMapperProvid case (property, visibility) => localVc = localVc.withVisibility(property, visibility) } localVc - }).asInstanceOf[MapperBuilder[ObjectMapper, ?]] + }).asInstanceOf[MapperBuilder[ObjectMapper, _]] } } private def configureObjectMapperModules( bindingName: String, - builder: MapperBuilder[ObjectMapper, ?], + builder: MapperBuilder[ObjectMapper, _], objectMapperFactory: JacksonObjectMapperFactory, config: Config, dynamicAccess: DynamicAccess, - log: Option[LoggingAdapter]): MapperBuilder[ObjectMapper, ?] = { + log: Option[LoggingAdapter]): MapperBuilder[ObjectMapper, _] = { val configuredModules = config.getStringList("jackson-modules").asScala val modules = configuredModules.flatMap { fqcn => @@ -402,9 +402,9 @@ object JacksonObjectMapperProvider extends ExtensionId[JacksonObjectMapperProvid val configuredJsonFactory = createJsonFactory(bindingName, objectMapperFactory, config, jsonFactory) val builder = objectMapperFactory.newObjectMapperBuilder(configuredJsonFactory) configureObjectMapperFeatures(bindingName, builder, objectMapperFactory, config) - configureObjectMapperModules(bindingName, builder.asInstanceOf[MapperBuilder[ObjectMapper, ?]], + configureObjectMapperModules(bindingName, builder.asInstanceOf[MapperBuilder[ObjectMapper, _]], objectMapperFactory, config, dynamicAccess, log) - configureObjectVisibility(bindingName, builder.asInstanceOf[MapperBuilder[ObjectMapper, ?]], + configureObjectVisibility(bindingName, builder.asInstanceOf[MapperBuilder[ObjectMapper, _]], objectMapperFactory, config) builder.build() } @@ -420,10 +420,10 @@ object JacksonObjectMapperProvider extends ExtensionId[JacksonObjectMapperProvid val configuredJsonFactory = createCBORFactory(bindingName, objectMapperFactory, config, streamFactory) val builder = objectMapperFactory.newCBORMapperBuilder(configuredJsonFactory) configureCBORMapperFeatures(bindingName, builder, objectMapperFactory, config) - configureObjectMapperModules(bindingName, builder.asInstanceOf[MapperBuilder[ObjectMapper, ?]], + configureObjectMapperModules(bindingName, builder.asInstanceOf[MapperBuilder[ObjectMapper, _]], objectMapperFactory, config, dynamicAccess, log) - configureObjectVisibility(bindingName, builder.asInstanceOf[MapperBuilder[ObjectMapper, ?]], + configureObjectVisibility(bindingName, builder.asInstanceOf[MapperBuilder[ObjectMapper, _]], objectMapperFactory, config) builder.build() } diff --git a/serialization-jackson3/src/main/scala/org/apache/pekko/serialization/jackson3/JacksonSerializer.scala b/serialization-jackson3/src/main/scala/org/apache/pekko/serialization/jackson3/JacksonSerializer.scala index 3ca46a78d66..956c34187cb 100644 --- a/serialization-jackson3/src/main/scala/org/apache/pekko/serialization/jackson3/JacksonSerializer.scala +++ b/serialization-jackson3/src/main/scala/org/apache/pekko/serialization/jackson3/JacksonSerializer.scala @@ -17,7 +17,7 @@ import java.io.{ ByteArrayOutputStream, NotSerializableException } import java.nio.ByteBuffer import java.util.zip.{ GZIPInputStream, GZIPOutputStream } -import scala.annotation.{ nowarn, tailrec } +import scala.annotation.tailrec import scala.util.{ Failure, Success } import scala.util.control.NonFatal @@ -45,7 +45,6 @@ import pekko.util.OptionVal * Not nice to depend on implementation details of Jackson, but good to use the same * list to automatically have the list updated when new classes are added in Jackson. */ - @nowarn("msg=deprecated") class GadgetClassDenyList extends SubTypeValidator { private def defaultNoDeserClassNames: java.util.Set[String] = @@ -63,14 +62,14 @@ import pekko.util.OptionVal true } - def isAllowedClass(clazz: Class[?]): Boolean = { + def isAllowedClass(clazz: Class[_]): Boolean = { if (clazz.getName.startsWith(prefixSpring)) { isAllowedSpringClass(clazz) } else true } - @tailrec private def isAllowedSpringClass(clazz: Class[?]): Boolean = { + @tailrec private def isAllowedSpringClass(clazz: Class[_]): Boolean = { if ((clazz eq null) || clazz.equals(classOf[java.lang.Object])) true else { @@ -86,8 +85,8 @@ import pekko.util.OptionVal } } - val disallowedSerializationBindings: Set[Class[?]] = - Set(classOf[java.io.Serializable], classOf[java.io.Serializable], classOf[java.lang.Comparable[?]]) + val disallowedSerializationBindings: Set[Class[_]] = + Set(classOf[java.io.Serializable], classOf[java.io.Serializable], classOf[java.lang.Comparable[_]]) def isGZipped(bytes: Array[Byte]): Boolean = { (bytes ne null) && (bytes.length >= 2) && @@ -176,7 +175,7 @@ import pekko.util.OptionVal * Configuration in `pekko.serialization.jackson` section. * It will load Jackson modules defined in configuration `jackson-modules`. * - * It will compress the payload if the compression `algorithm` is enabled and the + * It will compress the payload if the compression `algorithm` is enabled and the the * payload is larger than the configured `compress-larger-than` value. */ @InternalApi private[pekko] abstract class JacksonSerializer( @@ -223,7 +222,7 @@ import pekko.util.OptionVal } private val typeInManifest: Boolean = conf.getBoolean("type-in-manifest") // Calculated eagerly so as to fail fast - private val configuredDeserializationType: Option[Class[? <: AnyRef]] = conf.getString("deserialization-type") match { + private val configuredDeserializationType: Option[Class[_ <: AnyRef]] = conf.getString("deserialization-type") match { case "" => None case className => system.dynamicAccess.getClassFor[AnyRef](className) match { @@ -238,7 +237,7 @@ import pekko.util.OptionVal private lazy val serialization = SerializationExtension(system) // This must be lazy since it depends on serialization above - private lazy val deserializationType: Option[Class[? <: AnyRef]] = if (typeInManifest) { + private lazy val deserializationType: Option[Class[_ <: AnyRef]] = if (typeInManifest) { None } else { configuredDeserializationType.orElse { @@ -397,7 +396,7 @@ import pekko.util.OptionVal bytes: Array[Byte], decompressBytes: Array[Byte], startTime: Long, - clazz: Class[? <: AnyRef]): Unit = { + clazz: Class[_ <: AnyRef]): Unit = { if (isDebugEnabled) { val durationMicros = (System.nanoTime - startTime) / 1000 if (bytes.length == decompressBytes.length) @@ -428,7 +427,7 @@ import pekko.util.OptionVal } } - private def checkAllowedClass(clazz: Class[?]): Unit = { + private def checkAllowedClass(clazz: Class[_]): Unit = { if (!denyList.isAllowedClass(clazz)) { val warnMsg = s"Can't serialize/deserialize object of type [${clazz.getName}] in [${getClass.getName}]. " + s"Not allowed for security reasons." @@ -459,11 +458,11 @@ import pekko.util.OptionVal * That is also possible when changing a binding from a JacksonSerializer to another serializer (e.g. protobuf) * and still bind with the same class (interface). */ - private def isInAllowList(clazz: Class[?]): Boolean = { + private def isInAllowList(clazz: Class[_]): Boolean = { isBoundToJacksonSerializer(clazz) || hasAllowedClassPrefix(clazz.getName) } - private def isBoundToJacksonSerializer(clazz: Class[?]): Boolean = { + private def isBoundToJacksonSerializer(clazz: Class[_]): Boolean = { try { // The reason for using isInstanceOf rather than `eq this` is to allow change of // serializer within the Jackson family, but we don't trust other serializers @@ -487,7 +486,7 @@ import pekko.util.OptionVal */ private def checkAllowedSerializationBindings(): Unit = { if (!serializationBindingsCheckedOk) { - def isBindingOk(clazz: Class[?]): Boolean = + def isBindingOk(clazz: Class[_]): Boolean = try { serialization.serializerFor(clazz) ne this } catch { diff --git a/serialization-jackson3/src/main/scala/org/apache/pekko/serialization/jackson3/StreamRefModule.scala b/serialization-jackson3/src/main/scala/org/apache/pekko/serialization/jackson3/StreamRefModule.scala index 2756413fe1b..cf7cb1dbd64 100644 --- a/serialization-jackson3/src/main/scala/org/apache/pekko/serialization/jackson3/StreamRefModule.scala +++ b/serialization-jackson3/src/main/scala/org/apache/pekko/serialization/jackson3/StreamRefModule.scala @@ -33,8 +33,8 @@ import pekko.stream.StreamRefResolver * INTERNAL API: Adds support for serializing and deserializing [[pekko.stream.SourceRef]] and [[pekko.stream.SinkRef]]. */ @InternalApi private[pekko] trait StreamRefModule extends JacksonModule { - addSerializer(classOf[SourceRef[?]], () => SourceRefSerializer.instance, () => SourceRefDeserializer.instance) - addSerializer(classOf[SinkRef[?]], () => SinkRefSerializer.instance, () => SinkRefDeserializer.instance) + addSerializer(classOf[SourceRef[_]], () => SourceRefSerializer.instance, () => SourceRefDeserializer.instance) + addSerializer(classOf[SinkRef[_]], () => SinkRefSerializer.instance, () => SinkRefDeserializer.instance) } /** @@ -48,10 +48,10 @@ import pekko.stream.StreamRefResolver * INTERNAL API */ @InternalApi private[pekko] class SourceRefSerializer - extends StdScalarSerializer[SourceRef[?]](classOf[SourceRef[?]]) + extends StdScalarSerializer[SourceRef[_]](classOf[SourceRef[_]]) with ActorSystemAccess { - override def serialize(value: SourceRef[?], jgen: JsonGenerator, provider: SerializationContext): Unit = { + override def serialize(value: SourceRef[_], jgen: JsonGenerator, provider: SerializationContext): Unit = { val resolver = StreamRefResolver(currentSystem()) val serializedSourceRef = resolver.toSerializationFormat(value) jgen.writeString(serializedSourceRef) @@ -69,15 +69,15 @@ import pekko.stream.StreamRefResolver * INTERNAL API */ @InternalApi private[pekko] class SourceRefDeserializer - extends StdScalarDeserializer[SourceRef[?]](classOf[SourceRef[?]]) + extends StdScalarDeserializer[SourceRef[_]](classOf[SourceRef[_]]) with ActorSystemAccess { - def deserialize(jp: JsonParser, ctxt: DeserializationContext): SourceRef[?] = { + def deserialize(jp: JsonParser, ctxt: DeserializationContext): SourceRef[_] = { if (jp.currentTokenId() == JsonTokenId.ID_STRING) { val serializedSourceRef = jp.getString() StreamRefResolver(currentSystem()).resolveSourceRef(serializedSourceRef) } else - ctxt.handleUnexpectedToken(handledType(), jp).asInstanceOf[SourceRef[?]] + ctxt.handleUnexpectedToken(handledType(), jp).asInstanceOf[SourceRef[_]] } } @@ -92,10 +92,10 @@ import pekko.stream.StreamRefResolver * INTERNAL API */ @InternalApi private[pekko] class SinkRefSerializer - extends StdScalarSerializer[SinkRef[?]](classOf[SinkRef[?]]) + extends StdScalarSerializer[SinkRef[_]](classOf[SinkRef[_]]) with ActorSystemAccess { - override def serialize(value: SinkRef[?], jgen: JsonGenerator, provider: SerializationContext): Unit = { + override def serialize(value: SinkRef[_], jgen: JsonGenerator, provider: SerializationContext): Unit = { val resolver = StreamRefResolver(currentSystem()) val serializedSinkRef = resolver.toSerializationFormat(value) jgen.writeString(serializedSinkRef) @@ -113,14 +113,14 @@ import pekko.stream.StreamRefResolver * INTERNAL API */ @InternalApi private[pekko] class SinkRefDeserializer - extends StdScalarDeserializer[SinkRef[?]](classOf[SinkRef[?]]) + extends StdScalarDeserializer[SinkRef[_]](classOf[SinkRef[_]]) with ActorSystemAccess { - def deserialize(jp: JsonParser, ctxt: DeserializationContext): SinkRef[?] = { + def deserialize(jp: JsonParser, ctxt: DeserializationContext): SinkRef[_] = { if (jp.currentTokenId() == JsonTokenId.ID_STRING) { val serializedSinkref = jp.getString() StreamRefResolver(currentSystem()).resolveSinkRef(serializedSinkref) } else - ctxt.handleUnexpectedToken(handledType(), jp).asInstanceOf[SinkRef[?]] + ctxt.handleUnexpectedToken(handledType(), jp).asInstanceOf[SinkRef[_]] } } diff --git a/serialization-jackson3/src/main/scala/org/apache/pekko/serialization/jackson3/TypedActorRefModule.scala b/serialization-jackson3/src/main/scala/org/apache/pekko/serialization/jackson3/TypedActorRefModule.scala index a38b9aff80c..01436bf4ec8 100644 --- a/serialization-jackson3/src/main/scala/org/apache/pekko/serialization/jackson3/TypedActorRefModule.scala +++ b/serialization-jackson3/src/main/scala/org/apache/pekko/serialization/jackson3/TypedActorRefModule.scala @@ -31,7 +31,7 @@ import pekko.annotation.InternalApi * INTERNAL API: Adds support for serializing and deserializing [[pekko.actor.typed.ActorRef]]. */ @InternalApi private[pekko] trait TypedActorRefModule extends JacksonModule { - addSerializer(classOf[ActorRef[?]], () => TypedActorRefSerializer.instance, () => TypedActorRefDeserializer.instance) + addSerializer(classOf[ActorRef[_]], () => TypedActorRefSerializer.instance, () => TypedActorRefDeserializer.instance) } /** @@ -45,9 +45,9 @@ import pekko.annotation.InternalApi * INTERNAL API */ @InternalApi private[pekko] class TypedActorRefSerializer - extends StdScalarSerializer[ActorRef[?]](classOf[ActorRef[?]]) + extends StdScalarSerializer[ActorRef[_]](classOf[ActorRef[_]]) with ActorSystemAccess { - override def serialize(value: ActorRef[?], jgen: JsonGenerator, provider: SerializationContext): Unit = { + override def serialize(value: ActorRef[_], jgen: JsonGenerator, provider: SerializationContext): Unit = { val serializedActorRef = ActorRefResolver(currentSystem().toTyped).toSerializationFormat(value) jgen.writeString(serializedActorRef) } @@ -64,14 +64,14 @@ import pekko.annotation.InternalApi * INTERNAL API */ @InternalApi private[pekko] class TypedActorRefDeserializer - extends StdScalarDeserializer[ActorRef[?]](classOf[ActorRef[?]]) + extends StdScalarDeserializer[ActorRef[_]](classOf[ActorRef[_]]) with ActorSystemAccess { - def deserialize(jp: JsonParser, ctxt: DeserializationContext): ActorRef[?] = { + def deserialize(jp: JsonParser, ctxt: DeserializationContext): ActorRef[_] = { if (jp.currentTokenId() == JsonTokenId.ID_STRING) { val serializedActorRef = jp.getString() ActorRefResolver(currentSystem().toTyped).resolveActorRef(serializedActorRef) } else - ctxt.handleUnexpectedToken(handledType(), jp).asInstanceOf[ActorRef[?]] + ctxt.handleUnexpectedToken(handledType(), jp).asInstanceOf[ActorRef[_]] } } diff --git a/slf4j/src/main/scala/org/apache/pekko/event/slf4j/Slf4jLogger.scala b/slf4j/src/main/scala/org/apache/pekko/event/slf4j/Slf4jLogger.scala index c14a0780222..f6d6fdf4fb4 100644 --- a/slf4j/src/main/scala/org/apache/pekko/event/slf4j/Slf4jLogger.scala +++ b/slf4j/src/main/scala/org/apache/pekko/event/slf4j/Slf4jLogger.scala @@ -48,7 +48,7 @@ object Logger { * @param logSource - the textual representation of the source of this log stream * @return a Logger for the specified parameters */ - def apply(logClass: Class[?], logSource: String): SLFLogger = logClass match { + def apply(logClass: Class[_], logSource: String): SLFLogger = logClass match { case c if c == classOf[DummyClassForStringSources] => apply(logSource) case _ => SLFLoggerFactory.getLogger(logClass) } @@ -172,13 +172,13 @@ class Slf4jLogger extends Actor with SLF4JLogging with RequiresMessageQueue[Logg */ class Slf4jLoggingFilter(@nowarn("msg=never used") settings: ActorSystem.Settings, eventStream: EventStream) extends LoggingFilterWithMarker { - def isErrorEnabled(logClass: Class[?], logSource: String) = + def isErrorEnabled(logClass: Class[_], logSource: String) = (eventStream.logLevel >= ErrorLevel) && Logger(logClass, logSource).isErrorEnabled - def isWarningEnabled(logClass: Class[?], logSource: String) = + def isWarningEnabled(logClass: Class[_], logSource: String) = (eventStream.logLevel >= WarningLevel) && Logger(logClass, logSource).isWarnEnabled - def isInfoEnabled(logClass: Class[?], logSource: String) = + def isInfoEnabled(logClass: Class[_], logSource: String) = (eventStream.logLevel >= InfoLevel) && Logger(logClass, logSource).isInfoEnabled - def isDebugEnabled(logClass: Class[?], logSource: String) = + def isDebugEnabled(logClass: Class[_], logSource: String) = (eventStream.logLevel >= DebugLevel) && Logger(logClass, logSource).isDebugEnabled private def slf4jMarker(marker: LogMarker) = marker match { @@ -187,13 +187,13 @@ class Slf4jLoggingFilter(@nowarn("msg=never used") settings: ActorSystem.Setting case marker => MarkerFactory.getMarker(marker.name) } - override def isErrorEnabled(logClass: Class[?], logSource: String, marker: LogMarker): Boolean = + override def isErrorEnabled(logClass: Class[_], logSource: String, marker: LogMarker): Boolean = (eventStream.logLevel >= ErrorLevel) && Logger(logClass, logSource).isErrorEnabled(slf4jMarker(marker)) - override def isWarningEnabled(logClass: Class[?], logSource: String, marker: LogMarker): Boolean = + override def isWarningEnabled(logClass: Class[_], logSource: String, marker: LogMarker): Boolean = (eventStream.logLevel >= WarningLevel) && Logger(logClass, logSource).isWarnEnabled(slf4jMarker(marker)) - override def isInfoEnabled(logClass: Class[?], logSource: String, marker: LogMarker): Boolean = + override def isInfoEnabled(logClass: Class[_], logSource: String, marker: LogMarker): Boolean = (eventStream.logLevel >= InfoLevel) && Logger(logClass, logSource).isInfoEnabled(slf4jMarker(marker)) - override def isDebugEnabled(logClass: Class[?], logSource: String, marker: LogMarker): Boolean = + override def isDebugEnabled(logClass: Class[_], logSource: String, marker: LogMarker): Boolean = (eventStream.logLevel >= DebugLevel) && Logger(logClass, logSource).isDebugEnabled(slf4jMarker(marker)) } diff --git a/stream-testkit/src/main/scala/org/apache/pekko/stream/testkit/StreamTestKit.scala b/stream-testkit/src/main/scala/org/apache/pekko/stream/testkit/StreamTestKit.scala index 01193b39dc1..ebc90af57d6 100644 --- a/stream-testkit/src/main/scala/org/apache/pekko/stream/testkit/StreamTestKit.scala +++ b/stream-testkit/src/main/scala/org/apache/pekko/stream/testkit/StreamTestKit.scala @@ -62,7 +62,7 @@ object TestPublisher { * Publisher that subscribes the subscriber and completes after the first request. */ def lazyEmpty[T]: Publisher[T] = new Publisher[T] { - override def subscribe(subscriber: Subscriber[? >: T]): Unit = + override def subscribe(subscriber: Subscriber[_ >: T]): Unit = subscriber.onSubscribe(CompletedSubscription(subscriber)) } @@ -75,7 +75,7 @@ object TestPublisher { * Publisher that subscribes the subscriber and signals error after the first request. */ def lazyError[T](cause: Throwable): Publisher[T] = new Publisher[T] { - override def subscribe(subscriber: Subscriber[? >: T]): Unit = + override def subscribe(subscriber: Subscriber[_ >: T]): Unit = subscriber.onSubscribe(FailedSubscription(subscriber, cause)) } @@ -132,7 +132,7 @@ object TestPublisher { /** * Subscribes a given [[org.reactivestreams.Subscriber]] to this probe publisher. */ - def subscribe(subscriber: Subscriber[? >: I]): Unit = { + def subscribe(subscriber: Subscriber[_ >: I]): Unit = { val subscription: PublisherProbeSubscription[I] = new PublisherProbeSubscription[I](subscriber, probe) probe.ref ! Subscribe(subscription) if (autoOnSubscribe) subscriber.onSubscribe(subscription) @@ -1105,7 +1105,7 @@ private[stream] object StreamTestKit { override def cancel(): Unit = () } - final case class PublisherProbeSubscription[I](subscriber: Subscriber[? >: I], publisherProbe: TestProbe) + final case class PublisherProbeSubscription[I](subscriber: Subscriber[_ >: I], publisherProbe: TestProbe) extends Subscription with SubscriptionWithCancelException { def request(elements: Long): Unit = publisherProbe.ref ! RequestMore(this, elements) diff --git a/stream-testkit/src/test/scala/org/apache/pekko/stream/impl/fusing/GraphInterpreterSpecKit.scala b/stream-testkit/src/test/scala/org/apache/pekko/stream/impl/fusing/GraphInterpreterSpecKit.scala index b696708a837..bfe8d925999 100644 --- a/stream-testkit/src/test/scala/org/apache/pekko/stream/impl/fusing/GraphInterpreterSpecKit.scala +++ b/stream-testkit/src/test/scala/org/apache/pekko/stream/impl/fusing/GraphInterpreterSpecKit.scala @@ -96,19 +96,19 @@ object GraphInterpreterSpecKit { * @return Created logics and the maps of all inlets respective outlets to those logics */ private[stream] def createLogics( - stages: Array[GraphStageWithMaterializedValue[? <: Shape, ?]], - upstreams: Array[UpstreamBoundaryStageLogic[?]], - downstreams: Array[DownstreamBoundaryStageLogic[?]], + stages: Array[GraphStageWithMaterializedValue[_ <: Shape, _]], + upstreams: Array[UpstreamBoundaryStageLogic[_]], + downstreams: Array[DownstreamBoundaryStageLogic[_]], attributes: Array[Attributes] = Array.empty)(implicit system: ActorSystem) - : (Array[GraphStageLogic], SMap[Inlet[?], GraphStageLogic], SMap[Outlet[?], GraphStageLogic]) = { + : (Array[GraphStageLogic], SMap[Inlet[_], GraphStageLogic], SMap[Outlet[_], GraphStageLogic]) = { if (attributes.nonEmpty && attributes.length != stages.length) throw new IllegalArgumentException("Attributes must be either empty or one per stage") @nowarn("msg=deprecated") val defaultAttributes = ActorMaterializerSettings(system).toAttributes - var inOwners = SMap.empty[Inlet[?], GraphStageLogic] - var outOwners = SMap.empty[Outlet[?], GraphStageLogic] + var inOwners = SMap.empty[Inlet[_], GraphStageLogic] + var outOwners = SMap.empty[Outlet[_], GraphStageLogic] val logics = new Array[GraphStageLogic](upstreams.length + stages.length + downstreams.length) var idx = 0 @@ -206,9 +206,9 @@ object GraphInterpreterSpecKit { * Create interpreter connections for all the given `connectedPorts`. */ private[stream] def createConnections( - connectedPorts: Seq[(Outlet[?], Inlet[?])], - inOwners: SMap[Inlet[?], GraphStageLogic], - outOwners: SMap[Outlet[?], GraphStageLogic]): Array[Connection] = { + connectedPorts: Seq[(Outlet[_], Inlet[_])], + inOwners: SMap[Inlet[_], GraphStageLogic], + outOwners: SMap[Outlet[_], GraphStageLogic]): Array[Connection] = { val connections = new Array[Connection](connectedPorts.size) connectedPorts.zipWithIndex.foreach { @@ -239,7 +239,7 @@ object GraphInterpreterSpecKit { } } - private def setPortIds(stage: GraphStageWithMaterializedValue[? <: Shape, ?]): Unit = { + private def setPortIds(stage: GraphStageWithMaterializedValue[_ <: Shape, _]): Unit = { stage.shape.inlets.zipWithIndex.foreach { case (inlet, idx) => inlet.id = idx } stage.shape.outlets.zipWithIndex.foreach { case (inlet, idx) => inlet.id = idx } } @@ -296,10 +296,10 @@ trait GraphInterpreterSpecKit extends StreamSpec { override def toString = "Downstream" } - class AssemblyBuilder(operators: Seq[GraphStageWithMaterializedValue[? <: Shape, ?]]) { - private var upstreams = Vector.empty[UpstreamBoundaryStageLogic[?]] - private var downstreams = Vector.empty[DownstreamBoundaryStageLogic[?]] - private var connectedPorts = Vector.empty[(Outlet[?], Inlet[?])] + class AssemblyBuilder(operators: Seq[GraphStageWithMaterializedValue[_ <: Shape, _]]) { + private var upstreams = Vector.empty[UpstreamBoundaryStageLogic[_]] + private var downstreams = Vector.empty[DownstreamBoundaryStageLogic[_]] + private var connectedPorts = Vector.empty[(Outlet[_], Inlet[_])] def connect[T](upstream: UpstreamBoundaryStageLogic[T], in: Inlet[T]): AssemblyBuilder = { upstreams :+= upstream @@ -343,7 +343,7 @@ trait GraphInterpreterSpecKit extends StreamSpec { _interpreter.init(null) } - def builder(operators: GraphStageWithMaterializedValue[? <: Shape, ?]*): AssemblyBuilder = + def builder(operators: GraphStageWithMaterializedValue[_ <: Shape, _]*): AssemblyBuilder = new AssemblyBuilder(operators.toVector) } diff --git a/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/ChainSetup.scala b/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/ChainSetup.scala index 7e6e7b51244..bc824c6835b 100644 --- a/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/ChainSetup.scala +++ b/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/ChainSetup.scala @@ -30,13 +30,13 @@ class ChainSetup[In, Out, M]( stream: Flow[In, In, NotUsed] => Flow[In, Out, M], val settings: ActorMaterializerSettings, materializer: Materializer, - toPublisher: (Source[Out, ?], Materializer) => Publisher[Out])(implicit val system: ActorSystem) { + toPublisher: (Source[Out, _], Materializer) => Publisher[Out])(implicit val system: ActorSystem) { @nowarn("msg=deprecated") def this( stream: Flow[In, In, NotUsed] => Flow[In, Out, M], settings: ActorMaterializerSettings, - toPublisher: (Source[Out, ?], Materializer) => Publisher[Out])(implicit system: ActorSystem) = + toPublisher: (Source[Out, _], Materializer) => Publisher[Out])(implicit system: ActorSystem) = this(stream, settings, ActorMaterializer(settings)(system), toPublisher)(system) @nowarn("msg=deprecated") @@ -44,7 +44,7 @@ class ChainSetup[In, Out, M]( stream: Flow[In, In, NotUsed] => Flow[In, Out, M], settings: ActorMaterializerSettings, materializerCreator: (ActorMaterializerSettings, ActorRefFactory) => Materializer, - toPublisher: (Source[Out, ?], Materializer) => Publisher[Out])(implicit system: ActorSystem) = + toPublisher: (Source[Out, _], Materializer) => Publisher[Out])(implicit system: ActorSystem) = this(stream, settings, materializerCreator(settings, system), toPublisher)(system) val upstream = TestPublisher.manualProbe[In]() diff --git a/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/ScriptedTest.scala b/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/ScriptedTest.scala index 6b2cbeac99f..0f4925556fe 100644 --- a/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/ScriptedTest.scala +++ b/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/ScriptedTest.scala @@ -39,7 +39,7 @@ trait ScriptedTest extends Matchers { class ScriptException(msg: String) extends RuntimeException(msg) - def toPublisher[In, Out]: (Source[Out, ?], Materializer) => Publisher[Out] = + def toPublisher[In, Out]: (Source[Out, _], Materializer) => Publisher[Out] = (f, m) => f.runWith(Sink.asPublisher(false))(m) object Script { diff --git a/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/StreamSpec.scala b/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/StreamSpec.scala index fea0f7df0c8..43c458f52d1 100644 --- a/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/StreamSpec.scala +++ b/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/StreamSpec.scala @@ -39,7 +39,7 @@ abstract class StreamSpec(_system: ActorSystem) extends PekkoSpec(_system) with def this(s: String) = this(ConfigFactory.parseString(s)) - def this(configMap: Map[String, ?]) = this(PekkoSpec.mapToConfig(configMap)) + def this(configMap: Map[String, _]) = this(PekkoSpec.mapToConfig(configMap)) def this() = this(ActorSystem(TestKitUtils.testNameFromCallStack(classOf[StreamSpec], "".r), PekkoSpec.testConf)) diff --git a/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/TwoStreamsSetup.scala b/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/TwoStreamsSetup.scala index 90cc495ba64..16960ae5abb 100644 --- a/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/TwoStreamsSetup.scala +++ b/stream-testkit/src/test/scala/org/apache/pekko/stream/testkit/TwoStreamsSetup.scala @@ -27,7 +27,7 @@ abstract class TwoStreamsSetup extends BaseTwoStreamsSetup { def out: Outlet[Outputs] } - def fixture(b: GraphDSL.Builder[?]): Fixture + def fixture(b: GraphDSL.Builder[_]): Fixture override def setup(p1: Publisher[Int], p2: Publisher[Int]) = { val subscriber = TestSubscriber.probe[Outputs]() diff --git a/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/FlatMapConcatDoubleSubscriberTest.scala b/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/FlatMapConcatDoubleSubscriberTest.scala index 9b40eee99a8..d8f577af666 100644 --- a/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/FlatMapConcatDoubleSubscriberTest.scala +++ b/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/FlatMapConcatDoubleSubscriberTest.scala @@ -26,7 +26,7 @@ class FlatMapConcatDoubleSubscriberTest extends PekkoSubscriberBlackboxVerificat val subscriber = Promise[Subscriber[Int]]() Source .single(Source.fromPublisher(new Publisher[Int] { - def subscribe(s: Subscriber[? >: Int]): Unit = + def subscribe(s: Subscriber[_ >: Int]): Unit = subscriber.success(s.asInstanceOf[Subscriber[Int]]) })) .flatten diff --git a/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/PekkoIdentityProcessorVerification.scala b/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/PekkoIdentityProcessorVerification.scala index b3f29b076d2..606d69466d9 100644 --- a/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/PekkoIdentityProcessorVerification.scala +++ b/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/PekkoIdentityProcessorVerification.scala @@ -47,7 +47,7 @@ abstract class PekkoIdentityProcessorVerification[T](env: TestEnvironment, publi override def onError(t: Throwable): Unit = sub.onError(t) override def onComplete(): Unit = sub.onComplete() override def onNext(t: T): Unit = sub.onNext(t) - override def subscribe(s: Subscriber[? >: T]): Unit = pub.subscribe(s) + override def subscribe(s: Subscriber[_ >: T]): Unit = pub.subscribe(s) } } diff --git a/stream-tests/src/test/java/org/apache/pekko/stream/javadsl/TcpTest.java b/stream-tests/src/test/java/org/apache/pekko/stream/javadsl/TcpTest.java index b0b7d62ce56..43000127de3 100644 --- a/stream-tests/src/test/java/org/apache/pekko/stream/javadsl/TcpTest.java +++ b/stream-tests/src/test/java/org/apache/pekko/stream/javadsl/TcpTest.java @@ -49,6 +49,7 @@ import java.util.concurrent.TimeUnit; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; // #setting-up-ssl-engine // imports diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/DslConsistencySpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/DslConsistencySpec.scala index 1befcaefb76..04b8bbe3fed 100755 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/DslConsistencySpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/DslConsistencySpec.scala @@ -38,23 +38,23 @@ object DslConsistencySpec { class DslConsistencySpec extends AnyWordSpec with Matchers { - val sFlowClass: Class[?] = classOf[pekko.stream.scaladsl.Flow[?, ?, ?]] - val jFlowClass: Class[?] = classOf[pekko.stream.javadsl.Flow[?, ?, ?]] + val sFlowClass: Class[_] = classOf[pekko.stream.scaladsl.Flow[_, _, _]] + val jFlowClass: Class[_] = classOf[pekko.stream.javadsl.Flow[_, _, _]] - val sSubFlowClass: Class[?] = classOf[DslConsistencySpec.ScalaSubFlow[?, ?, ?]] - val jSubFlowClass: Class[?] = classOf[pekko.stream.javadsl.SubFlow[?, ?, ?]] + val sSubFlowClass: Class[_] = classOf[DslConsistencySpec.ScalaSubFlow[_, _, _]] + val jSubFlowClass: Class[_] = classOf[pekko.stream.javadsl.SubFlow[_, _, _]] - val sSourceClass: Class[?] = classOf[pekko.stream.scaladsl.Source[?, ?]] - val jSourceClass: Class[?] = classOf[pekko.stream.javadsl.Source[?, ?]] + val sSourceClass: Class[_] = classOf[pekko.stream.scaladsl.Source[_, _]] + val jSourceClass: Class[_] = classOf[pekko.stream.javadsl.Source[_, _]] - val sSubSourceClass: Class[?] = classOf[DslConsistencySpec.ScalaSubSource[?, ?]] - val jSubSourceClass: Class[?] = classOf[pekko.stream.javadsl.SubSource[?, ?]] + val sSubSourceClass: Class[_] = classOf[DslConsistencySpec.ScalaSubSource[_, _]] + val jSubSourceClass: Class[_] = classOf[pekko.stream.javadsl.SubSource[_, _]] - val sSinkClass: Class[?] = classOf[pekko.stream.scaladsl.Sink[?, ?]] - val jSinkClass: Class[?] = classOf[pekko.stream.javadsl.Sink[?, ?]] + val sSinkClass: Class[_] = classOf[pekko.stream.scaladsl.Sink[_, _]] + val jSinkClass: Class[_] = classOf[pekko.stream.javadsl.Sink[_, _]] - val jRunnableGraphClass: Class[?] = classOf[pekko.stream.javadsl.RunnableGraph[?]] - val sRunnableGraphClass: Class[?] = classOf[pekko.stream.scaladsl.RunnableGraph[?]] + val jRunnableGraphClass: Class[_] = classOf[pekko.stream.javadsl.RunnableGraph[_]] + val sRunnableGraphClass: Class[_] = classOf[pekko.stream.scaladsl.RunnableGraph[_]] val ignore: Set[String] = Set("equals", "hashCode", "notify", "notifyAll", "wait", "toString", "getClass") ++ @@ -98,7 +98,7 @@ class DslConsistencySpec extends AnyWordSpec with Matchers { val forComprehensions = Set("withFilter", "flatMap", "foreach") - val allowMissing: Map[Class[?], Set[String]] = Map( + val allowMissing: Map[Class[_], Set[String]] = Map( jFlowClass -> (graphHelpers ++ forComprehensions), jSourceClass -> (graphHelpers ++ forComprehensions ++ Set("watch", "ask")), // Java subflows can only be nested using .via and .to (due to type system restrictions) @@ -118,7 +118,7 @@ class DslConsistencySpec extends AnyWordSpec with Matchers { @nowarn def materializing(m: Method): Boolean = m.getParameterTypes.contains(classOf[Materializer]) - def assertHasMethod(c: Class[?], name: String): Unit = { + def assertHasMethod(c: Class[_], name: String): Unit = { // include class name to get better error message if (!allowMissing.getOrElse(c, Set.empty).contains(name)) c.getMethods.collect { case m if !ignore(m.getName) => c.getName + "." + m.getName } should contain( @@ -127,12 +127,12 @@ class DslConsistencySpec extends AnyWordSpec with Matchers { "Java and Scala DSLs" must { - (("Source" -> List[Class[?]](sSourceClass, jSourceClass)) :: - ("SubSource" -> List[Class[?]](sSubSourceClass, jSubSourceClass)) :: - ("Flow" -> List[Class[?]](sFlowClass, jFlowClass)) :: - ("SubFlow" -> List[Class[?]](sSubFlowClass, jSubFlowClass)) :: - ("Sink" -> List[Class[?]](sSinkClass, jSinkClass)) :: - ("RunnableFlow" -> List[Class[?]](sRunnableGraphClass, jRunnableGraphClass)) :: + (("Source" -> List[Class[_]](sSourceClass, jSourceClass)) :: + ("SubSource" -> List[Class[_]](sSubSourceClass, jSubSourceClass)) :: + ("Flow" -> List[Class[_]](sFlowClass, jFlowClass)) :: + ("SubFlow" -> List[Class[_]](sSubFlowClass, jSubFlowClass)) :: + ("Sink" -> List[Class[_]](sSinkClass, jSinkClass)) :: + ("RunnableFlow" -> List[Class[_]](sRunnableGraphClass, jRunnableGraphClass)) :: Nil).foreach { case (element, classes) => s"provide same $element transforming operators" in { diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/DslFactoriesConsistencySpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/DslFactoriesConsistencySpec.scala index 0ae5b383d53..8f9fffa1553 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/DslFactoriesConsistencySpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/DslFactoriesConsistencySpec.scala @@ -85,26 +85,26 @@ class DslFactoriesConsistencySpec extends AnyWordSpec with Matchers { (2 to 22) .map { i => (Class.forName(s"scala.Function$i"), Class.forName(s"org.apache.pekko.japi.function.Function$i")) }.toList // format: ON - val sSource = classOf[scaladsl.Source[?, ?]] - val jSource = classOf[javadsl.Source[?, ?]] + val sSource = classOf[scaladsl.Source[_, _]] + val jSource = classOf[javadsl.Source[_, _]] - val sSink = classOf[scaladsl.Sink[?, ?]] - val jSink = classOf[javadsl.Sink[?, ?]] + val sSink = classOf[scaladsl.Sink[_, _]] + val jSink = classOf[javadsl.Sink[_, _]] - val sFlow = classOf[scaladsl.Flow[?, ?, ?]] - val jFlow = classOf[javadsl.Flow[?, ?, ?]] + val sFlow = classOf[scaladsl.Flow[_, _, _]] + val jFlow = classOf[javadsl.Flow[_, _, _]] - val sRunnableGraph = classOf[scaladsl.RunnableGraph[?]] - val jRunnableGraph = classOf[javadsl.RunnableGraph[?]] + val sRunnableGraph = classOf[scaladsl.RunnableGraph[_]] + val jRunnableGraph = classOf[javadsl.RunnableGraph[_]] - val graph = classOf[Graph[?, ?]] + val graph = classOf[Graph[_, _]] - case class TestCase(name: String, sClass: Option[Class[?]], jClass: Option[Class[?]], jFactory: Option[Class[?]]) + case class TestCase(name: String, sClass: Option[Class[_]], jClass: Option[Class[_]], jFactory: Option[Class[_]]) object TestCase { - def apply(name: String, sClass: Class[?], jClass: Class[?], jFactory: Class[?]): TestCase = + def apply(name: String, sClass: Class[_], jClass: Class[_], jFactory: Class[_]): TestCase = TestCase(name, Some(sClass), Some(jClass), Some(jFactory)) - def apply(name: String, sClass: Class[?], jClass: Class[?]): TestCase = + def apply(name: String, sClass: Class[_], jClass: Class[_]): TestCase = TestCase(name, Some(sClass), Some(jClass), None) } @@ -142,19 +142,19 @@ class DslFactoriesConsistencySpec extends AnyWordSpec with Matchers { // here be dragons... - private def getJMethods(jClass: Class[?]): List[Method] = + private def getJMethods(jClass: Class[_]): List[Method] = jClass.getDeclaredMethods.filterNot(javaIgnore contains _.getName).map(toMethod).filterNot(ignore).toList - private def getSMethods(sClass: Class[?]): List[Method] = + private def getSMethods(sClass: Class[_]): List[Method] = sClass.getMethods.filterNot(scalaIgnore contains _.getName).map(toMethod).filterNot(ignore).toList private def toMethod(m: java.lang.reflect.Method): Method = Method(m.getName, List(m.getParameterTypes.toIndexedSeq: _*), m.getReturnType, m.getDeclaringClass) private case class Ignore( - cls: Class[?] => Boolean, + cls: Class[_] => Boolean, name: String => Boolean, parameters: Int => Boolean, - paramTypes: List[Class[?]] => Boolean) + paramTypes: List[Class[_]] => Boolean) private def ignore(m: Method): Boolean = { val ignores = Seq( @@ -163,13 +163,13 @@ class DslFactoriesConsistencySpec extends AnyWordSpec with Matchers { _ == pekko.stream.scaladsl.Source.getClass, _ == "apply", _ == 1, - _ == List(classOf[pekko.stream.impl.SourceModule[?, ?]])), + _ == List(classOf[pekko.stream.impl.SourceModule[_, _]])), // no Java equivalent for this Scala only convenience method Ignore( _ == pekko.stream.scaladsl.Source.getClass, _ == "apply", _ == 1, - _ == List(classOf[scala.collection.immutable.Seq[?]])), + _ == List(classOf[scala.collection.immutable.Seq[_]])), // corresponding matches on java side would need to have Function23 Ignore(_ == pekko.stream.scaladsl.Source.getClass, _ == "apply", _ == 24, _ => true), Ignore(_ == pekko.stream.scaladsl.Flow.getClass, _ == "apply", _ == 24, _ => true), @@ -214,7 +214,7 @@ class DslFactoriesConsistencySpec extends AnyWordSpec with Matchers { case m if m.parameterTypes.size > 1 => m.copy( name = m.name.filter(Character.isLetter), - parameterTypes = m.parameterTypes.dropRight(1) :+ classOf[pekko.japi.function.Function[?, ?]]) + parameterTypes = m.parameterTypes.dropRight(1) :+ classOf[pekko.japi.function.Function[_, _]]) case m => m } @@ -270,7 +270,7 @@ class DslFactoriesConsistencySpec extends AnyWordSpec with Matchers { def returnTypeString(m: Method): String = m.returnType.getName.drop("pekko.stream.".length) - case class Method(name: String, parameterTypes: List[Class[?]], returnType: Class[?], declaringClass: Class[?]) + case class Method(name: String, parameterTypes: List[Class[_]], returnType: Class[_], declaringClass: Class[_]) sealed trait MatchResult { def j: Method @@ -309,21 +309,21 @@ class DslFactoriesConsistencySpec extends AnyWordSpec with Matchers { * Keyed elements in scaladsl must also be keyed elements in javadsl. * If scaladsl is not a keyed type, javadsl shouldn't be as well. */ - def returnTypeMatch(s: Class[?], j: Class[?]): Boolean = + def returnTypeMatch(s: Class[_], j: Class[_]): Boolean = (sSource.isAssignableFrom(s) && jSource.isAssignableFrom(j)) || (sSink.isAssignableFrom(s) && jSink.isAssignableFrom(j)) || (sFlow.isAssignableFrom(s) && jFlow.isAssignableFrom(j)) || (sRunnableGraph.isAssignableFrom(s) && jRunnableGraph.isAssignableFrom(j)) || (graph.isAssignableFrom(s) && graph.isAssignableFrom(j)) - def typeMatch(scalaParams: List[Class[?]], javaParams: List[Class[?]]): Boolean = + def typeMatch(scalaParams: List[Class[_]], javaParams: List[Class[_]]): Boolean = (scalaParams, javaParams) match { case (s, j) if s == j => true case (s, j) if s.zip(j).forall(typeMatch) => true case _ => false } - def typeMatch(p: (Class[?], Class[?])): Boolean = + def typeMatch(p: (Class[_], Class[_])): Boolean = if (p._1 == p._2) true else if (`scala -> java types` contains p) true else false diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/impl/FanoutPublisherBehaviorSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/impl/FanoutPublisherBehaviorSpec.scala index 94357b9cf0a..884db05a05d 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/impl/FanoutPublisherBehaviorSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/impl/FanoutPublisherBehaviorSpec.scala @@ -21,6 +21,7 @@ import scala.concurrent.Await import scala.concurrent.duration._ import org.apache.pekko +import pekko.testkit.EventFilter import pekko.stream.{ AbruptStageTerminationException, ActorAttributes, @@ -31,12 +32,11 @@ import pekko.stream.{ import pekko.stream.scaladsl.Keep import pekko.stream.scaladsl.Sink import pekko.stream.scaladsl.Source -import pekko.stream.testkit.StreamSpec import pekko.stream.testkit.TestPublisher +import pekko.stream.testkit.StreamSpec import pekko.stream.testkit.TestSubscriber -import pekko.stream.testkit.Utils.TE import pekko.stream.testkit.scaladsl.TestSink -import pekko.testkit.EventFilter +import pekko.stream.testkit.Utils.TE class FanoutPublisherBehaviorSpec extends StreamSpec { diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/impl/FixedBufferSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/impl/FixedBufferSpec.scala index a3d27efaf65..1ad64742591 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/impl/FixedBufferSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/impl/FixedBufferSpec.scala @@ -113,8 +113,8 @@ class FixedBufferSpec extends StreamSpec { try { val cheat = buf.asInstanceOf[{ def readIdx_=(l: Long): Unit; def writeIdx_=(l: Long): Unit }] - val _: Unit = cheat.readIdx_=(Int.MaxValue) - val _: Unit = cheat.writeIdx_=(Int.MaxValue) + cheat.readIdx_=(Int.MaxValue) + cheat.writeIdx_=(Int.MaxValue) for (_ <- 1 to 10) { buf.isEmpty should be(true) @@ -141,19 +141,19 @@ class FixedBufferSpec extends StreamSpec { } "produce BoundedBuffers when capacity > max-fixed-buffer-size" in { - Buffer(Int.MaxValue, default) shouldBe a[BoundedBuffer[?]] + Buffer(Int.MaxValue, default) shouldBe a[BoundedBuffer[_]] } "produce FixedSizeBuffers when capacity < max-fixed-buffer-size" in { - Buffer(1000, default) shouldBe a[FixedSizeBuffer.ModuloFixedSizeBuffer[?]] - Buffer(1024, default) shouldBe a[FixedSizeBuffer.PowerOfTwoFixedSizeBuffer[?]] + Buffer(1000, default) shouldBe a[FixedSizeBuffer.ModuloFixedSizeBuffer[_]] + Buffer(1024, default) shouldBe a[FixedSizeBuffer.PowerOfTwoFixedSizeBuffer[_]] } "produce FixedSizeBuffers when max-fixed-buffer-size < BoundedBufferSize" in { val settings = default and ActorAttributes.maxFixedBufferSize(9) - Buffer(5, settings) shouldBe a[FixedSizeBuffer.ModuloFixedSizeBuffer[?]] - Buffer(10, settings) shouldBe a[FixedSizeBuffer.ModuloFixedSizeBuffer[?]] - Buffer(16, settings) shouldBe a[FixedSizeBuffer.PowerOfTwoFixedSizeBuffer[?]] + Buffer(5, settings) shouldBe a[FixedSizeBuffer.ModuloFixedSizeBuffer[_]] + Buffer(10, settings) shouldBe a[FixedSizeBuffer.ModuloFixedSizeBuffer[_]] + Buffer(16, settings) shouldBe a[FixedSizeBuffer.PowerOfTwoFixedSizeBuffer[_]] } } diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/impl/GraphStageLogicSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/impl/GraphStageLogicSpec.scala index 28b7b9a5243..1258b3935bc 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/impl/GraphStageLogicSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/impl/GraphStageLogicSpec.scala @@ -260,6 +260,9 @@ class GraphStageLogicSpec extends StreamSpec with GraphInterpreterSpecKit with S // note: a bit dangerous assumptions about connection and logic positions here // if anything around creating the logics and connections in the builder changes this may fail + // Save references before execute() since afterStageHasRun releases completed logics + val gLogic = interpreter.logics(1) + val passThroughLogic = interpreter.logics(2) interpreter.complete(interpreter.connections(0)) interpreter.cancel(interpreter.connections(1), SubscriptionWithCancelException.NoMoreElementsNeeded) interpreter.execute(2) @@ -269,8 +272,8 @@ class GraphStageLogicSpec extends StreamSpec with GraphInterpreterSpecKit with S interpreter.isCompleted should ===(false) interpreter.isSuspended should ===(false) - interpreter.isStageCompleted(interpreter.logics(1)) should ===(true) - interpreter.isStageCompleted(interpreter.logics(2)) should ===(false) + interpreter.isStageCompleted(gLogic) should ===(true) + interpreter.isStageCompleted(passThroughLogic) should ===(false) } "not allow push from constructor" in { diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/impl/TraversalBuilderSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/impl/TraversalBuilderSpec.scala index 9bff87c4aca..153339aeeff 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/impl/TraversalBuilderSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/impl/TraversalBuilderSpec.scala @@ -18,10 +18,10 @@ import scala.concurrent.Promise import org.apache.pekko import pekko.NotUsed import pekko.stream._ -import pekko.stream.impl.Stages.DefaultAttributes import pekko.stream.impl.TraversalTestUtils._ -import pekko.stream.impl.fusing.{ IterableSource, IteratorSource, RangeSource } +import pekko.stream.impl.Stages.DefaultAttributes import pekko.stream.impl.fusing.GraphStages.{ FutureSource, RepeatSource, SingleSource } +import pekko.stream.impl.fusing.{ IterableSource, IteratorSource, RangeSource } import pekko.stream.scaladsl.{ Keep, Source } import pekko.testkit.PekkoSpec import pekko.util.OptionVal @@ -585,7 +585,7 @@ class TraversalBuilderSpec extends PekkoSpec { "find Source.javaStreamSource via TraversalBuilder with getValuePresentedSource" in { val javaStream = java.util.stream.Stream.empty[String]() TraversalBuilder.getValuePresentedSource(Source.fromJavaStream(() => javaStream)).get - .asInstanceOf[JavaStreamSource[String, ?]].open() shouldEqual javaStream + .asInstanceOf[JavaStreamSource[String, _]].open() shouldEqual javaStream val streamSource = new JavaStreamSource(() => javaStream) TraversalBuilder.getValuePresentedSource(streamSource) should be(OptionVal.Some(streamSource)) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/impl/fusing/ActorGraphInterpreterSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/impl/fusing/ActorGraphInterpreterSpec.scala index b6919b4f1ea..84ddb87c263 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/impl/fusing/ActorGraphInterpreterSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/impl/fusing/ActorGraphInterpreterSpec.scala @@ -321,7 +321,7 @@ class ActorGraphInterpreterSpec extends StreamSpec { "be able to handle Publisher spec violations without leaking" in { val filthyPublisher = new Publisher[Int] { - override def subscribe(s: Subscriber[? >: Int]): Unit = { + override def subscribe(s: Subscriber[_ >: Int]): Unit = { s.onSubscribe(new Subscription { override def cancel(): Unit = () override def request(n: Long): Unit = throw TE("violating your spec") @@ -417,7 +417,7 @@ class ActorGraphInterpreterSpec extends StreamSpec { val done = Promise[Done]() Source .single(Source.fromPublisher(new Publisher[Int] { - def subscribe(s: Subscriber[? >: Int]): Unit = { + def subscribe(s: Subscriber[_ >: Int]): Unit = { s.onSubscribe(new Subscription { def cancel(): Unit = () def request(n: Long): Unit = () diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/impl/fusing/GraphInterpreterSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/impl/fusing/GraphInterpreterSpec.scala index 10bcb91d408..de33b0ca146 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/impl/fusing/GraphInterpreterSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/impl/fusing/GraphInterpreterSpec.scala @@ -315,6 +315,79 @@ class GraphInterpreterSpec extends StreamSpec with GraphInterpreterSpecKit { interpreter.isSuspended should be(false) } + "release references to completed stage logics to prevent memory leaks" in new TestSetup { + val source = new UpstreamProbe[Int]("source") + val sink = new DownstreamProbe[Int]("sink") + val identityStage = GraphStages.identity[Int] + + builder(identityStage) + .connect(source, identityStage.in) + .connect(identityStage.out, sink) + .init() + + lastEvents() should ===(Set.empty[TestEvent]) + + sink.requestOne() + lastEvents() should ===(Set(RequestOne(source))) + + source.onNext(1) + lastEvents() should ===(Set(OnNext(sink, 1))) + + // Get reference to the logics array + val logicsField = interpreter.getClass.getDeclaredField("logics") + logicsField.setAccessible(true) + val logics = logicsField.get(interpreter).asInstanceOf[Array[org.apache.pekko.stream.stage.GraphStageLogic]] + + // All logics should be non-null initially + logics.foreach(logic => logic should not be null) + + // Complete the source to trigger shutdown of stages + source.onComplete() + lastEvents() should ===(Set(OnComplete(sink))) + + // After finish() is called, all logics should be released + interpreter.finish() + + // After finish(), all stage logics should have been released (set to null) + logics.foreach(logic => logic should be(null)) + } + + "release references to completed stage logics when some stages complete early" in new TestSetup { + val source = new UpstreamProbe[Int]("source") + val detachStage = detacher[Int] + val identityStage = GraphStages.identity[Int] + val sink = new DownstreamProbe[Int]("sink") + + builder(detachStage, identityStage) + .connect(source, detachStage.shape.in) + .connect(detachStage.shape.out, identityStage.in) + .connect(identityStage.out, sink) + .init() + + lastEvents() should ===(Set.empty[TestEvent]) + + sink.requestOne() + lastEvents() should ===(Set(RequestOne(source))) + + // Get reference to the logics array + val logicsField = interpreter.getClass.getDeclaredField("logics") + logicsField.setAccessible(true) + val logics = logicsField.get(interpreter).asInstanceOf[Array[org.apache.pekko.stream.stage.GraphStageLogic]] + + // All logics should be non-null initially + logics.foreach(logic => logic should not be null) + + source.onNext(1) + lastEvents() should ===(Set(OnNext(sink, 1), RequestOne(source))) + + // Complete the source - this triggers completion of detacher and identity stages. + // afterStageHasRun releases logics during normal stage completion (not just in finish()). + source.onComplete() + + // After normal stage completion via afterStageHasRun, all stage logics should be released + logics.foreach(logic => logic should be(null)) + } + } } diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/io/FileSinkSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/io/FileSinkSpec.scala index e3cfc925246..30e208af68d 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/io/FileSinkSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/io/FileSinkSpec.scala @@ -26,13 +26,13 @@ import com.google.common.jimfs.{ Configuration, Jimfs } import org.apache.pekko import pekko.stream._ -import pekko.stream.SystemMaterializer import pekko.stream.impl.{ PhasedFusingActorMaterializer, StreamSupervisor } import pekko.stream.impl.StreamSupervisor.Children import pekko.stream.scaladsl.{ FileIO, Keep, Source } import pekko.stream.testkit._ import pekko.stream.testkit.Utils._ import pekko.util.ByteString +import pekko.stream.SystemMaterializer import org.scalatest.concurrent.ScalaFutures diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/io/FileSourceSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/io/FileSourceSpec.scala index e5d94c37ca2..8f6a417568c 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/io/FileSourceSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/io/FileSourceSpec.scala @@ -26,7 +26,6 @@ import com.google.common.jimfs.{ Configuration, Jimfs } import org.apache.pekko import pekko.stream._ import pekko.stream.IOResult._ -import pekko.stream.SystemMaterializer import pekko.stream.impl.{ PhasedFusingActorMaterializer, StreamSupervisor } import pekko.stream.impl.StreamSupervisor.Children import pekko.stream.io.FileSourceSpec.Settings @@ -35,6 +34,7 @@ import pekko.stream.testkit._ import pekko.stream.testkit.Utils._ import pekko.stream.testkit.scaladsl.TestSink import pekko.util.ByteString +import pekko.stream.SystemMaterializer object FileSourceSpec { final case class Settings(chunkSize: Int, readAhead: Int) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/io/TlsGraphStageEdgeCasesSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/io/TlsGraphStageEdgeCasesSpec.scala index 5f6f471179d..718867a9b83 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/io/TlsGraphStageEdgeCasesSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/io/TlsGraphStageEdgeCasesSpec.scala @@ -17,13 +17,16 @@ package org.apache.pekko.stream.io -import java.util.concurrent.atomic.AtomicInteger import javax.net.ssl.{ SSLContext, SSLEngine, SSLSession } +import java.util.concurrent.atomic.AtomicInteger + import scala.concurrent.Await import scala.concurrent.duration._ import scala.util.{ Success, Try } +import com.typesafe.config.ConfigFactory + import org.apache.pekko import pekko.NotUsed import pekko.stream._ @@ -34,8 +37,6 @@ import pekko.stream.testkit.StreamSpec import pekko.testkit.TestDuration import pekko.util.ByteString -import com.typesafe.config.ConfigFactory - /** * Edge cases for the [[TlsGraphStage]] path that are awkward to express in the * shared [[TlsGraphStageSpec]] matrix: fragmented TLS records, user-side diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/io/compression/DeflateAutoFlushSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/io/compression/DeflateAutoFlushSpec.scala index e7f2c0c8c07..284aaa3ae19 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/io/compression/DeflateAutoFlushSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/io/compression/DeflateAutoFlushSpec.scala @@ -17,11 +17,11 @@ package org.apache.pekko.stream.io.compression -import java.util.zip.Deflater - import org.apache.pekko.stream.scaladsl.{ Compression, Flow } import org.apache.pekko.util.ByteString +import java.util.zip.Deflater + class DeflateAutoFlushSpec extends DeflateSpec { override protected val encoderFlow: Flow[ByteString, ByteString, Any] = Compression.deflate(Deflater.BEST_COMPRESSION, nowrap = false, autoFlush = false) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/io/compression/GzipAutoFlushSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/io/compression/GzipAutoFlushSpec.scala index d0e83e1fc5f..031c19428b2 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/io/compression/GzipAutoFlushSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/io/compression/GzipAutoFlushSpec.scala @@ -17,11 +17,11 @@ package org.apache.pekko.stream.io.compression -import java.util.zip.Deflater - import org.apache.pekko.stream.scaladsl.{ Compression, Flow } import org.apache.pekko.util.ByteString +import java.util.zip.Deflater + class GzipAutoFlushSpec extends GzipSpec { override protected val encoderFlow: Flow[ByteString, ByteString, Any] = Compression.gzip(Deflater.BEST_COMPRESSION, autoFlush = false) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/CoupledTerminationFlowSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/CoupledTerminationFlowSpec.scala index d16943ba320..7d8ff04c5ee 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/CoupledTerminationFlowSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/CoupledTerminationFlowSpec.scala @@ -112,7 +112,7 @@ class CoupledTerminationFlowSpec extends StreamSpec(""" val probe = TestProbe() val f = Flow.fromSinkAndSourceCoupledMat(Sink.cancelled, Source.fromPublisher(new Publisher[String] { - override def subscribe(subscriber: Subscriber[? >: String]): Unit = { + override def subscribe(subscriber: Subscriber[_ >: String]): Unit = { subscriber.onSubscribe(new Subscription { override def cancel(): Unit = probe.ref ! "cancelled" @@ -159,7 +159,7 @@ class CoupledTerminationFlowSpec extends StreamSpec(""" val downstreamEffect = Sink.onComplete(s => probe.ref ! s) val upstreamEffect = Source.fromPublisher(new Publisher[String] { - override def subscribe(s: Subscriber[? >: String]): Unit = + override def subscribe(s: Subscriber[_ >: String]): Unit = s.onSubscribe(new Subscription { override def cancel(): Unit = probe.ref ! "cancel-received" diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowCompileSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowCompileSpec.scala index 12381c01668..78a58202121 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowCompileSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowCompileSpec.scala @@ -34,47 +34,47 @@ class FlowCompileSpec extends StreamSpec { "Flow" should { "not run" in { - val open: Flow[Int, Int, ?] = Flow[Int] + val open: Flow[Int, Int, _] = Flow[Int] "open.run()" shouldNot compile } "accept Iterable" in { - val f: Source[Int, ?] = intSeq.via(Flow[Int]) + val f: Source[Int, _] = intSeq.via(Flow[Int]) } "accept Future" in { - val f: Source[Int, ?] = intFut.via(Flow[Int]) + val f: Source[Int, _] = intFut.via(Flow[Int]) } "append Flow" in { - val open1: Flow[Int, String, ?] = Flow[Int].map(_.toString) - val open2: Flow[String, Int, ?] = Flow[String].map(_.hashCode) - val open3: Flow[Int, Int, ?] = open1.via(open2) + val open1: Flow[Int, String, _] = Flow[Int].map(_.toString) + val open2: Flow[String, Int, _] = Flow[String].map(_.hashCode) + val open3: Flow[Int, Int, _] = open1.via(open2) "open3.run()" shouldNot compile - val closedSource: Source[Int, ?] = intSeq.via(open3) - val closedSink: Sink[Int, ?] = open3.to(Sink.asPublisher[Int](false)) + val closedSource: Source[Int, _] = intSeq.via(open3) + val closedSink: Sink[Int, _] = open3.to(Sink.asPublisher[Int](false)) "closedSink.run()" shouldNot compile closedSource.to(Sink.asPublisher[Int](false)).run() intSeq.to(closedSink).run() } "append Sink" in { - val open: Flow[Int, String, ?] = Flow[Int].map(_.toString) - val closedSink: Sink[String, ?] = Flow[String].map(_.hashCode).to(Sink.asPublisher[Int](false)) - val appended: Sink[Int, ?] = open.to(closedSink) + val open: Flow[Int, String, _] = Flow[Int].map(_.toString) + val closedSink: Sink[String, _] = Flow[String].map(_.hashCode).to(Sink.asPublisher[Int](false)) + val appended: Sink[Int, _] = open.to(closedSink) "appended.run()" shouldNot compile "appended.to(Sink.head[Int])" shouldNot compile intSeq.to(appended).run() } "be appended to Source" in { - val open: Flow[Int, String, ?] = Flow[Int].map(_.toString) - val closedSource: Source[Int, ?] = strSeq.via(Flow[String].map(_.hashCode)) - val closedSource2: Source[String, ?] = closedSource.via(open) + val open: Flow[Int, String, _] = Flow[Int].map(_.toString) + val closedSource: Source[Int, _] = strSeq.via(Flow[String].map(_.hashCode)) + val closedSource2: Source[String, _] = closedSource.via(open) "strSeq.to(closedSource2)" shouldNot compile closedSource2.to(Sink.asPublisher[String](false)).run() } } "Sink" should { - val openSink: Sink[Int, ?] = + val openSink: Sink[Int, _] = Flow[Int].map(_.toString).to(Sink.asPublisher[String](false)) "accept Source" in { intSeq.to(openSink) @@ -88,7 +88,7 @@ class FlowCompileSpec extends StreamSpec { } "Source" should { - val openSource: Source[String, ?] = + val openSource: Source[String, _] = Source(Seq(1, 2, 3)).map(_.toString) "accept Sink" in { openSource.to(Sink.asPublisher[String](false)) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowConcatAllSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowConcatAllSpec.scala index 89bf57b86b1..47b73352f31 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowConcatAllSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowConcatAllSpec.scala @@ -117,7 +117,7 @@ class FlowConcatAllSpec extends StreamSpec(""" } "on onError on opening substream, cancel the master stream and signal error " in { - val publisher = TestPublisher.manualProbe[Source[Int, ?]]() + val publisher = TestPublisher.manualProbe[Source[Int, _]]() val subscriber = TestSubscriber.manualProbe[Int]() Source.fromPublisher(publisher).flatMapConcat(_ => throw testException).to(Sink.fromSubscriber(subscriber)).run() diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowConcatSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowConcatSpec.scala index e4aa94abe67..2b2deb052c5 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowConcatSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowConcatSpec.scala @@ -56,9 +56,9 @@ abstract class AbstractFlowConcatSpec extends BaseTwoStreamsSetup { s"${if (eager) "An eager" else "A lazy"} Concat for Flow " must { "be able to concat Flow with a Source" in { - val f1: Flow[Int, String, ?] = Flow[Int].map(_.toString + "-s") - val s1: Source[Int, ?] = Source(List(1, 2, 3)) - val s2: Source[String, ?] = Source(List(4, 5, 6)).map(_.toString + "-s") + val f1: Flow[Int, String, _] = Flow[Int].map(_.toString + "-s") + val s1: Source[Int, _] = Source(List(1, 2, 3)) + val s2: Source[String, _] = Source(List(4, 5, 6)).map(_.toString + "-s") val subs = TestSubscriber.manualProbe[Any]() val subSink = Sink.asPublisher[Any](false) @@ -74,9 +74,9 @@ abstract class AbstractFlowConcatSpec extends BaseTwoStreamsSetup { } "be able to prepend a Source to a Flow" in { - val s1: Source[String, ?] = Source(List(1, 2, 3)).map(_.toString + "-s") - val s2: Source[Int, ?] = Source(List(4, 5, 6)) - val f2: Flow[Int, String, ?] = Flow[Int].map(_.toString + "-s") + val s1: Source[String, _] = Source(List(1, 2, 3)).map(_.toString + "-s") + val s2: Source[Int, _] = Source(List(4, 5, 6)) + val f2: Flow[Int, String, _] = Flow[Int].map(_.toString + "-s") val subs = TestSubscriber.manualProbe[Any]() val subSink = Sink.asPublisher[Any](false) @@ -290,7 +290,7 @@ abstract class AbstractFlowConcatSpec extends BaseTwoStreamsSetup { // map() is not value-presented, so the optimization should not kick in for s2 here. // To exercise the optimization, build a JavaStream source whose value-presented form survives. val s2Direct = Source.fromJavaStream(() => Collections.singleton(2: Integer).stream()) - val concatDirect: Source[Integer, ?] = + val concatDirect: Source[Integer, _] = if (eager) Source.single[Integer](1).concat(s2Direct) else Source.single[Integer](1).concatLazy(s2Direct) if (!eager) concatDirect.traversalBuilder.pendingBuilder.toString should include("JavaStreamConcat") diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowGroupBySpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowGroupBySpec.scala index 4aef5e112e0..8055bded4c9 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowGroupBySpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowGroupBySpec.scala @@ -75,17 +75,17 @@ class FlowGroupBySpec extends StreamSpec(""" val max = if (maxSubstreams > 0) maxSubstreams else groupCount val groupStream = Source.fromPublisher(source).groupBy(max, _ % groupCount).lift(_ % groupCount).runWith(Sink.asPublisher(false)) - val masterSubscriber = TestSubscriber.manualProbe[(Int, Source[Int, ?])]() + val masterSubscriber = TestSubscriber.manualProbe[(Int, Source[Int, _])]() groupStream.subscribe(masterSubscriber) val masterSubscription = masterSubscriber.expectSubscription() - def getSubFlow(expectedKey: Int): Source[Int, ?] = { + def getSubFlow(expectedKey: Int): Source[Int, _] = { masterSubscription.request(1) expectSubFlow(expectedKey) } - def expectSubFlow(expectedKey: Int): Source[Int, ?] = { + def expectSubFlow(expectedKey: Int): Source[Int, _] = { val (key, substream) = masterSubscriber.expectNext() key should be(expectedKey) substream @@ -184,7 +184,7 @@ class FlowGroupBySpec extends StreamSpec(""" val publisherProbeProbe = TestPublisher.manualProbe[Int]() val publisher = Source.fromPublisher(publisherProbeProbe).groupBy(2, _ % 2).lift(_ % 2).runWith(Sink.asPublisher(false)) - val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, ?])]() + val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, _])]() publisher.subscribe(subscriber) val upstreamSubscription = publisherProbeProbe.expectSubscription() @@ -195,7 +195,7 @@ class FlowGroupBySpec extends StreamSpec(""" "work with empty input stream" in { val publisher = Source(List.empty[Int]).groupBy(2, _ % 2).lift(_ % 2).runWith(Sink.asPublisher(false)) - val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, ?])]() + val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, _])]() publisher.subscribe(subscriber) subscriber.expectSubscriptionAndComplete() @@ -205,7 +205,7 @@ class FlowGroupBySpec extends StreamSpec(""" val publisherProbeProbe = TestPublisher.manualProbe[Int]() val publisher = Source.fromPublisher(publisherProbeProbe).groupBy(2, _ % 2).lift(_ % 2).runWith(Sink.asPublisher(false)) - val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, ?])]() + val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, _])]() publisher.subscribe(subscriber) val upstreamSubscription = publisherProbeProbe.expectSubscription() @@ -223,7 +223,7 @@ class FlowGroupBySpec extends StreamSpec(""" val publisherProbeProbe = TestPublisher.manualProbe[Int]() val publisher = Source.fromPublisher(publisherProbeProbe).groupBy(2, _ % 2).lift(_ % 2).runWith(Sink.asPublisher(false)) - val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, ?])]() + val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, _])]() publisher.subscribe(subscriber) val upstreamSubscription = publisherProbeProbe.expectSubscription() diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowOnCompleteSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowOnCompleteSpec.scala index 120130e5a7a..d2badf0e408 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowOnCompleteSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowOnCompleteSpec.scala @@ -98,7 +98,7 @@ class FlowOnCompleteSpec extends StreamSpec(""" proc.expectRequest() mat.shutdown() - onCompleteProbe.expectMsgType[Failure[?]] + onCompleteProbe.expectMsgType[Failure[_]] } } diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowPrefixAndTailSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowPrefixAndTailSpec.scala index cca5fa171b2..1a6cf808529 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowPrefixAndTailSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowPrefixAndTailSpec.scala @@ -33,7 +33,7 @@ class FlowPrefixAndTailSpec extends StreamSpec(""" val testException = new Exception("test") with NoStackTrace - def newHeadSink = Sink.head[(immutable.Seq[Int], Source[Int, ?])] + def newHeadSink = Sink.head[(immutable.Seq[Int], Source[Int, _])] "work on empty input" in { val futureSink = newHeadSink @@ -172,7 +172,7 @@ class FlowPrefixAndTailSpec extends StreamSpec(""" "handle onError when no substream open" in { val publisher = TestPublisher.manualProbe[Int]() - val subscriber = TestSubscriber.manualProbe[(immutable.Seq[Int], Source[Int, ?])]() + val subscriber = TestSubscriber.manualProbe[(immutable.Seq[Int], Source[Int, _])]() Source.fromPublisher(publisher).prefixAndTail(3).to(Sink.fromSubscriber(subscriber)).run() @@ -190,7 +190,7 @@ class FlowPrefixAndTailSpec extends StreamSpec(""" "handle onError when substream is open" in { val publisher = TestPublisher.manualProbe[Int]() - val subscriber = TestSubscriber.manualProbe[(immutable.Seq[Int], Source[Int, ?])]() + val subscriber = TestSubscriber.manualProbe[(immutable.Seq[Int], Source[Int, _])]() Source.fromPublisher(publisher).prefixAndTail(1).to(Sink.fromSubscriber(subscriber)).run() @@ -217,7 +217,7 @@ class FlowPrefixAndTailSpec extends StreamSpec(""" "handle master stream cancellation" in { val publisher = TestPublisher.manualProbe[Int]() - val subscriber = TestSubscriber.manualProbe[(immutable.Seq[Int], Source[Int, ?])]() + val subscriber = TestSubscriber.manualProbe[(immutable.Seq[Int], Source[Int, _])]() Source.fromPublisher(publisher).prefixAndTail(3).to(Sink.fromSubscriber(subscriber)).run() @@ -235,7 +235,7 @@ class FlowPrefixAndTailSpec extends StreamSpec(""" "handle substream cancellation" in { val publisher = TestPublisher.manualProbe[Int]() - val subscriber = TestSubscriber.manualProbe[(immutable.Seq[Int], Source[Int, ?])]() + val subscriber = TestSubscriber.manualProbe[(immutable.Seq[Int], Source[Int, _])]() Source.fromPublisher(publisher).prefixAndTail(1).to(Sink.fromSubscriber(subscriber)).run() @@ -261,7 +261,7 @@ class FlowPrefixAndTailSpec extends StreamSpec(""" "pass along early cancellation" in { val up = TestPublisher.manualProbe[Int]() - val down = TestSubscriber.manualProbe[(immutable.Seq[Int], Source[Int, ?])]() + val down = TestSubscriber.manualProbe[(immutable.Seq[Int], Source[Int, _])]() val flowSubscriber = Source.asSubscriber[Int].prefixAndTail(1).to(Sink.fromSubscriber(down)).run() diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowScanAsyncSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowScanAsyncSpec.scala index 30ce6713026..2f86c4b431d 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowScanAsyncSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowScanAsyncSpec.scala @@ -272,7 +272,7 @@ class FlowScanAsyncSpec extends StreamSpec with Matchers { elements: immutable.Seq[String], zero: String, decider: Supervision.Decider = Supervision.stoppingDecider): Probe[String] = { - val nullFutureScanFlow: Flow[String, String, ?] = Flow[String].scanAsync(zero) { (_: String, next: String) => + val nullFutureScanFlow: Flow[String, String, _] = Flow[String].scanAsync(zero) { (_: String, next: String) => if (next != "null") Future(next) else Future(null) } diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSpec.scala index eec0390ba17..064bd0cdb57 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSpec.scala @@ -58,13 +58,13 @@ class FlowSpec extends StreamSpec(ConfigFactory.parseString("pekko.actor.debug.r val identity: Flow[Any, Any, NotUsed] => Flow[Any, Any, NotUsed] = in => in.map(e => e) val identity2: Flow[Any, Any, NotUsed] => Flow[Any, Any, NotUsed] = in => identity(in) - val toPublisher: (Source[Any, ?], Materializer) => Publisher[Any] = + val toPublisher: (Source[Any, _], Materializer) => Publisher[Any] = (f, m) => f.runWith(Sink.asPublisher(false))(m) - def toFanoutPublisher[In, Out](elasticity: Int): (Source[Out, ?], Materializer) => Publisher[Out] = + def toFanoutPublisher[In, Out](elasticity: Int): (Source[Out, _], Materializer) => Publisher[Out] = (f, m) => f.runWith(Sink.asPublisher(true).withAttributes(Attributes.inputBuffer(elasticity, elasticity)))(m) - def materializeIntoSubscriberAndPublisher[In, Out](flow: Flow[In, Out, ?]): (Subscriber[In], Publisher[Out]) = { + def materializeIntoSubscriberAndPublisher[In, Out](flow: Flow[In, Out, _]): (Subscriber[In], Publisher[Out]) = { flow.runWith(Source.asSubscriber[In], Sink.asPublisher[Out](false)) } @@ -196,9 +196,9 @@ class FlowSpec extends StreamSpec(ConfigFactory.parseString("pekko.actor.debug.r } "subscribe Subscriber" in { - val flow: Flow[String, String, ?] = Flow[String] + val flow: Flow[String, String, _] = Flow[String] val c1 = TestSubscriber.manualProbe[String]() - val sink: Sink[String, ?] = flow.to(Sink.fromSubscriber(c1)) + val sink: Sink[String, _] = flow.to(Sink.fromSubscriber(c1)) val publisher: Publisher[String] = Source(List("1", "2", "3")).runWith(Sink.asPublisher(false)) Source.fromPublisher(publisher).to(sink).run() @@ -240,7 +240,7 @@ class FlowSpec extends StreamSpec(ConfigFactory.parseString("pekko.actor.debug.r "perform transformation operation and subscribe Subscriber" in { val flow = Flow[Int].map(_.toString) val c1 = TestSubscriber.manualProbe[String]() - val sink: Sink[Int, ?] = flow.to(Sink.fromSubscriber(c1)) + val sink: Sink[Int, _] = flow.to(Sink.fromSubscriber(c1)) val publisher: Publisher[Int] = Source(List(1, 2, 3)).runWith(Sink.asPublisher(false)) Source.fromPublisher(publisher).to(sink).run() @@ -286,18 +286,18 @@ class FlowSpec extends StreamSpec(ConfigFactory.parseString("pekko.actor.debug.r } "be covariant" in { - val f1: Source[Fruit, ?] = Source.fromIterator[Fruit](fruits) + val f1: Source[Fruit, _] = Source.fromIterator[Fruit](fruits) val p1: Publisher[Fruit] = Source.fromIterator[Fruit](fruits).runWith(Sink.asPublisher(false)) - val f2: SubFlow[Fruit, ?, Source[Fruit, NotUsed]#Repr, ?] = + val f2: SubFlow[Fruit, _, Source[Fruit, NotUsed]#Repr, _] = Source.fromIterator[Fruit](fruits).splitWhen(_ => true) - val f3: SubFlow[Fruit, ?, Source[Fruit, NotUsed]#Repr, ?] = + val f3: SubFlow[Fruit, _, Source[Fruit, NotUsed]#Repr, _] = Source.fromIterator[Fruit](fruits).groupBy(2, _ => true) - val f4: Source[(immutable.Seq[Fruit], Source[Fruit, ?]), ?] = Source.fromIterator[Fruit](fruits).prefixAndTail(1) - val d1: SubFlow[Fruit, ?, Flow[String, Fruit, NotUsed]#Repr, ?] = + val f4: Source[(immutable.Seq[Fruit], Source[Fruit, _]), _] = Source.fromIterator[Fruit](fruits).prefixAndTail(1) + val d1: SubFlow[Fruit, _, Flow[String, Fruit, NotUsed]#Repr, _] = Flow[String].map(_ => new Apple).splitWhen(_ => true) - val d2: SubFlow[Fruit, ?, Flow[String, Fruit, NotUsed]#Repr, ?] = + val d2: SubFlow[Fruit, _, Flow[String, Fruit, NotUsed]#Repr, _] = Flow[String].map(_ => new Apple).groupBy(2, _ => true) - val d3: Flow[String, (immutable.Seq[Apple], Source[Fruit, ?]), ?] = + val d3: Flow[String, (immutable.Seq[Apple], Source[Fruit, _]), _] = Flow[String].map(_ => new Apple).prefixAndTail(1) } diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSplitAfterSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSplitAfterSpec.scala index 9f8144fed3a..edc9e980dc3 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSplitAfterSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSplitAfterSpec.scala @@ -68,17 +68,17 @@ class FlowSplitAfterSpec extends StreamSpec(""" .lift .withAttributes(ActorAttributes.supervisionStrategy(decider)) .runWith(Sink.asPublisher(false)) - val masterSubscriber = TestSubscriber.manualProbe[Source[Int, ?]]() + val masterSubscriber = TestSubscriber.manualProbe[Source[Int, _]]() groupStream.subscribe(masterSubscriber) val masterSubscription = masterSubscriber.expectSubscription() - def expectSubFlow(): Source[Int, ?] = { + def expectSubFlow(): Source[Int, _] = { masterSubscription.request(1) expectSubPublisher() } - def expectSubPublisher(): Source[Int, ?] = { + def expectSubPublisher(): Source[Int, _] = { val substream = masterSubscriber.expectNext() substream } diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSplitWhenSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSplitWhenSpec.scala index d9ea36e09f8..0f36f744b21 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSplitWhenSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSplitWhenSpec.scala @@ -61,17 +61,17 @@ class FlowSplitWhenSpec extends StreamSpec(""" .lift .withAttributes(ActorAttributes.supervisionStrategy(decider)) .runWith(Sink.asPublisher(false)) - val masterSubscriber = TestSubscriber.manualProbe[Source[Int, ?]]() + val masterSubscriber = TestSubscriber.manualProbe[Source[Int, _]]() groupStream.subscribe(masterSubscriber) val masterSubscription = masterSubscriber.expectSubscription() - def getSubFlow(): Source[Int, ?] = { + def getSubFlow(): Source[Int, _] = { masterSubscription.request(1) expectSubPublisher() } - def expectSubPublisher(): Source[Int, ?] = { + def expectSubPublisher(): Source[Int, _] = { val substream = masterSubscriber.expectNext() substream } diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowTakeSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowTakeSpec.scala index cc51de854bd..d6cee2b546b 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowTakeSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowTakeSpec.scala @@ -28,7 +28,7 @@ class FlowTakeSpec extends StreamSpec(""" pekko.stream.materializer.initial-input-buffer-size = 2 """) with ScriptedTest { - muteDeadLetters(classOf[OnNext], OnComplete.getClass, classOf[RequestMore[?]])() + muteDeadLetters(classOf[OnNext], OnComplete.getClass, classOf[RequestMore[_]])() "A Take" must { diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphConcatSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphConcatSpec.scala index c778c0fad67..0c3eebf7fd7 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphConcatSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphConcatSpec.scala @@ -24,7 +24,7 @@ class GraphConcatSpec extends TwoStreamsSetup { override type Outputs = Int - override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { val concat = b.add(Concat[Outputs]()) override def left: Inlet[Outputs] = concat.in(0) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeLatestSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeLatestSpec.scala index dc7fb7357e2..34c7cae69c7 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeLatestSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeLatestSpec.scala @@ -27,7 +27,7 @@ class GraphMergeLatestSpec extends TwoStreamsSetup { override type Outputs = List[Int] - override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { val merge = b.add(MergeLatest[Int](2)) override def left: Inlet[Int] = merge.in(0) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergePreferredSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergePreferredSpec.scala index 64ee4fbe64c..1b916977d99 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergePreferredSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergePreferredSpec.scala @@ -27,7 +27,7 @@ class GraphMergePreferredSpec extends TwoStreamsSetup { override type Outputs = Int - override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { val merge = b.add(MergePreferred[Outputs](1)) override def left: Inlet[Outputs] = merge.preferred diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergePrioritizedSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergePrioritizedSpec.scala index df9eacc7c71..6b6e7fc9257 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergePrioritizedSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergePrioritizedSpec.scala @@ -26,7 +26,7 @@ class GraphMergePrioritizedSpec extends TwoStreamsSetup { override type Outputs = Int - override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { val mergePrioritized = b.add(MergePrioritized[Outputs](Seq(2, 8))) override def left: Inlet[Outputs] = mergePrioritized.in(0) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSequenceSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSequenceSpec.scala index 38c4f8323d4..f39bd724a7a 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSequenceSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSequenceSpec.scala @@ -27,7 +27,7 @@ class GraphMergeSequenceSpec extends TwoStreamsSetup { override type Outputs = Int - override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { val merge = b.add(MergeSequence[Outputs](2)(i => i)) override def left: Inlet[Outputs] = merge.in(0) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSortedSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSortedSpec.scala index f97a2e85264..c387c2d0968 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSortedSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSortedSpec.scala @@ -28,7 +28,7 @@ class GraphMergeSortedSpec extends TwoStreamsSetup with ScalaCheckPropertyChecks override type Outputs = Int - override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { val merge = b.add(MergeSorted[Outputs]()) override def left: Inlet[Outputs] = merge.in0 diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSpec.scala index e75f2598c7c..0c91bde3a34 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphMergeSpec.scala @@ -26,7 +26,7 @@ class GraphMergeSpec extends TwoStreamsSetup { override type Outputs = Int - override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { val merge = b.add(Merge[Outputs](2)) override def left: Inlet[Outputs] = merge.in(0) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphOpsIntegrationSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphOpsIntegrationSpec.scala index cef5e97de79..4886b5d7cb8 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphOpsIntegrationSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphOpsIntegrationSpec.scala @@ -30,13 +30,13 @@ object GraphOpsIntegrationSpec { case class ShufflePorts[In, Out](in1: Inlet[In], in2: Inlet[In], out1: Outlet[Out], out2: Outlet[Out]) extends Shape { - override def inlets: immutable.Seq[Inlet[?]] = List(in1, in2) - override def outlets: immutable.Seq[Outlet[?]] = List(out1, out2) + override def inlets: immutable.Seq[Inlet[_]] = List(in1, in2) + override def outlets: immutable.Seq[Outlet[_]] = List(out1, out2) override def deepCopy() = ShufflePorts(in1.carbonCopy(), in2.carbonCopy(), out1.carbonCopy(), out2.carbonCopy()) } - def apply[In, Out](pipeline: Flow[In, Out, ?]): Graph[ShufflePorts[In, Out], NotUsed] = { + def apply[In, Out](pipeline: Flow[In, Out, _]): Graph[ShufflePorts[In, Out], NotUsed] = { GraphDSL.create() { implicit b => val merge = b.add(Merge[In](2)) val balance = b.add(Balance[Out](2)) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphUnzipWithSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphUnzipWithSpec.scala index 159b5c16111..6110ba4d7c0 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphUnzipWithSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphUnzipWithSpec.scala @@ -41,7 +41,7 @@ class GraphUnzipWithSpec extends StreamSpec(""" type LeftOutput = Int type RightOutput = String - abstract class Fixture(@nowarn("msg=never used") b: GraphDSL.Builder[?]) { + abstract class Fixture(@nowarn("msg=never used") b: GraphDSL.Builder[_]) { def in: Inlet[Int] def left: Outlet[LeftOutput] def right: Outlet[RightOutput] @@ -49,7 +49,7 @@ class GraphUnzipWithSpec extends StreamSpec(""" val f: (Int => (Int, String)) = b => (b + b, s"$b + $b") - def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture(b) { + def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture(b) { val unzip = b.add(UnzipWith[Int, Int, String](f)) override def in: Inlet[Int] = unzip.in @@ -207,7 +207,7 @@ class GraphUnzipWithSpec extends StreamSpec(""" rightProbe.expectNoMessage(100.millis) } - "propagate last downstream cancellation cause once all downstreams have cancelled" in { + "propagagate last downstream cancellation cause once all downstreams have cancelled" in { val probe = TestProbe() RunnableGraph .fromGraph(GraphDSL.create() { implicit b => @@ -232,7 +232,7 @@ class GraphUnzipWithSpec extends StreamSpec(""" ClosedShape }) .run() - val termination = probe.expectMsgType[Future[?]].asInstanceOf[Future[Done]] + val termination = probe.expectMsgType[Future[_]].asInstanceOf[Future[Done]] val killSwitch1 = probe.expectMsgType[UniqueKillSwitch] val killSwitch2 = probe.expectMsgType[UniqueKillSwitch] val boom = TE("Boom") diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipLatestWithSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipLatestWithSpec.scala index 1149eda4ee1..3fad74ae1f5 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipLatestWithSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipLatestWithSpec.scala @@ -27,7 +27,7 @@ class GraphZipLatestWithSpec extends TwoStreamsSetup { override type Outputs = Int - override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { val zip = b.add(ZipWith((_: Int) + (_: Int))) override def left: Inlet[Int] = zip.in0 override def right: Inlet[Int] = zip.in1 diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipNSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipNSpec.scala index ad62175d2d1..5a106cc57b7 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipNSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipNSpec.scala @@ -26,7 +26,7 @@ class GraphZipNSpec extends TwoStreamsSetup { override type Outputs = immutable.Seq[Int] - override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { val zipN = b.add(ZipN[Int](2)) override def left: Inlet[Int] = zipN.in(0) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipSpec.scala index 3be67e01348..df35cb58c46 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipSpec.scala @@ -26,7 +26,7 @@ class GraphZipSpec extends TwoStreamsSetup { override type Outputs = (Int, Int) - override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { val zip = b.add(Zip[Int, Int]()) override def left: Inlet[Int] = zip.in0 diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipWithNSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipWithNSpec.scala index deacff1f2ba..1341889462d 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipWithNSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipWithNSpec.scala @@ -26,7 +26,7 @@ class GraphZipWithNSpec extends TwoStreamsSetup { override type Outputs = Int - override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { val zip = b.add(ZipWithN((_: immutable.Seq[Int]).sum)(2)) override def left: Inlet[Int] = zip.in(0) override def right: Inlet[Int] = zip.in(1) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipWithSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipWithSpec.scala index b2a9d69856d..b57ba6b2d86 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipWithSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipWithSpec.scala @@ -25,7 +25,7 @@ class GraphZipWithSpec extends TwoStreamsSetup { override type Outputs = Int - override def fixture(b: GraphDSL.Builder[?]): Fixture = new Fixture { + override def fixture(b: GraphDSL.Builder[_]): Fixture = new Fixture { val zip = b.add(ZipWith((_: Int) + (_: Int))) override def left: Inlet[Int] = zip.in0 override def right: Inlet[Int] = zip.in1 diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/HubSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/HubSpec.scala index b32c8746b10..a6d57dee19c 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/HubSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/HubSpec.scala @@ -629,51 +629,6 @@ class HubSpec extends StreamSpec { in.sendComplete() sinkProbe2.cancel() } - - "deliver all elements in order to many consumers" in { - val consumerCount = 200 - val messageCount = 2000 - - val source = Source(0 until messageCount).runWith(BroadcastHub.sink(bufferSize = 256, - startAfterNrOfConsumers = consumerCount)) - - val futures = (0 until consumerCount).map { _ => - source.runWith(Sink.seq) - } - - val results = Await.result(Future.sequence(futures), 30.seconds) - results.foreach { result => - result should ===(0 until messageCount) - } - } - - "handle many consumers when some cancel mid-stream" in { - val totalConsumers = 64 - val cancellingConsumers = 16 - val cancelAfter = 64 - val messageCount = 512 - - val source = Source(0 until messageCount).runWith( - BroadcastHub.sink(bufferSize = 256, startAfterNrOfConsumers = totalConsumers)) - - val cancellingFutures = (0 until cancellingConsumers).map { _ => - source.take(cancelAfter).runWith(Sink.seq) - } - - val remainingFutures = (0 until (totalConsumers - cancellingConsumers)).map { _ => - source.runWith(Sink.seq) - } - - val cancellingResults = Await.result(Future.sequence(cancellingFutures), 30.seconds) - cancellingResults.foreach { result => - result should ===(0 until cancelAfter) - } - - val remainingResults = Await.result(Future.sequence(remainingFutures), 30.seconds) - remainingResults.foreach { result => - result should ===(0 until messageCount) - } - } } "PartitionHub" must { diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/RestartSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/RestartSpec.scala index 726f9d382c3..5a55b91867e 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/RestartSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/RestartSpec.scala @@ -176,7 +176,7 @@ class RestartSpec probe.requestNext("a") probe.requestNext("b") probe.request(1) - // The probe should now be backing off again with increased backoff + // The probe should now be backing off again with with increased backoff // Now wait for the delay to pass, then it will start the new source, we also want to wait for the // subsequent backoff to pass, so it resets the restart count @@ -314,7 +314,7 @@ class RestartSpec probe.requestNext("a") // There should be minBackoff delay probe.requestNext("a") - // The probe should now be backing off again with increased backoff + // The probe should now be backing off again with with increased backoff // Now wait for the delay to pass, then it will start the new source, we also want to wait for the // subsequent backoff to pass @@ -668,7 +668,7 @@ class RestartSpec // helps reuse all the setupFlow code for both methods: withBackoff, and onlyOnFailuresWithBackoff def RestartFlowFactory[In, Out]( onlyOnFailures: Boolean, - settings: RestartSettings): (() => Flow[In, Out, ?]) => Flow[In, Out, NotUsed] = + settings: RestartSettings): (() => Flow[In, Out, _]) => Flow[In, Out, NotUsed] = if (onlyOnFailures) RestartFlow.onFailuresWithBackoff(settings) else RestartFlow.withBackoff(settings) diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/SinkSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/SinkSpec.scala index 11689a3ac70..87ea68ce865 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/SinkSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/SinkSpec.scala @@ -14,7 +14,6 @@ package org.apache.pekko.stream.scaladsl import scala.annotation.nowarn -import scala.collection.immutable import scala.concurrent.{ Await, Future } import scala.concurrent.duration._ @@ -26,6 +25,8 @@ import pekko.stream.testkit._ import pekko.stream.testkit.scaladsl.{ TestSink, TestSource } import pekko.testkit.DefaultTimeout +import scala.collection.immutable + import org.reactivestreams.Publisher import org.scalatest.concurrent.ScalaFutures diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/StageActorRefSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/StageActorRefSpec.scala index 3c7f2cd265e..372e98f3ea5 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/StageActorRefSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/StageActorRefSpec.scala @@ -18,19 +18,16 @@ import scala.concurrent.Promise import scala.concurrent.duration._ import org.apache.pekko -import pekko.actor.ActorPath import pekko.actor.ActorRef import pekko.actor.Kill import pekko.actor.NoSerializationVerificationNeeded import pekko.actor.PoisonPill import pekko.event.Logging import pekko.stream._ -import pekko.stream.impl.fusing.GraphInterpreter import pekko.stream.stage.GraphStageLogic import pekko.stream.stage.GraphStageWithMaterializedValue import pekko.stream.stage.InHandler import pekko.stream.testkit.StreamSpec -import pekko.stream.testkit.scaladsl.TestSink import pekko.testkit.EventFilter import pekko.testkit.ImplicitSender import pekko.testkit.TestEvent @@ -169,7 +166,7 @@ class StageActorRefSpec extends StreamSpec with ImplicitSender { stageRef ! PoisonPill // should log a warning, and NOT stop the stage. val actorName = """StageActorRef-[\d+]""" val expectedMsg = - s"[PoisonPill|Kill] message sent to StageActorRef($actorName) will be ignored, since it is not a real Actor. " + + s"[PoisonPill|Kill] message sent to StageActorRef($actorName) will be ignored,since it is not a real Actor. " + "Use a custom message type to communicate with it instead." expectMsgPF(1.second, expectedMsg) { case Logging.Warning(_, _, msg) => expectedMsg.r.pattern.matcher(msg.toString).matches() @@ -184,51 +181,6 @@ class StageActorRefSpec extends StreamSpec with ImplicitSender { res.futureValue should ===(42) } - "run non-eager stage actor messages in the graph interpreter" in { - val (_, res) = Source.maybe[Int].toMat(sumStage(testActor))(Keep.both).run() - - val stageRef = expectMsgType[ActorRef] - stageRef ! AddAndTell(1) - expectMsg(1) - - stageRef ! ReportStageActorInterpreter - val location = expectMsgType[StageActorLocation] - - location.stageActorParent should ===(location.supervisor) - location.interpreter should !==(location.supervisor) - - stageRef ! StopNow - res.futureValue should ===(1) - } - - "keep eagerly materialized stage actors usable before stream demand" in { - val (ref, probe) = Source - .actorRef[Int]({ - case CompleteNow => CompletionStrategy.Immediately - }, PartialFunction.empty, bufferSize = 8, OverflowStrategy.fail) - .toMat(TestSink[Int]())(Keep.both) - .run() - - ref ! 1 - probe.request(1).expectNext(1) - ref ! CompleteNow - probe.expectComplete() - } - - "keep eagerly materialized stage actors attached to the stream supervisor" in { - val (source, res) = Source.maybe[Int].toMat(eagerLocationStage(testActor))(Keep.both).run() - - val stageRef = expectMsgType[ActorRef] - stageRef ! ReportEagerStageActorInterpreter - val location = expectMsgType[EagerStageActorLocation] - - location.stageActorParent should ===(location.supervisor) - location.stageActorParent should !==(location.interpreter) - - source.success(None) - res.futureValue should ===(0) - } - } } @@ -242,19 +194,10 @@ object StageActorRefSpec { case object BecomeStringEcho extends NoSerializationVerificationNeeded case object PullNow extends NoSerializationVerificationNeeded case object StopNow extends NoSerializationVerificationNeeded - case object ReportStageActorInterpreter extends NoSerializationVerificationNeeded - case object ReportEagerStageActorInterpreter extends NoSerializationVerificationNeeded - case object CompleteNow extends NoSerializationVerificationNeeded - final case class StageActorLocation(stageActorParent: ActorPath, supervisor: ActorPath, interpreter: ActorPath) - extends NoSerializationVerificationNeeded - final case class EagerStageActorLocation(stageActorParent: ActorPath, supervisor: ActorPath, interpreter: ActorPath) - extends NoSerializationVerificationNeeded } import ControlProtocol._ - def eagerLocationStage(probe: ActorRef) = EagerLocationStage(probe) - case class SumTestStage(probe: ActorRef) extends GraphStageWithMaterializedValue[SinkShape[Int], Future[Int]] { val in = Inlet[Int]("IntSum.in") override val shape: SinkShape[Int] = SinkShape.of(in) @@ -273,15 +216,10 @@ object StageActorRefSpec { def behavior(m: (ActorRef, Any)): Unit = { m match { - case (_, Add(n)) => sum += n - case (_, PullNow) => pull(in) - case (sender, CallInitStageActorRef) => sender ! getStageActor(behavior).ref - case (sender, ReportStageActorInterpreter) => - sender ! StageActorLocation( - stageActor.ref.path.parent, - interpreter.materializer.supervisor.path, - GraphInterpreter.currentInterpreter.context.path) - case (_, BecomeStringEcho) => + case (_, Add(n)) => sum += n + case (_, PullNow) => pull(in) + case (sender, CallInitStageActorRef) => sender ! getStageActor(behavior).ref + case (_, BecomeStringEcho) => getStageActor { case (theSender, msg) => theSender ! msg.toString } @@ -320,52 +258,4 @@ object StageActorRefSpec { } } - case class EagerLocationStage(probe: ActorRef) extends GraphStageWithMaterializedValue[SinkShape[Int], Future[Int]] { - val in = Inlet[Int]("EagerLocation.in") - override val shape: SinkShape[Int] = SinkShape.of(in) - - override def createLogicAndMaterializedValue(inheritedAttributes: Attributes): (GraphStageLogic, Future[Int]) = { - val p: Promise[Int] = Promise() - - val logic = new GraphStageLogic(shape) { - var stageRef: ActorRef = _ - var interpreterPath: ActorPath = _ - var supervisorPath: ActorPath = _ - - override def preStart(): Unit = { - interpreterPath = interpreter.context.path - supervisorPath = interpreter.materializer.supervisor.path - stageRef = getEagerStageActor(interpreter.materializer) { - case (sender, ReportEagerStageActorInterpreter) => - sender ! EagerStageActorLocation(stageRef.path.parent, supervisorPath, interpreterPath) - case _ => throw new RuntimeException("unexpected message") - }.ref - pull(in) - probe ! stageRef - } - - setHandler( - in, - new InHandler { - override def onPush(): Unit = { - p.trySuccess(grab(in)) - completeStage() - } - - override def onUpstreamFinish(): Unit = { - p.trySuccess(0) - completeStage() - } - - override def onUpstreamFailure(ex: Throwable): Unit = { - p.tryFailure(ex) - failStage(ex) - } - }) - } - - logic -> p.future - } - } - } diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/SubstreamSubscriptionTimeoutSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/SubstreamSubscriptionTimeoutSpec.scala index 5f604ab63d1..5775bee84a7 100644 --- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/SubstreamSubscriptionTimeoutSpec.scala +++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/SubstreamSubscriptionTimeoutSpec.scala @@ -35,7 +35,7 @@ class SubstreamSubscriptionTimeoutSpec extends StreamSpec(""" "groupBy and splitwhen" must { "timeout and cancel substream publishers when no-one subscribes to them after some time (time them out)" in { - val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, ?])]() + val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, _])]() val publisherProbe = TestPublisher.probe[Int]() Source.fromPublisher(publisherProbe).groupBy(3, _ % 3).lift(_ % 3).runWith(Sink.fromSubscriber(subscriber)) @@ -76,7 +76,7 @@ class SubstreamSubscriptionTimeoutSpec extends StreamSpec(""" "timeout and stop groupBy parent actor if none of the substreams are actually consumed" in { val publisherProbe = TestPublisher.probe[Int]() - val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, ?])]() + val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, _])]() Source.fromPublisher(publisherProbe).groupBy(2, _ % 2).lift(_ % 2).runWith(Sink.fromSubscriber(subscriber)) val downstreamSubscription = subscriber.expectSubscription() @@ -93,7 +93,7 @@ class SubstreamSubscriptionTimeoutSpec extends StreamSpec(""" "not timeout and cancel substream publishers when they have been subscribed to" in { val publisherProbe = TestPublisher.probe[Int]() - val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, ?])]() + val subscriber = TestSubscriber.manualProbe[(Int, Source[Int, _])]() Source.fromPublisher(publisherProbe).groupBy(2, _ % 2).lift(_ % 2).runWith(Sink.fromSubscriber(subscriber)) val downstreamSubscription = subscriber.expectSubscription() diff --git a/stream-typed-tests/src/test/scala/org/apache/pekko/stream/MapAsyncPartitionedSpec.scala b/stream-typed-tests/src/test/scala/org/apache/pekko/stream/MapAsyncPartitionedSpec.scala index c22bde92c24..4c23b8a420f 100644 --- a/stream-typed-tests/src/test/scala/org/apache/pekko/stream/MapAsyncPartitionedSpec.scala +++ b/stream-typed-tests/src/test/scala/org/apache/pekko/stream/MapAsyncPartitionedSpec.scala @@ -117,7 +117,7 @@ class MapAsyncPartitionedSpec // We don't see problems on JDK 21 but see them on JDK 25. if (JavaVersion.majorVersion > 21) minSuccessful(20) else minSuccessful(100) - private implicit val system: ActorSystem[?] = ActorSystem(Behaviors.empty, "test-system") + private implicit val system: ActorSystem[_] = ActorSystem(Behaviors.empty, "test-system") private val executor: ExecutorService = Executors.newCachedThreadPool() private implicit val ec: ExecutionContext = ExecutionContext.fromExecutor(executor) diff --git a/stream-typed/src/test/scala/docs/org/apache/pekko/stream/typed/ActorSourceSinkExample.scala b/stream-typed/src/test/scala/docs/org/apache/pekko/stream/typed/ActorSourceSinkExample.scala index e54c9f30c31..5c7cfa26cf5 100644 --- a/stream-typed/src/test/scala/docs/org/apache/pekko/stream/typed/ActorSourceSinkExample.scala +++ b/stream-typed/src/test/scala/docs/org/apache/pekko/stream/typed/ActorSourceSinkExample.scala @@ -21,7 +21,7 @@ import pekko.actor.typed.scaladsl.Behaviors object ActorSourceSinkExample { def compileOnlySourceRef() = { - implicit val system: ActorSystem[?] = ActorSystem(Behaviors.empty, "ActorSourceSinkExample") + implicit val system: ActorSystem[_] = ActorSystem(Behaviors.empty, "ActorSourceSinkExample") // #actor-source-ref import org.apache.pekko @@ -80,7 +80,7 @@ object ActorSourceSinkExample { sender(streamActor, 0) } - private def runStream(ackReceiver: ActorRef[Emitted.type])(implicit system: ActorSystem[?]): ActorRef[Event] = { + private def runStream(ackReceiver: ActorRef[Emitted.type])(implicit system: ActorSystem[_]): ActorRef[Event] = { val source = ActorSource.actorRefWithBackpressure[Event, Emitted.type]( // get demand signalled to this actor receiving Ack @@ -128,7 +128,7 @@ object ActorSourceSinkExample { } def compileOnlyAcotrRef() = { - implicit val system: ActorSystem[?] = ActorSystem(Behaviors.empty, "ActorSourceSinkExample") + implicit val system: ActorSystem[_] = ActorSystem(Behaviors.empty, "ActorSourceSinkExample") def targetActor(): ActorRef[Protocol] = ??? @@ -154,7 +154,7 @@ object ActorSourceSinkExample { } def compileOnlySinkWithBackpressure() = { - implicit val system: ActorSystem[?] = ActorSystem(Behaviors.empty, "ActorSourceSinkExample") + implicit val system: ActorSystem[_] = ActorSystem(Behaviors.empty, "ActorSourceSinkExample") def targetActor(): ActorRef[Protocol] = ??? diff --git a/stream/src/main/java/org/apache/pekko/stream/StreamRefMessages.java b/stream/src/main/java/org/apache/pekko/stream/StreamRefMessages.java index 3945e21a928..a2f95c7d7a7 100644 --- a/stream/src/main/java/org/apache/pekko/stream/StreamRefMessages.java +++ b/stream/src/main/java/org/apache/pekko/stream/StreamRefMessages.java @@ -14,7 +14,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: StreamRefMessages.proto -// Protobuf Java Version: 4.35.0 +// Protobuf Java Version: 4.34.1 package org.apache.pekko.stream; @@ -25,8 +25,8 @@ private StreamRefMessages() {} org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "StreamRefMessages"); } @@ -70,8 +70,8 @@ public static final class SinkRef extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "SinkRef"); } @@ -154,21 +154,17 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream - .computeMessageSize(1, getTargetRef()); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream + .computeMessageSize(1, getTargetRef()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -663,8 +659,8 @@ public static final class SourceRef extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "SourceRef"); } @@ -747,21 +743,17 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream - .computeMessageSize(1, getOriginRef()); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream + .computeMessageSize(1, getOriginRef()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -1258,8 +1250,8 @@ public static final class ActorRef extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "ActorRef"); } @@ -1362,20 +1354,16 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, path_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.GeneratedMessage.computeStringSize(1, path_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -1832,8 +1820,8 @@ public static final class Payload extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "Payload"); } @@ -1955,8 +1943,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(1, enclosedMessage_); @@ -1969,15 +1962,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeBytesSize(3, messageManifest_); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2501,8 +2485,8 @@ public static final class OnSubscribeHandshake extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "OnSubscribeHandshake"); } @@ -2585,21 +2569,17 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream - .computeMessageSize(1, getTargetRef()); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream + .computeMessageSize(1, getTargetRef()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -3090,8 +3070,8 @@ public static final class CumulativeDemand extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "CumulativeDemand"); } @@ -3163,21 +3143,17 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream - .computeInt64Size(1, seqNr_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream + .computeInt64Size(1, seqNr_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -3586,8 +3562,8 @@ public static final class SequencedOnNext extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "SequencedOnNext"); } @@ -3696,8 +3672,13 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeInt64Size(1, seqNr_); @@ -3706,15 +3687,6 @@ private int computeSerializedSize_0() { size += org.apache.pekko.protobufv3.internal.CodedOutputStream .computeMessageSize(2, getPayload()); } - return size; - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += computeSerializedSize_0(); size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -4271,8 +4243,8 @@ public static final class RemoteStreamFailure extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "RemoteStreamFailure"); } @@ -4341,21 +4313,17 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream - .computeBytesSize(1, cause_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream + .computeBytesSize(1, cause_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -4745,8 +4713,8 @@ public static final class RemoteStreamCompleted extends org.apache.pekko.protobufv3.internal.RuntimeVersion.validateProtobufGencodeVersion( org.apache.pekko.protobufv3.internal.RuntimeVersion.RuntimeDomain.PUBLIC, /* major= */ 4, - /* minor= */ 35, - /* patch= */ 0, + /* minor= */ 34, + /* patch= */ 1, /* suffix= */ "", "RemoteStreamCompleted"); } @@ -4818,21 +4786,17 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu } getUnknownFields().writeTo(output); } - private int computeSerializedSize_0() { - int size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += org.apache.pekko.protobufv3.internal.CodedOutputStream - .computeInt64Size(1, seqNr_); - } - return size; - } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - size += computeSerializedSize_0(); + if (((bitField0_ & 0x00000001) != 0)) { + size += org.apache.pekko.protobufv3.internal.CodedOutputStream + .computeInt64Size(1, seqNr_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; diff --git a/stream/src/main/resources/reference.conf b/stream/src/main/resources/reference.conf index 059d28079ae..f4e4bd31934 100644 --- a/stream/src/main/resources/reference.conf +++ b/stream/src/main/resources/reference.conf @@ -83,13 +83,6 @@ pekko { # Allows to accelerate message processing that happening within same actor but keep system responsive. sync-processing-limit = 1000 - # Upper bound on stage-actor messages drained per envelope for non-eager `getStageActor` refs. Lazy - # stage actors batch external `tell` deliveries into a MPSC queue and elect a single drain envelope; - # this cap bounds the burst so that other BoundaryEvents (pull/push/complete) can still interleave - # naturally via the actor mailbox. Smaller = better fairness for upstream/downstream events; - # larger = better tell throughput. Must be >= 1. - stage-actor-drain-batch = 16 - debug { # Enables the fuzzing mode which increases the chance of race conditions # by aggressively reordering events and making certain operations more diff --git a/stream/src/main/scala/org/apache/pekko/stream/FanInShape.scala b/stream/src/main/scala/org/apache/pekko/stream/FanInShape.scala index 3fd6d734971..511a3e1a354 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/FanInShape.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/FanInShape.scala @@ -19,14 +19,14 @@ import scala.collection.immutable object FanInShape { sealed trait Init[O] { def outlet: Outlet[O] - def inlets: immutable.Seq[Inlet[?]] + def inlets: immutable.Seq[Inlet[_]] def name: String } final case class Name[O](override val name: String) extends Init[O] { override def outlet: Outlet[O] = Outlet(s"$name.out") - override def inlets: immutable.Seq[Inlet[?]] = Nil + override def inlets: immutable.Seq[Inlet[_]] = Nil } - final case class Ports[O](override val outlet: Outlet[O], override val inlets: immutable.Seq[Inlet[?]]) + final case class Ports[O](override val outlet: Outlet[O], override val inlets: immutable.Seq[Inlet[_]]) extends Init[O] { override def name: String = "FanIn" } @@ -34,7 +34,7 @@ object FanInShape { abstract class FanInShape[+O] private ( _out: Outlet[O @uncheckedVariance], - _registered: Iterator[Inlet[?]], + _registered: Iterator[Inlet[_]], _name: String) extends Shape { import FanInShape._ @@ -47,12 +47,12 @@ abstract class FanInShape[+O] private ( /** * Not meant for overriding outside of Apache Pekko. */ - override def inlets: immutable.Seq[Inlet[?]] = _inlets + override def inlets: immutable.Seq[Inlet[_]] = _inlets /** * Performance of subclass `UniformFanInShape` relies on `_inlets` being a `Vector`, not a `List`. */ - private var _inlets: Vector[Inlet[?]] = Vector.empty + private var _inlets: Vector[Inlet[_]] = Vector.empty protected def newInlet[T](name: String): Inlet[T] = { val p = if (_registered.hasNext) _registered.next().asInstanceOf[Inlet[T]] else Inlet[T](s"${_name}.$name") _inlets :+= p diff --git a/stream/src/main/scala/org/apache/pekko/stream/FanOutShape.scala b/stream/src/main/scala/org/apache/pekko/stream/FanOutShape.scala index 765387916c6..131ec1db7ff 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/FanOutShape.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/FanOutShape.scala @@ -19,14 +19,14 @@ import scala.collection.immutable object FanOutShape { sealed trait Init[I] { def inlet: Inlet[I] - def outlets: immutable.Seq[Outlet[?]] + def outlets: immutable.Seq[Outlet[_]] def name: String } final case class Name[I](override val name: String) extends Init[I] { override def inlet: Inlet[I] = Inlet(s"$name.in") - override def outlets: immutable.Seq[Outlet[?]] = Nil + override def outlets: immutable.Seq[Outlet[_]] = Nil } - final case class Ports[I](override val inlet: Inlet[I], override val outlets: immutable.Seq[Outlet[?]]) + final case class Ports[I](override val inlet: Inlet[I], override val outlets: immutable.Seq[Outlet[_]]) extends Init[I] { override def name: String = "FanOut" } @@ -34,7 +34,7 @@ object FanOutShape { abstract class FanOutShape[-I] private ( _in: Inlet[I @uncheckedVariance], - _registered: Iterator[Outlet[?]], + _registered: Iterator[Outlet[_]], _name: String) extends Shape { import FanOutShape._ @@ -46,13 +46,13 @@ abstract class FanOutShape[-I] private ( /** * Not meant for overriding outside of Apache Pekko. */ - override def outlets: immutable.Seq[Outlet[?]] = _outlets + override def outlets: immutable.Seq[Outlet[_]] = _outlets final override def inlets: immutable.Seq[Inlet[I @uncheckedVariance]] = in :: Nil /** * Performance of subclass `UniformFanOutShape` relies on `_outlets` being a `Vector`, not a `List`. */ - private var _outlets: Vector[Outlet[?]] = Vector.empty + private var _outlets: Vector[Outlet[_]] = Vector.empty protected def newOutlet[T](name: String): Outlet[T] = { val p = if (_registered.hasNext) _registered.next().asInstanceOf[Outlet[T]] else Outlet[T](s"${_name}.$name") _outlets :+= p diff --git a/stream/src/main/scala/org/apache/pekko/stream/Shape.scala b/stream/src/main/scala/org/apache/pekko/stream/Shape.scala index bd4253edc8d..201b9a75f22 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/Shape.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/Shape.scala @@ -27,7 +27,7 @@ import pekko.util.Collections.EmptyImmutableSeq * It is also used in the Java DSL for “classic Inlets” as a work-around * for otherwise unreasonable existential types. */ -sealed abstract class InPort { self: Inlet[?] => +sealed abstract class InPort { self: Inlet[_] => final override def hashCode: Int = super.hashCode final override def equals(that: Any): Boolean = this eq that.asInstanceOf[AnyRef] @@ -44,7 +44,7 @@ sealed abstract class InPort { self: Inlet[?] => /** * INTERNAL API */ - private[stream] def inlet: Inlet[?] = this + private[stream] def inlet: Inlet[_] = this } /** @@ -53,7 +53,7 @@ sealed abstract class InPort { self: Inlet[?] => * It is also used in the Java DSL for “classic Outlets” as a work-around * for otherwise unreasonable existential types. */ -sealed abstract class OutPort { self: Outlet[?] => +sealed abstract class OutPort { self: Outlet[_] => final override def hashCode: Int = super.hashCode final override def equals(that: Any): Boolean = this eq that.asInstanceOf[AnyRef] @@ -70,7 +70,7 @@ sealed abstract class OutPort { self: Outlet[?] => /** * INTERNAL API */ - private[stream] def outlet: Outlet[?] = this + private[stream] def outlet: Outlet[_] = this } /** @@ -166,10 +166,10 @@ final class Outlet[T] private (val s: String) extends OutPort { * `inlets` and `outlets` can be `Vector` or `List` so this method * checks the size of 1 in an optimized way. */ - def hasOnePort(ports: immutable.Seq[?]): Boolean = { + def hasOnePort(ports: immutable.Seq[_]): Boolean = { ports.nonEmpty && (ports match { - case l: List[?] => l.tail.isEmpty // assuming List is most common + case l: List[_] => l.tail.isEmpty // assuming List is most common case _ => ports.size == 1 // e.g. Vector }) } @@ -186,12 +186,12 @@ abstract class Shape { /** * Scala API: get a list of all input ports */ - def inlets: immutable.Seq[Inlet[?]] + def inlets: immutable.Seq[Inlet[_]] /** * Scala API: get a list of all output ports */ - def outlets: immutable.Seq[Outlet[?]] + def outlets: immutable.Seq[Outlet[_]] /** * Create a copy of this Shape object, returning the same type as the @@ -203,12 +203,12 @@ abstract class Shape { /** * Java API: get a list of all input ports */ - def getInlets: java.util.List[Inlet[?]] = inlets.asJava + def getInlets: java.util.List[Inlet[_]] = inlets.asJava /** * Java API: get a list of all output ports */ - def getOutlets: java.util.List[Outlet[?]] = outlets.asJava + def getOutlets: java.util.List[Outlet[_]] = outlets.asJava /** * Compare this to another shape and determine whether the set of ports is the same (ignoring their ordering). @@ -245,15 +245,15 @@ abstract class AbstractShape extends Shape { /** * Provide the list of all input ports of this shape. */ - def allInlets: java.util.List[Inlet[?]] + def allInlets: java.util.List[Inlet[_]] /** * Provide the list of all output ports of this shape. */ - def allOutlets: java.util.List[Outlet[?]] + def allOutlets: java.util.List[Outlet[_]] - final override lazy val inlets: immutable.Seq[Inlet[?]] = allInlets.asScala.toList - final override lazy val outlets: immutable.Seq[Outlet[?]] = allOutlets.asScala.toList + final override lazy val inlets: immutable.Seq[Inlet[_]] = allInlets.asScala.toList + final override lazy val outlets: immutable.Seq[Outlet[_]] = allOutlets.asScala.toList final override def getInlets = allInlets final override def getOutlets = allOutlets @@ -265,8 +265,8 @@ abstract class AbstractShape extends Shape { */ sealed abstract class ClosedShape extends Shape object ClosedShape extends ClosedShape { - override val inlets: immutable.Seq[Inlet[?]] = EmptyImmutableSeq - override val outlets: immutable.Seq[Outlet[?]] = EmptyImmutableSeq + override val inlets: immutable.Seq[Inlet[_]] = EmptyImmutableSeq + override val outlets: immutable.Seq[Outlet[_]] = EmptyImmutableSeq override def deepCopy() = this /** @@ -283,7 +283,7 @@ object ClosedShape extends ClosedShape { * implementation of the [[Graph]] builders and typically replaced by a more * meaningful type of Shape when the building is finished. */ -case class AmorphousShape(inlets: immutable.Seq[Inlet[?]], outlets: immutable.Seq[Outlet[?]]) extends Shape { +case class AmorphousShape(inlets: immutable.Seq[Inlet[_]], outlets: immutable.Seq[Outlet[_]]) extends Shape { override def deepCopy() = AmorphousShape(inlets.map(_.carbonCopy()), outlets.map(_.carbonCopy())) } @@ -292,8 +292,8 @@ case class AmorphousShape(inlets: immutable.Seq[Inlet[?]], outlets: immutable.Se * of data. */ final case class SourceShape[+T](out: Outlet[T @uncheckedVariance]) extends Shape { - override val inlets: immutable.Seq[Inlet[?]] = EmptyImmutableSeq - override val outlets: immutable.Seq[Outlet[?]] = out :: Nil + override val inlets: immutable.Seq[Inlet[_]] = EmptyImmutableSeq + override val outlets: immutable.Seq[Outlet[_]] = out :: Nil override def deepCopy(): SourceShape[T] = SourceShape(out.carbonCopy()) } @@ -310,8 +310,8 @@ object SourceShape { * course). */ final case class FlowShape[-I, +O](in: Inlet[I @uncheckedVariance], out: Outlet[O @uncheckedVariance]) extends Shape { - override val inlets: immutable.Seq[Inlet[?]] = in :: Nil - override val outlets: immutable.Seq[Outlet[?]] = out :: Nil + override val inlets: immutable.Seq[Inlet[_]] = in :: Nil + override val outlets: immutable.Seq[Outlet[_]] = out :: Nil override def deepCopy(): FlowShape[I, O] = FlowShape(in.carbonCopy(), out.carbonCopy()) } @@ -326,8 +326,8 @@ object FlowShape { * A Sink [[Shape]] has exactly one input and no outputs, it models a data sink. */ final case class SinkShape[-T](in: Inlet[T @uncheckedVariance]) extends Shape { - override val inlets: immutable.Seq[Inlet[?]] = in :: Nil - override val outlets: immutable.Seq[Outlet[?]] = EmptyImmutableSeq + override val inlets: immutable.Seq[Inlet[_]] = in :: Nil + override val outlets: immutable.Seq[Outlet[_]] = EmptyImmutableSeq override def deepCopy(): SinkShape[T] = SinkShape(in.carbonCopy()) } @@ -358,8 +358,8 @@ final case class BidiShape[-In1, +Out1, -In2, +Out2]( out2: Outlet[Out2 @uncheckedVariance]) extends Shape { // #implementation-details-elided - override val inlets: immutable.Seq[Inlet[?]] = in1 :: in2 :: Nil - override val outlets: immutable.Seq[Outlet[?]] = out1 :: out2 :: Nil + override val inlets: immutable.Seq[Inlet[_]] = in1 :: in2 :: Nil + override val outlets: immutable.Seq[Outlet[_]] = out1 :: out2 :: Nil /** * Java API for creating from a pair of unidirectional flows. diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/ActorPublisher.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/ActorPublisher.scala index 80ab09ca63e..504ce57b39d 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/ActorPublisher.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/ActorPublisher.scala @@ -58,11 +58,11 @@ import org.reactivestreams.Subscription // SubscribePending message. The AtomicReference is set to null by the shutdown method, which is // called by the actor from postStop. Pending (unregistered) subscription attempts are denied by // the shutdown method. Subscription attempts after shutdown can be denied immediately. - private val pendingSubscribers = new AtomicReference[immutable.Seq[Subscriber[? >: T]]](Nil) + private val pendingSubscribers = new AtomicReference[immutable.Seq[Subscriber[_ >: T]]](Nil) protected val wakeUpMsg: Any = SubscribePending - override def subscribe(subscriber: Subscriber[? >: T]): Unit = { + override def subscribe(subscriber: Subscriber[_ >: T]): Unit = { requireNonNullSubscriber(subscriber) @tailrec def doSubscribe(): Unit = { val current = pendingSubscribers.get @@ -79,7 +79,7 @@ import org.reactivestreams.Subscription doSubscribe() } - def takePendingSubscribers(): immutable.Seq[Subscriber[? >: T]] = { + def takePendingSubscribers(): immutable.Seq[Subscriber[_ >: T]] = { val pending = pendingSubscribers.getAndSet(Nil) if (pending eq null) Nil else pending.reverse } @@ -94,7 +94,7 @@ import org.reactivestreams.Subscription @volatile private var shutdownReason: Option[Throwable] = None - private def reportSubscribeFailure(subscriber: Subscriber[? >: T]): Unit = + private def reportSubscribeFailure(subscriber: Subscriber[_ >: T]): Unit = try shutdownReason match { case Some(_: SpecViolation) => // ok, not allowed to call onError case Some(e) => @@ -115,7 +115,7 @@ import org.reactivestreams.Subscription */ @InternalApi private[pekko] class ActorSubscription[T]( final val impl: ActorRef, - final val subscriber: Subscriber[? >: T]) + final val subscriber: Subscriber[_ >: T]) extends Subscription { override def request(elements: Long): Unit = impl ! RequestMore(this, elements) override def cancel(): Unit = impl ! Cancel(this) @@ -124,7 +124,7 @@ import org.reactivestreams.Subscription /** * INTERNAL API */ -@InternalApi private[pekko] class ActorSubscriptionWithCursor[T](_impl: ActorRef, _subscriber: Subscriber[? >: T]) +@InternalApi private[pekko] class ActorSubscriptionWithCursor[T](_impl: ActorRef, _subscriber: Subscriber[_ >: T]) extends ActorSubscription[T](_impl, _subscriber) with SubscriptionWithCursor[T] diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefBackpressureSource.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefBackpressureSource.scala index e8f51ecf87c..b80cfbb8d91 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefBackpressureSource.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefBackpressureSource.scala @@ -51,7 +51,7 @@ private object ActorRefBackpressureSource { with OutHandler with StageLogging with ActorRefStage { - override protected def logSource: Class[?] = classOf[ActorRefSource[?]] + override protected def logSource: Class[_] = classOf[ActorRefSource[_]] private var isCompleting: Boolean = false private var element: OptionVal[(ActorRef, T)] = OptionVal.none diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefSinkStage.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefSinkStage.scala index 70d418b5d61..94852df9732 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefSinkStage.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefSinkStage.scala @@ -39,7 +39,7 @@ final private[pekko] class ActorRefSinkStage[T]( override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = new GraphStageLogic(shape) with InHandler with StageLogging { - override protected def logSource: Class[?] = classOf[ActorRefSinkStage[?]] + override protected def logSource: Class[_] = classOf[ActorRefSinkStage[_]] var completionSignalled = false diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefSource.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefSource.scala index 1a76f23bf07..1abea0b5ce2 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefSource.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/ActorRefSource.scala @@ -52,7 +52,7 @@ private object ActorRefSource { with OutHandler with StageLogging with ActorRefStage { - override protected def logSource: Class[?] = classOf[ActorRefSource[?]] + override protected def logSource: Class[_] = classOf[ActorRefSource[_]] private val buffer: OptionVal[Buffer[T]] = if (maxBuffer != 0) diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/CompletedPublishers.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/CompletedPublishers.scala index 56add63eeab..32bda040aa3 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/CompletedPublishers.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/CompletedPublishers.scala @@ -22,7 +22,7 @@ import org.reactivestreams.{ Publisher, Subscriber, Subscription } */ @InternalApi private[pekko] case object EmptyPublisher extends Publisher[Nothing] { import ReactiveStreamsCompliance._ - override def subscribe(subscriber: Subscriber[? >: Nothing]): Unit = + override def subscribe(subscriber: Subscriber[_ >: Nothing]): Unit = try { requireNonNullSubscriber(subscriber) tryOnSubscribe(subscriber, CancelledSubscription) @@ -41,7 +41,7 @@ import org.reactivestreams.{ Publisher, Subscriber, Subscription } ReactiveStreamsCompliance.requireNonNullElement(t) import ReactiveStreamsCompliance._ - override def subscribe(subscriber: Subscriber[? >: Nothing]): Unit = + override def subscribe(subscriber: Subscriber[_ >: Nothing]): Unit = try { requireNonNullSubscriber(subscriber) tryOnSubscribe(subscriber, CancelledSubscription) @@ -78,7 +78,7 @@ import org.reactivestreams.{ Publisher, Subscriber, Subscription } */ @InternalApi private[pekko] case object RejectAdditionalSubscribers extends Publisher[Nothing] { import ReactiveStreamsCompliance._ - override def subscribe(subscriber: Subscriber[? >: Nothing]): Unit = + override def subscribe(subscriber: Subscriber[_ >: Nothing]): Unit = try rejectAdditionalSubscriber(subscriber, "Publisher") catch { case _: SpecViolation => // nothing we can do diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/FanoutPublisherBridgeStage.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/FanoutPublisherBridgeStage.scala index cce6a22e8f8..187dc2bb43d 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/FanoutPublisherBridgeStage.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/FanoutPublisherBridgeStage.scala @@ -25,10 +25,10 @@ import scala.util.control.NoStackTrace import org.apache.pekko import pekko.annotation.InternalApi -import pekko.stream._ import pekko.stream.ActorAttributes.StreamSubscriptionTimeout import pekko.stream.Attributes.InputBuffer import pekko.stream.StreamSubscriptionTimeoutTerminationMode +import pekko.stream._ import pekko.stream.impl.Stages.DefaultAttributes import pekko.stream.stage.{ AsyncCallback, @@ -127,7 +127,7 @@ import org.reactivestreams.{ Publisher, Subscriber } completeStage() } - override protected def createSubscription(subscriber: Subscriber[? >: T]): S = { + override protected def createSubscription(subscriber: Subscriber[_ >: T]): S = { everSubscribed = true cancelTimer(SubscriptionTimerKey) new FanoutPublisherBridgeSubscription[T](subscriber, requestCallback, cancelCallback) @@ -172,7 +172,7 @@ import org.reactivestreams.{ Publisher, Subscriber } * INTERNAL API */ @InternalApi private[pekko] final class FanoutPublisherBridgeSubscription[T]( - override val subscriber: Subscriber[? >: T], + override val subscriber: Subscriber[_ >: T], requestCallback: AsyncCallback[(FanoutPublisherBridgeSubscription[T], Long)], cancelCallback: AsyncCallback[FanoutPublisherBridgeSubscription[T]]) extends SubscriptionWithCursor[T] { @@ -192,12 +192,12 @@ import org.reactivestreams.{ Publisher, Subscriber } extends Publisher[T] { import ReactiveStreamsCompliance._ - private val pendingSubscribers = new AtomicReference[immutable.Seq[Subscriber[? >: T]]](Nil) + private val pendingSubscribers = new AtomicReference[immutable.Seq[Subscriber[_ >: T]]](Nil) private val shutdownStarted = new AtomicBoolean(false) @volatile private var shutdownReason: Option[Throwable] = None - override def subscribe(subscriber: Subscriber[? >: T]): Unit = { + override def subscribe(subscriber: Subscriber[_ >: T]): Unit = { requireNonNullSubscriber(subscriber) @tailrec def doSubscribe(): Unit = { @@ -210,8 +210,8 @@ import org.reactivestreams.{ Publisher, Subscriber } doSubscribe() } - def takePendingSubscribers(): immutable.Seq[Subscriber[? >: T]] = { - @tailrec def swapPendingSubscribers(): immutable.Seq[Subscriber[? >: T]] = { + def takePendingSubscribers(): immutable.Seq[Subscriber[_ >: T]] = { + @tailrec def swapPendingSubscribers(): immutable.Seq[Subscriber[_ >: T]] = { val current = pendingSubscribers.get() if (current eq null) Nil else if (pendingSubscribers.compareAndSet(current, Nil)) current.reverse @@ -231,7 +231,7 @@ import org.reactivestreams.{ Publisher, Subscriber } } } - private def reportSubscribeFailure(subscriber: Subscriber[? >: T]): Unit = + private def reportSubscribeFailure(subscriber: Subscriber[_ >: T]): Unit = try shutdownReason match { case Some(_: ReactiveStreamsCompliance.SpecViolation) => // ok, not allowed to call onError case Some(e) => diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/JavaFlowAndRsConverters.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/JavaFlowAndRsConverters.scala index 73b4fe21677..2b33cb5761c 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/JavaFlowAndRsConverters.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/JavaFlowAndRsConverters.scala @@ -122,14 +122,14 @@ private[pekko] object JavaFlowAndRsConverters { /** INTERNAL API: Adapters are not meant to be touched directly */ @InternalApi private[pekko] final class JavaFlowPublisherToRsAdapter[T]( val delegate: Flow.Publisher[T]) extends rs.Publisher[T] { - override def subscribe(rsSubscriber: rs.Subscriber[? >: T]): Unit = + override def subscribe(rsSubscriber: rs.Subscriber[_ >: T]): Unit = delegate.subscribe(rsSubscriber.asJava) } /** INTERNAL API: Adapters are not meant to be touched directly */ @InternalApi private[pekko] final class RsPublisherToJavaFlowAdapter[T]( val delegate: rs.Publisher[T]) extends Flow.Publisher[T] { - override def subscribe(javaSubscriber: Flow.Subscriber[? >: T]): Unit = + override def subscribe(javaSubscriber: Flow.Subscriber[_ >: T]): Unit = delegate.subscribe(javaSubscriber.asRs) } @@ -196,7 +196,7 @@ private[pekko] object JavaFlowAndRsConverters { override def onSubscribe(s: Flow.Subscription): Unit = delegate.onSubscribe(s.asRs) - override def subscribe(javaSubscriber: Flow.Subscriber[? >: R]): Unit = + override def subscribe(javaSubscriber: Flow.Subscriber[_ >: R]): Unit = delegate.subscribe(javaSubscriber.asRs) } @@ -215,6 +215,6 @@ private[pekko] object JavaFlowAndRsConverters { override def onSubscribe(s: rs.Subscription): Unit = delegate.onSubscribe(s.asJava) - override def subscribe(rsSubscriber: rs.Subscriber[? >: R]): Unit = + override def subscribe(rsSubscriber: rs.Subscriber[_ >: R]): Unit = delegate.subscribe(rsSubscriber.asJava) } diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/JavaStreamConcat.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/JavaStreamConcat.scala index 03e3f46a3b1..7b399b43a5f 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/JavaStreamConcat.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/JavaStreamConcat.scala @@ -37,7 +37,7 @@ import pekko.stream.stage.{ GraphStage, GraphStageLogic, InHandler, OutHandler } * INTERNAL API */ @InternalApi -private[pekko] final class JavaStreamConcat[E](open: () => java.util.stream.BaseStream[E, ?]) +private[pekko] final class JavaStreamConcat[E](open: () => java.util.stream.BaseStream[E, _]) extends GraphStage[FlowShape[E, E]] { val in = Inlet[E]("JavaStreamConcat.in") @@ -47,7 +47,7 @@ private[pekko] final class JavaStreamConcat[E](open: () => java.util.stream.Base override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = new GraphStageLogic(shape) with InHandler with OutHandler { - private var stream: java.util.stream.BaseStream[E, ?] = _ + private var stream: java.util.stream.BaseStream[E, _] = _ private var iterator: Iterator[E] = _ // DO NOT CHANGE diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/PhasedFusingActorMaterializer.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/PhasedFusingActorMaterializer.scala index 0a3861984eb..96033f26edd 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/PhasedFusingActorMaterializer.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/PhasedFusingActorMaterializer.scala @@ -198,12 +198,7 @@ private final case class SavedIslandData( private var segments: java.util.ArrayList[SegmentInfo] = _ private var activePhases: java.util.ArrayList[PhaseIsland[Any]] = _ - // Forward wires stored as sorted parallel arrays by key (global offset). - // Avoids java.lang.Integer boxing, per-operation allocation, and provides - // better cache locality than IntMap's Patricia trie nodes. - private var forwardWireKeys: Array[Int] = _ - private var forwardWireValues: Array[ForwardWire] = _ - private var forwardWireCount: Int = 0 + private var forwardWires: java.util.ArrayList[ForwardWire] = _ private var islandStateStack: java.util.ArrayList[SavedIslandData] = _ private var currentPhase: PhaseIsland[Any] = defaultPhase.apply(settings, attributes, materializer, nextIslandName()) @@ -282,26 +277,22 @@ private final case class SavedIslandData( currentPhase.assignPort(in, localInSlot, logic) // Check if there was any forward wiring that has this offset/slot as its target - val forwardWire: ForwardWire = - if (forwardWireCount > 0) { - val idx = java.util.Arrays.binarySearch(forwardWireKeys, 0, forwardWireCount, currentGlobalOffset) - if (idx >= 0) { - val fw = forwardWireValues(idx) - forwardWireCount -= 1 - if (idx < forwardWireCount) { - System.arraycopy(forwardWireKeys, idx + 1, forwardWireKeys, idx, forwardWireCount - idx) - System.arraycopy(forwardWireValues, idx + 1, forwardWireValues, idx, forwardWireCount - idx) - } - forwardWireValues(forwardWireCount) = null - if (forwardWireCount == 0) { - forwardWireKeys = null - forwardWireValues = null - } - fw - } else null - } else null - if ((forwardWire ne null) && Debug) - println(s" there is a forward wire to this slot $forwardWire") + // First try to find such wiring + var forwardWire: ForwardWire = null + if ((forwardWires ne null) && !forwardWires.isEmpty) { + var i = 0 + while (i < forwardWires.size()) { + forwardWire = forwardWires.get(i) + if (forwardWire.toGlobalOffset == currentGlobalOffset) { + if (Debug) println(s" there is a forward wire to this slot $forwardWire") + forwardWires.remove(i) + i = Int.MaxValue // Exit the loop + } else { + forwardWire = null // Didn't found it yet + i += 1 + } + } + } // If there is a forward wiring we need to resolve it if (forwardWire ne null) { @@ -370,9 +361,8 @@ private final case class SavedIslandData( // The forward wire tracking data structure is only allocated when needed. Many graphs have no forward wires // even though it might have islands. - if (forwardWireKeys eq null) { - forwardWireKeys = new Array[Int](4) - forwardWireValues = new Array[ForwardWire](4) + if (forwardWires eq null) { + forwardWires = new java.util.ArrayList[ForwardWire](8) } val forwardWire = ForwardWire( @@ -383,24 +373,7 @@ private final case class SavedIslandData( currentPhase) if (Debug) println(s" wiring is forward, recording $forwardWire") - if (forwardWireCount == forwardWireKeys.length) { - val newLen = forwardWireKeys.length * 2 - val newKeys = new Array[Int](newLen) - val newValues = new Array[ForwardWire](newLen) - System.arraycopy(forwardWireKeys, 0, newKeys, 0, forwardWireCount) - System.arraycopy(forwardWireValues, 0, newValues, 0, forwardWireCount) - forwardWireKeys = newKeys - forwardWireValues = newValues - } - val insertPos = java.util.Arrays.binarySearch(forwardWireKeys, 0, forwardWireCount, absoluteOffset) - val pos = if (insertPos < 0) -(insertPos + 1) else insertPos - if (pos < forwardWireCount) { - System.arraycopy(forwardWireKeys, pos, forwardWireKeys, pos + 1, forwardWireCount - pos) - System.arraycopy(forwardWireValues, pos, forwardWireValues, pos + 1, forwardWireCount - pos) - } - forwardWireKeys(pos) = absoluteOffset - forwardWireValues(pos) = forwardWire - forwardWireCount += 1 + forwardWires.add(forwardWire) } } @@ -729,7 +702,7 @@ private[pekko] object GraphStageIsland { private var connections = new Array[Connection](16) private var maxConnections = 0 - private var outConnections: java.util.ArrayList[Connection] = _ + private var outConnections: List[Connection] = Nil private var fullIslandName: OptionVal[String] = OptionVal.None val shell = new GraphInterpreterShell(connections = null, logics = null, effectiveAttributes, materializer) @@ -769,8 +742,7 @@ private[pekko] object GraphStageIsland { def outConn(): Connection = { val connection = new Connection(0, null, null, null, null) - if (outConnections eq null) outConnections = new util.ArrayList[Connection](4) - outConnections.add(connection) + outConnections ::= connection connection } @@ -828,22 +800,20 @@ private[pekko] object GraphStageIsland { override def onIslandReady(): Unit = { - val outConnSize = if (outConnections ne null) outConnections.size() else 0 - val totalConnections = maxConnections + outConnSize + 1 + val totalConnections = maxConnections + outConnections.size + 1 val finalConnections = java.util.Arrays.copyOf(connections, totalConnections) var i = maxConnections + 1 - var j = 0 + var outConns = outConnections while (i < totalConnections) { - val conn = outConnections.get(j) - j += 1 + val conn = outConns.head + outConns = outConns.tail if (conn.inHandler eq null) failOnMissingHandler(conn.inOwner) else if (conn.outHandler eq null) failOnMissingHandler(conn.outOwner) finalConnections(i) = conn conn.id = i i += 1 } - outConnections = null shell.connections = finalConnections shell.logics = logics.toArray(GraphStageIsland.emptyLogicArray) @@ -953,7 +923,7 @@ private[pekko] object GraphStageIsland { override def takePublisher(slot: Int, publisher: Publisher[Any], attributes: Attributes): Unit = { subscriberOrVirtualPublisher match { - case v: VirtualPublisher[?] => v.registerPublisher(publisher) + case v: VirtualPublisher[_] => v.registerPublisher(publisher) case s: Subscriber[Any] @unchecked => publisher.subscribe(s) case _ => throw new IllegalStateException() // won't happen, compiler exhaustiveness check pleaser } diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/QueueSource.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/QueueSource.scala index 8872c212b3f..36d8014ac3b 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/QueueSource.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/QueueSource.scala @@ -58,7 +58,7 @@ import pekko.stream.stage._ val name = inheritedAttributes.nameOrDefault(getClass.toString) val stageLogic = new GraphStageLogic(shape) with OutHandler with SourceQueueWithComplete[T] with StageLogging { - override protected def logSource: Class[?] = classOf[QueueSource[?]] + override protected def logSource: Class[_] = classOf[QueueSource[_]] var buffer: Buffer[T] = _ var pendingOffers: Buffer[Offer[T]] = _ diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/Sinks.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/Sinks.scala index de215da3eae..f1c2915cef9 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/Sinks.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/Sinks.scala @@ -248,7 +248,7 @@ import org.reactivestreams.Subscriber * INTERNAL API */ @InternalApi private[pekko] final class SeqStage[T, That]( - implicit cbf: scala.collection.Factory[T, That with immutable.Iterable[?]]) + implicit cbf: scala.collection.Factory[T, That with immutable.Iterable[_]]) extends GraphStageWithMaterializedValue[SinkShape[T], Future[That]] { val in = Inlet[T]("seq.in") @@ -350,7 +350,7 @@ import org.reactivestreams.Subscriber val e = buffer.dequeue() promise.complete(e) e match { - case Success(_: Some[?]) => // do nothing + case Success(_: Some[_]) => // do nothing case Success(None) => completeStage() case Failure(t) => failStage(t) } diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/StreamLayout.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/StreamLayout.scala index c59f15e9c74..a0945f60449 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/StreamLayout.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/StreamLayout.scala @@ -67,7 +67,7 @@ import org.reactivestreams.Subscription onErrorBuffered: OptionVal[Throwable] = OptionVal.None) extends HasActualSubscriber object Establishing { - def create(s: Subscriber[?]) = Establishing(s.asInstanceOf[Subscriber[Any]]) + def create(s: Subscriber[_]) = Establishing(s.asInstanceOf[Subscriber[Any]]) } } @@ -135,7 +135,7 @@ import org.reactivestreams.Subscription override def toString: String = s"VirtualProcessor(${this.hashCode()})" if (VirtualProcessor.Debug) println(s"created: $this") - override def subscribe(s: Subscriber[? >: T]): Unit = { + override def subscribe(s: Subscriber[_ >: T]): Unit = { @tailrec def rec(sub: Subscriber[Any]): Unit = { get() match { case null => @@ -147,7 +147,7 @@ import org.reactivestreams.Subscription val establishing = Establishing(sub, false) if (compareAndSet(subscription, establishing)) establishSubscription(establishing, subscription) else rec(sub) - case pub: Publisher[?] => + case pub: Publisher[_] => if (VirtualProcessor.Debug) println(s"VirtualPublisher#$hashCode($pub).subscribe.rec($s) -> Inert") if (compareAndSet(pub, Inert)) pub.subscribe(sub) else rec(sub) @@ -172,7 +172,7 @@ import org.reactivestreams.Subscription if (VirtualProcessor.Debug) println(s"VirtualPublisher#$hashCode(null).onSubscribe.rec($obj) -> ${obj.getClass}") if (!compareAndSet(null, obj)) rec(obj) - case subscriber: Subscriber[?] => + case subscriber: Subscriber[_] => obj match { case subscription: Subscription => if (VirtualProcessor.Debug) @@ -180,7 +180,7 @@ import org.reactivestreams.Subscription val establishing = Establishing.create(subscriber) if (compareAndSet(subscriber, establishing)) establishSubscription(establishing, subscription) else rec(obj) - case pub: Publisher[?] => + case pub: Publisher[_] => if (VirtualProcessor.Debug) println(s"VirtualPublisher#$hashCode($subscriber).onSubscribe.rec($obj) -> INert") getAndSet(Inert) match { @@ -274,7 +274,7 @@ import org.reactivestreams.Subscription println(s"VirtualPublisher#$hashCode(Both($s)).onError(${ex.getMessage}) -> ErrorPublisher") set(Inert) tryOnError(s, ex) - case s: Subscriber[?] => // spec violation + case s: Subscriber[_] => // spec violation if (VirtualProcessor.Debug) println(s"VirtualPublisher#$hashCode($s).onError(${ex.getMessage}) -> Inert") getAndSet(Inert) match { case Inert => // nothing to be done @@ -308,7 +308,7 @@ import org.reactivestreams.Subscription if (VirtualProcessor.Debug) println(s"VirtualPublisher#$hashCode($s).onComplete -> Inert") set(Inert) tryOnComplete(s) - case s: Subscriber[?] => // spec violation + case s: Subscriber[_] => // spec violation if (VirtualProcessor.Debug) println(s"VirtualPublisher#$hashCode($s).onComplete -> Inert") set(Inert) EmptyPublisher.subscribe(s) @@ -330,7 +330,7 @@ import org.reactivestreams.Subscription get() match { case x @ (null | _: Subscription) => if (!compareAndSet(x, ErrorPublisher(ex, "failed-VirtualProcessor"))) rec() - case s: Subscriber[?] => + case s: Subscriber[_] => try s.onError(ex) catch { case NonFatal(_) => } finally set(Inert) @@ -359,7 +359,7 @@ import org.reactivestreams.Subscription throw new IllegalStateException("Subscriber threw exception, this is in violation of rule 2:13", e) } - case s: Subscriber[?] => // spec violation + case s: Subscriber[_] => // spec violation if (VirtualProcessor.Debug) println(s"VirtualPublisher#$hashCode($s).onNext($t).rec(): spec violation -> Inert") val ex = new IllegalStateException(noDemand) @@ -368,7 +368,7 @@ import org.reactivestreams.Subscription case _ => ErrorPublisher(ex, "failed-VirtualProcessor").subscribe(s) } throw ex - case Inert | _: Publisher[?] => + case Inert | _: Publisher[_] => if (VirtualProcessor.Debug) println(s"VirtualPublisher#$hashCode(Inert|Publisher).onNext($t).rec(): nop") // nothing to be done case other => @@ -474,7 +474,7 @@ import org.reactivestreams.Subscription import ReactiveStreamsCompliance._ import VirtualProcessor.Inert - override def subscribe(subscriber: Subscriber[? >: T]): Unit = { + override def subscribe(subscriber: Subscriber[_ >: T]): Unit = { requireNonNullSubscriber(subscriber) if (VirtualProcessor.Debug) println(s"$this.subscribe: $subscriber") @tailrec def rec(): Unit = { @@ -482,12 +482,12 @@ import org.reactivestreams.Subscription case null => if (!compareAndSet(null, subscriber)) rec() // retry - case pub: Publisher[?] => + case pub: Publisher[_] => if (compareAndSet(pub, Inert.subscriber)) { pub.asInstanceOf[Publisher[T]].subscribe(subscriber) } else rec() // retry - case _: Subscriber[?] => + case _: Subscriber[_] => rejectAdditionalSubscriber(subscriber, "Sink.asPublisher(fanout = false)") case unexpected => throw new IllegalStateException(s"Unexpected state in VirtualPublisher: $unexpected") @@ -496,7 +496,7 @@ import org.reactivestreams.Subscription rec() // return value is boolean only to make the expressions above compile } - @tailrec final def registerPublisher(pub: Publisher[?]): Unit = { + @tailrec final def registerPublisher(pub: Publisher[_]): Unit = { if (VirtualProcessor.Debug) println(s"$this.registerPublisher: $pub") get() match { case null => @@ -506,7 +506,7 @@ import org.reactivestreams.Subscription set(Inert.subscriber) pub.asInstanceOf[Publisher[r]].subscribe(sub) - case p: Publisher[?] => + case p: Publisher[_] => throw new IllegalStateException( s"internal error, already registered [$p], yet attempted to register 2nd publisher [$pub]!") @@ -520,7 +520,7 @@ import org.reactivestreams.Subscription def onSubscriptionTimeout(am: Materializer, mode: StreamSubscriptionTimeoutTerminationMode): Unit = { import StreamSubscriptionTimeoutTerminationMode._ get() match { - case null | _: Publisher[?] => + case null | _: Publisher[_] => mode match { case CancelTermination => subscribe(new CancellingSubscriber[T]) case WarnTermination => diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/StreamSubscriptionTimeout.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/StreamSubscriptionTimeout.scala index bfd720ff055..9998c1e026e 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/StreamSubscriptionTimeout.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/StreamSubscriptionTimeout.scala @@ -93,17 +93,17 @@ import org.reactivestreams._ cancellable } - private def cancel(target: Publisher[?], timeout: FiniteDuration): Unit = { + private def cancel(target: Publisher[_], timeout: FiniteDuration): Unit = { val millis = timeout.toMillis target match { - case p: Processor[?, ?] => + case p: Processor[_, _] => log.debug("Cancelling {} Processor's publisher and subscriber sides (after {} ms)", p, millis) handleSubscriptionTimeout( target, new SubscriptionTimeoutException(s"Publisher was not attached to upstream within deadline ($millis) ms") with NoStackTrace) - case p: Publisher[?] => + case p: Publisher[_] => log.debug("Cancelling {} (after: {} ms)", p, millis) handleSubscriptionTimeout( target, @@ -113,7 +113,7 @@ import org.reactivestreams._ } } - private def warn(target: Publisher[?], timeout: FiniteDuration): Unit = { + private def warn(target: Publisher[_], timeout: FiniteDuration): Unit = { log.warning( "Timed out {} detected (after {} ms)! You should investigate if you either cancel or consume all {} instances", target, @@ -125,7 +125,7 @@ import org.reactivestreams._ * Called by the actor when a subscription has timed out. Expects the actual `Publisher` or `Processor` target. */ @nowarn("msg=deprecated") - protected def subscriptionTimedOut(target: Publisher[?]): Unit = subscriptionTimeoutSettings.mode match { + protected def subscriptionTimedOut(target: Publisher[_]): Unit = subscriptionTimeoutSettings.mode match { case NoopTermination => // ignore... case WarnTermination => warn(target, subscriptionTimeoutSettings.timeout) case CancelTermination => cancel(target, subscriptionTimeoutSettings.timeout) @@ -134,7 +134,7 @@ import org.reactivestreams._ /** * Callback that should ensure that the target is canceled with the given cause. */ - protected def handleSubscriptionTimeout(target: Publisher[?], cause: Exception): Unit + protected def handleSubscriptionTimeout(target: Publisher[_], cause: Exception): Unit } /** diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/SubscriberManagement.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/SubscriberManagement.scala index 91c59a6bff6..1a4788d9cca 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/SubscriberManagement.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/SubscriberManagement.scala @@ -49,7 +49,7 @@ private[pekko] object SubscriberManagement { private[pekko] trait SubscriptionWithCursor[T] extends Subscription with ResizableMultiReaderRingBuffer.Cursor { import ReactiveStreamsCompliance._ - def subscriber: Subscriber[? >: T] + def subscriber: Subscriber[_ >: T] def dispatch(element: T): Unit = tryOnNext(subscriber, element) @@ -91,7 +91,7 @@ private[pekko] trait SubscriberManagement[T] extends ResizableMultiReaderRingBuf /** * Use to register a subscriber */ - protected def createSubscription(subscriber: Subscriber[? >: T]): S + protected def createSubscription(subscriber: Subscriber[_ >: T]): S private[this] val buffer = new ResizableMultiReaderRingBuffer[T](initialBufferSize, maxBufferSize, this) @@ -232,7 +232,7 @@ private[pekko] trait SubscriberManagement[T] extends ResizableMultiReaderRingBuf /** * Register a new subscriber. */ - protected def registerSubscriber(subscriber: Subscriber[? >: T]): Unit = endOfStream match { + protected def registerSubscriber(subscriber: Subscriber[_ >: T]): Unit = endOfStream match { case NotReached if subscriptions.exists(_.subscriber == subscriber) => ReactiveStreamsCompliance.rejectDuplicateSubscriber(subscriber) case NotReached => addSubscription(subscriber) @@ -240,7 +240,7 @@ private[pekko] trait SubscriberManagement[T] extends ResizableMultiReaderRingBuf case eos => eos(subscriber) } - private def addSubscription(subscriber: Subscriber[? >: T]): Unit = { + private def addSubscription(subscriber: Subscriber[_ >: T]): Unit = { import ReactiveStreamsCompliance._ val newSubscription = createSubscription(subscriber) subscriptions ::= newSubscription diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/TraversalBuilder.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/TraversalBuilder.scala index d4a7da20749..4ed9cbe6436 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/TraversalBuilder.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/TraversalBuilder.scala @@ -213,8 +213,6 @@ import pekko.util.OptionVal private val cachedEmptyCompleted = CompletedTraversalBuilder(PushNotUsed, 0, Map.empty, Attributes.none) - private val emptyOutSlots: Array[Int] = Array.emptyIntArray - /** * INTERNAL API * @@ -271,7 +269,7 @@ import pekko.util.OptionVal val builder = if (module.shape.outlets.isEmpty) { val b = CompletedTraversalBuilder( - traversalSoFar = MaterializeAtomic(module, emptyOutSlots), + traversalSoFar = MaterializeAtomic(module, new Array[Int](module.shape.outlets.size)), inSlots = module.shape.inlets.size, inToOffset = module.shape.inlets.map(in => in -> in.id).toMap, Attributes.none) @@ -356,10 +354,10 @@ import pekko.util.OptionVal * Try to find `SingleSource` or wrapped such. This is used as a * performance optimization in FlattenMerge and possibly other places. */ - def getSingleSource[A >: Null](graph: Graph[SourceShape[A], ?]): OptionVal[SingleSource[A]] = { - @inline def fromModule(module: AtomicModule[?, ?]): OptionVal[SingleSource[A]] = + def getSingleSource[A >: Null](graph: Graph[SourceShape[A], _]): OptionVal[SingleSource[A]] = { + @inline def fromModule(module: AtomicModule[_, _]): OptionVal[SingleSource[A]] = module match { - case m: GraphStageModule[?, ?] => + case m: GraphStageModule[_, _] => m.stage match { case single: SingleSource[A] @unchecked => OptionVal.Some(single) case _ => OptionVal.None @@ -394,18 +392,18 @@ import pekko.util.OptionVal * @since 1.2.0 */ @InternalApi def getValuePresentedSource[A >: Null]( - graph: Graph[SourceShape[A], ?]): OptionVal[Graph[SourceShape[A], ?]] = { - def isValuePresentedSource(graph: Graph[SourceShape[? <: A], ?]): Boolean = graph match { + graph: Graph[SourceShape[A], _]): OptionVal[Graph[SourceShape[A], _]] = { + def isValuePresentedSource(graph: Graph[SourceShape[_ <: A], _]): Boolean = graph match { case _: ValuePresentedSource => true case maybeEmpty if isEmptySource(maybeEmpty) => true case _ => false } - @inline def fromModule(module: AtomicModule[?, ?]): OptionVal[Graph[SourceShape[A], ?]] = + @inline def fromModule(module: AtomicModule[_, _]): OptionVal[Graph[SourceShape[A], _]] = module match { - case m: GraphStageModule[?, ?] => + case m: GraphStageModule[_, _] => m.stage match { - case _ if isValuePresentedSource(m.stage.asInstanceOf[Graph[SourceShape[A], ?]]) => - OptionVal.Some(m.stage.asInstanceOf[Graph[SourceShape[A], ?]]) + case _ if isValuePresentedSource(m.stage.asInstanceOf[Graph[SourceShape[A], _]]) => + OptionVal.Some(m.stage.asInstanceOf[Graph[SourceShape[A], _]]) case _ => OptionVal.None } case _ => OptionVal.None @@ -435,9 +433,9 @@ import pekko.util.OptionVal /** * Test if a Graph is an empty Source. */ - def isEmptySource(graph: Graph[SourceShape[?], ?]): Boolean = graph match { - case source: scaladsl.Source[?, ?] if source eq scaladsl.Source.empty => true - case source: javadsl.Source[?, ?] if source eq javadsl.Source.empty() => true + def isEmptySource(graph: Graph[SourceShape[_], _]): Boolean = graph match { + case source: scaladsl.Source[_, _] if source eq scaladsl.Source.empty => true + case source: javadsl.Source[_, _] if source eq javadsl.Source.empty() => true case EmptySource => true case _ => false } @@ -796,7 +794,7 @@ import pekko.util.OptionVal } @inline @InternalApi private[pekko] def fromGraphStage( - graphStage: GraphStageWithMaterializedValue[? <: Shape, ?]): LinearTraversalBuilder = { + graphStage: GraphStageWithMaterializedValue[_ <: Shape, _]): LinearTraversalBuilder = { val builder = graphStage.traversalBuilder val attributes = builder.attributes val linear = builder match { diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/ActorGraphInterpreter.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/ActorGraphInterpreter.scala index 61eb9b8a293..39e16aa9c3d 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/ActorGraphInterpreter.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/ActorGraphInterpreter.scala @@ -336,7 +336,7 @@ import org.reactivestreams.Subscription protected val wakeUpMsg: Any = new SubscribePending(boundary) - override def subscribe(subscriber: Subscriber[? >: Any]): Unit = { + override def subscribe(subscriber: Subscriber[_ >: Any]): Unit = { requireNonNullSubscriber(subscriber) @tailrec def doSubscribe(): Unit = { val current = pendingSubscribers.get diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/FlattenConcat.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/FlattenConcat.scala index 197f8801d08..2aefcc9d572 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/FlattenConcat.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/FlattenConcat.scala @@ -178,7 +178,7 @@ private[pekko] final class FlattenConcat[T, M](parallelism: Int) queue.enqueue(inflightSource) } - private def addJavaStreamSource(javaStream: JavaStreamSource[T, ?]): Unit = { + private def addJavaStreamSource(javaStream: JavaStreamSource[T, _]): Unit = { val inflightSource = new InflightJavaStreamSource[T](javaStream.open) if (isAvailable(out) && queue.isEmpty) { if (inflightSource.hasNext) { @@ -275,7 +275,7 @@ private[pekko] final class FlattenConcat[T, M](parallelism: Int) case iterator: IteratorSource[T] @unchecked => addSourceElements(iterator.createIterator()) case range: RangeSource[T] @unchecked => addRangeSource(range.range) case repeat: RepeatSource[T] @unchecked => addRepeatSource(repeat.elem) - case javaStream: JavaStreamSource[T, ?] @unchecked => addJavaStreamSource(javaStream) + case javaStream: JavaStreamSource[T, _] @unchecked => addJavaStreamSource(javaStream) case failed: FailedSource[T] @unchecked => addCompletedFutureElem(Failure(failed.failure)) case maybeEmpty if TraversalBuilder.isEmptySource(maybeEmpty) => // Empty source is discarded case _ => attachAndMaterializeSource(source) diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/GraphInterpreter.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/GraphInterpreter.scala index aedcd0b301a..14f4a8c062e 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/GraphInterpreter.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/GraphInterpreter.scala @@ -342,12 +342,25 @@ import pekko.stream.stage._ var i = 0 while (i < logics.length) { val logic = logics(i) - if (!isStageCompleted(logic) && !isStageFinalized(logic)) { + if ((logic ne null) && !isStageCompleted(logic) && !isStageFinalized(logic)) { markStageFinalized(logic) finalizeStage(logic) } + // Release reference to the stage logic so it can be garbage collected + // even if the GraphInterpreter is still alive due to other references + logics(i) = null i += 1 } + // Null connection handlers for all finalized stages to break handler-to-logic reference chains + var j = 0 + while (j < connections.length) { + val conn = connections(j) + if (conn ne null) { + conn.inHandler = null + conn.outHandler = null + } + j += 1 + } } // Debug name for a connections input part @@ -357,10 +370,16 @@ import pekko.stream.stage._ private def outOwnerName(connection: Connection): String = connection.outOwner.toString // Debug name for a connections input part - private def inLogicName(connection: Connection): String = logics(connection.inOwner.stageId).toString + private def inLogicName(connection: Connection): String = { + val logic = logics(connection.inOwner.stageId) + if (logic ne null) logic.toString else "" + } // Debug name for a connections output part - private def outLogicName(connection: Connection): String = logics(connection.outOwner.stageId).toString + private def outLogicName(connection: Connection): String = { + val logic = logics(connection.outOwner.stageId) + if (logic ne null) logic.toString else "" + } private def shutdownCounters: String = shutdownCounter.map(x => if (x >= KeepGoingFlag) s"${x & KeepGoingMask}(KeepGoing)" else x.toString).mkString(",") @@ -620,12 +639,34 @@ import pekko.stream.stage._ queueTail += 1 } - def afterStageHasRun(logic: GraphStageLogic): Unit = - if (isStageCompleted(logic) && !isStageFinalized(logic)) { - markStageFinalized(logic) - runningStages -= 1 - finalizeStage(logic) + @scala.annotation.nowarn("cat=unused-params") + def afterStageHasRun(logic: GraphStageLogic): Unit = { + var i = 0 + while (i < logics.length) { + val l = logics(i) + if ((l ne null) && isStageCompleted(l) && !isStageFinalized(l)) { + markStageFinalized(l) + runningStages -= 1 + finalizeStage(l) + logics(i) = null + } + i += 1 + } + // Null connection handlers for finalized stages to break handler-to-logic reference chains + var j = 0 + while (j < connections.length) { + val conn = connections(j) + if (conn ne null) { + if (finalizedMark(conn.inOwner.stageId)) { + conn.inHandler = null + } + if (finalizedMark(conn.outOwner.stageId)) { + conn.outHandler = null + } + } + j += 1 } + } // Returns true if the given stage is already completed def isStageCompleted(stage: GraphStageLogic): Boolean = (stage ne null) && shutdownCounter(stage.stageId) == 0 @@ -741,15 +782,16 @@ import pekko.stream.stage._ def toSnapshot: RunningInterpreter = { val logicSnapshots = logics.zipWithIndex.map { - case (logic, idx) => + case (logic, idx) if logic ne null => LogicSnapshotImpl(idx, logic.toString, logic.attributes) + case (_, idx) => + LogicSnapshotImpl(idx, "", Attributes.none) } - val logicIndexes = logics.zipWithIndex.map { case (stage, idx) => stage -> idx }.toMap val connectionSnapshots = connections.filter(_ ne null).map { connection => ConnectionSnapshotImpl( connection.id, - logicSnapshots(logicIndexes(connection.inOwner)), - logicSnapshots(logicIndexes(connection.outOwner)), + logicSnapshots(connection.inOwner.stageId), + logicSnapshots(connection.outOwner.stageId), connection.portState match { case InReady | Pushing => ConnectionSnapshot.ShouldPull case OutReady | Pulling => ConnectionSnapshot.ShouldPush diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/GraphStages.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/GraphStages.scala index 2ac39c9c08d..b901584ffe2 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/GraphStages.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/GraphStages.scala @@ -181,7 +181,7 @@ import pekko.stream.stage._ private class FlowMonitorImpl[T] extends AtomicReference[Any](Initialized) with FlowMonitor[T] { override def state = get match { - case s: StreamState[?] => s.asInstanceOf[StreamState[T]] + case s: StreamState[_] => s.asInstanceOf[StreamState[T]] case msg => Received(msg.asInstanceOf[T]) } } @@ -199,7 +199,7 @@ import pekko.stream.stage._ def onPush(): Unit = { val msg = grab(in) push(out, msg) - monitor.set(if (msg.isInstanceOf[StreamState[?]]) Received(msg) else msg) + monitor.set(if (msg.isInstanceOf[StreamState[_]]) Received(msg) else msg) } override def onUpstreamFinish(): Unit = { diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/InflightSources.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/InflightSources.scala index 588f1de2cf2..3d4a11c0393 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/InflightSources.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/InflightSources.scala @@ -71,8 +71,8 @@ private[fusing] object InflightSources { * does not do implicitly. */ private[fusing] final class InflightJavaStreamSource[T]( - open: () => java.util.stream.BaseStream[T, ?]) extends InflightSource[T] { - private val stream: java.util.stream.BaseStream[T, ?] = open() + open: () => java.util.stream.BaseStream[T, _]) extends InflightSource[T] { + private val stream: java.util.stream.BaseStream[T, _] = open() private val iterator: java.util.Iterator[T] = stream.iterator() private var closed: Boolean = false // Eagerly close empty streams so we don't leak the resource for empty inner sources. diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/IteratorSource.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/IteratorSource.scala index 8877586c8c1..7c6baa51145 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/IteratorSource.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/IteratorSource.scala @@ -21,8 +21,8 @@ import scala.util.control.NonFatal import org.apache.pekko import pekko.annotation.InternalApi -import pekko.stream.{ Attributes, Outlet, SourceShape, Supervision } import pekko.stream.ActorAttributes.SupervisionStrategy +import pekko.stream.{ Attributes, Outlet, SourceShape, Supervision } import pekko.stream.impl.fusing.GraphStages.ValuePresentedSource import pekko.stream.stage.{ GraphStage, GraphStageLogic, OutHandler } diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala index ba21468469a..4aec981690a 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala @@ -954,7 +954,7 @@ private[stream] object Collect { override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = new GraphStageLogic(shape) with InHandler with OutHandler with StageLogging { - override protected def logSource: Class[?] = classOf[Buffer[?]] + override protected def logSource: Class[_] = classOf[Buffer[_]] private val buffer: BufferImpl[T] = BufferImpl(size, inheritedAttributes) @@ -1482,7 +1482,7 @@ private[stream] object Collect { override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = new GraphStageLogic(shape) with InHandler with OutHandler with StageLogging { - override protected def logSource: Class[?] = classOf[Watch[?]] + override protected def logSource: Class[_] = classOf[Watch[_]] override def preStart(): Unit = { val self = getStageActor { @@ -1602,7 +1602,7 @@ private[stream] object Collect { final val fromMaterializer = new LogSource[Materializer] { // do not expose private context classes (of OneBoundedInterpreter) - override def getClazz(t: Materializer): Class[?] = classOf[Materializer] + override def getClazz(t: Materializer): Class[_] = classOf[Materializer] override def genString(t: Materializer): String = { try s"$DefaultLoggerName(${t.supervisor.path})" @@ -1722,7 +1722,7 @@ private[stream] object Collect { final val fromMaterializer = new LogSource[Materializer] { // do not expose private context classes (of OneBoundedInterpreter) - override def getClazz(t: Materializer): Class[?] = classOf[Materializer] + override def getClazz(t: Materializer): Class[_] = classOf[Materializer] override def genString(t: Materializer): String = { try s"$DefaultLoggerName(${t.supervisor.path})" @@ -2213,7 +2213,7 @@ private[pekko] object TakeWithin { emitMultiple(out, rangeSource.range.iterator.asInstanceOf[Iterator[T]], () => completeStage()) case repeatSource: RepeatSource[T @unchecked] => emitMultiple(out, Iterator.continually(repeatSource.elem), () => completeStage()) - case javaStreamSource: JavaStreamSource[T @unchecked, ?] => + case javaStreamSource: JavaStreamSource[T @unchecked, _] => emitMultiple(out, javaStreamSource.open().spliterator(), () => completeStage()) case _ => attempt += 1 diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/StreamOfStreams.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/StreamOfStreams.scala index 1d7ffff8b45..bf9dd864336 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/StreamOfStreams.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/StreamOfStreams.scala @@ -141,7 +141,7 @@ import pekko.util.OptionVal case iterator: IteratorSource[T] @unchecked => addInflightIteratorSource(iterator.createIterator()) case range: RangeSource[T] @unchecked => addInflightRangeSource(range.range) case repeat: RepeatSource[T] @unchecked => addInflightRepeatSource(repeat.elem) - case javaStream: JavaStreamSource[T, ?] @unchecked => addInflightJavaStreamSource(javaStream) + case javaStream: JavaStreamSource[T, _] @unchecked => addInflightJavaStreamSource(javaStream) case failed: FailedSource[T] @unchecked => addCompletedFutureElem(Failure(failed.failure)) case maybeEmpty if TraversalBuilder.isEmptySource(maybeEmpty) => // Empty source is discarded case _ => attachAndMaterializeSource(source) @@ -181,7 +181,7 @@ import pekko.util.OptionVal private def addInflightRepeatSource(elem: T): Unit = addInflightSource(new InflightRepeatSource[T](elem)) - private def addInflightJavaStreamSource(javaStream: JavaStreamSource[T, ?]): Unit = { + private def addInflightJavaStreamSource(javaStream: JavaStreamSource[T, _]): Unit = { val inflight = new InflightJavaStreamSource[T](javaStream.open) if (inflight.hasNext) addInflightSource(inflight) } @@ -236,9 +236,9 @@ import pekko.util.OptionVal src match { case sub: SubSinkInlet[T] @unchecked => sources -= sub - case _: SingleSource[?] => + case _: SingleSource[_] => pendingSingleSources -= 1 - case _: InflightSource[?] => + case _: InflightSource[_] => pendingInflightSources -= 1 case other => throw new IllegalArgumentException(s"Unexpected source type: '${other.getClass}'") } @@ -852,7 +852,7 @@ import pekko.util.OptionVal override def createLogic(attr: Attributes) = new GraphStageLogic(shape) with InHandler { // check for previous materialization eagerly so we fail with a more useful stacktrace private[this] val materializationException: OptionVal[IllegalStateException] = - if (status.get.isInstanceOf[AsyncCallback[?]]) + if (status.get.isInstanceOf[AsyncCallback[_]]) OptionVal.Some(createMaterializedTwiceException()) else OptionVal.None @@ -947,7 +947,7 @@ import pekko.util.OptionVal override def createLogic(inheritedAttributes: Attributes) = new GraphStageLogic(shape) with OutHandler { // check for previous materialization eagerly so we fail with a more useful stacktrace private[this] val materializationException: OptionVal[IllegalStateException] = - if (status.get.isInstanceOf[AsyncCallback[?]]) + if (status.get.isInstanceOf[AsyncCallback[_]]) OptionVal.Some(createMaterializedTwiceException()) else OptionVal.None @@ -959,7 +959,7 @@ import pekko.util.OptionVal case null => if (!status.compareAndSet(null, cb)) setCB(cb) case ActorSubscriberMessage.OnComplete => completeStage() case ActorSubscriberMessage.OnError(ex) => failStage(ex) - case _: AsyncCallback[?] => + case _: AsyncCallback[_] => failStage(materializationException.getOrElse(createMaterializedTwiceException())) case _ => throw new RuntimeException() // won't happen, compiler exhaustiveness check pleaser } diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/io/InputStreamSource.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/io/InputStreamSource.scala index 5a483700adf..fd7c51c8aae 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/io/InputStreamSource.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/io/InputStreamSource.scala @@ -56,7 +56,7 @@ private[pekko] final class InputStreamSource(factory: () => InputStream, chunkSi private var inputStream: InputStream = _ private def isClosed = mat.isCompleted - override protected def logSource: Class[?] = classOf[InputStreamSource] + override protected def logSource: Class[_] = classOf[InputStreamSource] override def preStart(): Unit = { try { diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/io/OutputStreamGraphStage.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/io/OutputStreamGraphStage.scala index d3d62df0b23..e14bcc4cfeb 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/io/OutputStreamGraphStage.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/io/OutputStreamGraphStage.scala @@ -44,7 +44,7 @@ private[pekko] final class OutputStreamGraphStage(factory: () => OutputStream, a var outputStream: OutputStream = _ var bytesWritten: Long = 0L - override protected def logSource: Class[?] = classOf[OutputStreamGraphStage] + override protected def logSource: Class[_] = classOf[OutputStreamGraphStage] override def preStart(): Unit = { try { diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/io/TLSActor.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/io/TLSActor.scala index 9f220074d89..de8ffca0804 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/io/TLSActor.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/io/TLSActor.scala @@ -118,9 +118,9 @@ import pekko.util.ByteString ByteString.empty case _ => throw new RuntimeException() // won't happen, compiler exhaustiveness check pleaser } - if (tracing) log.debug("chopping from new chunk of {} into {} ({})", buffer.size, name, b.position()) + if (tracing) log.debug(s"chopping from new chunk of ${buffer.size} into $name (${b.position()})") } else { - if (tracing) log.debug("chopping from old chunk of {} into {} ({})", buffer.size, name, b.position()) + if (tracing) log.debug(s"chopping from old chunk of ${buffer.size} into $name (${b.position()})") } val copied = buffer.copyToBuffer(b) buffer = buffer.drop(copied) @@ -134,7 +134,7 @@ import pekko.util.ByteString */ def putBack(b: ByteBuffer): Unit = if (b.hasRemaining) { - if (tracing) log.debug("putting back {} bytes into {}", b.remaining, name) + if (tracing) log.debug(s"putting back ${b.remaining} bytes into $name") val bs = ByteString(b) if (bs.nonEmpty) buffer = bs ++ buffer prepare(b) @@ -178,7 +178,7 @@ import pekko.util.ByteString var currentSession = engine.getSession def setNewSessionParameters(params: NegotiateNewSession): Unit = { - if (tracing) log.debug("applying {}", params) + if (tracing) log.debug(s"applying $params") currentSession.invalidate() TlsUtils.applySessionParameters(engine, params) engine.beginHandshake() @@ -310,7 +310,7 @@ import pekko.util.ByteString true } catch { case ex: SSLException => - if (tracing) log.debug("SSLException during doUnwrap: {}", ex) + if (tracing) log.debug(s"SSLException during doUnwrap: $ex") fail(ex, closeTransport = false) try engine.closeInbound() catch { case _: SSLException => () } @@ -338,7 +338,7 @@ import pekko.util.ByteString try doWrap() catch { case ex: SSLException => - if (tracing) log.debug("SSLException during doWrap: {}", ex) + if (tracing) log.debug(s"SSLException during doWrap: $ex") fail(ex, closeTransport = false) completeOrFlush() } @@ -360,7 +360,7 @@ import pekko.util.ByteString if (transportOutBuffer.hasRemaining) { val bs = ByteString(transportOutBuffer) outputBunch.enqueue(TransportOut, bs) - if (tracing) log.debug("sending {} bytes", bs.size) + if (tracing) log.debug(s"sending ${bs.size} bytes") } transportOutBuffer.clear() } @@ -463,8 +463,8 @@ import pekko.util.ByteString val st = lastHandshakeStatus val taskCount = TlsEngineHelpers.runDelegatedTasks(engine) lastHandshakeStatus = engine.getHandshakeStatus - if (tracing && taskCount > 0) log.debug("ran {} delegated TLS task(s)", taskCount) - if (tracing && st != lastHandshakeStatus) log.debug("handshake status after tasks: {}", lastHandshakeStatus) + if (tracing && taskCount > 0) log.debug(s"ran $taskCount delegated TLS task(s)") + if (tracing && st != lastHandshakeStatus) log.debug(s"handshake status after tasks: $lastHandshakeStatus") } private def handshakeFinished(): Unit = { @@ -519,7 +519,7 @@ import pekko.util.ByteString override protected def pumpFinished(): Unit = { inputBunch.cancel() outputBunch.complete() - if (tracing) log.debug("STOP Outbound Closed: {} Inbound closed: {}", engine.isOutboundDone, engine.isInboundDone) + if (tracing) log.debug(s"STOP Outbound Closed: ${engine.isOutboundDone} Inbound closed: ${engine.isInboundDone}") stopped = true context.stop(self) } diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/streamref/SinkRefImpl.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/streamref/SinkRefImpl.scala index 67121c74214..e0430f0a0c0 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/streamref/SinkRefImpl.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/streamref/SinkRefImpl.scala @@ -69,7 +69,7 @@ private[stream] final class SinkRefStageImpl[In] private[pekko] (val initialPart eagerMaterializer: Materializer): (GraphStageLogic, SourceRef[In]) = { val logic = new TimerGraphStageLogic(shape) with StageLogging with ActorRefStage with InHandler { - override protected def logSource: Class[?] = classOf[SinkRefStageImpl[?]] + override protected def logSource: Class[_] = classOf[SinkRefStageImpl[_]] private[this] val streamRefsMaster = StreamRefsMaster(eagerMaterializer.system) diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/streamref/SourceRefImpl.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/streamref/SourceRefImpl.scala index f5cf889272c..98a494de53e 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/streamref/SourceRefImpl.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/streamref/SourceRefImpl.scala @@ -128,7 +128,7 @@ private[stream] final class SourceRefStageImpl[Out](val initialPartnerRef: Optio eagerMaterializer: Materializer): (GraphStageLogic, SinkRef[Out]) = { val logic = new TimerGraphStageLogic(shape) with StageLogging with ActorRefStage with OutHandler { - override protected def logSource: Class[?] = classOf[SourceRefStageImpl[?]] + override protected def logSource: Class[_] = classOf[SourceRefStageImpl[_]] private[this] val streamRefsMaster = StreamRefsMaster(eagerMaterializer.system) @@ -314,7 +314,7 @@ private[stream] final class SourceRefStageImpl[Out](val initialPartnerRef: Optio state match { case WaitingForCancelAck(partner, cause) => verifyPartner(sender, partner) - log.debug("[{}] Got cancellation ack from remote, canceling", stageActorName) + log.debug(s"[{}] Got cancellation ack from remote, canceling", stageActorName) cancelStage(cause) case other => throw new IllegalStateException(s"[$stageActorName] Got an Ack when in state $other") diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Flow.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Flow.scala index 5a889b61899..317f402af60 100755 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Flow.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Flow.scala @@ -28,8 +28,6 @@ import scala.jdk.OptionConverters._ import scala.reflect.ClassTag import scala.util.control.NonFatal -import org.jspecify.annotations.Nullable - import org.apache.pekko import pekko.Done import pekko.NotUsed @@ -45,6 +43,7 @@ import pekko.stream.impl.fusing.{ StatefulMapConcat, ZipWithIndexJava } import pekko.util.ConstantFun import pekko.util.Timeout +import org.jspecify.annotations.Nullable import org.reactivestreams.Processor object Flow { @@ -141,7 +140,7 @@ object Flow { * * See also [[fromSinkAndSourceMat]] when access to materialized values of the parameters is needed. */ - def fromSinkAndSource[I, O](sink: Graph[SinkShape[I], ?], source: Graph[SourceShape[O], ?]): Flow[I, O, NotUsed] = + def fromSinkAndSource[I, O](sink: Graph[SinkShape[I], _], source: Graph[SourceShape[O], _]): Flow[I, O, NotUsed] = new Flow(scaladsl.Flow.fromSinkAndSourceMat(sink, source)(scaladsl.Keep.none)) /** @@ -236,8 +235,8 @@ object Flow { * See also [[fromSinkAndSourceCoupledMat]] when access to materialized values of the parameters is needed. */ def fromSinkAndSourceCoupled[I, O]( - sink: Graph[SinkShape[I], ?], - source: Graph[SourceShape[O], ?]): Flow[I, O, NotUsed] = + sink: Graph[SinkShape[I], _], + source: Graph[SourceShape[O], _]): Flow[I, O, NotUsed] = new Flow(scaladsl.Flow.fromSinkAndSourceCoupled(sink, source)) /** @@ -469,7 +468,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * See also [[toMat]] when access to materialized values of the parameter is needed. */ - def to(sink: Graph[SinkShape[Out], ?]): javadsl.Sink[In, Mat] = + def to(sink: Graph[SinkShape[Out], _]): javadsl.Sink[In, Mat] = new Sink(delegate.to(sink)) /** @@ -1180,7 +1179,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * and the second parameter indicates whether the downstream was cancelled normally. * @since 1.3.0 */ - def doOnCancel(f: function.Procedure2[? >: Throwable, java.lang.Boolean]): javadsl.Flow[In, Out, Mat] = + def doOnCancel(f: function.Procedure2[_ >: Throwable, java.lang.Boolean]): javadsl.Flow[In, Out, Mat] = new Flow(delegate.doOnCancel((ex: Throwable, wasCancelledNormally: Boolean) => f(ex, wasCancelledNormally))) /** @@ -1952,7 +1951,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def recover(clazz: Class[? <: Throwable], creator: function.Creator[Out]): javadsl.Flow[In, Out, Mat] = + def recover(clazz: Class[_ <: Throwable], creator: function.Creator[Out]): javadsl.Flow[In, Out, Mat] = recover { case elem if clazz.isInstance(elem) => creator.create() } @@ -1975,7 +1974,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * @since 1.3.0 */ - def recover(clazz: Class[? <: Throwable], fallbackValue: Out): javadsl.Flow[In, Out, Mat] = + def recover(clazz: Class[_ <: Throwable], fallbackValue: Out): javadsl.Flow[In, Out, Mat] = recover { case elem if clazz.isInstance(elem) => fallbackValue } @@ -1998,7 +1997,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * @since 1.3.0 */ - def recover(p: function.Predicate[? >: Throwable], creator: function.Creator[Out]): javadsl.Flow[In, Out, Mat] = + def recover(p: function.Predicate[_ >: Throwable], creator: function.Creator[Out]): javadsl.Flow[In, Out, Mat] = recover { case elem if p.test(elem) => creator.create() } @@ -2021,7 +2020,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * @since 1.3.0 */ - def recover(p: function.Predicate[? >: Throwable], fallbackValue: Out): javadsl.Flow[In, Out, Mat] = + def recover(p: function.Predicate[_ >: Throwable], fallbackValue: Out): javadsl.Flow[In, Out, Mat] = recover { case elem if p.test(elem) => fallbackValue } @@ -2091,7 +2090,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def recoverWith(pf: PartialFunction[Throwable, ? <: Graph[SourceShape[Out], NotUsed]]): javadsl.Flow[In, Out, Mat] = + def recoverWith(pf: PartialFunction[Throwable, _ <: Graph[SourceShape[Out], NotUsed]]): javadsl.Flow[In, Out, Mat] = new Flow(delegate.recoverWith(pf)) /** @@ -2116,7 +2115,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * '''Cancels when''' downstream cancels */ def recoverWith( - clazz: Class[? <: Throwable], + clazz: Class[_ <: Throwable], creator: function.Creator[Graph[SourceShape[Out], NotUsed]]): javadsl.Flow[In, Out, Mat] = recoverWith({ case elem if clazz.isInstance(elem) => creator.create() @@ -2180,7 +2179,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr */ def recoverWithRetries( attempts: Int, - clazz: Class[? <: Throwable], + clazz: Class[_ <: Throwable], creator: function.Creator[Graph[SourceShape[Out], NotUsed]]): javadsl.Flow[In, Out, Mat] = recoverWithRetries(attempts, { @@ -2219,7 +2218,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * '''Cancels when''' downstream cancels * @since 1.1.0 */ - def onErrorComplete(clazz: Class[? <: Throwable]): javadsl.Flow[In, Out, Mat] = + def onErrorComplete(clazz: Class[_ <: Throwable]): javadsl.Flow[In, Out, Mat] = onErrorComplete(ex => clazz.isInstance(ex)) /** @@ -2237,7 +2236,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * '''Cancels when''' downstream cancels * @since 1.1.0 */ - def onErrorComplete(predicate: function.Predicate[? >: Throwable]): javadsl.Flow[In, Out, Mat] = + def onErrorComplete(predicate: function.Predicate[_ >: Throwable]): javadsl.Flow[In, Out, Mat] = new Flow(delegate.onErrorComplete { case ex: Throwable if predicate.test(ex) => true }) @@ -2263,7 +2262,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * @param errorConsumer function invoked when an error occurs * @since 1.3.0 */ - def onErrorContinue(errorConsumer: function.Procedure[? >: Throwable]): javadsl.Flow[In, Out, Mat] = + def onErrorContinue(errorConsumer: function.Procedure[_ >: Throwable]): javadsl.Flow[In, Out, Mat] = new Flow(delegate.onErrorContinue[Throwable](errorConsumer.apply)) /** @@ -2289,7 +2288,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * @since 1.3.0 */ def onErrorContinue[T <: Throwable](clazz: Class[T], - errorConsumer: function.Procedure[? >: Throwable]): javadsl.Flow[In, Out, Mat] = + errorConsumer: function.Procedure[_ >: Throwable]): javadsl.Flow[In, Out, Mat] = new Flow(delegate.onErrorContinue(clazz.isInstance)(errorConsumer.apply)) /** @@ -2314,8 +2313,8 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * @param errorConsumer function invoked when an error occurs * @since 1.3.0 */ - def onErrorContinue[T <: Throwable](predicate: function.Predicate[? >: Throwable], - errorConsumer: function.Procedure[? >: Throwable]): javadsl.Flow[In, Out, Mat] = + def onErrorContinue[T <: Throwable](predicate: function.Predicate[_ >: Throwable], + errorConsumer: function.Procedure[_ >: Throwable]): javadsl.Flow[In, Out, Mat] = new Flow(delegate.onErrorContinue(predicate.test)(errorConsumer.apply)) /** @@ -2336,7 +2335,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * @param fallback Function which produces a Source to continue the stream * @since 1.3.0 */ - def onErrorResume[T >: Out](fallback: function.Function[? >: Throwable, ? <: Graph[SourceShape[T], NotUsed]]) + def onErrorResume[T >: Out](fallback: function.Function[_ >: Throwable, _ <: Graph[SourceShape[T], NotUsed]]) : javadsl.Flow[In, T, Mat] = new Flow(delegate.recoverWith { case NonFatal(ex) => fallback(ex) }) @@ -2361,8 +2360,8 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * @since 1.3.0 */ def onErrorResume[T >: Out]( - clazz: Class[? <: Throwable], - fallback: function.Function[? >: Throwable, ? <: Graph[SourceShape[T], NotUsed]]) + clazz: Class[_ <: Throwable], + fallback: function.Function[_ >: Throwable, _ <: Graph[SourceShape[T], NotUsed]]) : javadsl.Flow[In, T, Mat] = new Flow(delegate.recoverWith { case NonFatal(ex) if clazz.isInstance(ex) => fallback(ex) }) @@ -2387,8 +2386,8 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * @since 1.3.0 */ def onErrorResume[T >: Out]( - predicate: function.Predicate[? >: Throwable], - fallback: function.Function[? >: Throwable, ? <: Graph[SourceShape[T], NotUsed]]) + predicate: function.Predicate[_ >: Throwable], + fallback: function.Function[_ >: Throwable, _ <: Graph[SourceShape[T], NotUsed]]) : javadsl.Flow[In, T, Mat] = new Flow(delegate.recoverWith { case NonFatal(ex) if predicate.test(ex) => fallback(ex) }) @@ -2956,7 +2955,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def flatMapConcat[T, M](f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): Flow[In, T, Mat] = + def flatMapConcat[T, M](f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): Flow[In, T, Mat] = new Flow(delegate.flatMapConcat[T, M](x => f(x))) /** @@ -2976,7 +2975,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr */ def flatMapConcat[T, M]( parallelism: Int, - f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): Flow[In, T, Mat] = + f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): Flow[In, T, Mat] = new Flow(delegate.flatMapConcat[T, M](parallelism, x => f(x))) /** @@ -2992,7 +2991,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def flatMapMerge[T, M](breadth: Int, f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): Flow[In, T, Mat] = + def flatMapMerge[T, M](breadth: Int, f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): Flow[In, T, Mat] = new Flow(delegate.flatMapMerge(breadth, o => f(o))) /** @@ -3011,7 +3010,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * @since 1.2.0 */ - def switchMap[T, M](f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): Flow[In, T, Mat] = + def switchMap[T, M](f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): Flow[In, T, Mat] = new Flow(delegate.switchMap(o => f(o))) /** @@ -3089,7 +3088,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr */ @varargs @SafeVarargs - def concatAllLazy(those: Graph[SourceShape[Out], ?]*): javadsl.Flow[In, Out, Mat] = + def concatAllLazy(those: Graph[SourceShape[Out], _]*): javadsl.Flow[In, Out, Mat] = new Flow(delegate.concatAllLazy(those: _*)) /** @@ -3279,7 +3278,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream or Sink cancels */ - def alsoTo(that: Graph[SinkShape[Out], ?]): javadsl.Flow[In, Out, Mat] = + def alsoTo(that: Graph[SinkShape[Out], _]): javadsl.Flow[In, Out, Mat] = new Flow(delegate.alsoTo(that)) /** @@ -3298,7 +3297,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr */ @varargs @SafeVarargs - def alsoToAll(those: Graph[SinkShape[Out], ?]*): javadsl.Flow[In, Out, Mat] = + def alsoToAll(those: Graph[SinkShape[Out], _]*): javadsl.Flow[In, Out, Mat] = new Flow(delegate.alsoToAll(those: _*)) /** @@ -3329,7 +3328,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' any of the downstreams cancel */ - def divertTo(that: Graph[SinkShape[Out], ?], when: function.Predicate[Out]): javadsl.Flow[In, Out, Mat] = + def divertTo(that: Graph[SinkShape[Out], _], when: function.Predicate[Out]): javadsl.Flow[In, Out, Mat] = new Flow(delegate.divertTo(that, when.test)) /** @@ -3363,7 +3362,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def wireTap(that: Graph[SinkShape[Out], ?]): javadsl.Flow[In, Out, Mat] = + def wireTap(that: Graph[SinkShape[Out], _]): javadsl.Flow[In, Out, Mat] = new Flow(delegate.wireTap(that)) /** @@ -3408,7 +3407,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def interleave(that: Graph[SourceShape[Out], ?], segmentSize: Int): javadsl.Flow[In, Out, Mat] = + def interleave(that: Graph[SourceShape[Out], _], segmentSize: Int): javadsl.Flow[In, Out, Mat] = interleave(that, segmentSize, eagerClose = false) /** @@ -3431,7 +3430,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def interleave(that: Graph[SourceShape[Out], ?], segmentSize: Int, eagerClose: Boolean): javadsl.Flow[In, Out, Mat] = + def interleave(that: Graph[SourceShape[Out], _], segmentSize: Int, eagerClose: Boolean): javadsl.Flow[In, Out, Mat] = new Flow(delegate.interleave(that, segmentSize, eagerClose)) /** @@ -3498,12 +3497,12 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * '''Cancels when''' downstream cancels */ def interleaveAll( - @Nullable those: java.util.List[? <: Graph[SourceShape[Out], ? <: Any]], + @Nullable those: java.util.List[_ <: Graph[SourceShape[Out], _ <: Any]], segmentSize: Int, eagerClose: Boolean): javadsl.Flow[In, Out, Mat] = { import pekko.util.Collections._ val seq = if (those ne null) those.collectToImmutableSeq { - case source: Source[Out @unchecked, ?] => source.asScala + case source: Source[Out @unchecked, _] => source.asScala case other => other } else immutable.Seq() @@ -3522,7 +3521,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def merge(that: Graph[SourceShape[Out], ?]): javadsl.Flow[In, Out, Mat] = + def merge(that: Graph[SourceShape[Out], _]): javadsl.Flow[In, Out, Mat] = merge(that, eagerComplete = false) /** @@ -3537,7 +3536,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def merge(that: Graph[SourceShape[Out], ?], eagerComplete: Boolean): javadsl.Flow[In, Out, Mat] = + def merge(that: Graph[SourceShape[Out], _], eagerComplete: Boolean): javadsl.Flow[In, Out, Mat] = new Flow(delegate.merge(that, eagerComplete)) /** @@ -3582,11 +3581,11 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * '''Cancels when''' downstream cancels */ def mergeAll( - @Nullable those: java.util.List[? <: Graph[SourceShape[Out], ? <: Any]], + @Nullable those: java.util.List[_ <: Graph[SourceShape[Out], _ <: Any]], eagerComplete: Boolean): javadsl.Flow[In, Out, Mat] = { import pekko.util.Collections._ val seq = if (those ne null) those.collectToImmutableSeq { - case source: Source[Out @unchecked, ?] => source.asScala + case source: Source[Out @unchecked, _] => source.asScala case other => other } else immutable.Seq() @@ -3604,7 +3603,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * '''Completes when''' all upstreams complete (eagerClose=false) or one upstream completes (eagerClose=true) */ def mergeLatest( - that: Graph[SourceShape[Out], ?], + that: Graph[SourceShape[Out], _], eagerComplete: Boolean): javadsl.Flow[In, java.util.List[Out], Mat] = new Flow(delegate.mergeLatest(that, eagerComplete).map(_.asJava)) @@ -3633,7 +3632,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * '''completes''' when all upstreams complete (This behavior is changeable to completing when any upstream completes by setting `eagerComplete=true`.) */ def mergePreferred( - that: Graph[SourceShape[Out], ?], + that: Graph[SourceShape[Out], _], preferred: Boolean, eagerComplete: Boolean): javadsl.Flow[In, Out, Mat] = new Flow(delegate.mergePreferred(that, preferred, eagerComplete)) @@ -3661,7 +3660,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * '''completes''' when both upstreams complete (This behavior is changeable to completing when any upstream completes by setting `eagerComplete=true`.) */ def mergePrioritized( - that: Graph[SourceShape[Out], ?], + that: Graph[SourceShape[Out], _], leftPriority: Int, rightPriority: Int, eagerComplete: Boolean): javadsl.Flow[In, Out, Mat] = @@ -3728,7 +3727,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def zip[T](source: Graph[SourceShape[T], ?]): javadsl.Flow[In, Out Pair T, Mat] = + def zip[T](source: Graph[SourceShape[T], _]): javadsl.Flow[In, Out Pair T, Mat] = zipMat(source, Keep.left) /** @@ -3765,7 +3764,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def zipAll[U, A >: Out](that: Graph[SourceShape[U], ?], thisElem: A, thatElem: U): Flow[In, Pair[A, U], Mat] = + def zipAll[U, A >: Out](that: Graph[SourceShape[U], _], thisElem: A, thatElem: U): Flow[In, Pair[A, U], Mat] = new Flow(delegate.zipAll(that, thisElem, thatElem).map { case (a, u) => Pair.create(a, u) }) /** @@ -3801,7 +3800,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * * '''Cancels when''' downstream cancels */ - def zipLatest[T](source: Graph[SourceShape[T], ?]): javadsl.Flow[In, Out Pair T, Mat] = + def zipLatest[T](source: Graph[SourceShape[T], _]): javadsl.Flow[In, Out Pair T, Mat] = zipLatestMat(source, Keep.left) /** @@ -3840,7 +3839,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * '''Cancels when''' downstream cancels */ def zipWith[Out2, Out3]( - that: Graph[SourceShape[Out2], ?], + that: Graph[SourceShape[Out2], _], combine: function.Function2[Out, Out2, Out3]): javadsl.Flow[In, Out3, Mat] = new Flow(delegate.zipWith[Out2, Out3](that)(combinerToScala(combine))) @@ -3877,7 +3876,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * '''Cancels when''' downstream cancels */ def zipLatestWith[Out2, Out3]( - that: Graph[SourceShape[Out2], ?], + that: Graph[SourceShape[Out2], _], combine: function.Function2[Out, Out2, Out3]): javadsl.Flow[In, Out3, Mat] = new Flow(delegate.zipLatestWith[Out2, Out3](that)(combinerToScala(combine))) @@ -3899,7 +3898,7 @@ final class Flow[In, Out, Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends Gr * '''Cancels when''' downstream cancels */ def zipLatestWith[Out2, Out3]( - that: Graph[SourceShape[Out2], ?], + that: Graph[SourceShape[Out2], _], eagerComplete: Boolean, combine: function.Function2[Out, Out2, Out3]): javadsl.Flow[In, Out3, Mat] = new Flow(delegate.zipLatestWith[Out2, Out3](that, eagerComplete)(combinerToScala(combine))) diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/FlowWithContext.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/FlowWithContext.scala index 00675baa843..7d3f74595a8 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/FlowWithContext.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/FlowWithContext.scala @@ -274,7 +274,7 @@ final class FlowWithContext[In, CtxIn, Out, CtxOut, +Mat]( * @see [[pekko.stream.javadsl.Flow.mapConcat]] */ def mapConcat[Out2]( - f: function.Function[Out, ? <: java.lang.Iterable[Out2]]): FlowWithContext[In, CtxIn, Out2, CtxOut, Mat] = + f: function.Function[Out, _ <: java.lang.Iterable[Out2]]): FlowWithContext[In, CtxIn, Out2, CtxOut, Mat] = viaScala(_.mapConcat(elem => f.apply(elem).asScala)) /** diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Graph.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Graph.scala index 0a919fde2a1..c0f424ffbc4 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Graph.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Graph.scala @@ -751,7 +751,7 @@ object GraphDSL extends GraphCreate { * materialized value and returning the copied Ports that are now to be * connected. */ - def add[S <: Shape](graph: Graph[S, ?]): S = delegate.add(graph) + def add[S <: Shape](graph: Graph[S, _]): S = delegate.add(graph) /** * Returns an [[Outlet]] that gives access to the materialized value of this graph. Once the graph is materialized @@ -782,24 +782,24 @@ object GraphDSL extends GraphCreate { def to[I, O](j: UniformFanOutShape[I, O]): ReverseOps[I] = new ReverseOps(j.in) final class ForwardOps[T](_out: Outlet[T]) { - def toInlet(in: Inlet[? >: T]): Builder[Mat] = { _out ~> in; self } - def to(dst: SinkShape[? >: T]): Builder[Mat] = { _out ~> dst; self } - def toFanIn[U](j: UniformFanInShape[? >: T, U]): Builder[Mat] = { _out ~> j; self } - def toFanOut[U](j: UniformFanOutShape[? >: T, U]): Builder[Mat] = { _out ~> j; self } - def via[U](f: FlowShape[? >: T, U]): ForwardOps[U] = from((_out ~> f).outlet) - def viaFanIn[U](j: UniformFanInShape[? >: T, U]): ForwardOps[U] = from((_out ~> j).outlet) - def viaFanOut[U](j: UniformFanOutShape[? >: T, U]): ForwardOps[U] = from((_out ~> j).outlet) + def toInlet(in: Inlet[_ >: T]): Builder[Mat] = { _out ~> in; self } + def to(dst: SinkShape[_ >: T]): Builder[Mat] = { _out ~> dst; self } + def toFanIn[U](j: UniformFanInShape[_ >: T, U]): Builder[Mat] = { _out ~> j; self } + def toFanOut[U](j: UniformFanOutShape[_ >: T, U]): Builder[Mat] = { _out ~> j; self } + def via[U](f: FlowShape[_ >: T, U]): ForwardOps[U] = from((_out ~> f).outlet) + def viaFanIn[U](j: UniformFanInShape[_ >: T, U]): ForwardOps[U] = from((_out ~> j).outlet) + def viaFanOut[U](j: UniformFanOutShape[_ >: T, U]): ForwardOps[U] = from((_out ~> j).outlet) def out(): Outlet[T] = _out } final class ReverseOps[T](out: Inlet[T]) { - def fromOutlet(dst: Outlet[? <: T]): Builder[Mat] = { out <~ dst; self } - def from(dst: SourceShape[? <: T]): Builder[Mat] = { out <~ dst; self } - def fromFanIn[U](j: UniformFanInShape[U, ? <: T]): Builder[Mat] = { out <~ j; self } - def fromFanOut[U](j: UniformFanOutShape[U, ? <: T]): Builder[Mat] = { out <~ j; self } - def via[U](f: FlowShape[U, ? <: T]): ReverseOps[U] = to((out <~ f).inlet) - def viaFanIn[U](j: UniformFanInShape[U, ? <: T]): ReverseOps[U] = to((out <~ j).inlet) - def viaFanOut[U](j: UniformFanOutShape[U, ? <: T]): ReverseOps[U] = to((out <~ j).inlet) + def fromOutlet(dst: Outlet[_ <: T]): Builder[Mat] = { out <~ dst; self } + def from(dst: SourceShape[_ <: T]): Builder[Mat] = { out <~ dst; self } + def fromFanIn[U](j: UniformFanInShape[U, _ <: T]): Builder[Mat] = { out <~ j; self } + def fromFanOut[U](j: UniformFanOutShape[U, _ <: T]): Builder[Mat] = { out <~ j; self } + def via[U](f: FlowShape[U, _ <: T]): ReverseOps[U] = to((out <~ f).inlet) + def viaFanIn[U](j: UniformFanInShape[U, _ <: T]): ReverseOps[U] = to((out <~ j).inlet) + def viaFanOut[U](j: UniformFanOutShape[U, _ <: T]): ReverseOps[U] = to((out <~ j).inlet) } } } diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartFlow.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartFlow.scala index d47a7893231..4811277a4d6 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartFlow.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartFlow.scala @@ -45,7 +45,7 @@ object RestartFlow { * @param settings [[RestartSettings]] defining restart configuration * @param flowFactory A factory for producing the [[Flow]] to wrap. */ - def withBackoff[In, Out](settings: RestartSettings, flowFactory: Creator[Flow[In, Out, ?]]): Flow[In, Out, NotUsed] = + def withBackoff[In, Out](settings: RestartSettings, flowFactory: Creator[Flow[In, Out, _]]): Flow[In, Out, NotUsed] = pekko.stream.scaladsl.RestartFlow .withBackoff(settings) { () => flowFactory.create().asScala @@ -72,7 +72,7 @@ object RestartFlow { */ def onFailuresWithBackoff[In, Out]( settings: RestartSettings, - flowFactory: Creator[Flow[In, Out, ?]]): Flow[In, Out, NotUsed] = + flowFactory: Creator[Flow[In, Out, _]]): Flow[In, Out, NotUsed] = pekko.stream.scaladsl.RestartFlow .onFailuresWithBackoff(settings) { () => flowFactory.create().asScala diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartSink.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartSink.scala index c0d665b4b07..6f7ef2c1338 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartSink.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartSink.scala @@ -46,7 +46,7 @@ object RestartSink { * @param settings [[RestartSettings]] defining restart configuration * @param sinkFactory A factory for producing the [[Sink]] to wrap. */ - def withBackoff[T](settings: RestartSettings, sinkFactory: Creator[Sink[T, ?]]): Sink[T, NotUsed] = + def withBackoff[T](settings: RestartSettings, sinkFactory: Creator[Sink[T, _]]): Sink[T, NotUsed] = pekko.stream.scaladsl.RestartSink .withBackoff(settings) { () => sinkFactory.create().asScala diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartSource.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartSource.scala index dfcfef50f23..b27f8cb6885 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartSource.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/RestartSource.scala @@ -43,7 +43,7 @@ object RestartSource { * @param settings [[RestartSettings]] defining restart configuration * @param sourceFactory A factory for producing the [[Source]] to wrap. */ - def withBackoff[T](settings: RestartSettings, sourceFactory: Creator[Source[T, ?]]): Source[T, NotUsed] = + def withBackoff[T](settings: RestartSettings, sourceFactory: Creator[Source[T, _]]): Source[T, NotUsed] = pekko.stream.scaladsl.RestartSource .withBackoff(settings) { () => sourceFactory.create().asScala @@ -64,7 +64,7 @@ object RestartSource { * @param settings [[RestartSettings]] defining restart configuration * @param sourceFactory A factory for producing the [[Source]] to wrap. */ - def onFailuresWithBackoff[T](settings: RestartSettings, sourceFactory: Creator[Source[T, ?]]): Source[T, NotUsed] = + def onFailuresWithBackoff[T](settings: RestartSettings, sourceFactory: Creator[Source[T, _]]): Source[T, NotUsed] = pekko.stream.scaladsl.RestartSource .onFailuresWithBackoff(settings) { () => sourceFactory.create().asScala diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Sink.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Sink.scala index f9baca42ec6..091caba216c 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Sink.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Sink.scala @@ -24,8 +24,6 @@ import scala.jdk.FutureConverters._ import scala.jdk.OptionConverters._ import scala.util.Try -import org.jspecify.annotations.Nullable - import org.apache.pekko import pekko._ import pekko.actor.{ ActorRef, ClassicActorSystemProvider, Status } @@ -36,6 +34,7 @@ import pekko.stream.impl.LinearTraversalBuilder import pekko.stream.scaladsl.SinkToCompletionStage import pekko.util.ConstantFun.scalaAnyToUnit +import org.jspecify.annotations.Nullable import org.reactivestreams.{ Publisher, Subscriber } /** Java API */ @@ -158,7 +157,7 @@ object Sink { * result container, optionally transformed into a final representation after all input elements have been processed. * The ``Collector`` can also do reduction at the end. Reduction processing is performed sequentially. */ - def collect[U, In](collector: Collector[In, ? <: Any, U]): Sink[In, CompletionStage[U]] = + def collect[U, In](collector: Collector[In, _ <: Any, U]): Sink[In, CompletionStage[U]] = StreamConverters.javaCollector(() => collector) /** @@ -435,9 +434,9 @@ object Sink { * Combine several sinks with fan-out strategy like `Broadcast` or `Balance` and returns `Sink`. */ def combine[T, U]( - output1: Sink[U, ?], - output2: Sink[U, ?], - @Nullable rest: java.util.List[Sink[U, ?]], + output1: Sink[U, _], + output2: Sink[U, _], + @Nullable rest: java.util.List[Sink[U, _]], fanOutStrategy: function.Function[java.lang.Integer, Graph[UniformFanOutShape[T, U], NotUsed]]) : Sink[T, NotUsed] = { import scala.jdk.CollectionConverters._ @@ -464,7 +463,7 @@ object Sink { * @since 1.1.0 */ def combine[T, U, M]( - @Nullable sinks: java.util.List[? <: Graph[SinkShape[U], M]], + @Nullable sinks: java.util.List[_ <: Graph[SinkShape[U], M]], fanOutStrategy: function.Function[java.lang.Integer, Graph[UniformFanOutShape[T, U], NotUsed]]) : Sink[T, java.util.List[M]] = { import pekko.util.Collections._ diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Source.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Source.scala index e60a445e62c..75f52cc7204 100755 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Source.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Source.scala @@ -538,10 +538,10 @@ object Source { * Combines several sources with fan-in strategy like [[Merge]] or [[Concat]] into a single [[Source]]. */ def combine[T, U]( - first: Source[T, ? <: Any], - second: Source[T, ? <: Any], - @Nullable rest: java.util.List[Source[T, ? <: Any]], - fanInStrategy: function.Function[java.lang.Integer, ? <: Graph[UniformFanInShape[T, U], NotUsed]]) + first: Source[T, _ <: Any], + second: Source[T, _ <: Any], + @Nullable rest: java.util.List[Source[T, _ <: Any]], + fanInStrategy: function.Function[java.lang.Integer, _ <: Graph[UniformFanInShape[T, U], NotUsed]]) : Source[U, NotUsed] = { import scala.jdk.CollectionConverters._ val seq = if (rest ne null) rest.asScala.map(_.asScala).toSeq else immutable.Seq() @@ -554,7 +554,7 @@ object Source { def combineMat[T, U, M1, M2, M]( first: Source[T, M1], second: Source[T, M2], - fanInStrategy: function.Function[java.lang.Integer, ? <: Graph[UniformFanInShape[T, U], NotUsed]], + fanInStrategy: function.Function[java.lang.Integer, _ <: Graph[UniformFanInShape[T, U], NotUsed]], combine: function.Function2[M1, M2, M]): Source[U, M] = { new Source( scaladsl.Source.combineMat(first.asScala, second.asScala)(num => fanInStrategy.apply(num))( @@ -566,7 +566,7 @@ object Source { * @since 1.1.0 */ def combine[T, U, M]( - @Nullable sources: java.util.List[? <: Graph[SourceShape[T], M]], + @Nullable sources: java.util.List[_ <: Graph[SourceShape[T], M]], fanInStrategy: function.Function[java.lang.Integer, Graph[UniformFanInShape[T, U], NotUsed]]) : Source[U, java.util.List[M]] = { import pekko.util.Collections._ @@ -581,7 +581,7 @@ object Source { /** * Combine the elements of multiple streams into a stream of lists. */ - def zipN[T](@Nullable sources: java.util.List[Source[T, ? <: Any]]): Source[java.util.List[T], NotUsed] = { + def zipN[T](@Nullable sources: java.util.List[Source[T, _ <: Any]]): Source[java.util.List[T], NotUsed] = { import scala.jdk.CollectionConverters._ val seq = if (sources ne null) sources.asScala.map(_.asScala).toSeq else immutable.Seq() new Source(scaladsl.Source.zipN(seq).map(_.asJava)) @@ -592,7 +592,7 @@ object Source { */ def zipWithN[T, O]( zipper: function.Function[java.util.List[T], O], - @Nullable sources: java.util.List[Source[T, ? <: Any]]): Source[O, NotUsed] = { + @Nullable sources: java.util.List[Source[T, _ <: Any]]): Source[O, NotUsed] = { import scala.jdk.CollectionConverters._ val seq = if (sources ne null) sources.asScala.map(_.asScala).toSeq else immutable.Seq() new Source(scaladsl.Source.zipWithN[T, O](seq => zipper.apply(seq.asJava))(seq)) @@ -840,7 +840,7 @@ object Source { * '''Cancels when''' downstream cancels */ def mergePrioritizedN[T]( - @Nullable sourcesAndPriorities: java.util.List[Pair[Source[T, ? <: Any], java.lang.Integer]], + @Nullable sourcesAndPriorities: java.util.List[Pair[Source[T, _ <: Any], java.lang.Integer]], eagerComplete: Boolean): javadsl.Source[T, NotUsed] = { import scala.jdk.CollectionConverters._ val seq = @@ -1213,7 +1213,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ */ @varargs @SafeVarargs - def concatAllLazy(those: Graph[SourceShape[Out], ?]*): javadsl.Source[Out, Mat] = + def concatAllLazy(those: Graph[SourceShape[Out], _]*): javadsl.Source[Out, Mat] = new Source(delegate.concatAllLazy(those: _*)) /** @@ -1403,7 +1403,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream or Sink cancels */ - def alsoTo(that: Graph[SinkShape[Out], ?]): javadsl.Source[Out, Mat] = + def alsoTo(that: Graph[SinkShape[Out], _]): javadsl.Source[Out, Mat] = new Source(delegate.alsoTo(that)) /** @@ -1422,7 +1422,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ */ @varargs @SafeVarargs - def alsoToAll(those: Graph[SinkShape[Out], ?]*): javadsl.Source[Out, Mat] = + def alsoToAll(those: Graph[SinkShape[Out], _]*): javadsl.Source[Out, Mat] = new Source(delegate.alsoToAll(those: _*)) /** @@ -1453,7 +1453,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' any of the downstreams cancel */ - def divertTo(that: Graph[SinkShape[Out], ?], when: function.Predicate[Out]): javadsl.Source[Out, Mat] = + def divertTo(that: Graph[SinkShape[Out], _], when: function.Predicate[Out]): javadsl.Source[Out, Mat] = new Source(delegate.divertTo(that, when.test)) /** @@ -1487,7 +1487,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def wireTap(that: Graph[SinkShape[Out], ?]): javadsl.Source[Out, Mat] = + def wireTap(that: Graph[SinkShape[Out], _]): javadsl.Source[Out, Mat] = new Source(delegate.wireTap(that)) /** @@ -1531,7 +1531,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def interleave(that: Graph[SourceShape[Out], ?], segmentSize: Int): javadsl.Source[Out, Mat] = + def interleave(that: Graph[SourceShape[Out], _], segmentSize: Int): javadsl.Source[Out, Mat] = new Source(delegate.interleave(that, segmentSize)) /** @@ -1554,7 +1554,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def interleave(that: Graph[SourceShape[Out], ?], segmentSize: Int, eagerClose: Boolean): javadsl.Source[Out, Mat] = + def interleave(that: Graph[SourceShape[Out], _], segmentSize: Int, eagerClose: Boolean): javadsl.Source[Out, Mat] = new Source(delegate.interleave(that, segmentSize, eagerClose)) /** @@ -1621,12 +1621,12 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * '''Cancels when''' downstream cancels */ def interleaveAll( - @Nullable those: java.util.List[? <: Graph[SourceShape[Out], ? <: Any]], + @Nullable those: java.util.List[_ <: Graph[SourceShape[Out], _ <: Any]], segmentSize: Int, eagerClose: Boolean): javadsl.Source[Out, Mat] = { import pekko.util.Collections._ val seq = if (those ne null) those.collectToImmutableSeq { - case source: Source[Out @unchecked, ?] => source.asScala + case source: Source[Out @unchecked, _] => source.asScala case other => other } else immutable.Seq() @@ -1645,7 +1645,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def merge(that: Graph[SourceShape[Out], ?]): javadsl.Source[Out, Mat] = + def merge(that: Graph[SourceShape[Out], _]): javadsl.Source[Out, Mat] = new Source(delegate.merge(that)) /** @@ -1660,7 +1660,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def merge(that: Graph[SourceShape[Out], ?], eagerComplete: Boolean): javadsl.Source[Out, Mat] = + def merge(that: Graph[SourceShape[Out], _], eagerComplete: Boolean): javadsl.Source[Out, Mat] = new Source(delegate.merge(that, eagerComplete)) /** @@ -1703,11 +1703,11 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * '''Cancels when''' downstream cancels */ def mergeAll( - @Nullable those: java.util.List[? <: Graph[SourceShape[Out], ? <: Any]], + @Nullable those: java.util.List[_ <: Graph[SourceShape[Out], _ <: Any]], eagerComplete: Boolean): javadsl.Source[Out, Mat] = { import pekko.util.Collections._ val seq = if (those ne null) those.collectToImmutableSeq { - case source: Source[Out @unchecked, ?] => source.asScala + case source: Source[Out @unchecked, _] => source.asScala case other => other } else immutable.Seq() @@ -1853,7 +1853,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def zip[T](that: Graph[SourceShape[T], ?]): javadsl.Source[Out @uncheckedVariance Pair T, Mat] = + def zip[T](that: Graph[SourceShape[T], _]): javadsl.Source[Out @uncheckedVariance Pair T, Mat] = zipMat(that, Keep.left) /** @@ -1880,7 +1880,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def zipAll[U, A >: Out](that: Graph[SourceShape[U], ?], thisElem: A, thatElem: U): Source[Pair[A, U], Mat] = + def zipAll[U, A >: Out](that: Graph[SourceShape[U], _], thisElem: A, thatElem: U): Source[Pair[A, U], Mat] = new Source(delegate.zipAll(that, thisElem, thatElem).map { case (a, u) => Pair.create(a, u) }) /** @@ -1916,7 +1916,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def zipLatest[T](that: Graph[SourceShape[T], ?]): javadsl.Source[Out @uncheckedVariance Pair T, Mat] = + def zipLatest[T](that: Graph[SourceShape[T], _]): javadsl.Source[Out @uncheckedVariance Pair T, Mat] = zipLatestMat(that, Keep.left) /** @@ -1945,7 +1945,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * '''Cancels when''' downstream cancels */ def zipWith[Out2, Out3]( - that: Graph[SourceShape[Out2], ?], + that: Graph[SourceShape[Out2], _], combine: function.Function2[Out, Out2, Out3]): javadsl.Source[Out3, Mat] = new Source(delegate.zipWith[Out2, Out3](that)(combinerToScala(combine))) @@ -1982,7 +1982,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * '''Cancels when''' downstream cancels */ def zipLatestWith[Out2, Out3]( - that: Graph[SourceShape[Out2], ?], + that: Graph[SourceShape[Out2], _], combine: function.Function2[Out, Out2, Out3]): javadsl.Source[Out3, Mat] = new Source(delegate.zipLatestWith[Out2, Out3](that)(combinerToScala(combine))) @@ -2004,7 +2004,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * '''Cancels when''' downstream cancels */ def zipLatestWith[Out2, Out3]( - that: Graph[SourceShape[Out2], ?], + that: Graph[SourceShape[Out2], _], eagerComplete: Boolean, combine: function.Function2[Out, Out2, Out3]): javadsl.Source[Out3, Mat] = new Source(delegate.zipLatestWith[Out2, Out3](that, eagerComplete)(combinerToScala(combine))) @@ -2182,7 +2182,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def recover(clazz: Class[? <: Throwable], creator: function.Creator[Out]): javadsl.Source[Out, Mat] = + def recover(clazz: Class[_ <: Throwable], creator: function.Creator[Out]): javadsl.Source[Out, Mat] = recover { case elem if clazz.isInstance(elem) => creator.create() } @@ -2205,7 +2205,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * @since 1.3.0 */ - def recover(clazz: Class[? <: Throwable], fallbackValue: Out): javadsl.Source[Out, Mat] = + def recover(clazz: Class[_ <: Throwable], fallbackValue: Out): javadsl.Source[Out, Mat] = recover { case elem if clazz.isInstance(elem) => fallbackValue } @@ -2228,7 +2228,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * @since 1.3.0 */ - def recover(p: function.Predicate[? >: Throwable], creator: function.Creator[Out]): javadsl.Source[Out, Mat] = + def recover(p: function.Predicate[_ >: Throwable], creator: function.Creator[Out]): javadsl.Source[Out, Mat] = recover { case elem if p.test(elem) => creator.create() } @@ -2251,7 +2251,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * @since 1.3.0 */ - def recover(p: function.Predicate[? >: Throwable], fallbackValue: Out): javadsl.Source[Out, Mat] = + def recover(p: function.Predicate[_ >: Throwable], fallbackValue: Out): javadsl.Source[Out, Mat] = recover { case elem if p.test(elem) => fallbackValue } @@ -2321,7 +2321,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def recoverWith(pf: PartialFunction[Throwable, ? <: Graph[SourceShape[Out], NotUsed]]): Source[Out, Mat] = + def recoverWith(pf: PartialFunction[Throwable, _ <: Graph[SourceShape[Out], NotUsed]]): Source[Out, Mat] = new Source(delegate.recoverWith(pf)) /** @@ -2346,7 +2346,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * '''Cancels when''' downstream cancels */ def recoverWith( - clazz: Class[? <: Throwable], + clazz: Class[_ <: Throwable], creator: function.Creator[Graph[SourceShape[Out], NotUsed]]): Source[Out, Mat] = recoverWith({ case elem if clazz.isInstance(elem) => creator.create() @@ -2376,7 +2376,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ */ def recoverWithRetries( attempts: Int, - pf: PartialFunction[Throwable, ? <: Graph[SourceShape[Out], NotUsed]]): Source[Out, Mat] = + pf: PartialFunction[Throwable, _ <: Graph[SourceShape[Out], NotUsed]]): Source[Out, Mat] = new Source(delegate.recoverWithRetries(attempts, pf)) /** @@ -2407,7 +2407,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ */ def recoverWithRetries( attempts: Int, - clazz: Class[? <: Throwable], + clazz: Class[_ <: Throwable], creator: function.Creator[Graph[SourceShape[Out], NotUsed]]): Source[Out, Mat] = recoverWithRetries(attempts, { @@ -2446,7 +2446,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * '''Cancels when''' downstream cancels * @since 1.1.0 */ - def onErrorComplete(clazz: Class[? <: Throwable]): javadsl.Source[Out, Mat] = + def onErrorComplete(clazz: Class[_ <: Throwable]): javadsl.Source[Out, Mat] = onErrorComplete(ex => clazz.isInstance(ex)) /** @@ -2464,7 +2464,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * '''Cancels when''' downstream cancels * @since 1.1.0 */ - def onErrorComplete(predicate: function.Predicate[? >: Throwable]): javadsl.Source[Out, Mat] = + def onErrorComplete(predicate: function.Predicate[_ >: Throwable]): javadsl.Source[Out, Mat] = new Source(delegate.onErrorComplete { case ex: Throwable if predicate.test(ex) => true }) @@ -2490,7 +2490,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * @param errorConsumer function invoked when an error occurs * @since 1.3.0 */ - def onErrorContinue(errorConsumer: function.Procedure[? >: Throwable]): javadsl.Source[Out, Mat] = + def onErrorContinue(errorConsumer: function.Procedure[_ >: Throwable]): javadsl.Source[Out, Mat] = new Source(delegate.onErrorContinue[Throwable](errorConsumer.apply)) /** @@ -2515,7 +2515,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * @param errorConsumer function invoked when an error occurs * @since 1.3.0 */ - def onErrorContinue[T <: Throwable](clazz: Class[T], errorConsumer: function.Procedure[? >: Throwable]) + def onErrorContinue[T <: Throwable](clazz: Class[T], errorConsumer: function.Procedure[_ >: Throwable]) : javadsl.Source[Out, Mat] = new Source(delegate.onErrorContinue(clazz.isInstance)(errorConsumer.apply)) @@ -2541,8 +2541,8 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * @param errorConsumer function invoked when an error occurs * @since 1.3.0 */ - def onErrorContinue[T <: Throwable](p: function.Predicate[? >: Throwable], - errorConsumer: function.Procedure[? >: Throwable]): javadsl.Source[Out, Mat] = + def onErrorContinue[T <: Throwable](p: function.Predicate[_ >: Throwable], + errorConsumer: function.Procedure[_ >: Throwable]): javadsl.Source[Out, Mat] = new Source(delegate.onErrorContinue(p.test)(errorConsumer.apply)) /** @@ -2564,7 +2564,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * @since 1.3.0 */ def onErrorResume[T >: Out]( - fallback: function.Function[? >: Throwable, ? <: Graph[SourceShape[T], NotUsed]]): javadsl.Source[T, Mat] = + fallback: function.Function[_ >: Throwable, _ <: Graph[SourceShape[T], NotUsed]]): javadsl.Source[T, Mat] = new Source(delegate.recoverWith { case NonFatal(ex) => fallback(ex) }) @@ -2589,8 +2589,8 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * @since 1.3.0 */ def onErrorResume[T >: Out]( - clazz: Class[? <: Throwable], - fallback: function.Function[? >: Throwable, ? <: Graph[SourceShape[T], NotUsed]]): javadsl.Source[T, Mat] = + clazz: Class[_ <: Throwable], + fallback: function.Function[_ >: Throwable, _ <: Graph[SourceShape[T], NotUsed]]): javadsl.Source[T, Mat] = new Source(delegate.recoverWith { case NonFatal(ex) if clazz.isInstance(ex) => fallback(ex) }) @@ -2615,8 +2615,8 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * @since 1.3.0 */ def onErrorResume[T >: Out]( - predicate: function.Predicate[? >: Throwable], - fallback: function.Function[? >: Throwable, ? <: Graph[SourceShape[T], NotUsed]]): javadsl.Source[T, Mat] = + predicate: function.Predicate[_ >: Throwable], + fallback: function.Function[_ >: Throwable, _ <: Graph[SourceShape[T], NotUsed]]): javadsl.Source[T, Mat] = new Source(delegate.recoverWith { case NonFatal(ex) if predicate.test(ex) => fallback(ex) }) @@ -2642,7 +2642,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def mapConcat[T](f: function.Function[Out, ? <: java.lang.Iterable[T]]): javadsl.Source[T, Mat] = + def mapConcat[T](f: function.Function[Out, _ <: java.lang.Iterable[T]]): javadsl.Source[T, Mat] = new Source(delegate.mapConcat(elem => f.apply(elem).asScala)) /** @@ -3076,7 +3076,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * and the second parameter indicates whether the downstream was cancelled normally. * @since 1.3.0 */ - def doOnCancel(f: function.Procedure2[? >: Throwable, java.lang.Boolean]): javadsl.Source[Out, Mat] = + def doOnCancel(f: function.Procedure2[_ >: Throwable, java.lang.Boolean]): javadsl.Source[Out, Mat] = new Source(delegate.doOnCancel((ex: Throwable, wasCancelledNormally: Boolean) => f(ex, wasCancelledNormally))) /** @@ -4384,7 +4384,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def flatMapConcat[T, M](f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): Source[T, Mat] = + def flatMapConcat[T, M](f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): Source[T, Mat] = new Source(delegate.flatMapConcat[T, M](x => f(x))) /** @@ -4402,7 +4402,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * '''Cancels when''' downstream cancels * @since 1.2.0 */ - def flatMapConcat[T, M](parallelism: Int, f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): Source[T, Mat] = + def flatMapConcat[T, M](parallelism: Int, f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): Source[T, Mat] = new Source(delegate.flatMapConcat[T, M](parallelism, x => f(x))) /** @@ -4418,7 +4418,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * '''Cancels when''' downstream cancels */ - def flatMapMerge[T, M](breadth: Int, f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): Source[T, Mat] = + def flatMapMerge[T, M](breadth: Int, f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): Source[T, Mat] = new Source(delegate.flatMapMerge(breadth, o => f(o))) /** @@ -4437,7 +4437,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[ * * @since 1.2.0 */ - def switchMap[T, M](f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): Source[T, Mat] = + def switchMap[T, M](f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): Source[T, Mat] = new Source(delegate.switchMap(o => f(o))) /** diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/SourceWithContext.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/SourceWithContext.scala index f0593e4420e..e46e591a3ea 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/SourceWithContext.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/SourceWithContext.scala @@ -267,7 +267,7 @@ final class SourceWithContext[+Out, +Ctx, +Mat](delegate: scaladsl.SourceWithCon * * @see [[pekko.stream.javadsl.Source.mapConcat]] */ - def mapConcat[Out2](f: function.Function[Out, ? <: java.lang.Iterable[Out2]]): SourceWithContext[Out2, Ctx, Mat] = + def mapConcat[Out2](f: function.Function[Out, _ <: java.lang.Iterable[Out2]]): SourceWithContext[Out2, Ctx, Mat] = viaScala(_.mapConcat(elem => f.apply(elem).asScala)) /** diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/StreamConverters.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/StreamConverters.scala index 967fc24db5c..f62f27fe5e7 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/StreamConverters.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/StreamConverters.scala @@ -213,7 +213,7 @@ object StreamConverters { * Note that a flow can be materialized multiple times, so the function producing the ``Collector`` must be able * to handle multiple invocations. */ - def javaCollector[T, R](collector: function.Creator[Collector[T, ? <: Any, R]]): Sink[T, CompletionStage[R]] = + def javaCollector[T, R](collector: function.Creator[Collector[T, _ <: Any, R]]): Sink[T, CompletionStage[R]] = new Sink(scaladsl.StreamConverters.javaCollector[T, R](() => collector.create()).toCompletionStage()) /** @@ -227,7 +227,7 @@ object StreamConverters { * to handle multiple invocations. */ def javaCollectorParallelUnordered[T, R](parallelism: Int, - collector: function.Creator[Collector[T, ? <: Any, R]]): Sink[T, CompletionStage[R]] = + collector: function.Creator[Collector[T, _ <: Any, R]]): Sink[T, CompletionStage[R]] = new Sink( scaladsl.StreamConverters .javaCollectorParallelUnordered[T, R](parallelism)(() => collector.create()) diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubFlow.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubFlow.scala index 0082bf73d55..79ccd6a908c 100755 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubFlow.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubFlow.scala @@ -26,8 +26,6 @@ import scala.jdk.OptionConverters._ import scala.reflect.ClassTag import scala.util.control.NonFatal -import org.jspecify.annotations.Nullable - import org.apache.pekko import pekko.NotUsed import pekko.event.{ LogMarker, LoggingAdapter, MarkerLoggingAdapter } @@ -37,6 +35,8 @@ import pekko.stream.impl.Stages.DefaultAttributes import pekko.stream.impl.fusing.{ StatefulMapConcat, ZipWithIndexJava } import pekko.util.ConstantFun +import org.jspecify.annotations.Nullable + object SubFlow { /** @@ -136,7 +136,7 @@ final class SubFlow[In, Out, Mat]( * Note that attributes set on the returned graph, including async boundaries are now for the entire graph and not * the `SubFlow`. for example `async` will not have any effect as the returned graph is the entire, closed graph. */ - def to(sink: Graph[SinkShape[Out], ?]): Sink[In, Mat] = + def to(sink: Graph[SinkShape[Out], _]): Sink[In, Mat] = new Sink(delegate.to(sink)) /** @@ -582,7 +582,7 @@ final class SubFlow[In, Out, Mat]( * and the second parameter indicates whether the downstream was cancelled normally. * @since 1.3.0 */ - def doOnCancel(f: function.Procedure2[? >: Throwable, java.lang.Boolean]): SubFlow[In, Out, Mat] = + def doOnCancel(f: function.Procedure2[_ >: Throwable, java.lang.Boolean]): SubFlow[In, Out, Mat] = new SubFlow(delegate.doOnCancel((ex: Throwable, wasCancelledNormally: Boolean) => f(ex, wasCancelledNormally))) /** @@ -1345,7 +1345,7 @@ final class SubFlow[In, Out, Mat]( * * @since 1.3.0 */ - def recover(clazz: Class[? <: Throwable], creator: function.Creator[Out]): SubFlow[In, Out, Mat] = + def recover(clazz: Class[_ <: Throwable], creator: function.Creator[Out]): SubFlow[In, Out, Mat] = new SubFlow(delegate.recover { case elem if clazz.isInstance(elem) => creator.create() }) @@ -1368,7 +1368,7 @@ final class SubFlow[In, Out, Mat]( * * @since 1.3.0 */ - def recover(clazz: Class[? <: Throwable], fallbackValue: Out): SubFlow[In, Out, Mat] = + def recover(clazz: Class[_ <: Throwable], fallbackValue: Out): SubFlow[In, Out, Mat] = new SubFlow(delegate.recover { case elem if clazz.isInstance(elem) => fallbackValue }) @@ -1391,7 +1391,7 @@ final class SubFlow[In, Out, Mat]( * * @since 1.3.0 */ - def recover(p: function.Predicate[? >: Throwable], creator: function.Creator[Out]): SubFlow[In, Out, Mat] = + def recover(p: function.Predicate[_ >: Throwable], creator: function.Creator[Out]): SubFlow[In, Out, Mat] = new SubFlow(delegate.recover { case elem if p.test(elem) => creator.create() }) @@ -1414,7 +1414,7 @@ final class SubFlow[In, Out, Mat]( * * @since 1.3.0 */ - def recover(p: function.Predicate[? >: Throwable], fallbackValue: Out): SubFlow[In, Out, Mat] = + def recover(p: function.Predicate[_ >: Throwable], fallbackValue: Out): SubFlow[In, Out, Mat] = new SubFlow(delegate.recover { case elem if p.test(elem) => fallbackValue }) @@ -1503,7 +1503,7 @@ final class SubFlow[In, Out, Mat]( * '''Cancels when''' downstream cancels * @since 1.1.0 */ - def onErrorComplete(clazz: Class[? <: Throwable]): SubFlow[In, Out, Mat] = onErrorComplete(ex => clazz.isInstance(ex)) + def onErrorComplete(clazz: Class[_ <: Throwable]): SubFlow[In, Out, Mat] = onErrorComplete(ex => clazz.isInstance(ex)) /** * onErrorComplete allows to complete the stream when an upstream error occurs. @@ -1520,7 +1520,7 @@ final class SubFlow[In, Out, Mat]( * '''Cancels when''' downstream cancels * @since 1.1.0 */ - def onErrorComplete(predicate: function.Predicate[? >: Throwable]): SubFlow[In, Out, Mat] = + def onErrorComplete(predicate: function.Predicate[_ >: Throwable]): SubFlow[In, Out, Mat] = new SubFlow(delegate.onErrorComplete { case ex: Throwable if predicate.test(ex) => true }) @@ -1546,7 +1546,7 @@ final class SubFlow[In, Out, Mat]( * @param errorConsumer function invoked when an error occurs * @since 1.3.0 */ - def onErrorContinue(errorConsumer: function.Procedure[? >: Throwable]): SubFlow[In, Out, Mat] = + def onErrorContinue(errorConsumer: function.Procedure[_ >: Throwable]): SubFlow[In, Out, Mat] = new SubFlow(delegate.onErrorContinue[Throwable](errorConsumer.apply)) /** @@ -1572,7 +1572,7 @@ final class SubFlow[In, Out, Mat]( * @since 1.3.0 */ def onErrorContinue[T <: Throwable](clazz: Class[T], - errorConsumer: function.Procedure[? >: Throwable]): SubFlow[In, Out, Mat] = + errorConsumer: function.Procedure[_ >: Throwable]): SubFlow[In, Out, Mat] = new SubFlow(delegate.onErrorContinue(clazz.isInstance)(errorConsumer.apply)) /** @@ -1597,8 +1597,8 @@ final class SubFlow[In, Out, Mat]( * @param errorConsumer function invoked when an error occurs * @since 1.3.0 */ - def onErrorContinue[T <: Throwable](p: function.Predicate[? >: Throwable], - errorConsumer: function.Procedure[? >: Throwable]): SubFlow[In, Out, Mat] = + def onErrorContinue[T <: Throwable](p: function.Predicate[_ >: Throwable], + errorConsumer: function.Procedure[_ >: Throwable]): SubFlow[In, Out, Mat] = new SubFlow(delegate.onErrorContinue(p.test)(errorConsumer.apply)) /** @@ -1620,7 +1620,7 @@ final class SubFlow[In, Out, Mat]( * @since 1.3.0 */ def onErrorResume[T >: Out]( - fallback: function.Function[? >: Throwable, ? <: Graph[SourceShape[T], NotUsed]]): SubFlow[In, T, Mat] = + fallback: function.Function[_ >: Throwable, _ <: Graph[SourceShape[T], NotUsed]]): SubFlow[In, T, Mat] = new SubFlow(delegate.recoverWith { case NonFatal(ex) => fallback(ex) }) @@ -1644,8 +1644,8 @@ final class SubFlow[In, Out, Mat]( * @param fallback Function which produces a Source to continue the stream * @since 1.3.0 */ - def onErrorResume[T >: Out](clazz: Class[? <: Throwable], - fallback: function.Function[? >: Throwable, ? <: Graph[SourceShape[T], NotUsed]]): SubFlow[In, T, Mat] = + def onErrorResume[T >: Out](clazz: Class[_ <: Throwable], + fallback: function.Function[_ >: Throwable, _ <: Graph[SourceShape[T], NotUsed]]): SubFlow[In, T, Mat] = new SubFlow(delegate.recoverWith { case NonFatal(ex) if clazz.isInstance(ex) => fallback(ex) }) @@ -1670,8 +1670,8 @@ final class SubFlow[In, Out, Mat]( * @since 1.3.0 */ def onErrorResume[T >: Out]( - predicate: function.Predicate[? >: Throwable], - fallback: function.Function[? >: Throwable, ? <: Graph[SourceShape[T], NotUsed]]): SubFlow[In, T, Mat] = + predicate: function.Predicate[_ >: Throwable], + fallback: function.Function[_ >: Throwable, _ <: Graph[SourceShape[T], NotUsed]]): SubFlow[In, T, Mat] = new SubFlow(delegate.recoverWith { case NonFatal(ex) if predicate.test(ex) => fallback(ex) }) @@ -2064,7 +2064,7 @@ final class SubFlow[In, Out, Mat]( * * '''Cancels when''' downstream cancels */ - def flatMapConcat[T, M](f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): SubFlow[In, T, Mat] = + def flatMapConcat[T, M](f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): SubFlow[In, T, Mat] = new SubFlow(delegate.flatMapConcat(x => f(x))) /** @@ -2084,7 +2084,7 @@ final class SubFlow[In, Out, Mat]( */ def flatMapConcat[T, M]( parallelism: Int, - f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): SubFlow[In, T, Mat] = + f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): SubFlow[In, T, Mat] = new SubFlow(delegate.flatMapConcat(parallelism, x => f(x))) /** @@ -2100,7 +2100,7 @@ final class SubFlow[In, Out, Mat]( * * '''Cancels when''' downstream cancels */ - def flatMapMerge[T, M](breadth: Int, f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): SubFlow[In, T, Mat] = + def flatMapMerge[T, M](breadth: Int, f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): SubFlow[In, T, Mat] = new SubFlow(delegate.flatMapMerge(breadth, o => f(o))) /** @@ -2119,7 +2119,7 @@ final class SubFlow[In, Out, Mat]( * * @since 1.2.0 */ - def switchMap[T, M](f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): SubFlow[In, T, Mat] = + def switchMap[T, M](f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): SubFlow[In, T, Mat] = new SubFlow(delegate.switchMap(o => f(o))) /** @@ -2197,7 +2197,7 @@ final class SubFlow[In, Out, Mat]( */ @varargs @SafeVarargs - def concatAllLazy(those: Graph[SourceShape[Out], ?]*): SubFlow[In, Out, Mat] = + def concatAllLazy(those: Graph[SourceShape[Out], _]*): SubFlow[In, Out, Mat] = new SubFlow(delegate.concatAllLazy(those: _*)) /** @@ -2286,7 +2286,7 @@ final class SubFlow[In, Out, Mat]( * * '''Cancels when''' downstream or Sink cancels */ - def alsoTo(that: Graph[SinkShape[Out], ?]): SubFlow[In, Out, Mat] = + def alsoTo(that: Graph[SinkShape[Out], _]): SubFlow[In, Out, Mat] = new SubFlow(delegate.alsoTo(that)) /** @@ -2305,7 +2305,7 @@ final class SubFlow[In, Out, Mat]( */ @varargs @SafeVarargs - def alsoToAll(those: Graph[SinkShape[Out], ?]*): SubFlow[In, Out, Mat] = + def alsoToAll(those: Graph[SinkShape[Out], _]*): SubFlow[In, Out, Mat] = new SubFlow(delegate.alsoToAll(those: _*)) /** @@ -2320,7 +2320,7 @@ final class SubFlow[In, Out, Mat]( * * '''Cancels when''' any of the downstreams cancel */ - def divertTo(that: Graph[SinkShape[Out], ?], when: function.Predicate[Out]): SubFlow[In, Out, Mat] = + def divertTo(that: Graph[SinkShape[Out], _], when: function.Predicate[Out]): SubFlow[In, Out, Mat] = new SubFlow(delegate.divertTo(that, when.test)) /** @@ -2339,7 +2339,7 @@ final class SubFlow[In, Out, Mat]( * * '''Cancels when''' downstream cancels */ - def wireTap(that: Graph[SinkShape[Out], ?]): SubFlow[In, Out, Mat] = + def wireTap(that: Graph[SinkShape[Out], _]): SubFlow[In, Out, Mat] = new SubFlow(delegate.wireTap(that)) /** @@ -2354,7 +2354,7 @@ final class SubFlow[In, Out, Mat]( * * '''Cancels when''' downstream cancels */ - def merge(that: Graph[SourceShape[Out], ?]): SubFlow[In, Out, Mat] = + def merge(that: Graph[SourceShape[Out], _]): SubFlow[In, Out, Mat] = new SubFlow(delegate.merge(that)) /** @@ -2370,11 +2370,11 @@ final class SubFlow[In, Out, Mat]( * '''Cancels when''' downstream cancels */ def mergeAll( - @Nullable those: java.util.List[? <: Graph[SourceShape[Out], ? <: Any]], + @Nullable those: java.util.List[_ <: Graph[SourceShape[Out], _ <: Any]], eagerComplete: Boolean): SubFlow[In, Out, Mat] = { import pekko.util.Collections._ val seq = if (those ne null) those.collectToImmutableSeq { - case source: Source[Out @unchecked, ?] => source.asScala + case source: Source[Out @unchecked, _] => source.asScala case other => other } else immutable.Seq() @@ -2404,7 +2404,7 @@ final class SubFlow[In, Out, Mat]( * * '''Cancels when''' downstream cancels */ - def interleave(that: Graph[SourceShape[Out], ?], segmentSize: Int): SubFlow[In, Out, Mat] = + def interleave(that: Graph[SourceShape[Out], _], segmentSize: Int): SubFlow[In, Out, Mat] = new SubFlow(delegate.interleave(that, segmentSize)) /** @@ -2428,12 +2428,12 @@ final class SubFlow[In, Out, Mat]( * '''Cancels when''' downstream cancels */ def interleaveAll( - @Nullable those: java.util.List[? <: Graph[SourceShape[Out], ? <: Any]], + @Nullable those: java.util.List[_ <: Graph[SourceShape[Out], _ <: Any]], segmentSize: Int, eagerClose: Boolean): SubFlow[In, Out, Mat] = { import pekko.util.Collections._ val seq = if (those ne null) those.collectToImmutableSeq { - case source: Source[Out @unchecked, ?] => source.asScala + case source: Source[Out @unchecked, _] => source.asScala case other => other } else immutable.Seq() @@ -2515,7 +2515,7 @@ final class SubFlow[In, Out, Mat]( * * '''Cancels when''' downstream cancels */ - def zip[T](source: Graph[SourceShape[T], ?]): SubFlow[In, pekko.japi.Pair[Out @uncheckedVariance, T], Mat] = + def zip[T](source: Graph[SourceShape[T], _]): SubFlow[In, pekko.japi.Pair[Out @uncheckedVariance, T], Mat] = new SubFlow(delegate.zip(source).map { case (o, t) => pekko.japi.Pair.create(o, t) }) /** @@ -2530,7 +2530,7 @@ final class SubFlow[In, Out, Mat]( * '''Cancels when''' downstream cancels */ def zipAll[U, A >: Out]( - that: Graph[SourceShape[U], ?], + that: Graph[SourceShape[U], _], thisElem: A, thatElem: U): SubFlow[In, pekko.japi.Pair[A, U], Mat] = new SubFlow(delegate.zipAll(that, thisElem, thatElem).map { case (a, u) => Pair.create(a, u) }) @@ -2547,7 +2547,7 @@ final class SubFlow[In, Out, Mat]( * * '''Cancels when''' downstream cancels */ - def zipLatest[T](source: Graph[SourceShape[T], ?]): SubFlow[In, pekko.japi.Pair[Out @uncheckedVariance, T], Mat] = + def zipLatest[T](source: Graph[SourceShape[T], _]): SubFlow[In, pekko.japi.Pair[Out @uncheckedVariance, T], Mat] = new SubFlow(delegate.zipLatest(source).map { case (o, t) => pekko.japi.Pair.create(o, t) }) /** @@ -2563,7 +2563,7 @@ final class SubFlow[In, Out, Mat]( * '''Cancels when''' downstream cancels */ def zipWith[Out2, Out3]( - that: Graph[SourceShape[Out2], ?], + that: Graph[SourceShape[Out2], _], combine: function.Function2[Out, Out2, Out3]): SubFlow[In, Out3, Mat] = new SubFlow(delegate.zipWith[Out2, Out3](that)(combinerToScala(combine))) @@ -2581,7 +2581,7 @@ final class SubFlow[In, Out, Mat]( * '''Cancels when''' downstream cancels */ def zipLatestWith[Out2, Out3]( - that: Graph[SourceShape[Out2], ?], + that: Graph[SourceShape[Out2], _], combine: function.Function2[Out, Out2, Out3]): SubFlow[In, Out3, Mat] = new SubFlow(delegate.zipLatestWith[Out2, Out3](that)(combinerToScala(combine))) diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubSource.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubSource.scala index 18ad5712bc1..6055f28760d 100755 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubSource.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/SubSource.scala @@ -26,8 +26,6 @@ import scala.jdk.OptionConverters._ import scala.reflect.ClassTag import scala.util.control.NonFatal -import org.jspecify.annotations.Nullable - import org.apache.pekko import pekko.NotUsed import pekko.event.{ LogMarker, LoggingAdapter, MarkerLoggingAdapter } @@ -37,6 +35,8 @@ import pekko.stream.impl.Stages.DefaultAttributes import pekko.stream.impl.fusing.{ StatefulMapConcat, ZipWithIndexJava } import pekko.util.ConstantFun +import org.jspecify.annotations.Nullable + /** * * Upcast a stream of elements to a stream of supertypes of that element. Useful in combination with * fan-in operators where you do not want to pay the cost of casting each element in a `map`. @@ -127,7 +127,7 @@ final class SubSource[Out, Mat]( * +----------------------------+ * }}} */ - def to(sink: Graph[SinkShape[Out], ?]): RunnableGraph[Mat] = + def to(sink: Graph[SinkShape[Out], _]): RunnableGraph[Mat] = RunnableGraph.fromGraph(delegate.to(sink)) /** @@ -573,7 +573,7 @@ final class SubSource[Out, Mat]( * and the second parameter indicates whether the downstream was cancelled normally. * @since 1.3.0 */ - def doOnCancel(f: function.Procedure2[? >: Throwable, java.lang.Boolean]): SubSource[Out, Mat] = + def doOnCancel(f: function.Procedure2[_ >: Throwable, java.lang.Boolean]): SubSource[Out, Mat] = new SubSource(delegate.doOnCancel((cause, wasCancelledNormally) => f(cause, wasCancelledNormally))) /** @@ -1325,7 +1325,7 @@ final class SubSource[Out, Mat]( * * @since 1.3.0 */ - def recover(clazz: Class[? <: Throwable], creator: function.Creator[Out]): SubSource[Out, Mat] = + def recover(clazz: Class[_ <: Throwable], creator: function.Creator[Out]): SubSource[Out, Mat] = new SubSource(delegate.recover { case elem if clazz.isInstance(elem) => creator.create() }) @@ -1346,7 +1346,7 @@ final class SubSource[Out, Mat]( * * @since 1.3.0 */ - def recover(clazz: Class[? <: Throwable], fallbackValue: Out): SubSource[Out, Mat] = + def recover(clazz: Class[_ <: Throwable], fallbackValue: Out): SubSource[Out, Mat] = new SubSource(delegate.recover { case elem if clazz.isInstance(elem) => fallbackValue }) @@ -1367,7 +1367,7 @@ final class SubSource[Out, Mat]( * * @since 1.3.0 */ - def recover(p: function.Predicate[? >: Throwable], creator: function.Creator[Out]): SubSource[Out, Mat] = + def recover(p: function.Predicate[_ >: Throwable], creator: function.Creator[Out]): SubSource[Out, Mat] = new SubSource(delegate.recover { case elem if p.test(elem) => creator.create() }) @@ -1388,7 +1388,7 @@ final class SubSource[Out, Mat]( * * @since 1.3.0 */ - def recover(p: function.Predicate[? >: Throwable], fallbackValue: Out): SubSource[Out, Mat] = + def recover(p: function.Predicate[_ >: Throwable], fallbackValue: Out): SubSource[Out, Mat] = new SubSource(delegate.recover { case elem if p.test(elem) => fallbackValue }) @@ -1472,7 +1472,7 @@ final class SubSource[Out, Mat]( * '''Cancels when''' downstream cancels * @since 1.1.0 */ - def onErrorComplete(clazz: Class[? <: Throwable]): SubSource[Out, Mat] = onErrorComplete(ex => clazz.isInstance(ex)) + def onErrorComplete(clazz: Class[_ <: Throwable]): SubSource[Out, Mat] = onErrorComplete(ex => clazz.isInstance(ex)) /** * onErrorComplete allows to complete the stream when an upstream error occurs. @@ -1489,7 +1489,7 @@ final class SubSource[Out, Mat]( * '''Cancels when''' downstream cancels * @since 1.1.0 */ - def onErrorComplete(predicate: function.Predicate[? >: Throwable]): SubSource[Out, Mat] = + def onErrorComplete(predicate: function.Predicate[_ >: Throwable]): SubSource[Out, Mat] = new SubSource(delegate.onErrorComplete { case ex: Throwable if predicate.test(ex) => true }) @@ -1515,7 +1515,7 @@ final class SubSource[Out, Mat]( * @param errorConsumer function invoked when an error occurs * @since 1.3.0 */ - def onErrorContinue(errorConsumer: function.Procedure[? >: Throwable]): SubSource[Out, Mat] = + def onErrorContinue(errorConsumer: function.Procedure[_ >: Throwable]): SubSource[Out, Mat] = new SubSource(delegate.onErrorContinue[Throwable](errorConsumer.apply)) /** @@ -1541,7 +1541,7 @@ final class SubSource[Out, Mat]( * @since 1.3.0 */ def onErrorContinue[T <: Throwable](clazz: Class[T], - errorConsumer: function.Procedure[? >: Throwable]): SubSource[Out, Mat] = + errorConsumer: function.Procedure[_ >: Throwable]): SubSource[Out, Mat] = new SubSource(delegate.onErrorContinue(clazz.isInstance)(errorConsumer.apply)) /** @@ -1566,8 +1566,8 @@ final class SubSource[Out, Mat]( * @param errorConsumer function invoked when an error occurs * @since 1.3.0 */ - def onErrorContinue[T <: Throwable](p: function.Predicate[? >: Throwable], - errorConsumer: function.Procedure[? >: Throwable]): SubSource[Out, Mat] = + def onErrorContinue[T <: Throwable](p: function.Predicate[_ >: Throwable], + errorConsumer: function.Procedure[_ >: Throwable]): SubSource[Out, Mat] = new SubSource(delegate.onErrorContinue(p.test)(errorConsumer.apply)) /** @@ -1589,7 +1589,7 @@ final class SubSource[Out, Mat]( * @since 1.3.0 */ def onErrorResume[T >: Out]( - fallback: function.Function[? >: Throwable, ? <: Graph[SourceShape[T], NotUsed]]): SubSource[T, Mat] = + fallback: function.Function[_ >: Throwable, _ <: Graph[SourceShape[T], NotUsed]]): SubSource[T, Mat] = new SubSource(delegate.recoverWith { case NonFatal(ex) => fallback(ex) }) @@ -1614,8 +1614,8 @@ final class SubSource[Out, Mat]( * @since 1.3.0 */ def onErrorResume[T >: Out]( - clazz: Class[? <: Throwable], - fallback: function.Function[? >: Throwable, ? <: Graph[SourceShape[T], NotUsed]]): SubSource[T, Mat] = + clazz: Class[_ <: Throwable], + fallback: function.Function[_ >: Throwable, _ <: Graph[SourceShape[T], NotUsed]]): SubSource[T, Mat] = new SubSource(delegate.recoverWith { case NonFatal(ex) if clazz.isInstance(ex) => fallback(ex) }) @@ -1640,8 +1640,8 @@ final class SubSource[Out, Mat]( * @since 1.3.0 */ def onErrorResume[T >: Out]( - predicate: function.Predicate[? >: Throwable], - fallback: function.Function[? >: Throwable, ? <: Graph[SourceShape[T], NotUsed]]): SubSource[T, Mat] = + predicate: function.Predicate[_ >: Throwable], + fallback: function.Function[_ >: Throwable, _ <: Graph[SourceShape[T], NotUsed]]): SubSource[T, Mat] = new SubSource(delegate.recoverWith { case NonFatal(ex) if predicate.test(ex) => fallback(ex) }) @@ -2030,7 +2030,7 @@ final class SubSource[Out, Mat]( * * '''Cancels when''' downstream cancels */ - def flatMapConcat[T, M](f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): SubSource[T, Mat] = + def flatMapConcat[T, M](f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): SubSource[T, Mat] = new SubSource(delegate.flatMapConcat(x => f(x))) /** @@ -2050,7 +2050,7 @@ final class SubSource[Out, Mat]( */ def flatMapConcat[T, M]( parallelism: Int, - f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): SubSource[T, Mat] = + f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): SubSource[T, Mat] = new SubSource(delegate.flatMapConcat(parallelism, x => f(x))) /** @@ -2066,7 +2066,7 @@ final class SubSource[Out, Mat]( * * '''Cancels when''' downstream cancels */ - def flatMapMerge[T, M](breadth: Int, f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): SubSource[T, Mat] = + def flatMapMerge[T, M](breadth: Int, f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): SubSource[T, Mat] = new SubSource(delegate.flatMapMerge(breadth, o => f(o))) /** @@ -2085,7 +2085,7 @@ final class SubSource[Out, Mat]( * * @since 1.2.0 */ - def switchMap[T, M](f: function.Function[Out, ? <: Graph[SourceShape[T], M]]): SubSource[T, Mat] = + def switchMap[T, M](f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): SubSource[T, Mat] = new SubSource(delegate.switchMap(o => f(o))) /** @@ -2163,7 +2163,7 @@ final class SubSource[Out, Mat]( */ @varargs @SafeVarargs - def concatAllLazy(those: Graph[SourceShape[Out], ?]*): SubSource[Out, Mat] = + def concatAllLazy(those: Graph[SourceShape[Out], _]*): SubSource[Out, Mat] = new SubSource(delegate.concatAllLazy(those: _*)) /** @@ -2252,7 +2252,7 @@ final class SubSource[Out, Mat]( * * '''Cancels when''' downstream or Sink cancels */ - def alsoTo(that: Graph[SinkShape[Out], ?]): SubSource[Out, Mat] = + def alsoTo(that: Graph[SinkShape[Out], _]): SubSource[Out, Mat] = new SubSource(delegate.alsoTo(that)) /** @@ -2271,7 +2271,7 @@ final class SubSource[Out, Mat]( */ @varargs @SafeVarargs - def alsoToAll(those: Graph[SinkShape[Out], ?]*): SubSource[Out, Mat] = + def alsoToAll(those: Graph[SinkShape[Out], _]*): SubSource[Out, Mat] = new SubSource(delegate.alsoToAll(those: _*)) /** @@ -2286,7 +2286,7 @@ final class SubSource[Out, Mat]( * * '''Cancels when''' any of the downstreams cancel */ - def divertTo(that: Graph[SinkShape[Out], ?], when: function.Predicate[Out]): SubSource[Out, Mat] = + def divertTo(that: Graph[SinkShape[Out], _], when: function.Predicate[Out]): SubSource[Out, Mat] = new SubSource(delegate.divertTo(that, when.test)) /** @@ -2305,7 +2305,7 @@ final class SubSource[Out, Mat]( * * '''Cancels when''' downstream cancels */ - def wireTap(that: Graph[SinkShape[Out], ?]): SubSource[Out, Mat] = + def wireTap(that: Graph[SinkShape[Out], _]): SubSource[Out, Mat] = new SubSource(delegate.wireTap(that)) /** @@ -2320,7 +2320,7 @@ final class SubSource[Out, Mat]( * * '''Cancels when''' downstream cancels */ - def merge(that: Graph[SourceShape[Out], ?]): SubSource[Out, Mat] = + def merge(that: Graph[SourceShape[Out], _]): SubSource[Out, Mat] = new SubSource(delegate.merge(that)) /** @@ -2336,11 +2336,11 @@ final class SubSource[Out, Mat]( * '''Cancels when''' downstream cancels */ def mergeAll( - @Nullable those: java.util.List[? <: Graph[SourceShape[Out], ? <: Any]], + @Nullable those: java.util.List[_ <: Graph[SourceShape[Out], _ <: Any]], eagerComplete: Boolean): SubSource[Out, Mat] = { import pekko.util.Collections._ val seq = if (those ne null) those.collectToImmutableSeq { - case source: Source[Out @unchecked, ?] => source.asScala + case source: Source[Out @unchecked, _] => source.asScala case other => other } else immutable.Seq() @@ -2371,7 +2371,7 @@ final class SubSource[Out, Mat]( * * '''Cancels when''' downstream cancels */ - def interleave(that: Graph[SourceShape[Out], ?], segmentSize: Int): SubSource[Out, Mat] = + def interleave(that: Graph[SourceShape[Out], _], segmentSize: Int): SubSource[Out, Mat] = new SubSource(delegate.interleave(that, segmentSize)) /** @@ -2395,12 +2395,12 @@ final class SubSource[Out, Mat]( * '''Cancels when''' downstream cancels */ def interleaveAll( - @Nullable those: java.util.List[? <: Graph[SourceShape[Out], ? <: Any]], + @Nullable those: java.util.List[_ <: Graph[SourceShape[Out], _ <: Any]], segmentSize: Int, eagerClose: Boolean): SubSource[Out, Mat] = { import pekko.util.Collections._ val seq = if (those ne null) those.collectToImmutableSeq { - case source: Source[Out @unchecked, ?] => source.asScala + case source: Source[Out @unchecked, _] => source.asScala case other => other } else immutable.Seq() @@ -2482,7 +2482,7 @@ final class SubSource[Out, Mat]( * * '''Cancels when''' downstream cancels */ - def zip[T](source: Graph[SourceShape[T], ?]): SubSource[pekko.japi.Pair[Out @uncheckedVariance, T], Mat] = + def zip[T](source: Graph[SourceShape[T], _]): SubSource[pekko.japi.Pair[Out @uncheckedVariance, T], Mat] = new SubSource(delegate.zip(source).map { case (o, t) => pekko.japi.Pair.create(o, t) }) /** @@ -2497,7 +2497,7 @@ final class SubSource[Out, Mat]( * '''Cancels when''' downstream cancels */ def zipAll[U, A >: Out]( - that: Graph[SourceShape[U], ?], + that: Graph[SourceShape[U], _], thisElem: A, thatElem: U): SubSource[pekko.japi.Pair[A, U], Mat] = new SubSource(delegate.zipAll(that, thisElem, thatElem).map { case (a, u) => Pair.create(a, u) }) @@ -2514,7 +2514,7 @@ final class SubSource[Out, Mat]( * * '''Cancels when''' downstream cancels */ - def zipLatest[T](source: Graph[SourceShape[T], ?]): SubSource[pekko.japi.Pair[Out @uncheckedVariance, T], Mat] = + def zipLatest[T](source: Graph[SourceShape[T], _]): SubSource[pekko.japi.Pair[Out @uncheckedVariance, T], Mat] = new SubSource(delegate.zipLatest(source).map { case (o, t) => pekko.japi.Pair.create(o, t) }) /** @@ -2530,7 +2530,7 @@ final class SubSource[Out, Mat]( * '''Cancels when''' downstream cancels */ def zipWith[Out2, Out3]( - that: Graph[SourceShape[Out2], ?], + that: Graph[SourceShape[Out2], _], combine: function.Function2[Out, Out2, Out3]): SubSource[Out3, Mat] = new SubSource(delegate.zipWith[Out2, Out3](that)(combinerToScala(combine))) @@ -2548,7 +2548,7 @@ final class SubSource[Out, Mat]( * '''Cancels when''' downstream cancels */ def zipLatestWith[Out2, Out3]( - that: Graph[SourceShape[Out2], ?], + that: Graph[SourceShape[Out2], _], combine: function.Function2[Out, Out2, Out3]): SubSource[Out3, Mat] = new SubSource(delegate.zipLatestWith[Out2, Out3](that)(combinerToScala(combine))) diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Tcp.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Tcp.scala index 70c47793bb5..2fe12dd0d88 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Tcp.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Tcp.scala @@ -36,13 +36,13 @@ import pekko.actor.ExtensionId import pekko.actor.ExtensionIdProvider import pekko.annotation.InternalApi import pekko.io.Inet.SocketOption -import pekko.japi.Util.immutableSeq import pekko.japi.function import pekko.stream.Materializer import pekko.stream.SystemMaterializer import pekko.stream.TLSClosing import pekko.stream.scaladsl import pekko.util.ByteString +import pekko.japi.Util.immutableSeq object Tcp extends ExtensionId[Tcp] with ExtensionIdProvider { diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/package.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/package.scala index b44a72b1f0f..56baec2ec43 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/package.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/package.scala @@ -20,7 +20,7 @@ package object javadsl { f match { case x if x eq Keep.left => scaladsl.Keep.left.asInstanceOf[(M1, M2) => M] case x if x eq Keep.right => scaladsl.Keep.right.asInstanceOf[(M1, M2) => M] - case s: Function2[?, ?, ?] => s.asInstanceOf[(M1, M2) => M] + case s: Function2[_, _, _] => s.asInstanceOf[(M1, M2) => M] case other => other.apply _ } } diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Flow.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Flow.scala index 59e524fc4cd..c670c8c76aa 100755 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Flow.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Flow.scala @@ -398,7 +398,7 @@ final class Flow[-In, +Out, +Mat]( override def onSubscribe(s: Subscription): Unit = sub.onSubscribe(s) override def onComplete(): Unit = sub.onComplete() override def onNext(t: In): Unit = sub.onNext(t) - override def subscribe(s: Subscriber[? >: Out]): Unit = pub.subscribe(s) + override def subscribe(s: Subscriber[_ >: Out]): Unit = pub.subscribe(s) } } @@ -550,7 +550,7 @@ object Flow { * * See also [[fromSinkAndSourceMat]] when access to materialized values of the parameters is needed. */ - def fromSinkAndSource[I, O](sink: Graph[SinkShape[I], ?], source: Graph[SourceShape[O], ?]): Flow[I, O, NotUsed] = + def fromSinkAndSource[I, O](sink: Graph[SinkShape[I], _], source: Graph[SourceShape[O], _]): Flow[I, O, NotUsed] = fromSinkAndSourceMat(sink, source)(Keep.none) /** @@ -645,8 +645,8 @@ object Flow { * See also [[fromSinkAndSourceCoupledMat]] when access to materialized values of the parameters is needed. */ def fromSinkAndSourceCoupled[I, O]( - sink: Graph[SinkShape[I], ?], - source: Graph[SourceShape[O], ?]): Flow[I, O, NotUsed] = + sink: Graph[SinkShape[I], _], + source: Graph[SourceShape[O], _]): Flow[I, O, NotUsed] = fromSinkAndSourceCoupledMat(sink, source)(Keep.none) /** @@ -1396,7 +1396,7 @@ trait FlowOps[+Out, +Mat] { def mapAsyncPartitioned[T, P](parallelism: Int)( partitioner: Out => P)( f: (Out, P) => Future[T]): Repr[T] = { - val graph: Graph[FlowShape[Out, T], ?] = if (parallelism == 1) { + val graph: Graph[FlowShape[Out, T], _] = if (parallelism == 1) { MapAsyncUnordered(1, elem => f(elem, partitioner(elem))) } else { new MapAsyncPartitioned(parallelism, orderedOutput = true, partitioner, f) @@ -1434,7 +1434,7 @@ trait FlowOps[+Out, +Mat] { def mapAsyncPartitionedUnordered[T, P](parallelism: Int)( partitioner: Out => P)( f: (Out, P) => Future[T]): Repr[T] = { - val graph: Graph[FlowShape[Out, T], ?] = if (parallelism == 1) { + val graph: Graph[FlowShape[Out, T], _] = if (parallelism == 1) { MapAsyncUnordered(1, elem => f(elem, partitioner(elem))) } else { new MapAsyncPartitioned(parallelism, orderedOutput = false, partitioner, f) @@ -3319,7 +3319,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def zip[U](that: Graph[SourceShape[U], ?]): Repr[(Out, U)] = via(zipGraph(that)) + def zip[U](that: Graph[SourceShape[U], _]): Repr[(Out, U)] = via(zipGraph(that)) /** * Combine the elements of current flow and the given [[Source]] into a stream of tuples. @@ -3332,7 +3332,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def zipAll[U, A >: Out](that: Graph[SourceShape[U], ?], thisElem: A, thatElem: U): Repr[(A, U)] = { + def zipAll[U, A >: Out](that: Graph[SourceShape[U], _], thisElem: A, thatElem: U): Repr[(A, U)] = { via(zipAllFlow(that, thisElem, thatElem)) } @@ -3382,7 +3382,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def zipLatest[U](that: Graph[SourceShape[U], ?]): Repr[(Out, U)] = via(zipLatestGraph(that)) + def zipLatest[U](that: Graph[SourceShape[U], _]): Repr[(Out, U)] = via(zipLatestGraph(that)) protected def zipLatestGraph[U, M]( that: Graph[SourceShape[U], M]): Graph[FlowShape[Out @uncheckedVariance, (Out, U)], M] = @@ -3404,7 +3404,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def zipWith[Out2, Out3](that: Graph[SourceShape[Out2], ?])(combine: (Out, Out2) => Out3): Repr[Out3] = + def zipWith[Out2, Out3](that: Graph[SourceShape[Out2], _])(combine: (Out, Out2) => Out3): Repr[Out3] = via(zipWithGraph(that)(combine)) protected def zipWithGraph[Out2, Out3, M](that: Graph[SourceShape[Out2], M])( @@ -3432,7 +3432,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def zipLatestWith[Out2, Out3](that: Graph[SourceShape[Out2], ?])(combine: (Out, Out2) => Out3): Repr[Out3] = + def zipLatestWith[Out2, Out3](that: Graph[SourceShape[Out2], _])(combine: (Out, Out2) => Out3): Repr[Out3] = zipLatestWith(that, eagerComplete = true)(combine) /** @@ -3452,7 +3452,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def zipLatestWith[Out2, Out3](that: Graph[SourceShape[Out2], ?], eagerComplete: Boolean)( + def zipLatestWith[Out2, Out3](that: Graph[SourceShape[Out2], _], eagerComplete: Boolean)( combine: (Out, Out2) => Out3): Repr[Out3] = via(zipLatestWithGraph(that, eagerComplete)(combine)) @@ -3505,7 +3505,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def interleave[U >: Out](that: Graph[SourceShape[U], ?], segmentSize: Int): Repr[U] = + def interleave[U >: Out](that: Graph[SourceShape[U], _], segmentSize: Int): Repr[U] = interleave(that, segmentSize, eagerClose = false) /** @@ -3528,7 +3528,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def interleave[U >: Out](that: Graph[SourceShape[U], ?], segmentSize: Int, eagerClose: Boolean): Repr[U] = + def interleave[U >: Out](that: Graph[SourceShape[U], _], segmentSize: Int, eagerClose: Boolean): Repr[U] = via(interleaveGraph(that, segmentSize, eagerClose)) protected def interleaveGraph[U >: Out, M]( @@ -3562,7 +3562,7 @@ trait FlowOps[+Out, +Mat] { * '''Cancels when''' downstream cancels */ def interleaveAll[U >: Out]( - those: immutable.Seq[Graph[SourceShape[U], ?]], + those: immutable.Seq[Graph[SourceShape[U], _]], segmentSize: Int, eagerClose: Boolean): Repr[U] = those match { case those if those.isEmpty => this.asInstanceOf[Repr[U]] @@ -3612,7 +3612,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def mergeAll[U >: Out](those: immutable.Seq[Graph[SourceShape[U], ?]], eagerComplete: Boolean): Repr[U] = + def mergeAll[U >: Out](those: immutable.Seq[Graph[SourceShape[U], _]], eagerComplete: Boolean): Repr[U] = those match { case those if those.isEmpty => this.asInstanceOf[Repr[U]] case _ => @@ -3809,7 +3809,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def concatAllLazy[U >: Out](those: Graph[SourceShape[U], ?]*): Repr[U] = + def concatAllLazy[U >: Out](those: Graph[SourceShape[U], _]*): Repr[U] = internalConcatAll(those.toArray, detached = false) private def internalConcat[U >: Out, Mat2](that: Graph[SourceShape[U], Mat2], detached: Boolean): Repr[U] = @@ -3844,7 +3844,7 @@ trait FlowOps[+Out, +Mat] { case range: RangeSource[U] @unchecked => via(new IterableConcat[U](() => range.range.iterator.asInstanceOf[Iterator[U]]).addAttributes( sourceAttrs)) - case javaStream: JavaStreamSource[U, ?] @unchecked => + case javaStream: JavaStreamSource[U, _] @unchecked => via(new JavaStreamConcat[U](javaStream.open).addAttributes(sourceAttrs)) case repeat: RepeatSource[U] @unchecked => via(new RepeatConcat[U](repeat.elem).addAttributes(sourceAttrs)) @@ -3859,7 +3859,7 @@ trait FlowOps[+Out, +Mat] { } else via(concatGraph(other, detached)) } - private def internalConcatAll[U >: Out](those: Array[Graph[SourceShape[U], ?]], detached: Boolean): Repr[U] = + private def internalConcatAll[U >: Out](those: Array[Graph[SourceShape[U], _]], detached: Boolean): Repr[U] = those match { case those if those.isEmpty => this.asInstanceOf[Repr[U]] case those if those.length == 1 => internalConcat(those.head, detached) @@ -4009,7 +4009,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream or Sink cancels */ - def alsoTo(that: Graph[SinkShape[Out], ?]): Repr[Out] = via(alsoToGraph(that)) + def alsoTo(that: Graph[SinkShape[Out], _]): Repr[Out] = via(alsoToGraph(that)) protected def alsoToGraph[M](that: Graph[SinkShape[Out], M]): Graph[FlowShape[Out @uncheckedVariance, Out], M] = GraphDSL.createGraph(that) { implicit b => r => @@ -4033,7 +4033,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream or any of the [[Sink]]s cancels */ - def alsoToAll(those: Graph[SinkShape[Out], ?]*): Repr[Out] = those match { + def alsoToAll(those: Graph[SinkShape[Out], _]*): Repr[Out] = those match { case those if those.isEmpty => this.asInstanceOf[Repr[Out]] case _ => via(GraphDSL.create() { implicit b => @@ -4057,7 +4057,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' any of the downstreams cancel */ - def divertTo(that: Graph[SinkShape[Out], ?], when: Out => Boolean): Repr[Out] = via(divertToGraph(that, when)) + def divertTo(that: Graph[SinkShape[Out], _], when: Out => Boolean): Repr[Out] = via(divertToGraph(that, when)) protected def divertToGraph[M]( that: Graph[SinkShape[Out], M], @@ -4085,7 +4085,7 @@ trait FlowOps[+Out, +Mat] { * * '''Cancels when''' downstream cancels */ - def wireTap(that: Graph[SinkShape[Out], ?]): Repr[Out] = via(wireTapGraph(that)) + def wireTap(that: Graph[SinkShape[Out], _]): Repr[Out] = via(wireTapGraph(that)) protected def wireTapGraph[M](that: Graph[SinkShape[Out], M]): Graph[FlowShape[Out @uncheckedVariance, Out], M] = GraphDSL.createGraph(that) { implicit b => r => @@ -4157,7 +4157,7 @@ trait FlowOpsMat[+Out, +Mat] extends FlowOps[Out, Mat] { type Closed = FlowOpsMat.this.ClosedMat[M @uncheckedVariance] type ClosedMat[+MM] = FlowOpsMat.this.ClosedMat[MM] } - type ClosedMat[+M] <: Graph[?, M] + type ClosedMat[+M] <: Graph[_, M] /** * Transform this [[Flow]] by appending the given processing steps. diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/FlowWithContext.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/FlowWithContext.scala index fd7c1eafb6d..c579266fc38 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/FlowWithContext.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/FlowWithContext.scala @@ -146,16 +146,16 @@ final class FlowWithContext[-In, -CtxIn, +Out, +CtxOut, +Mat](delegate: Flow[(In combine: (Mat, Mat2) => Mat3): FlowWithContext[In, CtxIn, Out2, Ctx2, Mat3] = new FlowWithContext(delegate.viaMat(flow)(combine)) - override def alsoTo(that: Graph[SinkShape[Out], ?]): Repr[Out, CtxOut] = + override def alsoTo(that: Graph[SinkShape[Out], _]): Repr[Out, CtxOut] = FlowWithContext.fromTuples(delegate.alsoTo(Sink.contramapImpl(that, (in: (Out, CtxOut)) => in._1))) - override def alsoToContext(that: Graph[SinkShape[CtxOut], ?]): Repr[Out, CtxOut] = + override def alsoToContext(that: Graph[SinkShape[CtxOut], _]): Repr[Out, CtxOut] = FlowWithContext.fromTuples(delegate.alsoTo(Sink.contramapImpl(that, (in: (Out, CtxOut)) => in._2))) - override def wireTap(that: Graph[SinkShape[Out], ?]): Repr[Out, CtxOut] = + override def wireTap(that: Graph[SinkShape[Out], _]): Repr[Out, CtxOut] = FlowWithContext.fromTuples(delegate.wireTap(Sink.contramapImpl(that, (in: (Out, CtxOut)) => in._1))) - override def wireTapContext(that: Graph[SinkShape[CtxOut], ?]): Repr[Out, CtxOut] = + override def wireTapContext(that: Graph[SinkShape[CtxOut], _]): Repr[Out, CtxOut] = FlowWithContext.fromTuples(delegate.wireTap(Sink.contramapImpl(that, (in: (Out, CtxOut)) => in._2))) /** diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/FlowWithContextOps.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/FlowWithContextOps.scala index 9fafa15e642..90c5eb6be48 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/FlowWithContextOps.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/FlowWithContextOps.scala @@ -92,7 +92,7 @@ trait FlowWithContextOps[+Out, +Ctx, +Mat] { * @see [[pekko.stream.scaladsl.FlowOps.alsoTo]] * @since 1.1.0 */ - def alsoTo(that: Graph[SinkShape[Out], ?]): Repr[Out, Ctx] + def alsoTo(that: Graph[SinkShape[Out], _]): Repr[Out, Ctx] /** * Context variant of [[pekko.stream.scaladsl.FlowOps.alsoTo]] @@ -100,7 +100,7 @@ trait FlowWithContextOps[+Out, +Ctx, +Mat] { * @see [[pekko.stream.scaladsl.FlowOps.alsoTo]] * @since 1.1.0 */ - def alsoToContext(that: Graph[SinkShape[Ctx], ?]): Repr[Out, Ctx] + def alsoToContext(that: Graph[SinkShape[Ctx], _]): Repr[Out, Ctx] /** * Data variant of [[pekko.stream.scaladsl.FlowOps.wireTap]] @@ -108,7 +108,7 @@ trait FlowWithContextOps[+Out, +Ctx, +Mat] { * @see [[pekko.stream.scaladsl.FlowOps.wireTap]] * @since 1.1.0 */ - def wireTap(that: Graph[SinkShape[Out], ?]): Repr[Out, Ctx] + def wireTap(that: Graph[SinkShape[Out], _]): Repr[Out, Ctx] /** * Context variant of [[pekko.stream.scaladsl.FlowOps.wireTap]] @@ -116,7 +116,7 @@ trait FlowWithContextOps[+Out, +Ctx, +Mat] { * @see [[pekko.stream.scaladsl.FlowOps.wireTap]] * @since 1.1.0 */ - def wireTapContext(that: Graph[SinkShape[Ctx], ?]): Repr[Out, Ctx] + def wireTapContext(that: Graph[SinkShape[Ctx], _]): Repr[Out, Ctx] /** * Context-preserving variant of [[pekko.stream.scaladsl.FlowOps.map]]. diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Graph.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Graph.scala index 16b9a605c0c..c653800bda0 100755 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Graph.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Graph.scala @@ -1615,8 +1615,8 @@ object GraphDSL extends GraphApply { } class Builder[+M] private[stream] () { - private val unwiredIns = new mutable.HashSet[Inlet[?]]() - private val unwiredOuts = new mutable.HashSet[Outlet[?]]() + private val unwiredIns = new mutable.HashSet[Inlet[_]]() + private val unwiredOuts = new mutable.HashSet[Outlet[_]]() private var traversalBuilderInProgress: TraversalBuilder = TraversalBuilder.empty() @@ -1642,7 +1642,7 @@ object GraphDSL extends GraphApply { * materialized value and returning the copied Ports that are now to be * connected. */ - def add[S <: Shape](graph: Graph[S, ?]): S = { + def add[S <: Shape](graph: Graph[S, _]): S = { val newShape = graph.shape.deepCopy() traversalBuilderInProgress = traversalBuilderInProgress.add(graph.traversalBuilder, newShape, Keep.left) @@ -1658,7 +1658,7 @@ object GraphDSL extends GraphApply { * This is only used by the materialization-importing apply methods of Source, * Flow, Sink and Graph. */ - private[stream] def add[S <: Shape, A](graph: Graph[S, ?], transform: (A) => Any): S = { + private[stream] def add[S <: Shape, A](graph: Graph[S, _], transform: (A) => Any): S = { val newShape = graph.shape.deepCopy() traversalBuilderInProgress = traversalBuilderInProgress.add(graph.traversalBuilder.transformMat(transform), newShape, Keep.right) @@ -1675,7 +1675,7 @@ object GraphDSL extends GraphApply { * This is only used by the materialization-importing apply methods of Source, * Flow, Sink and Graph. */ - private[stream] def add[S <: Shape, A, B](graph: Graph[S, ?], combine: (A, B) => Any): S = { + private[stream] def add[S <: Shape, A, B](graph: Graph[S, _], combine: (A, B) => Any): S = { val newShape = graph.shape.deepCopy() traversalBuilderInProgress = traversalBuilderInProgress.add(graph.traversalBuilder, newShape, combine) @@ -1742,7 +1742,7 @@ object GraphDSL extends GraphApply { object Implicits { @tailrec - private[stream] def findOut[I, O](b: Builder[?], junction: UniformFanOutShape[I, O], n: Int): Outlet[O] = { + private[stream] def findOut[I, O](b: Builder[_], junction: UniformFanOutShape[I, O], n: Int): Outlet[O] = { if (n == junction.outlets.length) throw new IllegalArgumentException(s"no more outlets free on $junction") else if (!b.traversalBuilder.isUnwired(junction.out(n))) findOut(b, junction, n + 1) @@ -1750,7 +1750,7 @@ object GraphDSL extends GraphApply { } @tailrec - private[stream] def findIn[I, O](b: Builder[?], junction: UniformFanInShape[I, O], n: Int): Inlet[I] = { + private[stream] def findIn[I, O](b: Builder[_], junction: UniformFanInShape[I, O], n: Int): Inlet[I] = { if (n == junction.inlets.length) throw new IllegalArgumentException(s"no more inlets free on $junction") else if (!b.traversalBuilder.isUnwired(junction.in(n))) findIn(b, junction, n + 1) @@ -1758,18 +1758,18 @@ object GraphDSL extends GraphApply { } sealed trait CombinerBase[+T] extends Any { - def importAndGetPort(b: Builder[?]): Outlet[T @uncheckedVariance] + def importAndGetPort(b: Builder[_]): Outlet[T @uncheckedVariance] - def ~>[U >: T](to: Inlet[U])(implicit b: Builder[?]): Unit = + def ~>[U >: T](to: Inlet[U])(implicit b: Builder[_]): Unit = b.addEdge(importAndGetPort(b), to) - def ~>[Out](via: Graph[FlowShape[T, Out], Any])(implicit b: Builder[?]): PortOps[Out] = { + def ~>[Out](via: Graph[FlowShape[T, Out], Any])(implicit b: Builder[_]): PortOps[Out] = { val s = b.add(via) b.addEdge(importAndGetPort(b), s.in) s.out } - def ~>[Out](junction: UniformFanInShape[T, Out])(implicit b: Builder[?]): PortOps[Out] = { + def ~>[Out](junction: UniformFanInShape[T, Out])(implicit b: Builder[_]): PortOps[Out] = { def bind(n: Int): Unit = { if (n == junction.inlets.length) throw new IllegalArgumentException(s"no more inlets free on $junction") @@ -1780,7 +1780,7 @@ object GraphDSL extends GraphApply { junction.out } - def ~>[Out](junction: UniformFanOutShape[T, Out])(implicit b: Builder[?]): PortOps[Out] = { + def ~>[Out](junction: UniformFanOutShape[T, Out])(implicit b: Builder[_]): PortOps[Out] = { b.addEdge(importAndGetPort(b), junction.in) try findOut(b, junction, 0) catch { @@ -1788,31 +1788,31 @@ object GraphDSL extends GraphApply { } } - def ~>[Out](flow: FlowShape[T, Out])(implicit b: Builder[?]): PortOps[Out] = { + def ~>[Out](flow: FlowShape[T, Out])(implicit b: Builder[_]): PortOps[Out] = { b.addEdge(importAndGetPort(b), flow.in) flow.out } - def ~>(to: Graph[SinkShape[T], ?])(implicit b: Builder[?]): Unit = + def ~>(to: Graph[SinkShape[T], _])(implicit b: Builder[_]): Unit = b.addEdge(importAndGetPort(b), b.add(to).in) - def ~>(to: SinkShape[T])(implicit b: Builder[?]): Unit = + def ~>(to: SinkShape[T])(implicit b: Builder[_]): Unit = b.addEdge(importAndGetPort(b), to.in) } sealed trait ReverseCombinerBase[T] extends Any { - def importAndGetPortReverse(b: Builder[?]): Inlet[T] + def importAndGetPortReverse(b: Builder[_]): Inlet[T] - def <~[U <: T](from: Outlet[U])(implicit b: Builder[?]): Unit = + def <~[U <: T](from: Outlet[U])(implicit b: Builder[_]): Unit = b.addEdge(from, importAndGetPortReverse(b)) - def <~[In](via: Graph[FlowShape[In, T], ?])(implicit b: Builder[?]): ReversePortOps[In] = { + def <~[In](via: Graph[FlowShape[In, T], _])(implicit b: Builder[_]): ReversePortOps[In] = { val s = b.add(via) b.addEdge(s.out, importAndGetPortReverse(b)) s.in } - def <~[In](junction: UniformFanOutShape[In, T])(implicit b: Builder[?]): ReversePortOps[In] = { + def <~[In](junction: UniformFanOutShape[In, T])(implicit b: Builder[_]): ReversePortOps[In] = { def bind(n: Int): Unit = { if (n == junction.outlets.length) throw new IllegalArgumentException(s"no more outlets free on $junction") @@ -1823,7 +1823,7 @@ object GraphDSL extends GraphApply { junction.in } - def <~[In](junction: UniformFanInShape[In, T])(implicit b: Builder[?]): ReversePortOps[In] = { + def <~[In](junction: UniformFanInShape[In, T])(implicit b: Builder[_]): ReversePortOps[In] = { b.addEdge(junction.out, importAndGetPortReverse(b)) try findIn(b, junction, 0) catch { @@ -1831,15 +1831,15 @@ object GraphDSL extends GraphApply { } } - def <~[In](flow: FlowShape[In, T])(implicit b: Builder[?]): ReversePortOps[In] = { + def <~[In](flow: FlowShape[In, T])(implicit b: Builder[_]): ReversePortOps[In] = { b.addEdge(flow.out, importAndGetPortReverse(b)) flow.in } - def <~(from: Graph[SourceShape[T], ?])(implicit b: Builder[?]): Unit = + def <~(from: Graph[SourceShape[T], _])(implicit b: Builder[_]): Unit = b.addEdge(b.add(from).out, importAndGetPortReverse(b)) - def <~(from: SourceShape[T])(implicit b: Builder[?]): Unit = + def <~(from: SourceShape[T])(implicit b: Builder[_]): Unit = b.addEdge(from.out, importAndGetPortReverse(b)) } @@ -1851,7 +1851,7 @@ object GraphDSL extends GraphApply { def outlet: Outlet[Out @uncheckedVariance] } - private class PortOpsImpl[+Out](override val outlet: Outlet[Out @uncheckedVariance], b: Builder[?]) + private class PortOpsImpl[+Out](override val outlet: Outlet[Out @uncheckedVariance], b: Builder[_]) extends PortOps[Out] { override def withAttributes(attr: Attributes): Repr[Out] = throw settingAttrNotSupported @@ -1862,7 +1862,7 @@ object GraphDSL extends GraphApply { private def settingAttrNotSupported = new UnsupportedOperationException("Cannot set attributes on chained ops from a junction output port") - override def importAndGetPort(b: Builder[?]): Outlet[Out @uncheckedVariance] = outlet + override def importAndGetPort(b: Builder[_]): Outlet[Out @uncheckedVariance] = outlet override def via[T, Mat2](flow: Graph[FlowShape[Out, T], Mat2]): Repr[T] = super.~>(flow)(b) @@ -1873,60 +1873,60 @@ object GraphDSL extends GraphApply { } private class DisabledPortOps[Out](msg: String) extends PortOpsImpl[Out](null, null) { - override def importAndGetPort(b: Builder[?]): Outlet[Out] = throw new IllegalArgumentException(msg) + override def importAndGetPort(b: Builder[_]): Outlet[Out] = throw new IllegalArgumentException(msg) override def via[T, Mat2](flow: Graph[FlowShape[Out, T], Mat2]): Repr[T] = throw new IllegalArgumentException(msg) } implicit class ReversePortOps[In](val inlet: Inlet[In]) extends ReverseCombinerBase[In] { - override def importAndGetPortReverse(b: Builder[?]): Inlet[In] = inlet + override def importAndGetPortReverse(b: Builder[_]): Inlet[In] = inlet } final class DisabledReversePortOps[In](msg: String) extends ReversePortOps[In](null) { - override def importAndGetPortReverse(b: Builder[?]): Inlet[In] = throw new IllegalArgumentException(msg) + override def importAndGetPortReverse(b: Builder[_]): Inlet[In] = throw new IllegalArgumentException(msg) } implicit final class FanInOps[In, Out](val j: UniformFanInShape[In, Out]) extends AnyVal with CombinerBase[Out] with ReverseCombinerBase[In] { - override def importAndGetPort(b: Builder[?]): Outlet[Out] = j.out - override def importAndGetPortReverse(b: Builder[?]): Inlet[In] = findIn(b, j, 0) + override def importAndGetPort(b: Builder[_]): Outlet[Out] = j.out + override def importAndGetPortReverse(b: Builder[_]): Inlet[In] = findIn(b, j, 0) } implicit final class FanOutOps[In, Out](val j: UniformFanOutShape[In, Out]) extends AnyVal with ReverseCombinerBase[In] { - override def importAndGetPortReverse(b: Builder[?]): Inlet[In] = j.in + override def importAndGetPortReverse(b: Builder[_]): Inlet[In] = j.in } - implicit final class SinkArrow[T](val s: Graph[SinkShape[T], ?]) extends AnyVal with ReverseCombinerBase[T] { - override def importAndGetPortReverse(b: Builder[?]): Inlet[T] = b.add(s).in + implicit final class SinkArrow[T](val s: Graph[SinkShape[T], _]) extends AnyVal with ReverseCombinerBase[T] { + override def importAndGetPortReverse(b: Builder[_]): Inlet[T] = b.add(s).in } implicit final class SinkShapeArrow[T](val s: SinkShape[T]) extends AnyVal with ReverseCombinerBase[T] { - override def importAndGetPortReverse(b: Builder[?]): Inlet[T] = s.in + override def importAndGetPortReverse(b: Builder[_]): Inlet[T] = s.in } implicit final class FlowShapeArrow[I, O](val f: FlowShape[I, O]) extends AnyVal with ReverseCombinerBase[I] { - override def importAndGetPortReverse(b: Builder[?]): Inlet[I] = f.in + override def importAndGetPortReverse(b: Builder[_]): Inlet[I] = f.in def <~>[I2, O2, Mat](bidi: Graph[BidiShape[O, O2, I2, I], Mat])( - implicit b: Builder[?]): BidiShape[O, O2, I2, I] = { + implicit b: Builder[_]): BidiShape[O, O2, I2, I] = { val shape = b.add(bidi) b.addEdge(f.out, shape.in1) b.addEdge(shape.out2, f.in) shape } - def <~>[I2, O2](bidi: BidiShape[O, O2, I2, I])(implicit b: Builder[?]): BidiShape[O, O2, I2, I] = { + def <~>[I2, O2](bidi: BidiShape[O, O2, I2, I])(implicit b: Builder[_]): BidiShape[O, O2, I2, I] = { b.addEdge(f.out, bidi.in1) b.addEdge(bidi.out2, f.in) bidi } - def <~>[M](flow: Graph[FlowShape[O, I], M])(implicit b: Builder[?]): Unit = { + def <~>[M](flow: Graph[FlowShape[O, I], M])(implicit b: Builder[_]): Unit = { val shape = b.add(flow) b.addEdge(shape.out, f.in) b.addEdge(f.out, shape.in) @@ -1935,7 +1935,7 @@ object GraphDSL extends GraphApply { implicit final class FlowArrow[I, O, M](val f: Graph[FlowShape[I, O], M]) extends AnyVal { def <~>[I2, O2, Mat](bidi: Graph[BidiShape[O, O2, I2, I], Mat])( - implicit b: Builder[?]): BidiShape[O, O2, I2, I] = { + implicit b: Builder[_]): BidiShape[O, O2, I2, I] = { val shape = b.add(bidi) val flow = b.add(f) b.addEdge(flow.out, shape.in1) @@ -1943,14 +1943,14 @@ object GraphDSL extends GraphApply { shape } - def <~>[I2, O2](bidi: BidiShape[O, O2, I2, I])(implicit b: Builder[?]): BidiShape[O, O2, I2, I] = { + def <~>[I2, O2](bidi: BidiShape[O, O2, I2, I])(implicit b: Builder[_]): BidiShape[O, O2, I2, I] = { val flow = b.add(f) b.addEdge(flow.out, bidi.in1) b.addEdge(bidi.out2, flow.in) bidi } - def <~>[M2](flow: Graph[FlowShape[O, I], M2])(implicit b: Builder[?]): Unit = { + def <~>[M2](flow: Graph[FlowShape[O, I], M2])(implicit b: Builder[_]): Unit = { val shape = b.add(flow) val ff = b.add(f) b.addEdge(shape.out, ff.in) @@ -1959,26 +1959,26 @@ object GraphDSL extends GraphApply { } implicit final class BidiFlowShapeArrow[I1, O1, I2, O2](val bidi: BidiShape[I1, O1, I2, O2]) extends AnyVal { - def <~>[I3, O3](other: BidiShape[O1, O3, I3, I2])(implicit b: Builder[?]): BidiShape[O1, O3, I3, I2] = { + def <~>[I3, O3](other: BidiShape[O1, O3, I3, I2])(implicit b: Builder[_]): BidiShape[O1, O3, I3, I2] = { b.addEdge(bidi.out1, other.in1) b.addEdge(other.out2, bidi.in2) other } def <~>[I3, O3, M](otherFlow: Graph[BidiShape[O1, O3, I3, I2], M])( - implicit b: Builder[?]): BidiShape[O1, O3, I3, I2] = { + implicit b: Builder[_]): BidiShape[O1, O3, I3, I2] = { val other = b.add(otherFlow) b.addEdge(bidi.out1, other.in1) b.addEdge(other.out2, bidi.in2) other } - def <~>(flow: FlowShape[O1, I2])(implicit b: Builder[?]): Unit = { + def <~>(flow: FlowShape[O1, I2])(implicit b: Builder[_]): Unit = { b.addEdge(bidi.out1, flow.in) b.addEdge(flow.out, bidi.in2) } - def <~>[M](f: Graph[FlowShape[O1, I2], M])(implicit b: Builder[?]): Unit = { + def <~>[M](f: Graph[FlowShape[O1, I2], M])(implicit b: Builder[_]): Unit = { val flow = b.add(f) b.addEdge(bidi.out1, flow.in) b.addEdge(flow.out, bidi.in2) @@ -1987,21 +1987,21 @@ object GraphDSL extends GraphApply { import scala.language.implicitConversions - implicit def port2flow[T](from: Outlet[T])(implicit b: Builder[?]): PortOps[T] = + implicit def port2flow[T](from: Outlet[T])(implicit b: Builder[_]): PortOps[T] = new PortOpsImpl(from, b) - implicit def fanOut2flow[I, O](j: UniformFanOutShape[I, O])(implicit b: Builder[?]): PortOps[O] = + implicit def fanOut2flow[I, O](j: UniformFanOutShape[I, O])(implicit b: Builder[_]): PortOps[O] = new PortOpsImpl(findOut(b, j, 0), b) - implicit def flow2flow[I, O](f: FlowShape[I, O])(implicit b: Builder[?]): PortOps[O] = + implicit def flow2flow[I, O](f: FlowShape[I, O])(implicit b: Builder[_]): PortOps[O] = new PortOpsImpl(f.out, b) - implicit final class SourceArrow[T](val s: Graph[SourceShape[T], ?]) extends AnyVal with CombinerBase[T] { - override def importAndGetPort(b: Builder[?]): Outlet[T] = b.add(s).out + implicit final class SourceArrow[T](val s: Graph[SourceShape[T], _]) extends AnyVal with CombinerBase[T] { + override def importAndGetPort(b: Builder[_]): Outlet[T] = b.add(s).out } implicit final class SourceShapeArrow[T](val s: SourceShape[T]) extends AnyVal with CombinerBase[T] { - override def importAndGetPort(b: Builder[?]): Outlet[T] = s.out + override def importAndGetPort(b: Builder[_]): Outlet[T] = s.out } } } diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Hub.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Hub.scala index 8849529e6d2..4b6ca0063ec 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Hub.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Hub.scala @@ -536,17 +536,14 @@ private[pekko] class BroadcastHub[T](startAfterNrOfConsumers: Int, bufferSize: I * of priorities always fall to a range * * This wheel tracks the position of Consumers relative to the slowest ones. Every slot - * contains a map of Consumers being known at that location (this might be out of date!). + * contains a list of Consumers being known at that location (this might be out of date!). * Consumers from time to time send Advance messages to indicate that they have progressed * by reading from the broadcast queue. Consumers that are blocked (due to reaching tail) request * a wakeup and update their position at the same time. * - * Each slot uses a LongMap keyed by Consumer.id for O(1) add/remove without Long boxing. - * Empty slots are null (no backing map allocated), reducing baseline memory and GC pressure. - * When a slot drains to zero consumers, its map is released (set to null). */ private[this] val consumerWheel = - new Array[LongMap[Consumer]](bufferSize * 2) + Array.fill[java.util.ArrayList[Consumer]](bufferSize * 2)(new util.ArrayList[Consumer]()) private[this] var activeConsumers = 0 override def preStart(): Unit = { @@ -577,19 +574,15 @@ private[pekko] class BroadcastHub[T](startAfterNrOfConsumers: Int, bufferSize: I val newOffset = previousOffset + DemandThreshold // Move the consumer from its last known offset to its new one. Check if we are unblocked. val consumer = findAndRemoveConsumer(id, previousOffset) - if (consumer ne null) { - addConsumer(consumer, newOffset) - } + addConsumer(consumer, newOffset) checkUnblock(previousOffset) case NeedWakeup(id, previousOffset, currentOffset) => // Move the consumer from its last known offset to its new one. Check if we are unblocked. val consumer = findAndRemoveConsumer(id, previousOffset) - if (consumer ne null) { - addConsumer(consumer, currentOffset) + addConsumer(consumer, currentOffset) - // Also check if the consumer is now unblocked since we published an element since it went asleep. - if (currentOffset != tail) consumer.callback.invoke(Wakeup) - } + // Also check if the consumer is now unblocked since we published an element since it went asleep. + if (currentOffset != tail) consumer.callback.invoke(Wakeup) checkUnblock(previousOffset) case RegistrationPending => @@ -657,14 +650,10 @@ private[pekko] class BroadcastHub[T](startAfterNrOfConsumers: Int, bufferSize: I consumer.callback.invoke(failMessage) } - // Notify registered consumers — skip null (empty) slots + // Notify registered consumers var idx = 0 while (idx < consumerWheel.length) { - val bucket = consumerWheel(idx) - if (bucket ne null) { - val itr = bucket.valuesIterator - while (itr.hasNext) itr.next().callback.invoke(failMessage) - } + consumerWheel(idx).forEach(_.callback.invoke(failMessage)) idx += 1 } failStage(ex) @@ -675,19 +664,21 @@ private[pekko] class BroadcastHub[T](startAfterNrOfConsumers: Int, bufferSize: I * * NB: You cannot remove a consumer without knowing its last offset! Consumers on the Source side always must * track this so this can be a fast operation. - * - * Uses LongMap.getOrNull + -= to avoid Option allocation on the hot path. */ private def findAndRemoveConsumer(id: Long, offset: Int): Consumer = { + // TODO: Try to eliminate modulo division somehow... val wheelSlot = offset & WheelMask - val bucket = consumerWheel(wheelSlot) - if (bucket eq null) return null - val consumer = bucket.getOrNull(id) - if (consumer ne null) { - bucket -= id - if (bucket.isEmpty) consumerWheel(wheelSlot) = null + val consumersInSlot = consumerWheel(wheelSlot) + var removedConsumer: Consumer = null + if (consumersInSlot.size() > 0) { + consumersInSlot.removeIf(consumer => { + if (consumer.id == id) { + removedConsumer = consumer + true + } else false + }) } - consumer + removedConsumer } /* @@ -706,7 +697,7 @@ private[pekko] class BroadcastHub[T](startAfterNrOfConsumers: Int, bufferSize: I if (offsetOfConsumerRemoved == head) { // Try to advance along the wheel. We can skip any wheel slots which have no waiting Consumers, until // we either find a nonempty one, or we reached the end of the buffer. - while (isConsumerWheelSlotEmpty(head & WheelMask) && head != tail) { + while (consumerWheel(head & WheelMask).isEmpty && head != tail) { queue(head & Mask) = null head += 1 unblocked = true @@ -715,35 +706,18 @@ private[pekko] class BroadcastHub[T](startAfterNrOfConsumers: Int, bufferSize: I unblocked } - private def isConsumerWheelSlotEmpty(slot: Int): Boolean = { - val bucket = consumerWheel(slot) - (bucket eq null) || bucket.isEmpty - } - private def addConsumer(consumer: Consumer, offset: Int): Unit = { val slot = offset & WheelMask - val bucket = consumerWheel(slot) - if (bucket ne null) bucket.update(consumer.id, consumer) - else { - val newBucket = LongMap.empty[Consumer] - newBucket.update(consumer.id, consumer) - consumerWheel(slot) = newBucket - } + consumerWheel(slot).add(consumer) } /* * Send a wakeup signal to all the Consumers at a certain wheel index. Note, this needs the actual index, * which is offset modulo (bufferSize + 1). - * - * Enumeration order of the bucket is not semantically significant — every consumer receives the same - * wakeup signal independently. */ private def wakeupIdx(idx: Int): Unit = { - val bucket = consumerWheel(idx) - if (bucket ne null) { - val itr = bucket.valuesIterator - while (itr.hasNext) itr.next().callback.invoke(Wakeup) - } + val itr = consumerWheel(idx).iterator + while (itr.hasNext) itr.next().callback.invoke(Wakeup) } private def complete(): Unit = { diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/JavaFlowSupport.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/JavaFlowSupport.scala index a8cb7148da6..0d0e01fe8da 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/JavaFlowSupport.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/JavaFlowSupport.scala @@ -102,7 +102,7 @@ object JavaFlowSupport { override def onSubscribe(s: juc.Flow.Subscription): Unit = sub.onSubscribe(s) override def onComplete(): Unit = sub.onComplete() override def onNext(t: In): Unit = sub.onNext(t) - override def subscribe(s: juc.Flow.Subscriber[? >: Out]): Unit = pub.subscribe(s) + override def subscribe(s: juc.Flow.Subscriber[_ >: Out]): Unit = pub.subscribe(s) } } } diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartFlow.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartFlow.scala index fa229be69b8..65f2ff9a4c7 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartFlow.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartFlow.scala @@ -55,7 +55,7 @@ object RestartFlow { * @param settings [[RestartSettings]] defining restart configuration * @param flowFactory A factory for producing the [[Flow]] to wrap. */ - def withBackoff[In, Out](settings: RestartSettings)(flowFactory: () => Flow[In, Out, ?]): Flow[In, Out, NotUsed] = + def withBackoff[In, Out](settings: RestartSettings)(flowFactory: () => Flow[In, Out, _]): Flow[In, Out, NotUsed] = Flow.fromGraph(new RestartWithBackoffFlow(flowFactory, settings, onlyOnFailures = false)) /** @@ -78,13 +78,13 @@ object RestartFlow { * @param flowFactory A factory for producing the [[Flow]] to wrap. */ def onFailuresWithBackoff[In, Out](settings: RestartSettings)( - flowFactory: () => Flow[In, Out, ?]): Flow[In, Out, NotUsed] = + flowFactory: () => Flow[In, Out, _]): Flow[In, Out, NotUsed] = Flow.fromGraph(new RestartWithBackoffFlow(flowFactory, settings, onlyOnFailures = true)) } private final class RestartWithBackoffFlow[In, Out]( - flowFactory: () => Flow[In, Out, ?], + flowFactory: () => Flow[In, Out, _], settings: RestartSettings, onlyOnFailures: Boolean) extends GraphStage[FlowShape[In, Out]] { self => @@ -160,7 +160,7 @@ private abstract class RestartWithBackoffLogic[S <: Shape]( // don't want to restart the sub inlet when it finishes, we just finish normally. var finishing = false - override protected def logSource: Class[?] = classOf[RestartWithBackoffLogic[?]] + override protected def logSource: Class[_] = classOf[RestartWithBackoffLogic[_]] protected def startGraph(): Unit protected def backoff(): Unit @@ -355,7 +355,7 @@ object RestartWithBackoffFlow { override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = new TimerGraphStageLogic(shape) with InHandler with OutHandler with StageLogging { - override protected def logSource: Class[?] = classOf[DelayCancellationStage[?]] + override protected def logSource: Class[_] = classOf[DelayCancellationStage[_]] private var cause: OptionVal[Throwable] = OptionVal.None @@ -371,7 +371,7 @@ object RestartWithBackoffFlow { } override protected def onTimer(timerKey: Any): Unit = { - log.debug("Stage was canceled after delay of {}", delay) + log.debug(s"Stage was canceled after delay of $delay") cause match { case OptionVal.Some(ex) => cancelStage(ex) diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartSink.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartSink.scala index 2f87c533f20..1bb1fd31531 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartSink.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartSink.scala @@ -46,11 +46,11 @@ object RestartSink { * @param settings [[RestartSettings]] defining restart configuration * @param sinkFactory A factory for producing the [[Sink]] to wrap. */ - def withBackoff[T](settings: RestartSettings)(sinkFactory: () => Sink[T, ?]): Sink[T, NotUsed] = + def withBackoff[T](settings: RestartSettings)(sinkFactory: () => Sink[T, _]): Sink[T, NotUsed] = Sink.fromGraph(new RestartWithBackoffSink(sinkFactory, settings)) } -private final class RestartWithBackoffSink[T](sinkFactory: () => Sink[T, ?], restartSettings: RestartSettings) +private final class RestartWithBackoffSink[T](sinkFactory: () => Sink[T, _], restartSettings: RestartSettings) extends GraphStage[SinkShape[T]] { self => val in = Inlet[T]("RestartWithBackoffSink.in") diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartSource.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartSource.scala index 31138018dd4..9524de8af09 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartSource.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/RestartSource.scala @@ -43,7 +43,7 @@ object RestartSource { * @param settings [[RestartSettings]] defining restart configuration * @param sourceFactory A factory for producing the [[Source]] to wrap. */ - def withBackoff[T](settings: RestartSettings)(sourceFactory: () => Source[T, ?]): Source[T, NotUsed] = + def withBackoff[T](settings: RestartSettings)(sourceFactory: () => Source[T, _]): Source[T, NotUsed] = Source.fromGraph(new RestartWithBackoffSource(sourceFactory, settings, onlyOnFailures = false)) /** @@ -61,12 +61,12 @@ object RestartSource { * @param settings [[RestartSettings]] defining restart configuration * @param sourceFactory A factory for producing the [[Source]] to wrap. */ - def onFailuresWithBackoff[T](settings: RestartSettings)(sourceFactory: () => Source[T, ?]): Source[T, NotUsed] = + def onFailuresWithBackoff[T](settings: RestartSettings)(sourceFactory: () => Source[T, _]): Source[T, NotUsed] = Source.fromGraph(new RestartWithBackoffSource(sourceFactory, settings, onlyOnFailures = true)) } private final class RestartWithBackoffSource[T]( - sourceFactory: () => Source[T, ?], + sourceFactory: () => Source[T, _], settings: RestartSettings, onlyOnFailures: Boolean) extends GraphStage[SourceShape[T]] { self => diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Sink.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Sink.scala index 2fa336579b6..b5b0a3c2d28 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Sink.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Sink.scala @@ -287,7 +287,7 @@ object Sink { * See also [[Flow.limit]], [[Flow.limitWeighted]], [[Flow.take]], [[Flow.takeWithin]], [[Flow.takeWhile]] */ def collection[T, That]( - implicit cbf: scala.collection.Factory[T, That with immutable.Iterable[?]]): Sink[T, Future[That]] = + implicit cbf: scala.collection.Factory[T, That with immutable.Iterable[_]]): Sink[T, Future[That]] = Sink.fromGraph(new SeqStage[T, That]) /** @@ -353,7 +353,7 @@ object Sink { /** * Combine several sinks with fan-out strategy like `Broadcast` or `Balance` and returns `Sink`. */ - def combine[T, U](first: Sink[U, ?], second: Sink[U, ?], rest: Sink[U, ?]*)( + def combine[T, U](first: Sink[U, _], second: Sink[U, _], rest: Sink[U, _]*)( fanOutStrategy: Int => Graph[UniformFanOutShape[T, U], NotUsed]): Sink[T, NotUsed] = Sink.fromGraph(GraphDSL.create() { implicit b => import GraphDSL.Implicits._ @@ -361,7 +361,7 @@ object Sink { d.out(0) ~> first d.out(1) ~> second - @tailrec def combineRest(idx: Int, i: Iterator[Sink[U, ?]]): SinkShape[T] = + @tailrec def combineRest(idx: Int, i: Iterator[Sink[U, _]]): SinkShape[T] = if (i.hasNext) { d.out(idx) ~> i.next() combineRest(idx + 1, i) diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Source.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Source.scala index 39b81555263..e598bdac474 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Source.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Source.scala @@ -792,7 +792,7 @@ object Source { /** * Combines several sources with fan-in strategy like [[Merge]] or [[Concat]] into a single [[Source]]. */ - def combine[T, U](first: Source[T, ?], second: Source[T, ?], rest: Source[T, ?]*)( + def combine[T, U](first: Source[T, _], second: Source[T, _], rest: Source[T, _]*)( fanInStrategy: Int => Graph[UniformFanInShape[T, U], NotUsed]): Source[U, NotUsed] = Source.fromGraph(GraphDSL.create() { implicit b => import GraphDSL.Implicits._ @@ -800,7 +800,7 @@ object Source { first ~> c.in(0) second ~> c.in(1) - @tailrec def combineRest(idx: Int, i: Iterator[Source[T, ?]]): SourceShape[U] = + @tailrec def combineRest(idx: Int, i: Iterator[Source[T, _]]): SourceShape[U] = if (i.hasNext) { i.next() ~> c.in(idx) combineRest(idx + 1, i) @@ -882,13 +882,13 @@ object Source { /** * Combine the elements of multiple streams into a stream of sequences. */ - def zipN[T](sources: immutable.Seq[Source[T, ?]]): Source[immutable.Seq[T], NotUsed] = + def zipN[T](sources: immutable.Seq[Source[T, _]]): Source[immutable.Seq[T], NotUsed] = zipWithN(ConstantFun.scalaIdentityFunction[immutable.Seq[T]])(sources).addAttributes(DefaultAttributes.zipN) /** * Combine the elements of multiple streams into a stream of sequences using a combiner function. */ - def zipWithN[T, O](zipper: immutable.Seq[T] => O)(sources: immutable.Seq[Source[T, ?]]): Source[O, NotUsed] = { + def zipWithN[T, O](zipper: immutable.Seq[T] => O)(sources: immutable.Seq[Source[T, _]]): Source[O, NotUsed] = { val source = sources match { case immutable.Seq() => empty[O] case immutable.Seq(source) => source.map(t => zipper(immutable.Seq(t))).mapMaterializedValue(_ => NotUsed) @@ -1119,7 +1119,7 @@ object Source { * '''Cancels when''' downstream cancels */ def mergePrioritizedN[T]( - sourcesAndPriorities: immutable.Seq[(Source[T, ?], Int)], + sourcesAndPriorities: immutable.Seq[(Source[T, _], Int)], eagerComplete: Boolean): Source[T, NotUsed] = { sourcesAndPriorities match { case immutable.Seq() => Source.empty diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/SourceWithContext.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/SourceWithContext.scala index 4890b40efe4..b7323ca4db8 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/SourceWithContext.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/SourceWithContext.scala @@ -163,16 +163,16 @@ final class SourceWithContext[+Out, +Ctx, +Mat] private[stream] (delegate: Sourc def toMat[Mat2, Mat3](sink: Graph[SinkShape[(Out, Ctx)], Mat2])(combine: (Mat, Mat2) => Mat3): RunnableGraph[Mat3] = delegate.toMat(sink)(combine) - override def alsoTo(that: Graph[SinkShape[Out], ?]): Repr[Out, Ctx] = + override def alsoTo(that: Graph[SinkShape[Out], _]): Repr[Out, Ctx] = SourceWithContext.fromTuples(delegate.alsoTo(Sink.contramapImpl(that, (in: (Out, Ctx)) => in._1))) - override def alsoToContext(that: Graph[SinkShape[Ctx], ?]): Repr[Out, Ctx] = + override def alsoToContext(that: Graph[SinkShape[Ctx], _]): Repr[Out, Ctx] = SourceWithContext.fromTuples(delegate.alsoTo(Sink.contramapImpl(that, (in: (Out, Ctx)) => in._2))) - override def wireTap(that: Graph[SinkShape[Out], ?]): Repr[Out, Ctx] = + override def wireTap(that: Graph[SinkShape[Out], _]): Repr[Out, Ctx] = SourceWithContext.fromTuples(delegate.wireTap(Sink.contramapImpl(that, (in: (Out, Ctx)) => in._1))) - override def wireTapContext(that: Graph[SinkShape[Ctx], ?]): Repr[Out, Ctx] = + override def wireTapContext(that: Graph[SinkShape[Ctx], _]): Repr[Out, Ctx] = SourceWithContext.fromTuples(delegate.wireTap(Sink.contramapImpl(that, (in: (Out, Ctx)) => in._2))) /** diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/StreamConverters.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/StreamConverters.scala index d010f59b46a..445e34bdafe 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/StreamConverters.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/StreamConverters.scala @@ -115,7 +115,7 @@ object StreamConverters { * Note that a flow can be materialized multiple times, so the function producing the ``Collector`` must be able * to handle multiple invocations. */ - def javaCollector[T, R](collectorFactory: () => java.util.stream.Collector[T, ? <: Any, R]): Sink[T, Future[R]] = + def javaCollector[T, R](collectorFactory: () => java.util.stream.Collector[T, _ <: Any, R]): Sink[T, Future[R]] = Flow[T] .fold { new FirstCollectorState[T, @@ -139,7 +139,7 @@ object StreamConverters { * to handle multiple invocations. */ def javaCollectorParallelUnordered[T, R](parallelism: Int)( - collectorFactory: () => java.util.stream.Collector[T, ? <: Any, R]): Sink[T, Future[R]] = { + collectorFactory: () => java.util.stream.Collector[T, _ <: Any, R]): Sink[T, Future[R]] = { if (parallelism == 1) javaCollector[T, R](collectorFactory) else { Sink diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/TLS.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/TLS.scala index f69d8ef577d..57e74f1f26a 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/TLS.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/TLS.scala @@ -17,6 +17,8 @@ import javax.net.ssl.{ SSLContext, SSLEngine, SSLSession } import scala.util.{ Success, Try } +import com.typesafe.config.{ ConfigException, ConfigFactory } + import org.apache.pekko import pekko.NotUsed import pekko.stream._ @@ -24,8 +26,6 @@ import pekko.stream.TLSProtocol._ import pekko.stream.impl.io.{ TlsGraphStage, TlsModule } import pekko.util.ByteString -import com.typesafe.config.{ ConfigException, ConfigFactory } - /** * Stream cipher support based upon JSSE. * diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Tcp.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Tcp.scala index f0ea8dc996e..c9b984c60ca 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Tcp.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Tcp.scala @@ -178,7 +178,7 @@ final class Tcp(system: ExtendedActorSystem) extends pekko.actor.Extension { * for servers, and therefore it is the default setting. */ def bindAndHandle( - handler: Flow[ByteString, ByteString, ?], + handler: Flow[ByteString, ByteString, _], interface: String, port: Int, backlog: Int = defaultBacklog, @@ -359,7 +359,7 @@ final class Tcp(system: ExtendedActorSystem) extends pekko.actor.Extension { * @see [[Tcp.bindAndHandle]] */ def bindAndHandleWithTls( - handler: Flow[ByteString, ByteString, ?], + handler: Flow[ByteString, ByteString, _], interface: String, port: Int, createSSLEngine: () => SSLEngine)(implicit m: Materializer): Future[ServerBinding] = @@ -385,7 +385,7 @@ final class Tcp(system: ExtendedActorSystem) extends pekko.actor.Extension { * @see [[Tcp.bindAndHandle]] */ def bindAndHandleWithTls( - handler: Flow[ByteString, ByteString, ?], + handler: Flow[ByteString, ByteString, _], interface: String, port: Int, createSSLEngine: () => SSLEngine, diff --git a/stream/src/main/scala/org/apache/pekko/stream/serialization/StreamRefSerializer.scala b/stream/src/main/scala/org/apache/pekko/stream/serialization/StreamRefSerializer.scala index daa66f753c2..24b9a97c99b 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/serialization/StreamRefSerializer.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/serialization/StreamRefSerializer.scala @@ -43,7 +43,7 @@ private[pekko] final class StreamRefSerializer(val system: ExtendedActorSystem) override def manifest(o: AnyRef): String = o match { // protocol - case _: StreamRefsProtocol.SequencedOnNext[?] => SequencedOnNextManifest + case _: StreamRefsProtocol.SequencedOnNext[_] => SequencedOnNextManifest case _: StreamRefsProtocol.CumulativeDemand => CumulativeDemandManifest // handshake case _: StreamRefsProtocol.OnSubscribeHandshake => OnSubscribeHandshakeManifest @@ -51,9 +51,9 @@ private[pekko] final class StreamRefSerializer(val system: ExtendedActorSystem) case _: StreamRefsProtocol.RemoteStreamFailure => RemoteSinkFailureManifest case _: StreamRefsProtocol.RemoteStreamCompleted => RemoteSinkCompletedManifest // refs - case _: SourceRefImpl[?] => SourceRefManifest + case _: SourceRefImpl[_] => SourceRefManifest // case _: MaterializedSourceRef[_] => SourceRefManifest - case _: SinkRefImpl[?] => SinkRefManifest + case _: SinkRefImpl[_] => SinkRefManifest // case _: MaterializedSinkRef[_] => SinkRefManifest case StreamRefsProtocol.Ack => AckManifest case unknown => throw new IllegalArgumentException(s"Unsupported object ${unknown.getClass}") @@ -61,7 +61,7 @@ private[pekko] final class StreamRefSerializer(val system: ExtendedActorSystem) override def toBinary(o: AnyRef): Array[Byte] = o match { // protocol - case o: StreamRefsProtocol.SequencedOnNext[?] => serializeSequencedOnNext(o).toByteArray + case o: StreamRefsProtocol.SequencedOnNext[_] => serializeSequencedOnNext(o).toByteArray case d: StreamRefsProtocol.CumulativeDemand => serializeCumulativeDemand(d).toByteArray // handshake case h: StreamRefsProtocol.OnSubscribeHandshake => serializeOnSubscribeHandshake(h).toByteArray @@ -69,9 +69,9 @@ private[pekko] final class StreamRefSerializer(val system: ExtendedActorSystem) case d: StreamRefsProtocol.RemoteStreamFailure => serializeRemoteSinkFailure(d).toByteArray case d: StreamRefsProtocol.RemoteStreamCompleted => serializeRemoteSinkCompleted(d).toByteArray // refs - case ref: SinkRefImpl[?] => serializeSinkRef(ref).toByteArray + case ref: SinkRefImpl[_] => serializeSinkRef(ref).toByteArray // case ref: MaterializedSinkRef[_] => ??? // serializeSinkRef(ref).toByteArray - case ref: SourceRefImpl[?] => serializeSourceRef(ref).toByteArray + case ref: SourceRefImpl[_] => serializeSourceRef(ref).toByteArray // case ref: MaterializedSourceRef[_] => serializeSourceRef(ref.).toByteArray case StreamRefsProtocol.Ack => Array.emptyByteArray case unknown => throw new IllegalArgumentException(s"Unsupported object ${unknown.getClass}") @@ -121,7 +121,7 @@ private[pekko] final class StreamRefSerializer(val system: ExtendedActorSystem) .build() } - private def serializeSequencedOnNext(o: StreamRefsProtocol.SequencedOnNext[?]) = { + private def serializeSequencedOnNext(o: StreamRefsProtocol.SequencedOnNext[_]) = { val p = o.payload.asInstanceOf[AnyRef] val msgSerializer = serialization.findSerializerFor(p) @@ -136,7 +136,7 @@ private[pekko] final class StreamRefSerializer(val system: ExtendedActorSystem) StreamRefMessages.SequencedOnNext.newBuilder().setSeqNr(o.seqNr).setPayload(payloadBuilder.build()).build() } - private def serializeSinkRef(sink: SinkRefImpl[?]): StreamRefMessages.SinkRef = { + private def serializeSinkRef(sink: SinkRefImpl[_]): StreamRefMessages.SinkRef = { StreamRefMessages.SinkRef .newBuilder() .setTargetRef( @@ -144,7 +144,7 @@ private[pekko] final class StreamRefSerializer(val system: ExtendedActorSystem) .build() } - private def serializeSourceRef(source: SourceRefImpl[?]): StreamRefMessages.SourceRef = { + private def serializeSourceRef(source: SourceRefImpl[_]): StreamRefMessages.SourceRef = { StreamRefMessages.SourceRef .newBuilder() .setOriginRef( diff --git a/stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala b/stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala index 8a8168ff26e..5e1aec586c6 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala @@ -14,7 +14,6 @@ package org.apache.pekko.stream.stage import java.util.Spliterator -import java.lang.invoke.{ MethodHandles, VarHandle } import java.util.concurrent.{ CompletionStage, ConcurrentHashMap } import java.util.concurrent.atomic.AtomicReference @@ -28,7 +27,6 @@ import org.apache.pekko import pekko.{ Done, NotUsed } import pekko.actor._ import pekko.annotation.InternalApi -import pekko.dispatch.AbstractNodeQueue import pekko.japi.function.{ Effect, Procedure } import pekko.stream._ import pekko.stream.Attributes.SourceLocation @@ -208,61 +206,29 @@ object GraphStageLogic { * * Not for user instantiation, use [[GraphStageLogic.getStageActor]]. */ - final class StageActor @InternalApi() private ( + final class StageActor @InternalApi() private[pekko] ( materializer: Materializer, + getAsyncCallback: StageActorRef.Receive => AsyncCallback[(ActorRef, Any)], initialReceive: StageActorRef.Receive, - name: String, - cell: ActorCell, - buildDispatch: StageActorRef.Receive => ((ActorRef, Any)) => Unit) { - - @InternalApi private[pekko] def this( - materializer: Materializer, - getAsyncCallback: StageActorRef.Receive => AsyncCallback[(ActorRef, Any)], - initialReceive: StageActorRef.Receive, - name: String) = - this( - materializer, - initialReceive, - name, - StageActor.localCell(materializer.supervisor, "Stream supervisor"), - receive => getAsyncCallback(receive).invoke) - - @InternalApi private[pekko] def this( - materializer: Materializer, - interpreter: GraphInterpreter, - logic: GraphStageLogic, - initialReceive: StageActorRef.Receive, - name: String) = - this( - materializer, - initialReceive, - name, - StageActor.localCell(materializer.supervisor, "Stream supervisor"), - // Coalesce per-tell mailbox traffic: N tells produce 1 AsyncInput envelope (amortized). - receive => - new StageActor.LazyDispatch( - interpreter, - logic, - receive.asInstanceOf[Any => Unit], - StageActor.drainBatchSize(materializer))) - - // Monomorphic Function1 captured once; JIT can inline the apply at the FunctionRef call site. - private val dispatch: ((ActorRef, Any)) => Unit = buildDispatch(internalReceive) + name: String) { + private val callback = getAsyncCallback(internalReceive) + + private def cell = materializer.supervisor match { + case ref: LocalActorRef => ref.underlying + case unknown => + throw new IllegalStateException(s"Stream supervisor must be a local actor, was [${unknown.getClass.getName}]") + } private val functionRef: FunctionRef = { - // Explicit (sender, msg) lambda (not a pattern-match Function2 literal) so the PoisonPill / Kill - // branch matches on `msg` directly and does not allocate a Tuple2. The regular branch still - // constructs one tuple per tell, as required by the `((ActorRef, Any)) => Unit` public Receive type. - val f: (ActorRef, Any) => Unit = (sender, msg) => - msg match { - case PoisonPill | Kill => - materializer.logger.warning( - "{} message sent to StageActor({}) will be ignored, since it is not a real Actor. " + - "Use a custom message type to communicate with it instead.", - msg, - functionRef.path) - case _ => dispatch((sender, msg)) - } + val f: (ActorRef, Any) => Unit = { + case (_, m @ (PoisonPill | Kill)) => + materializer.logger.warning( + "{} message sent to StageActor({}) will be ignored, since it is not a real Actor." + + "Use a custom message type to communicate with it instead.", + m, + functionRef.path) + case pair => callback.invoke(pair) + } cell.addFunctionRef(f, name) } @@ -309,135 +275,6 @@ object GraphStageLogic { type Receive = ((ActorRef, Any)) => Unit } - private object StageActor { - def localCell(ref: ActorRef, description: String): ActorCell = - ref match { - case ref: LocalActorRef => ref.underlying - case ref: RepointableActorRef => - ref.underlying match { - case cell: ActorCell => cell - case unknown => - throw new IllegalStateException(s"$description must be a local actor, was [${unknown.getClass.getName}]") - } - case unknown => - throw new IllegalStateException(s"$description must be a local actor, was [${unknown.getClass.getName}]") - } - - /** - * Reads `pekko.stream.materializer.stage-actor-drain-batch` from the materializer's ActorSystem config. - * Called once per lazy StageActor construction (never on the hot path). Bounded to `>= 1`. - */ - def drainBatchSize(materializer: Materializer): Int = - Math.max(1, materializer.system.settings.config.getInt("pekko.stream.materializer.stage-actor-drain-batch")) - - private final val SchedStateIdle: Int = 0 - private final val SchedStateScheduled: Int = 1 - - /** - * Lazy-path dispatch: producers enqueue into a Vyukov MPSC queue and elect a single drain via - * IDLE -> SCHEDULED CAS; only the elected producer pays a mailbox enqueue. The drain runs on the - * interpreter thread, polls in a tight loop bounded by `drainBatchSize`, then either publishes IDLE - * (with a recheck for the publish-window race) or re-schedules another envelope to yield to other - * BoundaryEvents. - * - * JIT/GC notes: - * - `final class` + monomorphic per-StageActor instance → JIT devirtualizes the apply at the - * FunctionRef call site. - * - Extends `AbstractNodeQueue` directly so the queue head atomic and the dispatch function share one - * object (one allocation per StageActor, one fewer field deref on the producer hot path). - * - Implements `Any => Unit` directly — serves as both the producer callback and the drain callback, - * eliminating the separate `drainCallback` lambda allocation. - * - `state` is a plain `@volatile var Int` driven by a static `VarHandle` in the companion object - * (via `MethodHandles.privateLookupIn`), same pattern as `AbstractNodeQueue` itself; - * avoids per-instance `AtomicInteger`. - * - `drainBatchSize` is read once into a stack-local at the top of `drain` so the JIT can treat the loop - * bound as a constant. - * - Per-tell allocation = 1 Node (`AbstractNodeQueue.Node`, ~24 bytes) + 1 Tuple2 (~24 bytes). The - * Tuple2 is forced by the public `StageActorRef.Receive` type. No AsyncInput / Envelope per tell — - * those are amortized across the batch. - */ - // Not marked `private` so that `class StageActor`'s aux constructor (compiled outside of the companion - // object on Scala 3) can reference it; the enclosing `object StageActor` is itself private. - final class LazyDispatch( - interpreter: GraphInterpreter, - logic: GraphStageLogic, - handler: Any => Unit, - drainBatchSize: Int) - extends AbstractNodeQueue[(ActorRef, Any)] - with (Any => Unit) { - - // IDLE/SCHEDULED election state. VarHandle avoids per-instance AtomicInteger; - // the handle lives in the companion object (true JVM static), same pattern as - // AbstractNodeQueue._tailDoNotCallMeDirectly. - @volatile var state: Int = SchedStateIdle - - // Typed local witnesses the Int-returning signature-polymorphic VarHandle.get overload - // (required for Scala 3 cross-compile; on Scala 2 this is a no-op). - private def getState(): Int = { - val v: Int = LazyDispatch.stateHandle.get(this) - v - } - private def setState(v: Int): Unit = LazyDispatch.stateHandle.set(this, v) - private def casState(expect: Int, update: Int): Boolean = - LazyDispatch.stateHandle.compareAndSet(this, expect, update) - - // null msg = drain signal from onAsyncInput; non-null = (ActorRef, Any) tuple from FunctionRef. - override def apply(msg: Any): Unit = - if (msg == null) drain() - else { - val pair = msg.asInstanceOf[(ActorRef, Any)] - if (!interpreter.isStageCompleted(logic)) { - add(pair) - if (getState() == SchedStateIdle && casState(SchedStateIdle, SchedStateScheduled)) { - if (interpreter.isStageCompleted(logic)) setState(SchedStateIdle) - else scheduleDrain() - } - } - } - - private def scheduleDrain(): Unit = - // 1 AsyncInput + 1 Envelope per drain batch (amortized across up to drainBatchSize tells). - // `this` serves as the drain callback (Any => Unit); onAsyncInput calls apply(null). - interpreter.onAsyncInput(logic, null, NoPromise, this) - - private def drain(): Unit = { - val limit = drainBatchSize - var processed = 0 - while (processed < limit) { - if (interpreter.isStageCompleted(logic)) { - while (poll() ne null) () - setState(SchedStateIdle) - return - } - val item = poll() - if (item eq null) { - setState(SchedStateIdle) - // Recheck race: a producer may have added between `poll == null` and the IDLE publish above. - if (!isEmpty && casState(SchedStateIdle, SchedStateScheduled)) - scheduleDrain() - return - } - handler(item) - processed += 1 - } - // The last handler(item) may have completed the stage; check before re-scheduling. - if (interpreter.isStageCompleted(logic)) { - while (poll() ne null) () - setState(SchedStateIdle) - return - } - scheduleDrain() - } - } - - object LazyDispatch { - private val stateHandle: VarHandle = { - val lookup = MethodHandles.privateLookupIn(classOf[LazyDispatch], MethodHandles.lookup()) - lookup.findVarHandle(classOf[LazyDispatch], "state", Integer.TYPE) - } - } - } - /** * Internal API * @@ -503,7 +340,7 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: * * If possible a link back to the operator that the logic was created with, used for debugging. */ - private[stream] var originalStage: OptionVal[GraphStageWithMaterializedValue[? <: Shape, ?]] = OptionVal.None + private[stream] var originalStage: OptionVal[GraphStageWithMaterializedValue[_ <: Shape, _]] = OptionVal.None /** * INTERNAL API @@ -617,7 +454,7 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: /** * Assigns callbacks for the events for an [[Inlet]] */ - final protected def setHandler(in: Inlet[?], handler: InHandler): Unit = { + final protected def setHandler(in: Inlet[_], handler: InHandler): Unit = { handlers(in.id) = handler if (_interpreter ne null) _interpreter.setHandler(conn(in), handler) } @@ -625,7 +462,7 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: /** * Assign callbacks for linear operator for both [[Inlet]] and [[Outlet]] */ - final protected def setHandlers(in: Inlet[?], out: Outlet[?], handler: InHandler with OutHandler): Unit = { + final protected def setHandlers(in: Inlet[_], out: Outlet[_], handler: InHandler with OutHandler): Unit = { setHandler(in, handler) setHandler(out, handler) } @@ -633,31 +470,31 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: /** * Retrieves the current callback for the events on the given [[Inlet]] */ - final protected def getHandler(in: Inlet[?]): InHandler = { + final protected def getHandler(in: Inlet[_]): InHandler = { handlers(in.id).asInstanceOf[InHandler] } /** * Assigns callbacks for the events for an [[Outlet]] */ - final protected def setHandler(out: Outlet[?], handler: OutHandler): Unit = { + final protected def setHandler(out: Outlet[_], handler: OutHandler): Unit = { handlers(out.id + inCount) = handler if (_interpreter ne null) _interpreter.setHandler(conn(out), handler) } - private def conn(in: Inlet[?]): Connection = portToConn(in.id) - private def conn(out: Outlet[?]): Connection = portToConn(out.id + inCount) + private def conn(in: Inlet[_]): Connection = portToConn(in.id) + private def conn(out: Outlet[_]): Connection = portToConn(out.id + inCount) /** * Retrieves the current callback for the events on the given [[Outlet]] */ - final protected def getHandler(out: Outlet[?]): OutHandler = { + final protected def getHandler(out: Outlet[_]): OutHandler = { handlers(out.id + inCount).asInstanceOf[OutHandler] } - private def getNonEmittingHandler(out: Outlet[?]): OutHandler = + private def getNonEmittingHandler(out: Outlet[_]): OutHandler = getHandler(out) match { - case e: Emitting[?] => e.previous + case e: Emitting[_] => e.previous case other => other } @@ -914,14 +751,14 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: private def cleanUpSubstreams(optionalFailureCause: OptionVal[Throwable]): Unit = { _subInletsAndOutlets.foreach { - case inlet: SubSinkInlet[?] => - val subSink = inlet.sink.asInstanceOf[SubSink[?]] + case inlet: SubSinkInlet[_] => + val subSink = inlet.sink.asInstanceOf[SubSink[_]] optionalFailureCause match { case OptionVal.Some(cause) => subSink.cancelSubstream(cause) case _ => subSink.cancelSubstream() } - case outlet: SubSourceOutlet[?] => - val subSource = outlet.source.asInstanceOf[SubSource[?]] + case outlet: SubSourceOutlet[_] => + val subSource = outlet.source.asInstanceOf[SubSource[_]] optionalFailureCause match { case OptionVal.Some(cause) => subSource.failSubstream(cause) case _ => subSource.completeSubstream() @@ -1027,15 +864,15 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: * This will reinstall the replaced handler that was in effect before the `read` * call. */ - final protected def abortReading(in: Inlet[?]): Unit = + final protected def abortReading(in: Inlet[_]): Unit = getHandler(in) match { - case r: Reading[?] => + case r: Reading[_] => setHandler(in, r.previous) case _ => } - private def requireNotReading(in: Inlet[?]): Unit = - if (getHandler(in).isInstanceOf[Reading[?]]) + private def requireNotReading(in: Inlet[_]): Unit = + if (getHandler(in).isInstanceOf[Reading[_]]) throw new IllegalStateException("already reading on inlet " + in) /** @@ -1197,15 +1034,15 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: * This will reinstall the replaced handler that was in effect before the `emit` * call. */ - final protected def abortEmitting(out: Outlet[?]): Unit = + final protected def abortEmitting(out: Outlet[_]): Unit = getHandler(out) match { - case e: Emitting[?] => setHandler(out, e.previous) + case e: Emitting[_] => setHandler(out, e.previous) case _ => } private def setOrAddEmitting[T](out: Outlet[T], next: Emitting[T]): Unit = getHandler(out) match { - case e: Emitting[?] => e.asInstanceOf[Emitting[T]].addFollowUp(next) + case e: Emitting[_] => e.asInstanceOf[Emitting[T]].addFollowUp(next) case _ => setHandler(out, next) } @@ -1224,11 +1061,11 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: * we should add it to the end of emission queue */ val currentHandler = getHandler(out) - if (currentHandler.isInstanceOf[Emitting[?]]) + if (currentHandler.isInstanceOf[Emitting[_]]) addFollowUp(currentHandler.asInstanceOf[Emitting[T]]) val next = dequeue() - if (next.isInstanceOf[EmittingCompletion[?]]) { + if (next.isInstanceOf[EmittingCompletion[_]]) { /* * If next element is emitting completion and there are some elements after it, @@ -1471,7 +1308,7 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: final protected def createAsyncCallback[T](handler: Procedure[T]): AsyncCallback[T] = getAsyncCallback(handler.apply) - private var callbacksWaitingForInterpreter: List[ConcurrentAsyncCallback[?]] = Nil + private var callbacksWaitingForInterpreter: List[ConcurrentAsyncCallback[_]] = Nil // is used for two purposes: keep track of running callbacks and signal that the // stage has stopped to fail incoming async callback invocations by being set to null // Using ConcurrentHashMap's KeySetView as Set to track the inProgress async callbacks. @@ -1488,22 +1325,22 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: // when this stage completes/fails, not threadsafe only accessed from stream machinery callbacks etc. private var _subInletsAndOutlets: Set[AnyRef] = Set.empty - private def created(inlet: SubSinkInlet[?]): Unit = + private def created(inlet: SubSinkInlet[_]): Unit = _subInletsAndOutlets += inlet - private def completedOrFailed(inlet: SubSinkInlet[?]): Unit = + private def completedOrFailed(inlet: SubSinkInlet[_]): Unit = _subInletsAndOutlets -= inlet - private def created(outlet: SubSourceOutlet[?]): Unit = + private def created(outlet: SubSourceOutlet[_]): Unit = _subInletsAndOutlets += outlet - private def completedOrFailed(outlet: SubSourceOutlet[?]): Unit = + private def completedOrFailed(outlet: SubSourceOutlet[_]): Unit = _subInletsAndOutlets -= outlet /** * Initialize a [[GraphStageLogic.StageActorRef]] which can be used to interact with from the outside world "as-if" a [[pekko.actor.Actor]]. - * The messages are delivered through the owning stream interpreter so they are safe to modify internal state of this - * operator. + * The messages are looped through the [[getAsyncCallback]] mechanism of [[GraphStage]] so they are safe to modify + * internal state of this operator. * * This method must (the earliest) be called after the [[GraphStageLogic]] constructor has finished running, * for example from the [[preStart]] callback the graph operator logic provides. @@ -1521,20 +1358,7 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: * @return minimal actor with watch method */ final protected def getStageActor(receive: ((ActorRef, Any)) => Unit): StageActor = - _stageActor match { - case null => - val currentInterpreter = interpreter - _stageActor = new StageActor( - currentInterpreter.materializer, - currentInterpreter, - this, - receive, - stageActorName) - _stageActor - case existing => - existing.become(receive) - existing - } + getEagerStageActor(interpreter.materializer)(receive) /** * INTERNAL API @@ -1558,7 +1382,7 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: * Override and return a name to be given to the StageActor of this operator. * * This method will be only invoked and used once, during the first [[getStageActor]] - * invocation which creates the actor, since subsequent `getStageActor` calls function + * invocation whichc reates the actor, since subsequent `getStageActors` calls function * like `become`, rather than creating new actors. * * Returns an empty string by default, which means that the name will a unique generated String (e.g. "$$a"). diff --git a/stream/src/main/scala/org/apache/pekko/stream/stage/StageLogging.scala b/stream/src/main/scala/org/apache/pekko/stream/stage/StageLogging.scala index dcc12cbd8fb..71e2175c4a7 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/stage/StageLogging.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/stage/StageLogging.scala @@ -33,7 +33,7 @@ trait StageLogging { self: GraphStageLogic => private[this] var _log: LoggingAdapter = _ /** Override to customise reported log source */ - protected def logSource: Class[?] = this.getClass + protected def logSource: Class[_] = this.getClass def log: LoggingAdapter = { // only used in StageLogic, i.e. thread safe diff --git a/testkit/src/main/scala/org/apache/pekko/testkit/CallingThreadDispatcher.scala b/testkit/src/main/scala/org/apache/pekko/testkit/CallingThreadDispatcher.scala index 49be17a601e..8a34ecb0d4a 100644 --- a/testkit/src/main/scala/org/apache/pekko/testkit/CallingThreadDispatcher.scala +++ b/testkit/src/main/scala/org/apache/pekko/testkit/CallingThreadDispatcher.scala @@ -362,7 +362,7 @@ class CallingThreadMailbox(_receiver: pekko.actor.Cell, val mailboxType: Mailbox } /** - * This is only a marker to be put in the messageQueue's stead to make error + * This is only a marker to be put in the messageQueue’s stead to make error * messages pertaining to violated mailbox type requirements less cryptic. */ override val messageQueue: MessageQueue = q.get diff --git a/testkit/src/main/scala/org/apache/pekko/testkit/TestEventListener.scala b/testkit/src/main/scala/org/apache/pekko/testkit/TestEventListener.scala index 39419075117..f275bc540a3 100644 --- a/testkit/src/main/scala/org/apache/pekko/testkit/TestEventListener.scala +++ b/testkit/src/main/scala/org/apache/pekko/testkit/TestEventListener.scala @@ -321,7 +321,7 @@ object EventFilter { * If you want to match all Error events, the most efficient is to use Left(""). */ final case class ErrorFilter( - throwable: Class[?], + throwable: Class[_], override val source: Option[String], override val message: Either[String, Regex], override val complete: Boolean)(occurrences: Int) @@ -352,7 +352,7 @@ final case class ErrorFilter( * whether the event’s message must match the given message string or pattern completely */ def this( - throwable: Class[?], + throwable: Class[_], source: String, message: String, pattern: Boolean, @@ -369,7 +369,7 @@ final case class ErrorFilter( /** * Java API: filter only on the given type of exception */ - def this(throwable: Class[?]) = this(throwable, null, null, false, false, Int.MaxValue) + def this(throwable: Class[_]) = this(throwable, null, null, false, false, Int.MaxValue) } @@ -529,7 +529,7 @@ object DeadLettersFilter { * Filter which matches DeadLetter events, if the wrapped message conforms to the * given type. */ -final case class DeadLettersFilter(val messageClass: Class[?])(occurrences: Int) extends EventFilter(occurrences) { +final case class DeadLettersFilter(val messageClass: Class[_])(occurrences: Int) extends EventFilter(occurrences) { def matches(event: LogEvent) = { event match { diff --git a/testkit/src/main/scala/org/apache/pekko/testkit/TestJavaSerializer.scala b/testkit/src/main/scala/org/apache/pekko/testkit/TestJavaSerializer.scala index 77fed41cb04..4978b217386 100644 --- a/testkit/src/main/scala/org/apache/pekko/testkit/TestJavaSerializer.scala +++ b/testkit/src/main/scala/org/apache/pekko/testkit/TestJavaSerializer.scala @@ -43,7 +43,7 @@ class TestJavaSerializer(val system: ExtendedActorSystem) extends BaseSerializer bos.toByteArray } - def fromBinary(bytes: Array[Byte], clazz: Option[Class[?]]): AnyRef = { + def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = { val in = new ClassLoaderObjectInputStream(system.dynamicAccess.classLoader, new UnsynchronizedByteArrayInputStream(bytes)) try JavaSerializer.currentSystem.withValue(system) { in.readObject } diff --git a/testkit/src/main/scala/org/apache/pekko/testkit/TestKit.scala b/testkit/src/main/scala/org/apache/pekko/testkit/TestKit.scala index d47f5ae763f..5431a82e106 100644 --- a/testkit/src/main/scala/org/apache/pekko/testkit/TestKit.scala +++ b/testkit/src/main/scala/org/apache/pekko/testkit/TestKit.scala @@ -606,7 +606,7 @@ trait TestKitBase { /** * Same as `expectMsgAnyClassOf(remainingOrDefault, obj...)`, but correctly treating the timeFactor. */ - def expectMsgAnyClassOf[C](obj: Class[? <: C]*): C = expectMsgAnyClassOf_internal(remainingOrDefault, obj: _*) + def expectMsgAnyClassOf[C](obj: Class[_ <: C]*): C = expectMsgAnyClassOf_internal(remainingOrDefault, obj: _*) /** * Receive one message from the test actor and assert that it conforms to @@ -615,10 +615,10 @@ trait TestKitBase { * * @return the received object */ - def expectMsgAnyClassOf[C](max: FiniteDuration, obj: Class[? <: C]*): C = + def expectMsgAnyClassOf[C](max: FiniteDuration, obj: Class[_ <: C]*): C = expectMsgAnyClassOf_internal(max.dilated, obj: _*) - private def expectMsgAnyClassOf_internal[C](max: FiniteDuration, obj: Class[? <: C]*): C = { + private def expectMsgAnyClassOf_internal[C](max: FiniteDuration, obj: Class[_ <: C]*): C = { val o = receiveOne(max) assert(o ne null, s"timeout ($max) during expectMsgAnyClassOf waiting for ${obj.mkString("(", ", ", ")")}") assert(obj.exists(c => BoxedType(c).isInstance(o)), s"found unexpected $o") @@ -667,7 +667,7 @@ trait TestKitBase { /** * Same as `expectMsgAllClassOf(remainingOrDefault, obj...)`, but correctly treating the timeFactor. */ - def expectMsgAllClassOf[T](obj: Class[? <: T]*): immutable.Seq[T] = + def expectMsgAllClassOf[T](obj: Class[_ <: T]*): immutable.Seq[T] = internalExpectMsgAllClassOf(remainingOrDefault, obj: _*) /** @@ -678,10 +678,10 @@ trait TestKitBase { * Wait time is bounded by the given duration, with an AssertionFailure * being thrown in case of timeout. */ - def expectMsgAllClassOf[T](max: FiniteDuration, obj: Class[? <: T]*): immutable.Seq[T] = + def expectMsgAllClassOf[T](max: FiniteDuration, obj: Class[_ <: T]*): immutable.Seq[T] = internalExpectMsgAllClassOf(max.dilated, obj: _*) - private def internalExpectMsgAllClassOf[T](max: FiniteDuration, obj: Class[? <: T]*): immutable.Seq[T] = { + private def internalExpectMsgAllClassOf[T](max: FiniteDuration, obj: Class[_ <: T]*): immutable.Seq[T] = { val recv = receiveN_internal(obj.size, max) val missing = obj.filterNot(x => recv.exists(_.getClass eq BoxedType(x))) val unexpected = recv.filterNot(x => obj.exists(c => BoxedType(c) eq x.getClass)) @@ -692,7 +692,7 @@ trait TestKitBase { /** * Same as `expectMsgAllConformingOf(remainingOrDefault, obj...)`, but correctly treating the timeFactor. */ - def expectMsgAllConformingOf[T](obj: Class[? <: T]*): immutable.Seq[T] = + def expectMsgAllConformingOf[T](obj: Class[_ <: T]*): immutable.Seq[T] = internalExpectMsgAllConformingOf(remainingOrDefault, obj: _*) /** @@ -706,10 +706,10 @@ trait TestKitBase { * Beware that one object may satisfy all given class constraints, which * may be counter-intuitive. */ - def expectMsgAllConformingOf[T](max: FiniteDuration, obj: Class[? <: T]*): immutable.Seq[T] = + def expectMsgAllConformingOf[T](max: FiniteDuration, obj: Class[_ <: T]*): immutable.Seq[T] = internalExpectMsgAllConformingOf(max.dilated, obj: _*) - private def internalExpectMsgAllConformingOf[T](max: FiniteDuration, obj: Class[? <: T]*): immutable.Seq[T] = { + private def internalExpectMsgAllConformingOf[T](max: FiniteDuration, obj: Class[_ <: T]*): immutable.Seq[T] = { val recv = receiveN_internal(obj.size, max) val missing = obj.filterNot(x => recv.exists(BoxedType(x).isInstance(_))) val unexpected = recv.filterNot(x => obj.exists(c => BoxedType(c).isInstance(x))) diff --git a/testkit/src/main/scala/org/apache/pekko/testkit/TestKitUtils.scala b/testkit/src/main/scala/org/apache/pekko/testkit/TestKitUtils.scala index 9694eeb61aa..67c471b4a1f 100644 --- a/testkit/src/main/scala/org/apache/pekko/testkit/TestKitUtils.scala +++ b/testkit/src/main/scala/org/apache/pekko/testkit/TestKitUtils.scala @@ -25,7 +25,7 @@ import org.apache.pekko.annotation.InternalApi @InternalApi private[pekko] object TestKitUtils { - def testNameFromCallStack(classToStartFrom: Class[?], testKitRegex: Regex): String = { + def testNameFromCallStack(classToStartFrom: Class[_], testKitRegex: Regex): String = { def isAbstractClass(className: String): Boolean = { try { diff --git a/testkit/src/main/scala/org/apache/pekko/testkit/javadsl/EventFilter.scala b/testkit/src/main/scala/org/apache/pekko/testkit/javadsl/EventFilter.scala index 98797c6ba39..658ce859991 100644 --- a/testkit/src/main/scala/org/apache/pekko/testkit/javadsl/EventFilter.scala +++ b/testkit/src/main/scala/org/apache/pekko/testkit/javadsl/EventFilter.scala @@ -20,21 +20,21 @@ import pekko.actor.ActorSystem import pekko.event.Logging import pekko.testkit.{ DebugFilter, ErrorFilter, InfoFilter, WarningFilter } -class EventFilter(clazz: Class[?], system: ActorSystem) { +class EventFilter(clazz: Class[_], system: ActorSystem) { require( classOf[Throwable].isAssignableFrom(clazz) || classOf[Logging.LogEvent].isAssignableFrom(clazz), "supplied class must either be LogEvent or Throwable") - private val _clazz: Class[? <: Logging.LogEvent] = + private val _clazz: Class[_ <: Logging.LogEvent] = if (classOf[Throwable].isAssignableFrom(clazz)) classOf[Logging.Error] else - clazz.asInstanceOf[Class[? <: Logging.LogEvent]] + clazz.asInstanceOf[Class[_ <: Logging.LogEvent]] - private var exceptionType: Class[? <: Throwable] = + private var exceptionType: Class[_ <: Throwable] = if (classOf[Throwable].isAssignableFrom(clazz)) - clazz.asInstanceOf[Class[? <: Throwable]] + clazz.asInstanceOf[Class[_ <: Throwable]] else null diff --git a/testkit/src/main/scala/org/apache/pekko/testkit/javadsl/TestKit.scala b/testkit/src/main/scala/org/apache/pekko/testkit/javadsl/TestKit.scala index fd05fd9f132..59aca8c6ceb 100644 --- a/testkit/src/main/scala/org/apache/pekko/testkit/javadsl/TestKit.scala +++ b/testkit/src/main/scala/org/apache/pekko/testkit/javadsl/TestKit.scala @@ -400,7 +400,7 @@ class TestKit(system: ActorSystem) { * Same as `expectMsgAnyClassOf(remainingOrDefault, obj...)`, but correctly treating the timeFactor. */ @varargs - def expectMsgAnyClassOf[T](objs: Class[?]*): T = tp.expectMsgAnyClassOf(objs: _*).asInstanceOf[T] + def expectMsgAnyClassOf[T](objs: Class[_]*): T = tp.expectMsgAnyClassOf(objs: _*).asInstanceOf[T] /** * Receive one message from the test actor and assert that it conforms to @@ -408,7 +408,7 @@ class TestKit(system: ActorSystem) { * with an AssertionFailure being thrown in case of timeout. */ @varargs - def expectMsgAnyClassOf[T](max: java.time.Duration, objs: Class[?]*): T = + def expectMsgAnyClassOf[T](max: java.time.Duration, objs: Class[_]*): T = tp.expectMsgAnyClassOf(max.toScala, objs: _*).asInstanceOf[T] /** diff --git a/testkit/src/test/scala/org/apache/pekko/testkit/PekkoSpec.scala b/testkit/src/test/scala/org/apache/pekko/testkit/PekkoSpec.scala index 49332b9e86d..ff0baaa2d3a 100644 --- a/testkit/src/test/scala/org/apache/pekko/testkit/PekkoSpec.scala +++ b/testkit/src/test/scala/org/apache/pekko/testkit/PekkoSpec.scala @@ -96,7 +96,7 @@ abstract class PekkoSpec(_system: ActorSystem) def this(s: String) = this(ConfigFactory.parseString(s)) - def this(configMap: Map[String, ?]) = this(PekkoSpec.mapToConfig(configMap)) + def this(configMap: Map[String, _]) = this(PekkoSpec.mapToConfig(configMap)) def this() = this(ActorSystem(TestKitUtils.testNameFromCallStack(classOf[PekkoSpec], "".r), PekkoSpec.testConf)) @@ -130,9 +130,9 @@ abstract class PekkoSpec(_system: ActorSystem) override def expectedTestDuration: FiniteDuration = 60.seconds - def muteDeadLetters(messageClasses: Class[?]*)(sys: ActorSystem = system): Unit = + def muteDeadLetters(messageClasses: Class[_]*)(sys: ActorSystem = system): Unit = if (!sys.log.isDebugEnabled) { - def mute(clazz: Class[?]): Unit = + def mute(clazz: Class[_]): Unit = sys.eventStream.publish(Mute(DeadLettersFilter(clazz)(occurrences = Int.MaxValue))) if (messageClasses.isEmpty) mute(classOf[AnyRef]) else messageClasses.foreach(mute) @@ -144,7 +144,7 @@ abstract class PekkoSpec(_system: ActorSystem) def areEqual(a: Class[A], b: Class[B]) = a == b } - implicit def setEqualityConstraint[A, T <: Set[? <: A]]: CanEqual[Set[A], T] = + implicit def setEqualityConstraint[A, T <: Set[_ <: A]]: CanEqual[Set[A], T] = new CanEqual[Set[A], T] { def areEqual(a: Set[A], b: T) = a == b } diff --git a/testkit/src/test/scala/org/apache/pekko/testkit/PekkoSpecSpec.scala b/testkit/src/test/scala/org/apache/pekko/testkit/PekkoSpecSpec.scala index c833e4fc27c..e353d09fd83 100644 --- a/testkit/src/test/scala/org/apache/pekko/testkit/PekkoSpecSpec.scala +++ b/testkit/src/test/scala/org/apache/pekko/testkit/PekkoSpecSpec.scala @@ -46,7 +46,7 @@ class PekkoSpecSpec extends AnyWordSpec with Matchers { } "terminate all actors" in { - // verbose config just for demonstration purposes, please leave in case of debugging + // verbose config just for demonstration purposes, please leave in in case of debugging import scala.jdk.CollectionConverters._ val conf = Map( "pekko.actor.debug.lifecycle" -> true, diff --git a/testkit/src/test/scala/org/apache/pekko/testkit/TestActorRefSpec.scala b/testkit/src/test/scala/org/apache/pekko/testkit/TestActorRefSpec.scala index d4481894231..dc4d3800a80 100644 --- a/testkit/src/test/scala/org/apache/pekko/testkit/TestActorRefSpec.scala +++ b/testkit/src/test/scala/org/apache/pekko/testkit/TestActorRefSpec.scala @@ -69,7 +69,7 @@ object TestActorRefSpec { case "work" => sender() ! "workDone" context.stop(self) - case replyTo: Promise[?] => replyTo.asInstanceOf[Promise[Any]].success("complexReply") + case replyTo: Promise[_] => replyTo.asInstanceOf[Promise[Any]].success("complexReply") case replyTo: ActorRef => replyTo ! "complexReply" } diff --git a/testkit/src/test/scala/org/apache/pekko/testkit/metrics/reporter/PekkoConsoleReporter.scala b/testkit/src/test/scala/org/apache/pekko/testkit/metrics/reporter/PekkoConsoleReporter.scala index 850939ab0a1..b4fdf026b60 100644 --- a/testkit/src/test/scala/org/apache/pekko/testkit/metrics/reporter/PekkoConsoleReporter.scala +++ b/testkit/src/test/scala/org/apache/pekko/testkit/metrics/reporter/PekkoConsoleReporter.scala @@ -36,7 +36,7 @@ class PekkoConsoleReporter(registry: PekkoMetricRegistry, verbose: Boolean, outp private final val ConsoleWidth = 80 override def report( - gauges: util.SortedMap[String, Gauge[?]], + gauges: util.SortedMap[String, Gauge[_]], counters: util.SortedMap[String, Counter], histograms: util.SortedMap[String, Histogram], meters: util.SortedMap[String, Meter], @@ -82,7 +82,7 @@ class PekkoConsoleReporter(registry: PekkoMetricRegistry, verbose: Boolean, outp output.print(" count = %d%n".format(entry.getCount)) } - private def printGauge(entry: Gauge[?]): Unit = { + private def printGauge(entry: Gauge[_]): Unit = { output.print(" value = %s%n".format(entry.getValue)) } @@ -168,7 +168,7 @@ class PekkoConsoleReporter(registry: PekkoMetricRegistry, verbose: Boolean, outp } /** Required for getting simple names of refined instances */ - private def simpleName(clazz: Class[?]): String = { + private def simpleName(clazz: Class[_]): String = { val n = clazz.getName val i = n.lastIndexOf('.') n.substring(i + 1)