diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000..def5ba5d90 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + + - package-ecosystem: "gradle" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml index 405a2b3065..3bb843889a 100644 --- a/.github/workflows/gradle-wrapper-validation.yml +++ b/.github/workflows/gradle-wrapper-validation.yml @@ -1,10 +1,13 @@ name: "Validate Gradle Wrapper" on: [push, pull_request] +permissions: + contents: read + jobs: validation: name: "Validation" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: gradle/wrapper-validation-action@v1 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: gradle/wrapper-validation-action@f9c9c575b8b21b6485636a91ffecd10e558c62f6 # v3.5.0 diff --git a/.github/workflows/gradle_branch.yml b/.github/workflows/gradle_branch.yml new file mode 100644 index 0000000000..8fd55412ec --- /dev/null +++ b/.github/workflows/gradle_branch.yml @@ -0,0 +1,37 @@ +# This workflow will build a Java project with Gradle +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Branch + +on: + push: + branches-ignore: [ '3.x' ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - name: Set up JDK 11 + uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 + with: + distribution: 'zulu' + java-version: '11' + - name: Cache Gradle packages + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle-${{ secrets.CACHE_VERSION }} + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build RxJava + run: ./gradlew build --stacktrace + - name: Upload to Codecov + uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 + - name: Generate Javadoc + run: ./gradlew javadoc --stacktrace diff --git a/.github/workflows/gradle_jdk11.yml b/.github/workflows/gradle_jdk11.yml new file mode 100644 index 0000000000..5eed0fa3da --- /dev/null +++ b/.github/workflows/gradle_jdk11.yml @@ -0,0 +1,42 @@ +# This workflow will build a Java project with Gradle +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: JDK 11 + +on: + push: + branches: [ 3.x ] + pull_request: + branches: [ 3.x ] + +permissions: + contents: read + +env: + BUILD_WITH_11: true + +jobs: + build: + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - name: Set up JDK 11 + uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 + with: + distribution: 'zulu' + java-version: '11' + - name: Cache Gradle packages + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-1-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle-1- + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Verify generated module-info + run: ./gradlew -PjavaCompatibility=9 jar + - name: Build RxJava + run: ./gradlew build --stacktrace +# - name: Generate Javadoc +# run: ./gradlew javadoc --stacktrace diff --git a/.github/workflows/gradle_pr.yml b/.github/workflows/gradle_pr.yml new file mode 100644 index 0000000000..ba0bc523ad --- /dev/null +++ b/.github/workflows/gradle_pr.yml @@ -0,0 +1,37 @@ +# This workflow will build a Java project with Gradle +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Pull Request + +on: + pull_request: + branches: [ 3.x ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - name: Set up JDK 11 + uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 + with: + distribution: 'zulu' + java-version: '11' + - name: Cache Gradle packages + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-1-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle-1- + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build RxJava + run: ./gradlew build --stacktrace + - name: Upload to Codecov + uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 + - name: Generate Javadoc + run: ./gradlew javadoc --stacktrace diff --git a/.github/workflows/gradle_release.yml b/.github/workflows/gradle_release.yml new file mode 100644 index 0000000000..4c65fc24ed --- /dev/null +++ b/.github/workflows/gradle_release.yml @@ -0,0 +1,70 @@ +# This workflow will build a Java project with Gradle +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Release + +on: + release: + types: [ released, prereleased ] + branches: [ '3.x' ] + tags: + - 'v3.*.*' + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: write + env: + CI_BUILD_NUMBER: ${{ github.run_number }} + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - name: Set up JDK 11 + uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 + with: + distribution: 'zulu' + java-version: '11' + - name: Cache Gradle packages + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle-${{ secrets.CACHE_VERSION }} + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Grant execute permission for push + run: chmod +x push_javadoc.sh + - name: Extract version tag + run: echo "BUILD_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV + - name: Build RxJava + run: ./gradlew build --stacktrace --no-daemon + - name: Upload to Codecov + uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 +# - name: Upload release +# run: ./gradlew -PreleaseMode=full publish --no-daemon --no-parallel --stacktrace +# env: +# # Define secrets at https://github.com/ReactiveX/RxJava/settings/secrets/actions +# # ------------------------------------------------------------------------------ +# ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USER }} +# ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} +# ORG_GRADLE_PROJECT_SIGNING_PRIVATE_KEY: ${{ secrets.SIGNING_PRIVATE_KEY }} +# ORG_GRADLE_PROJECT_SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} + - name: Publish release + run: ./gradlew -PreleaseMode=full publishAndReleaseToMavenCentral --no-configuration-cache --no-daemon --no-parallel --stacktrace + env: + # Define secrets at https://github.com/ReactiveX/RxJava/settings/secrets/actions + # ------------------------------------------------------------------------------ + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USER }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} + ORG_GRADLE_PROJECT_SIGNING_PRIVATE_KEY: ${{ secrets.SIGNING_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} + - name: Push Javadoc + run: ./push_javadoc.sh + env: + # Define secrets at https://github.com/ReactiveX/RxJava/settings/secrets/actions + # ------------------------------------------------------------------------------ + JAVADOCS_TOKEN: ${{ secrets.JAVADOCS_TOKEN }} diff --git a/.github/workflows/gradle_snapshot.yml b/.github/workflows/gradle_snapshot.yml new file mode 100644 index 0000000000..4a29e0757a --- /dev/null +++ b/.github/workflows/gradle_snapshot.yml @@ -0,0 +1,56 @@ +# This workflow will build a Java project with Gradle +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Snapshot + +on: + push: + branches: [ '3.x' ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + if: github.repository == 'ReactiveX/RxJava' + permissions: + contents: write + env: + # ------------------------------------------------------------------------------ + CI_BUILD_NUMBER: ${{ github.run_number }} + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - name: Set up JDK 11 + uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 + with: + distribution: 'zulu' + java-version: '11' + - name: Cache Gradle packages + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle-${{ secrets.CACHE_VERSION }} + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Grant execute permission for push + run: chmod +x push_javadoc.sh + - name: Build RxJava + run: ./gradlew build --stacktrace --no-daemon + - name: Upload Snapshot + run: ./gradlew -PreleaseMode=branch publishAllPublicationsToMavenCentralRepository --no-daemon --no-parallel --stacktrace + env: + # Define secrets at https://github.com/ReactiveX/RxJava/settings/secrets/actions + # ------------------------------------------------------------------------------ + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USER }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} + - name: Upload to Codecov + uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 + - name: Push Javadoc + run: ./push_javadoc.sh + # Define secrets at https://github.com/ReactiveX/RxJava/settings/secrets/actions + # ------------------------------------------------------------------------------ + env: + JAVADOCS_TOKEN: ${{ secrets.JAVADOCS_TOKEN }} diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml new file mode 100644 index 0000000000..fa9ad404f0 --- /dev/null +++ b/.github/workflows/scorecard.yml @@ -0,0 +1,59 @@ +name: Scorecard supply-chain security +on: + # For Branch-Protection check. Only the default branch is supported. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection + branch_protection_rule: + # To guarantee Maintained check is occasionally updated. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained + schedule: + - cron: '43 12 * * 4' + push: + branches: [ "3.x" ] + +permissions: read-all + +jobs: + analysis: + name: Scorecard analysis + runs-on: ubuntu-latest + permissions: + # Needed to upload the results to code-scanning dashboard. + security-events: write + # Needed to publish results and get a badge (see publish_results below). + id-token: write + + steps: + - name: "Checkout code" + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + + - name: "Run analysis" + uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2 + with: + results_file: results.sarif + results_format: sarif + # (Optional) "write" PAT token. Uncomment the `repo_token` line below if + # you want to enable the Branch-Protection check on a *public* repository + # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-fine-grained-pat-optional. + # repo_token: ${{ secrets.SCORECARD_TOKEN }} + + # - Publish results to OpenSSF REST API for easy access by consumers + # - Allows the repository to include the Scorecard badge. + # - See https://github.com/ossf/scorecard-action#publishing-results. + publish_results: true + + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF + # format to the repository Actions tab. + - name: "Upload artifact" + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: SARIF file + path: results.sarif + retention-days: 5 + + # Upload the results to GitHub's code scanning dashboard. + - name: "Upload to code-scanning" + uses: github/codeql-action/upload-sarif@303c0aef88fc2fe5ff6d63d3b1596bfd83dfa1f9 # v3.29.5 + with: + sarif_file: results.sarif diff --git a/.gitignore b/.gitignore index 428d55b2fb..b60171cf2d 100644 --- a/.gitignore +++ b/.gitignore @@ -73,4 +73,10 @@ bin/ # PMD files .pmd .ruleset -test-output/ \ No newline at end of file +test-output/ + +# Checkstyle local config +.checkstyle + +# Some editor's config +.editorconfig diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 0000000000..954870bba6 --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,139 @@ +## Learn more about this file at 'https://www.gitpod.io/docs/references/gitpod-yml' +## +## This '.gitpod.yml' file when placed at the root of a project instructs +## Gitpod how to prepare & build the project, start development environments +## and configure continuous prebuilds. Prebuilds when enabled builds a project +## like a CI server so you can start coding right away - no more waiting for +## dependencies to download and builds to finish when reviewing pull-requests +## or hacking on something new. +## +## With Gitpod you can develop software from any device (even iPads) via +## desktop or browser based versions of VS Code or any JetBrains IDE and +## customise it to your individual needs - from themes to extensions, you +## have full control. +## +## The easiest way to try out Gitpod is install the browser extenion: +## 'https://www.gitpod.io/docs/browser-extension' or by prefixing +## 'https://gitpod.io#' to the source control URL of any project. +## +## For example: 'https://gitpod.io#https://github.com/gitpod-io/gitpod' + + +## The 'image' section defines which Docker image Gitpod should use. +## By default, Gitpod uses a standard Docker Image called 'workspace-full' +## which can be found at 'https://github.com/gitpod-io/workspace-images' +## +## Workspaces started based on this default image come pre-installed with +## Docker, Go, Java, Node.js, C/C++, Python, Ruby, Rust, PHP as well as +## tools such as Homebrew, Tailscale, Nginx and several more. +## +## If this image does not include the tools needed for your project then +## a public Docker image or your own Docker file can be configured. +## +## Learn more about images at 'https://www.gitpod.io/docs/config-docker' + +#image: node:buster # use 'https://hub.docker.com/_/node' +# +#image: # leave image undefined if using a Dockerfile +# file: .gitpod.Dockerfile # relative path to the Dockerfile from the +# # root of the project + +## The 'tasks' section defines how Gitpod prepares and builds this project +## or how Gitpod can start development servers. With Gitpod, there are three +## types of tasks: +## +## - before: Use this for tasks that need to run before init and before command. +## - init: Use this to configure prebuilds of heavy-lifting tasks such as +## downloading dependencies or compiling source code. +## - command: Use this to start your database or application when the workspace starts. +## +## Learn more about these tasks at 'https://www.gitpod.io/docs/config-start-tasks' + +#tasks: +# - before: | +# # commands to execute... +# +# - init: | +# # sudo apt-get install python3 # can be used to install operating system +# # dependencies but these are not kept after the +# # prebuild completes thus Gitpod recommends moving +# # operating system dependency installation steps +# # to a custom Dockerfile to make prebuilds faster +# # and to keep your codebase DRY. +# # 'https://www.gitpod.io/docs/config-docker' +# +# # pip install -r requirements.txt # install codebase dependencies +# # cmake # precompile codebase +# +# - name: Web Server +# openMode: split-left +# env: +# WEBSERVER_PORT: 8080 +# command: | +# python3 -m http.server $WEBSERVER_PORT +# +# - name: Web Browser +# openMode: split-right +# env: +# WEBSERVER_PORT: 8080 +# command: | +# gp await-port $WEBSERVER_PORT +# lynx `gp url` + +tasks: + - command: ./gradlew build + +## The 'ports' section defines various ports your may listen on are +## configured in Gitpod on an authenticated URL. By default, all ports +## are in private visibility state. +## +## Learn more about ports at 'https://www.gitpod.io/docs/config-ports' + +#ports: +# - port: 8080 # alternatively configure entire ranges via '8080-8090' +# visibility: private # either 'public' or 'private' (default) +# onOpen: open-browser # either 'open-browser', 'open-preview' or 'ignore' + + +## The 'vscode' section defines a list of Visual Studio Code extensions from +## the OpenVSX.org registry to be installed upon workspace startup. OpenVSX +## is an open alternative to the proprietary Visual Studio Code Marketplace +## and extensions can be added by sending a pull-request with the extension +## identifier to https://github.com/open-vsx/publish-extensions +## +## The identifier of an extension is always ${publisher}.${name}. +## +## For example: 'vscodevim.vim' +## +## Learn more at 'https://www.gitpod.io/docs/ides-and-editors/vscode' + +#vscode: +# extensions: +# - vscodevim.vim +# - esbenp.prettier-vscode@9.5.0 +# - https://example.com/abc/releases/extension-0.26.0.vsix + + +## The 'github' section defines configuration of continuous prebuilds +## for GitHub repositories when the GitHub application +## 'https://github.com/apps/gitpod-io' is installed in GitHub and granted +## permissions to access the repository. +## +## Learn more at 'https://www.gitpod.io/docs/prebuilds' + +github: + prebuilds: + # enable for the default branch + master: true + # enable for all branches in this repo + branches: true + # enable for pull requests coming from this repo + pullRequests: true + # enable for pull requests coming from forks + pullRequestsFromForks: true + # add a check to pull requests + addCheck: true + # add a "Review in Gitpod" button as a comment to pull requests + addComment: false + # add a "Review in Gitpod" button to the pull request's description + addBadge: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6e595b4e93..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -language: java -jdk: -- openjdk8 - -# prevent travis running gradle assemble; let the build script do it anyway -install: true - -# running in container causes test failures and 2x-3x longer build, use standalone instances -sudo: required - -# script for build and release via Travis to Bintray -script: gradle/buildViaTravis.sh - -# Code coverage -after_success: - - bash <(curl -s --retry 10 https://codecov.io/bash) - - bash gradle/push_javadoc.sh - -# cache between builds -cache: - directories: - - $HOME/.m2 - - $HOME/.gradle -env: - global: - - secure: YcLpYfNc/dyDON+oDvnJK5pFNhpPeJHxlAHV8JBt42e51prAl6njqrg1Qlfdp0pvBiskTPQHUxbFy9DOB1Z+43lPj5vlqz6qBgtS3vtBnsrczr+5Xx7NTdVKq6oZGl45VjfNPT7zdM6GQ5ifdzOid6kJIFu34g9JZkCzOY3BWGM= - - secure: WVmfSeW1UMNdem7+X4cVDjkEkqdeNavYH4udn3bFN1IFaWdliWFp4FYVBVi+p1T/IgkRSqzoW9Bm43DABe1UMFoErFCbfd7B0Ofgb4NZAsxFgokHGVLCe6k5+rQyASseiO7k0itSj3Kq9TrDueKPhv+g+IG0w1A8yZTnXdhXHvY= - - secure: Xt8E09nmSr+5r7ly95hG/EiBitZbhFGPRGp8oqPkNn1A2fzG9+hnvlNLgQhVPsISZGzJwkWa3LGBxAVGmuysVOz7eCwkoqlDZaaSLYAPfWXqkr+cmYGPkErgHSp+n/hnQG4TylX0YxzqX8flr6db21zWyNduiyHmo+xFydI5LeM= - - secure: RmpIsmYa5BdLLWR6DILjhEE/dx2q3O0NIkvnMx5G1cyRCNCrOf1B7fYFHnsTDwpvRA+6H6dZinmeyf6D3G+czOG5q/TW2jcu5nh+YOLhBb6jPIqRDfq/WHAa5Lkdssxs5g9RdWlEDVFMoE62lGc4cnfJz5F5puH29dy2SvXxIQw= diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4547f563a8..98ae7225f3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,19 +13,16 @@ All files are released with the Apache 2.0 license. If you are adding a new file it should have a header like this: ``` -/** +/* * Copyright (c) 2016-present, RxJava Contributors. - * - * Licensed 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 - * + * + * Licensed 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. + * + * 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. */ ``` diff --git a/COPYRIGHT b/COPYRIGHT new file mode 100644 index 0000000000..5d2c6e53f3 --- /dev/null +++ b/COPYRIGHT @@ -0,0 +1,13 @@ +Copyright (c) 2016-present, RxJava Contributors. + +Licensed 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. \ No newline at end of file diff --git a/README.md b/README.md index ed7ad4a5de..9963ffee46 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ # RxJava: Reactive Extensions for the JVM - + [![codecov.io](http://codecov.io/github/ReactiveX/RxJava/coverage.svg?branch=3.x)](https://codecov.io/gh/ReactiveX/RxJava/branch/3.x) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.reactivex.rxjava3/rxjava/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.reactivex.rxjava3/rxjava) +[![Contribute with Gitpod](https://img.shields.io/badge/Contribute%20with-Gitpod-908a85?logo=gitpod)](https://gitpod.io/#https://github.com/ReactiveX/RxJava) +[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/ReactiveX/RxJava/badge)](https://securityscorecards.dev/viewer/?uri=github.com/ReactiveX/RxJava) RxJava is a Java VM implementation of [Reactive Extensions](http://reactivex.io): a library for composing asynchronous and event-based programs by using observable sequences. @@ -10,15 +12,19 @@ It extends the [observer pattern](http://en.wikipedia.org/wiki/Observer_pattern) #### Version 3.x ([Javadoc](http://reactivex.io/RxJava/3.x/javadoc/)) -- single dependency: [Reactive-Streams](https://github.com/reactive-streams/reactive-streams-jvm) -- Java 8+ ([Android](https://github.com/ReactiveX/RxAndroid) desugar friendly) -- Java 8 lambda-friendly API -- fixed API mistakes and many limits of RxJava 2 -- intended to be a replacement for RxJava 2 with relatively few binary incompatible changes -- non-opinionated about the source of concurrency (threads, pools, event loops, fibers, actors, etc.) -- async or synchronous execution -- virtual time and schedulers for parameterized concurrency -- test and diagnostic support via test schedulers, test consumers and plugin hooks +- Single dependency: [Reactive-Streams](https://github.com/reactive-streams/reactive-streams-jvm). +- Java 8+ or Android API 21+ required. +- Java 8 lambda-friendly API. +- [Android](https://github.com/ReactiveX/RxAndroid) desugar friendly. +- Fixed API mistakes and many limits of RxJava 2. +- Intended to be a replacement for RxJava 2 with relatively few binary incompatible changes. +- Non-opinionated about the source of concurrency (threads, pools, event loops, fibers, actors, etc.). +- Async or synchronous execution. +- Virtual time and schedulers for parameterized concurrency. +- Test and diagnostic support via test schedulers, test consumers and plugin hooks. +- Interop with newer JDK versions via 3rd party libraries, such as + - [Java 9 Flow API](https://github.com/akarnokd/RxJavaJdk9Interop#rxjavajdk9interop) + - [Java 21 Virtual Threads](https://github.com/akarnokd/RxJavaFiberInterop#rxjavafiberinterop) Learn more about RxJava in general on the Wiki Home. @@ -26,7 +32,7 @@ Learn more about RxJava in general on the - dep.name == it.artifactId.text() - } - }.each { it.scope*.value = "compile"} - } -} - jmh { jmhVersion = jmhLibVersion humanOutputFile = null @@ -217,162 +141,79 @@ jmh { jvmArgsAppend = ["-Djmh.separateClasspathJAR=true"] if (project.hasProperty("jmh")) { - include = ".*" + project.jmh + ".*" - println("JMH: " + include); + includes = [".*" + project.jmh + ".*"] + logger.info("JMH: {}", includes) } +} +test { + maxHeapSize = "1200m" } -plugins.withType(EclipsePlugin) { - project.eclipse.classpath.plusConfigurations += [ configurations.jmh ] +task testNG(type: Test) { + useTestNG() } -test { - - testLogging { - // showing skipped occasionally should prevent CI timeout due to lack of standard output - events=["skipped", "failed"] // "started", "passed" - // showStandardStreams = true - exceptionFormat="full" +check.dependsOn testNG + +tasks.withType(Test) { + testLogging { + events = ["skipped", "failed"] + exceptionFormat = "full" debug.events = ["skipped", "failed"] - debug.exceptionFormat="full" + debug.exceptionFormat = "full" info.events = ["failed", "skipped"] - info.exceptionFormat="full" - + info.exceptionFormat = "full" + warn.events = ["failed", "skipped"] - warn.exceptionFormat="full" + warn.exceptionFormat = "full" } - maxHeapSize = "1200m" - if (System.getenv("CI") == null) { maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1 } } -task testng(type: Test) { - useTestNG() - testLogging { - events=["skipped", "failed"] - exceptionFormat="full" - - debug.events = ["skipped", "failed"] - debug.exceptionFormat="full" - - info.events = ["failed", "skipped"] - info.exceptionFormat="full" - - warn.events = ["failed", "skipped"] - warn.exceptionFormat="full" - } -} - -check.dependsOn testng - -jacoco { - toolVersion = jacocoVersion // See http://www.eclemma.org/jacoco/. -} - -task GCandMem(dependsOn: "check") doLast { - print("Memory usage before: ") - println(java.lang.management.ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed() / 1024.0 / 1024.0) - System.gc() - Thread.sleep(200) - print("Memory usage: ") - println(java.lang.management.ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed() / 1024.0 / 1024.0) -} - -task GCandMem2(dependsOn: "test") doLast { - print("Memory usage before: ") - println(java.lang.management.ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed() / 1024.0 / 1024.0) - System.gc() - Thread.sleep(200) - print("Memory usage: ") - println(java.lang.management.ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed() / 1024.0 / 1024.0) -} - -testng.dependsOn GCandMem2 - jacocoTestReport { + dependsOn test + dependsOn testNG + reports { - xml.enabled = true - html.enabled = true + xml.required.set(true) + csv.required.set(false) + html.required.set(true) } } -jacocoTestReport.dependsOn GCandMem - -build.dependsOn jacocoTestReport +check.dependsOn jacocoTestReport checkstyle { - configFile file("checkstyle.xml") - ignoreFailures = true - toolVersion = checkstyleVersion + configFile = project.file("config/checkstyle/checkstyle.xml") + configProperties = [ + "checkstyle.suppressions.file": project.file("config/checkstyle/suppressions.xml"), + "checkstyle.header.file" : project.file("config/license/HEADER_JAVA") + ] + checkstyleMain.exclude '**/module-info.java' } -if (rootProject.hasProperty("releaseMode")) { - - if ("branch".equals(rootProject.releaseMode)) { - // From https://github.com/ReactiveX/RxAndroid/blob/2.x/rxandroid/build.gradle#L94 - - println("ReleaseMode: " + rootProject.releaseMode); - artifactory { - contextUrl = "https://oss.jfrog.org" - - publish { - repository { - repoKey = "oss-snapshot-local" - - username = rootProject.bintrayUser - password = rootProject.bintrayKey - } - - defaults { - publishConfigs("archives") - } - } +if (project.hasProperty("releaseMode")) { + logger.lifecycle("ReleaseMode: {}", project.releaseMode) + + + if ("full" == project.releaseMode) { + signing { + if (project.hasProperty("SIGNING_PRIVATE_KEY") && project.hasProperty("SIGNING_PASSWORD")) { + useInMemoryPgpKeys(project.getProperty("SIGNING_PRIVATE_KEY"), project.getProperty("SIGNING_PASSWORD")) + sign(publishing.publications) + } } - - build.finalizedBy(artifactoryPublish) } + mavenPublishing { + // or when publishing to https://central.sonatype.com/ + publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.CENTRAL_PORTAL) - if ("full".equals(rootProject.releaseMode)) { - // based on https://github.com/bintray/gradle-bintray-plugin - def rver = version; - - println("ReleaseMode: " + rootProject.releaseMode + " version " + rver); - - bintray { - user = rootProject.bintrayUser - key = rootProject.bintrayKey - configurations = ["archives"] - publish = true - pkg { - repo = "RxJava" - name = "RxJava" - userOrg = "reactivex" - labels = ["rxjava", "reactivex"] - licenses = ["Apache-2.0"] - vcsUrl = "https://github.com/ReactiveX/RxJava.git" - version { - name = rver - gpg { - sign = true - } - mavenCentralSync { - sync = true - user = rootProject.sonatypeUsername - password = rootProject.sonatypePassword - close = "1" - } - } - } - } - - build.finalizedBy(bintrayUpload) - } + // signAllPublications() + } } - -apply from: file("gradle/javadoc_cleanup.gradle") diff --git a/checkstyle.xml b/checkstyle.xml deleted file mode 100644 index 3e7ba879da..0000000000 --- a/checkstyle.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 0000000000..05896aee12 --- /dev/null +++ b/config/checkstyle/checkstyle.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml new file mode 100644 index 0000000000..cf580e45e6 --- /dev/null +++ b/config/checkstyle/suppressions.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/HEADER b/config/license/HEADER similarity index 100% rename from HEADER rename to config/license/HEADER diff --git a/config/license/HEADER_JAVA b/config/license/HEADER_JAVA new file mode 100644 index 0000000000..d95b44938b --- /dev/null +++ b/config/license/HEADER_JAVA @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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. + */ diff --git a/docs/Additional-Reading.md b/docs/Additional-Reading.md index 85e7d47077..4badd81308 100644 --- a/docs/Additional-Reading.md +++ b/docs/Additional-Reading.md @@ -3,7 +3,7 @@ A more complete and up-to-date list of resources can be found at the [reactivex. # Introducing Reactive Programming * [Introduction to Rx](http://www.introtorx.com/): a free, on-line book by Lee Campbell **(1.x)** * [The introduction to Reactive Programming you've been missing](https://gist.github.com/staltz/868e7e9bc2a7b8c1f754) by Andre Staltz -* [Mastering Observables](http://docs.couchbase.com/developer/java-2.0/observables.html) from the Couchbase documentation **(1.x)** +* [Mastering Observables](https://docs.huihoo.com/couchbase/developer-guide/java-2.0/observables.html) from the Couchbase documentation **(1.x)** * [Reactive Programming in Java 8 With RxJava](http://pluralsight.com/training/Courses/TableOfContents/reactive-programming-java-8-rxjava), a course designed by Russell Elledge **(1.x)** * [33rd Degree Reactive Java](http://www.slideshare.net/tkowalcz/33rd-degree-reactive-java) by Tomasz Kowalczewski **(1.x)** * [What Every Hipster Should Know About Functional Reactive Programming](http://www.infoq.com/presentations/game-functional-reactive-programming) - Bodil Stokke demos the creation of interactive game mechanics in RxJS diff --git a/docs/Backpressure-(2.0).md b/docs/Backpressure-(2.0).md index 61361d21c4..6b2f2860af 100644 --- a/docs/Backpressure-(2.0).md +++ b/docs/Backpressure-(2.0).md @@ -172,7 +172,7 @@ If some of the values can be safely ignored, one can use the sampling (with time } ``` -Note hovewer that these operators only reduce the rate of value reception by the downstream and thus they may still lead to `MissingBackpressureException`. +Note however that these operators only reduce the rate of value reception by the downstream and thus they may still lead to `MissingBackpressureException`. ## onBackpressureBuffer() @@ -229,7 +229,7 @@ Note that the last two strategies cause discontinuity in the stream as they drop ## onBackpressureDrop() -Whenever the downstream is not ready to receive values, this operator will drop that elemenet from the sequence. One can think of it as a 0 capacity `onBackpressureBuffer` with strategy `ON_OVERFLOW_DROP_LATEST`. +Whenever the downstream is not ready to receive values, this operator will drop that element from the sequence. One can think of it as a 0 capacity `onBackpressureBuffer` with strategy `ON_OVERFLOW_DROP_LATEST`. This operator is useful when one can safely ignore values from a source (such as mouse moves or current GPS location signals) as there will be more up-to-date values later on. diff --git a/docs/Filtering-Observables.md b/docs/Filtering-Observables.md index 620800dc8c..512b69ba8a 100644 --- a/docs/Filtering-Observables.md +++ b/docs/Filtering-Observables.md @@ -259,7 +259,7 @@ firstOrError.subscribe( **ReactiveX documentation:** [http://reactivex.io/documentation/operators/ignoreelements.html](http://reactivex.io/documentation/operators/ignoreelements.html) -Ignores the single item emitted by a `Single` or `Maybe` source, and returns a `Completable` that signals only the error or completion event from the the source. +Ignores the single item emitted by a `Single` or `Maybe` source, and returns a `Completable` that signals only the error or completion event from the source. ### ignoreElement example diff --git a/docs/Getting-Started.md b/docs/Getting-Started.md index d2ac2e4640..69b69a8ca6 100644 --- a/docs/Getting-Started.md +++ b/docs/Getting-Started.md @@ -66,18 +66,21 @@ You need Java 6 or later. ### Snapshots -Snapshots are available via [JFrog](https://oss.jfrog.org/libs-snapshot/io/reactivex/rxjava3/rxjava/): +Snapshots after May 1st, 2021 are available via https://oss.sonatype.org/content/repositories/snapshots/io/reactivex/rxjava3/rxjava/ ```groovy repositories { - maven { url 'https://oss.jfrog.org/libs-snapshot' } + maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } } dependencies { - compile 'io.reactivex.rxjava3:rxjava:3.0.4' + implementation 'io.reactivex.rxjava3:rxjava:3.0.0-SNAPSHOT' } ``` +JavaDoc snapshots are available at http://reactivex.io/RxJava/3.x/javadoc/snapshot + + ## Building To check out and build the RxJava source, issue the following commands: diff --git a/docs/How-To-Use-RxJava.md b/docs/How-To-Use-RxJava.md index 2d091bdce4..41a46bb75d 100644 --- a/docs/How-To-Use-RxJava.md +++ b/docs/How-To-Use-RxJava.md @@ -285,7 +285,7 @@ onNext => value_14_xform Here is a marble diagram that illustrates this transformation: - + This next example, in Clojure, consumes three asynchronous Observables, including a dependency from one to another, and emits a single response item by combining the items emitted by each of the three Observables with the [`zip`](http://reactivex.io/documentation/operators/zip.html) operator and then transforming the result with [`map`](http://reactivex.io/documentation/operators/map.html): @@ -333,7 +333,7 @@ The response looks like this: And here is a marble diagram that illustrates how that code produces that response: - + The following example, in Groovy, comes from [Ben Christensen’s QCon presentation on the evolution of the Netflix API](https://speakerdeck.com/benjchristensen/evolution-of-the-netflix-api-qcon-sf-2013). It combines two Observables with the [`merge`](http://reactivex.io/documentation/operators/merge.html) operator, then uses the [`reduce`](http://reactivex.io/documentation/operators/reduce.html) operator to construct a single item out of the resulting sequence, then transforms that item with [`map`](http://reactivex.io/documentation/operators/map.html) before emitting it: @@ -350,7 +350,7 @@ public Observable getVideoSummary(APIVideo video) { And here is a marble diagram that illustrates how that code uses the [`reduce`](http://reactivex.io/documentation/operators/reduce.html) operator to bring the results from multiple Observables together in one structure: - + ## Error Handling diff --git a/docs/Phantom-Operators.md b/docs/Phantom-Operators.md index b01ac28ff2..5193147a22 100644 --- a/docs/Phantom-Operators.md +++ b/docs/Phantom-Operators.md @@ -127,7 +127,7 @@ streamOfItems.flatMap(item -> { itemToObservable(item).subscribeOn(Schedulers.io()); }); ``` -Kick off your work for each item inside [`flatMap`](Transforming-Observables#flatmap-concatmap-and-flatmapiterable) using [`subscribeOn`](Observable-Utility-Operators#subscribeon) to make it asynchronous, or by using a function that already makes asychronous calls. +Kick off your work for each item inside [`flatMap`](Transforming-Observables#flatmap-concatmap-and-flatmapiterable) using [`subscribeOn`](Observable-Utility-Operators#subscribeon) to make it asynchronous, or by using a function that already makes asynchronous calls. #### see also: * RxJava Threading Examples by Graham Lea diff --git a/docs/What's-different-in-2.0.md b/docs/What's-different-in-2.0.md index fac50df56d..edc681fa7f 100644 --- a/docs/What's-different-in-2.0.md +++ b/docs/What's-different-in-2.0.md @@ -450,12 +450,12 @@ Before 2.0.7, the operator `strict()` had to be applied in order to achieve the As one of the primary goals of RxJava 2, the design focuses on performance and in order enable it, RxJava 2.0.7 adds a custom `io.reactivex.FlowableSubscriber` interface (extends `org.reactivestreams.Subscriber`) but adds no new methods to it. The new interface is **constrained to RxJava 2** and represents a consumer to `Flowable` that is able to work in a mode that relaxes the Reactive-Streams version 1.0.0 specification in rules §1.3, §2.3, §2.12 and §3.9: - - §1.3 relaxation: `onSubscribe` may run concurrently with `onNext` in case the `FlowableSubscriber` calls `request()` from inside `onSubscribe` and it is the resposibility of `FlowableSubscriber` to ensure thread-safety between the remaining instructions in `onSubscribe` and `onNext`. + - §1.3 relaxation: `onSubscribe` may run concurrently with `onNext` in case the `FlowableSubscriber` calls `request()` from inside `onSubscribe` and it is the responsibility of `FlowableSubscriber` to ensure thread-safety between the remaining instructions in `onSubscribe` and `onNext`. - §2.3 relaxation: calling `Subscription.cancel` and `Subscription.request` from `FlowableSubscriber.onComplete()` or `FlowableSubscriber.onError()` is considered a no-operation. - §2.12 relaxation: if the same `FlowableSubscriber` instance is subscribed to multiple sources, it must ensure its `onXXX` methods remain thread safe. - §3.9 relaxation: issuing a non-positive `request()` will not stop the current stream but signal an error via `RxJavaPlugins.onError`. -From a user's perspective, if one was using the the `subscribe` methods other than `Flowable.subscribe(Subscriber)`, there is no need to do anything regarding this change and there is no extra penalty for it. +From a user's perspective, if one was using the `subscribe` methods other than `Flowable.subscribe(Subscriber)`, there is no need to do anything regarding this change and there is no extra penalty for it. If one was using `Flowable.subscribe(Subscriber)` with the built-in RxJava `Subscriber` implementations such as `DisposableSubscriber`, `TestSubscriber` and `ResourceSubscriber`, there is a small runtime overhead (one `instanceof` check) associated when the code is not recompiled against 2.0.7. diff --git a/docs/Writing-operators-for-2.0.md b/docs/Writing-operators-for-2.0.md index e8486564b1..1a51664880 100644 --- a/docs/Writing-operators-for-2.0.md +++ b/docs/Writing-operators-for-2.0.md @@ -565,7 +565,7 @@ Version 2.0.7 introduced a new interface, `FlowableSubscriber` that extends `Sub The rule relaxations are as follows: -- §1.3 relaxation: `onSubscribe` may run concurrently with onNext in case the `FlowableSubscriber` calls `request()` from inside `onSubscribe` and it is the resposibility of `FlowableSubscriber` to ensure thread-safety between the remaining instructions in `onSubscribe` and `onNext`. +- §1.3 relaxation: `onSubscribe` may run concurrently with onNext in case the `FlowableSubscriber` calls `request()` from inside `onSubscribe` and it is the responsibility of `FlowableSubscriber` to ensure thread-safety between the remaining instructions in `onSubscribe` and `onNext`. - §2.3 relaxation: calling `Subscription.cancel` and `Subscription.request` from `FlowableSubscriber.onComplete()` or `FlowableSubscriber.onError()` is considered a no-operation. - §2.12 relaxation: if the same `FlowableSubscriber` instance is subscribed to multiple sources, it must ensure its `onXXX` methods remain thread safe. - §3.9 relaxation: issuing a non-positive `request()` will not stop the current stream but signal an error via `RxJavaPlugins.onError`. diff --git a/docs/_Sidebar.md b/docs/_Sidebar.md index 32e201fc46..22961acec3 100644 --- a/docs/_Sidebar.md +++ b/docs/_Sidebar.md @@ -27,6 +27,6 @@ * [Writing operators](https://github.com/ReactiveX/RxJava/wiki/Writing-operators-for-2.0) * [Backpressure](https://github.com/ReactiveX/RxJava/wiki/Backpressure-(2.0)) * [another explanation](https://github.com/ReactiveX/RxJava/wiki/Backpressure) -* [JavaDoc](http://reactivex.io/RxJava/2.x/javadoc) +* JavaDoc: [1.x](http://reactivex.io/RxJava/1.x/javadoc), [2.x](http://reactivex.io/RxJava/2.x/javadoc), [3.x](http://reactivex.io/RxJava/3.x/javadoc) * [Coming from RxJava 1](https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0) * [Additional Reading](https://github.com/ReactiveX/RxJava/wiki/Additional-Reading) diff --git a/gradle.properties b/gradle.properties index 820b2a5bc1..e685b8103a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,24 @@ -release.scope=patch -release.version=3.0.0-SNAPSHOT +group=io.reactivex.rxjava3 +version=3.0.0-SNAPSHOT +description=RxJava: Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM. + +POM_ARTIFACT_ID=rxjava +POM_NAME=RxJava +POM_PACKAGING=jar + +POM_DESCRIPTION=Reactive Extensions for Java +POM_INCEPTION_YEAR=2013 + +POM_URL=https://github.com/ReactiveX/RxJava +POM_SCM_URL=https://github.com/ReactiveX/RxJava +POM_SCM_CONNECTION=scm:git:git://github.com/ReactiveX/RxJava.git +POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/ReactiveX/RxJava.git + +POM_LICENCE_NAME=The Apache Software License, Version 2.0 +POM_LICENCE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt +POM_LICENCE_DIST=repo + +POM_DEVELOPER_ID=akarnokd +POM_DEVELOPER_NAME=David Karnok +POM_DEVELOPER_URL=https://github.com/akarnokd/ +POM_DEVELOPER_EMAIL=akarnokd@gmail.com diff --git a/gradle/buildViaTravis.sh b/gradle/buildViaTravis.sh deleted file mode 100755 index ea385c3e92..0000000000 --- a/gradle/buildViaTravis.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# This script will build the project. - -buildTag="$TRAVIS_TAG" - -if [ "$buildTag" != "" ] && [ "${buildTag:0:3}" != "v3." ]; then - echo -e "Wrong tag on the 3.x brach: $buildTag : build stopped" - exit 1 -fi - -export GRADLE_OPTS=-Xmx1024m - -if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then - echo -e "Build Pull Request #$TRAVIS_PULL_REQUEST => Branch [$TRAVIS_BRANCH]" - ./gradlew -PreleaseMode=pr build --stacktrace -elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" == "" ]; then - if [ "$TRAVIS_BRANCH" != "3.x" ]; then - echo -e 'Build secondary Branch (no snapshot) => Branch ['$TRAVIS_BRANCH']' - ./gradlew -PreleaseMode=pr build --stacktrace - else - echo -e 'Build Branch with Snapshot => Branch ['$TRAVIS_BRANCH']' - ./gradlew -PreleaseMode=branch -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" build --stacktrace - fi -elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" != "" ]; then - echo -e 'Build Branch for Release => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG']' - ./gradlew -PreleaseMode=full -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" build --stacktrace -else - echo -e 'WARN: Should not be here => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG'] Pull Request ['$TRAVIS_PULL_REQUEST']' -fi diff --git a/gradle/javadoc_cleanup.gradle b/gradle/javadoc_cleanup.gradle index 64f6437288..63b4f7f045 100644 --- a/gradle/javadoc_cleanup.gradle +++ b/gradle/javadoc_cleanup.gradle @@ -1,61 +1,74 @@ // remove the excessive whitespaces between method arguments in the javadocs task javadocCleanup(dependsOn: "javadoc") doLast { - fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/core/Flowable.html')); - fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/core/Observable.html')); - fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/core/Single.html')); - fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/core/Maybe.html')); - fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/core/Completable.html')); + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/core/Flowable.html')) + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/core/Observable.html')) + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/core/Single.html')) + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/core/Maybe.html')) + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/core/Completable.html')) - fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/flowables/ConnectableFlowable.html')); - fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/observables/ConnectableObservable.html')); + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/flowables/ConnectableFlowable.html')) + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/observables/ConnectableObservable.html')) - fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/subjects/ReplaySubject.html')); - fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/processors/ReplayProcessor.html')); - fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/plugins/RxJavaPlugins.html')); + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/subjects/ReplaySubject.html')) + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/processors/ReplayProcessor.html')) + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/subjects/PublishSubject.html')) + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/processors/PublishProcessor.html')) + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/subjects/AsyncSubject.html')) + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/processors/AsyncProcessor.html')) + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/subjects/BehaviorSubject.html')) + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/processors/BehaviorProcessor.html')) + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/processors/MulticastProcessor.html')) + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/subjects/UnicastSubject.html')) + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/processors/UnicastProcessor.html')) - fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/parallel/ParallelFlowable.html')); + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/plugins/RxJavaPlugins.html')) + + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/parallel/ParallelFlowable.html')) + + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/disposables/Disposable.html')) + + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/observers/TestObserver.html')) + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/observers/BaseTestConsumer.html')) + fixJavadocFile(rootProject.file('build/docs/javadoc/io/reactivex/rxjava3/subscribers/TestSubscriber.html')) } def fixJavadocFile(file) { - println("Cleaning up: " + file); + logger.lifecycle("Cleaning up: " + file) String fileContents = file.getText('UTF-8') // lots of spaces after the previous method argument - fileContents = fileContents.replaceAll(",\\s{4,}", ",\n "); + fileContents = fileContents.replaceAll(",\\s{4,}", ",\n ") // lots of spaces after the @NonNull annotations - fileContents = fileContents.replaceAll("@NonNull\\s{4,}", "@NonNull "); + fileContents = fileContents.replaceAll("@NonNull\\s{4,}", "@NonNull ") // lots of spaces after the @Nullable annotations - fileContents = fileContents.replaceAll("@Nullable\\s{4,}", "@Nullable "); + fileContents = fileContents.replaceAll("@Nullable\\s{4,}", "@Nullable ") // javadoc bug: duplicates the link to @NonNull for some reason - def nonNullText1 = "@NonNull"; - - fileContents = fileContents.replace(nonNullText1 + " " + nonNullText1, nonNullText1); - fileContents = fileContents.replace(nonNullText1 + "\n " + nonNullText1, nonNullText1); - fileContents = fileContents.replace(nonNullText1 + "\r\n " + nonNullText1, nonNullText1); + def nonNullText1 = "@NonNull" + + fileContents = fileContents.replace(nonNullText1 + " " + nonNullText1, nonNullText1) + fileContents = fileContents.replace(nonNullText1 + "\n " + nonNullText1, nonNullText1) + fileContents = fileContents.replace(nonNullText1 + "\r\n " + nonNullText1, nonNullText1) - def nonNullText2 = "@NonNull"; - fileContents = fileContents.replace(nonNullText2 + " " + nonNullText2, nonNullText2); - fileContents = fileContents.replace(nonNullText2 + "\n " + nonNullText2, nonNullText2); - fileContents = fileContents.replace(nonNullText2 + "\r\n " + nonNullText2, nonNullText2); + def nonNullText2 = "@NonNull" + fileContents = fileContents.replace(nonNullText2 + " " + nonNullText2, nonNullText2) + fileContents = fileContents.replace(nonNullText2 + "\n " + nonNullText2, nonNullText2) + fileContents = fileContents.replace(nonNullText2 + "\r\n " + nonNullText2, nonNullText2) // javadoc bug: duplicates the link to @Nullable for some reason - def nullableText1 = "@Nullable"; - - fileContents = fileContents.replace(nullableText1 + " " + nullableText1, nullableText1); - fileContents = fileContents.replace(nullableText1 + "\n " + nullableText1, nullableText1); - fileContents = fileContents.replace(nullableText1 + "\r\n " + nullableText1, nullableText1); + def nullableText1 = "@Nullable" - def nullableText2 = "@Nullable"; - - fileContents = fileContents.replace(nullableText2 + " " + nullableText2, nullableText2); - fileContents = fileContents.replace(nullableText2 + "\n " + nullableText2, nullableText2); - fileContents = fileContents.replace(nullableText2 + "\r\n " + nullableText2, nullableText2); + fileContents = fileContents.replace(nullableText1 + " " + nullableText1, nullableText1) + fileContents = fileContents.replace(nullableText1 + "\n " + nullableText1, nullableText1) + fileContents = fileContents.replace(nullableText1 + "\r\n " + nullableText1, nullableText1) - file.setText(fileContents, 'UTF-8'); -} + def nullableText2 = "@Nullable" -javadocJar.dependsOn javadocCleanup -build.dependsOn javadocCleanup \ No newline at end of file + fileContents = fileContents.replace(nullableText2 + " " + nullableText2, nullableText2) + fileContents = fileContents.replace(nullableText2 + "\n " + nullableText2, nullableText2) + fileContents = fileContents.replace(nullableText2 + "\r\n " + nullableText2, nullableText2) + + file.setText(fileContents, 'UTF-8') +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 5c2d1cf016..afba109285 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 94920145f3..3c44eb1b6f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 83f2acfdc3..65dcd68d65 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,78 +17,113 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -97,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -105,84 +140,105 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=$((i+1)) + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 9618d8d960..93e3f59f13 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,10 +25,14 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @@ -37,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -51,7 +55,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -61,38 +65,26 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/gradle/push_javadoc.sh b/push_javadoc.sh similarity index 78% rename from gradle/push_javadoc.sh rename to push_javadoc.sh index c8f648258e..28ce74f1db 100644 --- a/gradle/push_javadoc.sh +++ b/push_javadoc.sh @@ -8,21 +8,9 @@ targetRepo=github.com/ReactiveX/RxJava.git # ======================================================================= -# only for main pushes, for now -if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then - echo -e "Pull request detected, skipping JavaDocs pushback." - exit 0 -fi - -# only when on the 3.x branch and not tagged -if [ "$TRAVIS_BRANCH" != "3.x" ] && [ "$TRAVIS_TAG" == "" ]; then - echo -e "On a secondary branch '$TRAVIS_BRANCH', skipping JavaDocs pushback." - exit 0 -fi - # get the current build tag if any -buildTag="$TRAVIS_TAG" -echo -e "Travis tag: '$buildTag'" +buildTag="$BUILD_TAG" +echo -e "Build tag: '$buildTag'" if [ "$buildTag" == "" ]; then buildTag="snapshot" @@ -33,18 +21,18 @@ fi echo -e "JavaDocs pushback for tag: $buildTag" # check if the token is actually there -if [ "$GITHUB_TOKEN" == "" ]; then +if [ "$JAVADOCS_TOKEN" == "" ]; then echo -e "No access to GitHub, skipping JavaDocs pushback." exit 0 fi # prepare the git information -git config --global user.email "travis@travis-ci.org" -git config --global user.name "Travis CI" +git config --global user.email "akarnokd+ci@gmail.com" +git config --global user.name "akarnokd+ci" # setup the remote echo -e "Adding the target repository to git" -git remote add origin-pages https://${GITHUB_TOKEN}@${targetRepo} > /dev/null 2>&1 +git remote add origin-pages https://${JAVADOCS_TOKEN}@${targetRepo} > /dev/null 2>&1 # stash changes due to chmod echo -e "Stashing any local non-ignored changes" @@ -119,8 +107,8 @@ echo -e "Removing deleted files" git add -u # commit all -echo -e "commit Travis build: $TRAVIS_BUILD_NUMBER for $buildTag" -git commit --message "Travis build: $TRAVIS_BUILD_NUMBER for $buildTag" +echo -e "commit CI build: $CI_BUILD_NUMBER for $buildTag" +git commit --message "CI build: $CI_BUILD_NUMBER for $buildTag" # debug file list #find -name "*.html" diff --git a/src/jmh/java/io/reactivex/rxjava3/core/BinaryFlatMapPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/BinaryFlatMapPerf.java index 836957192e..c4a0a385a5 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/BinaryFlatMapPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/BinaryFlatMapPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/BlockingGetPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/BlockingGetPerf.java index f40a8ca55b..7f3711788a 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/BlockingGetPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/BlockingGetPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/BlockingPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/BlockingPerf.java index 020befc21a..5fb2825b3e 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/BlockingPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/BlockingPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/CallableAsyncPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/CallableAsyncPerf.java index 8098b1aaf4..1bae28f9f9 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/CallableAsyncPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/CallableAsyncPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/EachTypeFlatMapPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/EachTypeFlatMapPerf.java index 37a4f196e8..14aa8c3605 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/EachTypeFlatMapPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/EachTypeFlatMapPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/FlatMapJustPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/FlatMapJustPerf.java index 2a1fd7539c..597fae480d 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/FlatMapJustPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/FlatMapJustPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/FlattenCrossMapPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/FlattenCrossMapPerf.java index 866fe5de77..c5d516423f 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/FlattenCrossMapPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/FlattenCrossMapPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/FlattenJustPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/FlattenJustPerf.java index d2ac9aa5b7..3bb1ad1473 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/FlattenJustPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/FlattenJustPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/FlattenRangePerf.java b/src/jmh/java/io/reactivex/rxjava3/core/FlattenRangePerf.java index a3195b760d..0339f345c3 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/FlattenRangePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/FlattenRangePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/FlowableFlatMapCompletableAsyncPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/FlowableFlatMapCompletableAsyncPerf.java index e9494e97df..0ebb2d4458 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/FlowableFlatMapCompletableAsyncPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/FlowableFlatMapCompletableAsyncPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/FlowableFlatMapCompletableSyncPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/FlowableFlatMapCompletableSyncPerf.java index 34f53a954a..400e0609a8 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/FlowableFlatMapCompletableSyncPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/FlowableFlatMapCompletableSyncPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/InputWithIncrementingInteger.java b/src/jmh/java/io/reactivex/rxjava3/core/InputWithIncrementingInteger.java index 772d202dca..44d109fb4d 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/InputWithIncrementingInteger.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/InputWithIncrementingInteger.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/JustAsyncPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/JustAsyncPerf.java index f60204c88b..6906470aea 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/JustAsyncPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/JustAsyncPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/LatchedSingleObserver.java b/src/jmh/java/io/reactivex/rxjava3/core/LatchedSingleObserver.java index 1b908ac6b2..6bcdba465e 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/LatchedSingleObserver.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/LatchedSingleObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/MemoryPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/MemoryPerf.java index c7c407de15..7cd45de74e 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/MemoryPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/MemoryPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/ObservableFlatMapPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/ObservableFlatMapPerf.java index d0d75e78d4..65145b07b4 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/ObservableFlatMapPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/ObservableFlatMapPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/OperatorFlatMapPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/OperatorFlatMapPerf.java index 0eb7f03aa9..777fc9e1a6 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/OperatorFlatMapPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/OperatorFlatMapPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/OperatorMergePerf.java b/src/jmh/java/io/reactivex/rxjava3/core/OperatorMergePerf.java index 560736c86c..24605fc02a 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/OperatorMergePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/OperatorMergePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/PerfAsyncConsumer.java b/src/jmh/java/io/reactivex/rxjava3/core/PerfAsyncConsumer.java index 7c222fddab..ccaaf75573 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/PerfAsyncConsumer.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/PerfAsyncConsumer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/PerfBoundedSubscriber.java b/src/jmh/java/io/reactivex/rxjava3/core/PerfBoundedSubscriber.java index 8ec19a833a..68083976be 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/PerfBoundedSubscriber.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/PerfBoundedSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/PerfConsumer.java b/src/jmh/java/io/reactivex/rxjava3/core/PerfConsumer.java index 6025438218..60f93f089a 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/PerfConsumer.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/PerfConsumer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/PerfInteropConsumer.java b/src/jmh/java/io/reactivex/rxjava3/core/PerfInteropConsumer.java index 6dfbac7a31..fc7f0b04b0 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/PerfInteropConsumer.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/PerfInteropConsumer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/PerfObserver.java b/src/jmh/java/io/reactivex/rxjava3/core/PerfObserver.java index 5f09b97ffe..a62a1e68f6 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/PerfObserver.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/PerfObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/PerfSubscriber.java b/src/jmh/java/io/reactivex/rxjava3/core/PerfSubscriber.java index 51da5a5c53..8c0f30cffa 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/PerfSubscriber.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/PerfSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/PublishProcessorPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/PublishProcessorPerf.java index c64e1f794d..1278bfd641 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/PublishProcessorPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/PublishProcessorPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/RangePerf.java b/src/jmh/java/io/reactivex/rxjava3/core/RangePerf.java index c9723b086d..0773cd4f72 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/RangePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/RangePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/ReducePerf.java b/src/jmh/java/io/reactivex/rxjava3/core/ReducePerf.java index faf0423760..3d2bb476c8 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/ReducePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/ReducePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/RxVsStreamPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/RxVsStreamPerf.java index 74c8952c7a..8861a6cdf5 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/RxVsStreamPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/RxVsStreamPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/StrictPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/StrictPerf.java index 59d17f4d60..23315ef617 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/StrictPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/StrictPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/TakeUntilPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/TakeUntilPerf.java index b2f89a39ca..a6a3949605 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/TakeUntilPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/TakeUntilPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/ToFlowablePerf.java b/src/jmh/java/io/reactivex/rxjava3/core/ToFlowablePerf.java index 9c86e83678..7b7f0dc36d 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/ToFlowablePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/ToFlowablePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/core/XMapYPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/XMapYPerf.java index 6205efa25d..b95d76ffe4 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/XMapYPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/XMapYPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/parallel/ParallelPerf.java b/src/jmh/java/io/reactivex/rxjava3/parallel/ParallelPerf.java index 4eaac7b0da..c6fd16ffb6 100644 --- a/src/jmh/java/io/reactivex/rxjava3/parallel/ParallelPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/parallel/ParallelPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -109,4 +109,4 @@ public void groupBy(Blackhole bh) { public void parallel(Blackhole bh) { subscribe(parallel, bh); } -} \ No newline at end of file +} diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapCompletablePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapCompletablePerf.java index 9e1096ab74..f1124f7a81 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapCompletablePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapCompletablePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapMaybeEmptyPerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapMaybeEmptyPerf.java index a211fbe829..7eabfcfbde 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapMaybeEmptyPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapMaybeEmptyPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapMaybePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapMaybePerf.java index 059a0b162b..87ee5a07e4 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapMaybePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapMaybePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapSinglePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapSinglePerf.java index e812708a15..cbeac5ada9 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapSinglePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapSinglePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapCompletablePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapCompletablePerf.java index 1960735cfa..b46725986f 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapCompletablePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapCompletablePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapMaybeEmptyPerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapMaybeEmptyPerf.java index 96e6fcf672..8ab19a00c6 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapMaybeEmptyPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapMaybeEmptyPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapMaybePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapMaybePerf.java index 2f71d5793e..d0f3730b42 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapMaybePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapMaybePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapSinglePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapSinglePerf.java index 2bbdf9bf95..4f50938647 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapSinglePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapSinglePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapCompletablePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapCompletablePerf.java index 033d35c429..4e419a5d2e 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapCompletablePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapCompletablePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapMaybeEmptyPerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapMaybeEmptyPerf.java index adc6060189..83ad00e0f9 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapMaybeEmptyPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapMaybeEmptyPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapMaybePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapMaybePerf.java index d5d8cb9443..e36b49c4d3 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapMaybePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapMaybePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapSinglePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapSinglePerf.java index a997f27b53..0da6941895 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapSinglePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapSinglePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapCompletablePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapCompletablePerf.java index ca6174a006..48b20dc005 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapCompletablePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapCompletablePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapMaybeEmptyPerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapMaybeEmptyPerf.java index b194580fa8..4528c90b50 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapMaybeEmptyPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapMaybeEmptyPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapMaybePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapMaybePerf.java index 5c7d6ad7a0..204020abfe 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapMaybePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapMaybePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapSinglePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapSinglePerf.java index 1785b59135..e2e34b24f5 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapSinglePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapSinglePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapCompletablePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapCompletablePerf.java index 64247ac219..b6daa57eb6 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapCompletablePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapCompletablePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapMaybeEmptyPerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapMaybeEmptyPerf.java index 5e38b30061..5d0327fa46 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapMaybeEmptyPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapMaybeEmptyPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapMaybePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapMaybePerf.java index ffc5b15e56..e2a7c43bea 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapMaybePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapMaybePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapSinglePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapSinglePerf.java index 6356ad8ace..add0cd310c 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapSinglePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapSinglePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapCompletablePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapCompletablePerf.java index 1fc6eef9b3..69b8e71f18 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapCompletablePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapCompletablePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapMaybeEmptyPerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapMaybeEmptyPerf.java index 4737493420..3930534eb8 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapMaybeEmptyPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapMaybeEmptyPerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapMaybePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapMaybePerf.java index b8dca2d95b..30158d012d 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapMaybePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapMaybePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapSinglePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapSinglePerf.java index 682e2712f0..75aeb504f9 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapSinglePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapSinglePerf.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/annotations/BackpressureKind.java b/src/main/java/io/reactivex/rxjava3/annotations/BackpressureKind.java index fd53c196b3..3b979a045d 100644 --- a/src/main/java/io/reactivex/rxjava3/annotations/BackpressureKind.java +++ b/src/main/java/io/reactivex/rxjava3/annotations/BackpressureKind.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/annotations/BackpressureSupport.java b/src/main/java/io/reactivex/rxjava3/annotations/BackpressureSupport.java index 9deafa22f5..b73a477fec 100644 --- a/src/main/java/io/reactivex/rxjava3/annotations/BackpressureSupport.java +++ b/src/main/java/io/reactivex/rxjava3/annotations/BackpressureSupport.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/annotations/Beta.java b/src/main/java/io/reactivex/rxjava3/annotations/Beta.java index 123842b773..ca75ea0b3b 100644 --- a/src/main/java/io/reactivex/rxjava3/annotations/Beta.java +++ b/src/main/java/io/reactivex/rxjava3/annotations/Beta.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/annotations/CheckReturnValue.java b/src/main/java/io/reactivex/rxjava3/annotations/CheckReturnValue.java index 3091d2647f..02c7f2e0d9 100644 --- a/src/main/java/io/reactivex/rxjava3/annotations/CheckReturnValue.java +++ b/src/main/java/io/reactivex/rxjava3/annotations/CheckReturnValue.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/annotations/Experimental.java b/src/main/java/io/reactivex/rxjava3/annotations/Experimental.java index 32d60e1442..061361f9b4 100644 --- a/src/main/java/io/reactivex/rxjava3/annotations/Experimental.java +++ b/src/main/java/io/reactivex/rxjava3/annotations/Experimental.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/annotations/NonNull.java b/src/main/java/io/reactivex/rxjava3/annotations/NonNull.java index 03e5180588..4495092fc7 100644 --- a/src/main/java/io/reactivex/rxjava3/annotations/NonNull.java +++ b/src/main/java/io/reactivex/rxjava3/annotations/NonNull.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/annotations/Nullable.java b/src/main/java/io/reactivex/rxjava3/annotations/Nullable.java index c95ef4a35c..a6af9eb1b5 100644 --- a/src/main/java/io/reactivex/rxjava3/annotations/Nullable.java +++ b/src/main/java/io/reactivex/rxjava3/annotations/Nullable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/annotations/SchedulerSupport.java b/src/main/java/io/reactivex/rxjava3/annotations/SchedulerSupport.java index 53b395f06b..0132b6a33d 100644 --- a/src/main/java/io/reactivex/rxjava3/annotations/SchedulerSupport.java +++ b/src/main/java/io/reactivex/rxjava3/annotations/SchedulerSupport.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/annotations/package-info.java b/src/main/java/io/reactivex/rxjava3/annotations/package-info.java index 8fa44fd553..a4daca2a32 100644 --- a/src/main/java/io/reactivex/rxjava3/annotations/package-info.java +++ b/src/main/java/io/reactivex/rxjava3/annotations/package-info.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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. */ /** diff --git a/src/main/java/io/reactivex/rxjava3/core/BackpressureOverflowStrategy.java b/src/main/java/io/reactivex/rxjava3/core/BackpressureOverflowStrategy.java index 750a1308f2..144dbb6807 100644 --- a/src/main/java/io/reactivex/rxjava3/core/BackpressureOverflowStrategy.java +++ b/src/main/java/io/reactivex/rxjava3/core/BackpressureOverflowStrategy.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.core; /** diff --git a/src/main/java/io/reactivex/rxjava3/core/BackpressureStrategy.java b/src/main/java/io/reactivex/rxjava3/core/BackpressureStrategy.java index 4a26072650..f2bf8d01ae 100644 --- a/src/main/java/io/reactivex/rxjava3/core/BackpressureStrategy.java +++ b/src/main/java/io/reactivex/rxjava3/core/BackpressureStrategy.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/core/Completable.java b/src/main/java/io/reactivex/rxjava3/core/Completable.java index c411cae489..e31a44c32c 100644 --- a/src/main/java/io/reactivex/rxjava3/core/Completable.java +++ b/src/main/java/io/reactivex/rxjava3/core/Completable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.core; import java.util.*; @@ -18,7 +19,7 @@ import org.reactivestreams.*; import io.reactivex.rxjava3.annotations.*; -import io.reactivex.rxjava3.disposables.Disposable; +import io.reactivex.rxjava3.disposables.*; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.*; @@ -28,7 +29,7 @@ import io.reactivex.rxjava3.internal.operators.completable.*; import io.reactivex.rxjava3.internal.operators.maybe.*; import io.reactivex.rxjava3.internal.operators.mixed.*; -import io.reactivex.rxjava3.internal.operators.single.*; +import io.reactivex.rxjava3.internal.operators.single.SingleDelayWithCompletable; import io.reactivex.rxjava3.observers.TestObserver; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.schedulers.Schedulers; @@ -51,7 +52,7 @@ * Note that as with the {@code Observable} protocol, {@code onError} and {@code onComplete} are mutually exclusive events. *

* Like {@code Observable}, a running {@code Completable} can be stopped through the {@link Disposable} instance - * provided to consumers through {@link SingleObserver#onSubscribe}. + * provided to consumers through {@link CompletableObserver#onSubscribe}. *

* Like an {@code Observable}, a {@code Completable} is lazy, can be either "hot" or "cold", synchronous or * asynchronous. {@code Completable} instances returned by the methods of this class are cold @@ -478,7 +479,7 @@ public static Completable unsafeCreate(@NonNull CompletableSource onSubscribe) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Completable defer(@NonNull Supplier supplier) { + public static Completable defer(@NonNull Supplier supplier) { Objects.requireNonNull(supplier, "supplier is null"); return RxJavaPlugins.onAssembly(new CompletableDefer(supplier)); } @@ -502,7 +503,7 @@ public static Completable defer(@NonNull Supplier s @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Completable error(@NonNull Supplier supplier) { + public static Completable error(@NonNull Supplier supplier) { Objects.requireNonNull(supplier, "supplier is null"); return RxJavaPlugins.onAssembly(new CompletableErrorSupplier(supplier)); } @@ -600,6 +601,7 @@ public static Completable fromCallable(@NonNull Callable callable) { * @param future the {@code Future} to react to * @return the new {@code Completable} instance * @throws NullPointerException if {@code future} is {@code null} + * @see #fromCompletionStage(CompletionStage) */ @CheckReturnValue @NonNull @@ -629,7 +631,7 @@ public static Completable fromFuture(@NonNull Future future) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Completable fromMaybe(@NonNull MaybeSource maybe) { + public static <@NonNull T> Completable fromMaybe(@NonNull MaybeSource maybe) { Objects.requireNonNull(maybe, "maybe is null"); return RxJavaPlugins.onAssembly(new MaybeIgnoreElementCompletable<>(maybe)); } @@ -685,7 +687,7 @@ public static Completable fromRunnable(@NonNull Runnable run) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Completable fromObservable(@NonNull ObservableSource observable) { + public static <@NonNull T> Completable fromObservable(@NonNull ObservableSource observable) { Objects.requireNonNull(observable, "observable is null"); return RxJavaPlugins.onAssembly(new CompletableFromObservable<>(observable)); } @@ -723,7 +725,7 @@ public static Completable fromObservable(@NonNull ObservableSource observ @NonNull @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) @SchedulerSupport(SchedulerSupport.NONE) - public static Completable fromPublisher(@NonNull Publisher publisher) { + public static <@NonNull T> Completable fromPublisher(@NonNull Publisher publisher) { Objects.requireNonNull(publisher, "publisher is null"); return RxJavaPlugins.onAssembly(new CompletableFromPublisher<>(publisher)); } @@ -745,7 +747,7 @@ public static Completable fromPublisher(@NonNull Publisher publisher) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Completable fromSingle(@NonNull SingleSource single) { + public static <@NonNull T> Completable fromSingle(@NonNull SingleSource single) { Objects.requireNonNull(single, "single is null"); return RxJavaPlugins.onAssembly(new CompletableFromSingle<>(single)); } @@ -1224,7 +1226,7 @@ public static Completable switchOnNextDelayError(@NonNull Publisher<@NonNull ? e @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Completable using(@NonNull Supplier resourceSupplier, + public static <@NonNull R> Completable using(@NonNull Supplier resourceSupplier, @NonNull Function sourceSupplier, @NonNull Consumer resourceCleanup) { return using(resourceSupplier, sourceSupplier, resourceCleanup, true); @@ -1260,7 +1262,7 @@ public static Completable using(@NonNull Supplier resourceSupplier, @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Completable using( + public static <@NonNull R> Completable using( @NonNull Supplier resourceSupplier, @NonNull Function sourceSupplier, @NonNull Consumer resourceCleanup, @@ -1907,11 +1909,12 @@ public final Completable doOnLifecycle(@NonNull Consumer onS *

Scheduler:
*
{@code doOnLifecycle} does not operate by default on a particular {@link Scheduler}.
* - * @param onSubscribe the consumer called when a {@link CompletableObserver} subscribes. - * @param onError the consumer called when this emits an {@code onError} event - * @param onComplete the runnable called just before when the current {@code Completable} completes normally - * @param onAfterTerminate the runnable called after this {@code Completable} completes normally - * @param onDispose the {@link Runnable} called when the downstream disposes the subscription + * @param onSubscribe the {@link Consumer} called when a {@link CompletableObserver} subscribes. + * @param onError the {@code Consumer} called when this emits an {@code onError} event + * @param onComplete the {@link Action} called just before when the current {@code Completable} completes normally + * @param onTerminate the {@code Action} called just before this {@code Completable} terminates + * @param onAfterTerminate the {@code Action} called after this {@code Completable} completes normally + * @param onDispose the {@code Action} called when the downstream disposes the subscription * @return the new {@code Completable} instance * @throws NullPointerException if {@code onSubscribe}, {@code onError}, {@code onComplete} * {@code onTerminate}, {@code onAfterTerminate} or {@code onDispose} is {@code null} @@ -2192,7 +2195,7 @@ public final Completable lift(@NonNull CompletableOperator onLift) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Single> materialize() { + public final <@NonNull T> Single> materialize() { return RxJavaPlugins.onAssembly(new CompletableMaterialize<>(this)); } @@ -2354,7 +2357,7 @@ public final Completable onErrorResumeWith(@NonNull CompletableSource fallback) @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Maybe onErrorReturn(@NonNull Function itemSupplier) { + public final <@NonNull T> Maybe onErrorReturn(@NonNull Function itemSupplier) { Objects.requireNonNull(itemSupplier, "itemSupplier is null"); return RxJavaPlugins.onAssembly(new CompletableOnErrorReturn<>(this, itemSupplier)); } @@ -2382,7 +2385,7 @@ public final Maybe onErrorReturn(@NonNull Function Maybe onErrorReturnItem(@NonNull T item) { + public final <@NonNull T> Maybe onErrorReturnItem(@NonNull T item) { Objects.requireNonNull(item, "item is null"); return onErrorReturn(Functions.justFunction(item)); } @@ -2481,7 +2484,7 @@ public final Completable repeatUntil(@NonNull BooleanSupplier stop) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Completable repeatWhen(@NonNull Function, ? extends Publisher<@NonNull ?>> handler) { + public final Completable repeatWhen(@NonNull Function, @NonNull ? extends Publisher<@NonNull ?>> handler) { return fromPublisher(toFlowable().repeatWhen(handler)); } @@ -2653,7 +2656,7 @@ public final Completable retryUntil(@NonNull BooleanSupplier stop) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Completable retryWhen(@NonNull Function, ? extends Publisher<@NonNull ?>> handler) { + public final Completable retryWhen(@NonNull Function, @NonNull ? extends Publisher<@NonNull ?>> handler) { return fromPublisher(toFlowable().retryWhen(handler)); } @@ -2724,7 +2727,7 @@ public final Completable startWith(@NonNull CompletableSource other) { @NonNull @SchedulerSupport(SchedulerSupport.NONE) @BackpressureSupport(BackpressureKind.FULL) - public final Flowable startWith(@NonNull SingleSource other) { + public final <@NonNull T> Flowable startWith(@NonNull SingleSource other) { Objects.requireNonNull(other, "other is null"); return Flowable.concat(Single.wrap(other).toFlowable(), toFlowable()); } @@ -2750,7 +2753,7 @@ public final Flowable startWith(@NonNull SingleSource other) { @NonNull @SchedulerSupport(SchedulerSupport.NONE) @BackpressureSupport(BackpressureKind.FULL) - public final Flowable startWith(@NonNull MaybeSource other) { + public final <@NonNull T> Flowable startWith(@NonNull MaybeSource other) { Objects.requireNonNull(other, "other is null"); return Flowable.concat(Maybe.wrap(other).toFlowable(), toFlowable()); } @@ -2772,7 +2775,7 @@ public final Flowable startWith(@NonNull MaybeSource other) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Observable startWith(@NonNull ObservableSource other) { + public final <@NonNull T> Observable startWith(@NonNull ObservableSource other) { Objects.requireNonNull(other, "other is null"); return Observable.wrap(other).concatWith(this.toObservable()); } @@ -2798,7 +2801,7 @@ public final Observable startWith(@NonNull ObservableSource other) { @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable startWith(@NonNull Publisher other) { + public final <@NonNull T> Flowable startWith(@NonNull Publisher other) { Objects.requireNonNull(other, "other is null"); return this.toFlowable().startWith(other); } @@ -2834,6 +2837,7 @@ public final Completable hide() { *
{@code subscribe} does not operate by default on a particular {@link Scheduler}.
* * @return the new {@code Disposable} that can be used for disposing the subscription at any time + * @see #subscribe(Action, Consumer, DisposableContainer) */ @SchedulerSupport(SchedulerSupport.NONE) @NonNull @@ -2919,6 +2923,7 @@ public final void subscribe(@NonNull CompletableObserver observer) { * @param onError the {@link Consumer} that is called if this {@code Completable} emits an error * @return the new {@link Disposable} that can be used for disposing the subscription at any time * @throws NullPointerException if {@code onComplete} or {@code onError} is {@code null} + * @see #subscribe(Action, Consumer, DisposableContainer) */ @CheckReturnValue @NonNull @@ -2932,6 +2937,44 @@ public final Disposable subscribe(@NonNull Action onComplete, @NonNull Consumer< return observer; } + /** + * Wraps the given onXXX callbacks into a {@link Disposable} {@link CompletableObserver}, + * adds it to the given {@link DisposableContainer} and ensures, that if the upstream + * terminates or this particular {@code Disposable} is disposed, the {@code CompletableObserver} is removed + * from the given composite. + *

+ * The {@code CompletableObserver} will be removed after the callback for the terminal event has been invoked. + *

+ *
Scheduler:
+ *
{@code subscribe} does not operate by default on a particular {@link Scheduler}.
+ *
+ * @param onError the callback for an upstream error + * @param onComplete the callback for an upstream completion + * @param container the {@code DisposableContainer} (such as {@link CompositeDisposable}) to add and remove the + * created {@code Disposable} {@code CompletableObserver} + * @return the {@code Disposable} that allows disposing the particular subscription. + * @throws NullPointerException + * if {@code onComplete}, {@code onError} + * or {@code container} is {@code null} + * @since 3.1.0 + */ + @SchedulerSupport(SchedulerSupport.NONE) + @NonNull + public final Disposable subscribe( + @NonNull Action onComplete, + @NonNull Consumer onError, + @NonNull DisposableContainer container) { + Objects.requireNonNull(onComplete, "onComplete is null"); + Objects.requireNonNull(onError, "onError is null"); + Objects.requireNonNull(container, "container is null"); + + DisposableAutoReleaseMultiObserver observer = new DisposableAutoReleaseMultiObserver<>( + container, Functions.emptyConsumer(), onError, onComplete); + container.add(observer); + subscribe(observer); + return observer; + } + /** * Subscribes to this {@code Completable} and calls the given {@link Action} when this {@code Completable} * completes normally. @@ -2948,16 +2991,13 @@ public final Disposable subscribe(@NonNull Action onComplete, @NonNull Consumer< * @param onComplete the {@code Action} called when this {@code Completable} completes normally * @return the new {@link Disposable} that can be used for disposing the subscription at any time * @throws NullPointerException if {@code onComplete} is {@code null} + * @see #subscribe(Action, Consumer, DisposableContainer) */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) public final Disposable subscribe(@NonNull Action onComplete) { - Objects.requireNonNull(onComplete, "onComplete is null"); - - CallbackCompletableObserver observer = new CallbackCompletableObserver(onComplete); - subscribe(observer); - return observer; + return subscribe(onComplete, Functions.ON_ERROR_MISSING); } /** @@ -3171,7 +3211,7 @@ public final R to(@NonNull CompletableConverter converter) { @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable toFlowable() { + public final <@NonNull T> Flowable toFlowable() { if (this instanceof FuseToFlowable) { return ((FuseToFlowable)this).fuseToFlowable(); } @@ -3216,7 +3256,7 @@ public final Future toFuture() { @SuppressWarnings("unchecked") @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Maybe toMaybe() { + public final <@NonNull T> Maybe toMaybe() { if (this instanceof FuseToMaybe) { return ((FuseToMaybe)this).fuseToMaybe(); } @@ -3239,7 +3279,7 @@ public final Maybe toMaybe() { @SuppressWarnings("unchecked") @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable toObservable() { + public final <@NonNull T> Observable toObservable() { if (this instanceof FuseToObservable) { return ((FuseToObservable)this).fuseToObservable(); } @@ -3371,7 +3411,7 @@ public final TestObserver test(boolean dispose) { * *

* Note that the operator takes an already instantiated, running or terminated {@code CompletionStage}. - * If the optional is to be created per consumer upon subscription, use {@link #defer(Supplier)} + * If the {@code CompletionStage} is to be created per consumer upon subscription, use {@link #defer(Supplier)} * around {@code fromCompletionStage}: *


      * Maybe.defer(() -> Completable.fromCompletionStage(createCompletionStage()));
@@ -3426,7 +3466,7 @@ public static Completable fromCompletionStage(@NonNull CompletionStage stage)
     @CheckReturnValue
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
-    public final  CompletionStage toCompletionStage(@Nullable T defaultItem) {
+    public final <@Nullable T> CompletionStage toCompletionStage(T defaultItem) {
         return subscribeWith(new CompletionStageConsumer<>(true, defaultItem));
     }
 }
diff --git a/src/main/java/io/reactivex/rxjava3/core/CompletableConverter.java b/src/main/java/io/reactivex/rxjava3/core/CompletableConverter.java
index 83e8f693eb..a213c6f5ab 100644
--- a/src/main/java/io/reactivex/rxjava3/core/CompletableConverter.java
+++ b/src/main/java/io/reactivex/rxjava3/core/CompletableConverter.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/CompletableEmitter.java b/src/main/java/io/reactivex/rxjava3/core/CompletableEmitter.java
index 5ebb4e1877..2c5a9811c4 100644
--- a/src/main/java/io/reactivex/rxjava3/core/CompletableEmitter.java
+++ b/src/main/java/io/reactivex/rxjava3/core/CompletableEmitter.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/CompletableObserver.java b/src/main/java/io/reactivex/rxjava3/core/CompletableObserver.java
index 7c01ebfee1..9339307047 100644
--- a/src/main/java/io/reactivex/rxjava3/core/CompletableObserver.java
+++ b/src/main/java/io/reactivex/rxjava3/core/CompletableObserver.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/CompletableOnSubscribe.java b/src/main/java/io/reactivex/rxjava3/core/CompletableOnSubscribe.java
index 70d79e62b6..e73fae2d5c 100644
--- a/src/main/java/io/reactivex/rxjava3/core/CompletableOnSubscribe.java
+++ b/src/main/java/io/reactivex/rxjava3/core/CompletableOnSubscribe.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
@@ -10,13 +10,14 @@
  * 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 io.reactivex.rxjava3.core;
 
 import io.reactivex.rxjava3.annotations.NonNull;
 
 /**
  * A functional interface that has a {@code subscribe()} method that receives
- * an instance of a {@link CompletableEmitter} instance that allows pushing
+ * a {@link CompletableEmitter} instance that allows pushing
  * an event in a cancellation-safe manner.
  */
 @FunctionalInterface
diff --git a/src/main/java/io/reactivex/rxjava3/core/CompletableOperator.java b/src/main/java/io/reactivex/rxjava3/core/CompletableOperator.java
index e9b1df83cb..f06a94f36a 100644
--- a/src/main/java/io/reactivex/rxjava3/core/CompletableOperator.java
+++ b/src/main/java/io/reactivex/rxjava3/core/CompletableOperator.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/CompletableSource.java b/src/main/java/io/reactivex/rxjava3/core/CompletableSource.java
index 58edf9471c..90d3853b8a 100644
--- a/src/main/java/io/reactivex/rxjava3/core/CompletableSource.java
+++ b/src/main/java/io/reactivex/rxjava3/core/CompletableSource.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
@@ -10,6 +10,7 @@
  * 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 io.reactivex.rxjava3.core;
 
 import io.reactivex.rxjava3.annotations.NonNull;
diff --git a/src/main/java/io/reactivex/rxjava3/core/CompletableTransformer.java b/src/main/java/io/reactivex/rxjava3/core/CompletableTransformer.java
index 98a9e2aa19..2887c4717c 100644
--- a/src/main/java/io/reactivex/rxjava3/core/CompletableTransformer.java
+++ b/src/main/java/io/reactivex/rxjava3/core/CompletableTransformer.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/Emitter.java b/src/main/java/io/reactivex/rxjava3/core/Emitter.java
index e9ea2a1827..83410f056e 100644
--- a/src/main/java/io/reactivex/rxjava3/core/Emitter.java
+++ b/src/main/java/io/reactivex/rxjava3/core/Emitter.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
@@ -10,6 +10,7 @@
  * 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 io.reactivex.rxjava3.core;
 
 import io.reactivex.rxjava3.annotations.NonNull;
diff --git a/src/main/java/io/reactivex/rxjava3/core/Flowable.java b/src/main/java/io/reactivex/rxjava3/core/Flowable.java
index 4da8b6fd53..39f3c63b43 100644
--- a/src/main/java/io/reactivex/rxjava3/core/Flowable.java
+++ b/src/main/java/io/reactivex/rxjava3/core/Flowable.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
@@ -10,6 +10,7 @@
  * 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 io.reactivex.rxjava3.core;
 
 import java.util.*;
@@ -19,12 +20,11 @@
 import org.reactivestreams.*;
 
 import io.reactivex.rxjava3.annotations.*;
-import io.reactivex.rxjava3.disposables.Disposable;
+import io.reactivex.rxjava3.disposables.*;
 import io.reactivex.rxjava3.exceptions.*;
 import io.reactivex.rxjava3.flowables.*;
 import io.reactivex.rxjava3.functions.*;
 import io.reactivex.rxjava3.internal.functions.*;
-import io.reactivex.rxjava3.internal.fuseable.ScalarSupplier;
 import io.reactivex.rxjava3.internal.jdk8.*;
 import io.reactivex.rxjava3.internal.operators.flowable.*;
 import io.reactivex.rxjava3.internal.operators.maybe.MaybeToFlowable;
@@ -34,6 +34,7 @@
 import io.reactivex.rxjava3.internal.schedulers.ImmediateThinScheduler;
 import io.reactivex.rxjava3.internal.subscribers.*;
 import io.reactivex.rxjava3.internal.util.*;
+import io.reactivex.rxjava3.operators.ScalarSupplier;
 import io.reactivex.rxjava3.parallel.ParallelFlowable;
 import io.reactivex.rxjava3.plugins.RxJavaPlugins;
 import io.reactivex.rxjava3.schedulers.*;
@@ -163,13 +164,21 @@ public abstract class Flowable<@NonNull T> implements Publisher {
      * Mirrors the one {@link Publisher} in an {@link Iterable} of several {@code Publisher}s that first either emits an item or sends
      * a termination notification.
      * 

- * + * + *

+ * When one of the {@code Publisher}s signal an item or terminates first, all subscriptions to the other + * {@code Publisher}s are canceled. *

*
Backpressure:
*
The operator itself doesn't interfere with backpressure which is determined by the winning * {@code Publisher}'s backpressure behavior.
*
Scheduler:
*
{@code amb} does not operate by default on a particular {@link Scheduler}.
+ *
Error handling:
+ *
+ * If any of the losing {@code Publisher}s signals an error, the error is routed to the global + * error handler via {@link RxJavaPlugins#onError(Throwable)}. + *
*
* * @param the common element type @@ -184,7 +193,7 @@ public abstract class Flowable<@NonNull T> implements Publisher { @NonNull @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable amb(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources) { + public static <@NonNull T> Flowable amb(@NonNull Iterable<@NonNull ? extends Publisher> sources) { Objects.requireNonNull(sources, "sources is null"); return RxJavaPlugins.onAssembly(new FlowableAmb<>(null, sources)); } @@ -193,13 +202,21 @@ public static Flowable amb(@NonNull Iterable<@NonNull ? extends Publisher * Mirrors the one {@link Publisher} in an array of several {@code Publisher}s that first either emits an item or sends * a termination notification. *

- * + * + *

+ * When one of the {@code Publisher}s signal an item or terminates first, all subscriptions to the other + * {@code Publisher}s are canceled. *

*
Backpressure:
*
The operator itself doesn't interfere with backpressure which is determined by the winning * {@code Publisher}'s backpressure behavior.
*
Scheduler:
*
{@code ambArray} does not operate by default on a particular {@link Scheduler}.
+ *
Error handling:
+ *
+ * If any of the losing {@code Publisher}s signals an error, the error is routed to the global + * error handler via {@link RxJavaPlugins#onError(Throwable)}. + *
*
* * @param the common element type @@ -215,7 +232,7 @@ public static Flowable amb(@NonNull Iterable<@NonNull ? extends Publisher @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs - public static Flowable ambArray(@NonNull Publisher<@NonNull ? extends T>... sources) { + public static <@NonNull T> Flowable ambArray(@NonNull Publisher... sources) { Objects.requireNonNull(sources, "sources is null"); int len = sources.length; if (len == 0) { @@ -279,7 +296,7 @@ public static int bufferSize() { @CheckReturnValue @BackpressureSupport(BackpressureKind.FULL) @NonNull - public static Flowable combineLatestArray(@NonNull Publisher<@NonNull ? extends T>[] sources, @NonNull Function combiner) { + public static <@NonNull T, @NonNull R> Flowable combineLatestArray(@NonNull Publisher[] sources, @NonNull Function combiner) { return combineLatestArray(sources, combiner, bufferSize()); } @@ -327,7 +344,7 @@ public static int bufferSize() { @CheckReturnValue @NonNull @BackpressureSupport(BackpressureKind.FULL) - public static Flowable combineLatestArray(@NonNull Publisher<@NonNull ? extends T>[] sources, @NonNull Function combiner, int bufferSize) { + public static <@NonNull T, @NonNull R> Flowable combineLatestArray(@NonNull Publisher[] sources, @NonNull Function combiner, int bufferSize) { Objects.requireNonNull(sources, "sources is null"); if (sources.length == 0) { return empty(); @@ -378,7 +395,7 @@ public static Flowable combineLatestArray(@NonNull Publisher<@NonNull @CheckReturnValue @BackpressureSupport(BackpressureKind.FULL) @NonNull - public static Flowable combineLatest(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources, + public static <@NonNull T, @NonNull R> Flowable combineLatest(@NonNull Iterable<@NonNull ? extends Publisher> sources, @NonNull Function combiner) { return combineLatest(sources, combiner, bufferSize()); } @@ -427,7 +444,7 @@ public static Flowable combineLatestArray(@NonNull Publisher<@NonNull @CheckReturnValue @NonNull @BackpressureSupport(BackpressureKind.FULL) - public static Flowable combineLatest(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources, + public static <@NonNull T, @NonNull R> Flowable combineLatest(@NonNull Iterable<@NonNull ? extends Publisher> sources, @NonNull Function combiner, int bufferSize) { Objects.requireNonNull(sources, "sources is null"); Objects.requireNonNull(combiner, "combiner is null"); @@ -476,7 +493,7 @@ public static Flowable combineLatest(@NonNull Iterable<@NonNull ? exte @CheckReturnValue @BackpressureSupport(BackpressureKind.FULL) @NonNull - public static Flowable combineLatestArrayDelayError(@NonNull Publisher<@NonNull ? extends T>[] sources, + public static <@NonNull T, @NonNull R> Flowable combineLatestArrayDelayError(@NonNull Publisher[] sources, @NonNull Function combiner) { return combineLatestArrayDelayError(sources, combiner, bufferSize()); } @@ -526,7 +543,7 @@ public static Flowable combineLatest(@NonNull Iterable<@NonNull ? exte @CheckReturnValue @NonNull @BackpressureSupport(BackpressureKind.FULL) - public static Flowable combineLatestArrayDelayError(@NonNull Publisher<@NonNull ? extends T>[] sources, + public static <@NonNull T, @NonNull R> Flowable combineLatestArrayDelayError(@NonNull Publisher[] sources, @NonNull Function combiner, int bufferSize) { Objects.requireNonNull(sources, "sources is null"); Objects.requireNonNull(combiner, "combiner is null"); @@ -579,7 +596,7 @@ public static Flowable combineLatest(@NonNull Iterable<@NonNull ? exte @CheckReturnValue @BackpressureSupport(BackpressureKind.FULL) @NonNull - public static Flowable combineLatestDelayError(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources, + public static <@NonNull T, @NonNull R> Flowable combineLatestDelayError(@NonNull Iterable<@NonNull ? extends Publisher> sources, @NonNull Function combiner) { return combineLatestDelayError(sources, combiner, bufferSize()); } @@ -629,7 +646,7 @@ public static Flowable combineLatest(@NonNull Iterable<@NonNull ? exte @CheckReturnValue @BackpressureSupport(BackpressureKind.FULL) @NonNull - public static Flowable combineLatestDelayError(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources, + public static <@NonNull T, @NonNull R> Flowable combineLatestDelayError(@NonNull Iterable<@NonNull ? extends Publisher> sources, @NonNull Function combiner, int bufferSize) { Objects.requireNonNull(sources, "sources is null"); Objects.requireNonNull(combiner, "combiner is null"); @@ -674,8 +691,8 @@ public static Flowable combineLatestDelayError(@NonNull Iterable<@NonN @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable combineLatest( - @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2, + public static <@NonNull T1, @NonNull T2, @NonNull R> Flowable combineLatest( + @NonNull Publisher source1, @NonNull Publisher source2, @NonNull BiFunction combiner) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -723,9 +740,9 @@ public static Flowable combineLatest( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable combineLatest( - @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2, - @NonNull Publisher<@NonNull ? extends T3> source3, + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull R> Flowable combineLatest( + @NonNull Publisher source1, @NonNull Publisher source2, + @NonNull Publisher source3, @NonNull Function3 combiner) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -778,9 +795,9 @@ public static Flowable combineLatest( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable combineLatest( - @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2, - @NonNull Publisher<@NonNull ? extends T3> source3, @NonNull Publisher<@NonNull ? extends T4> source4, + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull R> Flowable combineLatest( + @NonNull Publisher source1, @NonNull Publisher source2, + @NonNull Publisher source3, @NonNull Publisher source4, @NonNull Function4 combiner) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -837,10 +854,10 @@ public static Flowable combineLatest( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable combineLatest( - @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2, - @NonNull Publisher<@NonNull ? extends T3> source3, @NonNull Publisher<@NonNull ? extends T4> source4, - @NonNull Publisher<@NonNull ? extends T5> source5, + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull R> Flowable combineLatest( + @NonNull Publisher source1, @NonNull Publisher source2, + @NonNull Publisher source3, @NonNull Publisher source4, + @NonNull Publisher source5, @NonNull Function5 combiner) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -901,10 +918,10 @@ public static Flowable combineLatest( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable combineLatest( - @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2, - @NonNull Publisher<@NonNull ? extends T3> source3, @NonNull Publisher<@NonNull ? extends T4> source4, - @NonNull Publisher<@NonNull ? extends T5> source5, @NonNull Publisher<@NonNull ? extends T6> source6, + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull R> Flowable combineLatest( + @NonNull Publisher source1, @NonNull Publisher source2, + @NonNull Publisher source3, @NonNull Publisher source4, + @NonNull Publisher source5, @NonNull Publisher source6, @NonNull Function6 combiner) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -970,11 +987,11 @@ public static Flowable combineLatest( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable combineLatest( - @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2, - @NonNull Publisher<@NonNull ? extends T3> source3, @NonNull Publisher<@NonNull ? extends T4> source4, - @NonNull Publisher<@NonNull ? extends T5> source5, @NonNull Publisher<@NonNull ? extends T6> source6, - @NonNull Publisher<@NonNull ? extends T7> source7, + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull R> Flowable combineLatest( + @NonNull Publisher source1, @NonNull Publisher source2, + @NonNull Publisher source3, @NonNull Publisher source4, + @NonNull Publisher source5, @NonNull Publisher source6, + @NonNull Publisher source7, @NonNull Function7 combiner) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -1044,11 +1061,11 @@ public static Flowable combineLatest( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable combineLatest( - @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2, - @NonNull Publisher<@NonNull ? extends T3> source3, @NonNull Publisher<@NonNull ? extends T4> source4, - @NonNull Publisher<@NonNull ? extends T5> source5, @NonNull Publisher<@NonNull ? extends T6> source6, - @NonNull Publisher<@NonNull ? extends T7> source7, @NonNull Publisher<@NonNull ? extends T8> source8, + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull T8, @NonNull R> Flowable combineLatest( + @NonNull Publisher source1, @NonNull Publisher source2, + @NonNull Publisher source3, @NonNull Publisher source4, + @NonNull Publisher source5, @NonNull Publisher source6, + @NonNull Publisher source7, @NonNull Publisher source8, @NonNull Function8 combiner) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -1123,12 +1140,12 @@ public static Flowable combineLatest( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable combineLatest( - @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2, - @NonNull Publisher<@NonNull ? extends T3> source3, @NonNull Publisher<@NonNull ? extends T4> source4, - @NonNull Publisher<@NonNull ? extends T5> source5, @NonNull Publisher<@NonNull ? extends T6> source6, - @NonNull Publisher<@NonNull ? extends T7> source7, @NonNull Publisher<@NonNull ? extends T8> source8, - @NonNull Publisher<@NonNull ? extends T9> source9, + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull T8, @NonNull T9, @NonNull R> Flowable combineLatest( + @NonNull Publisher source1, @NonNull Publisher source2, + @NonNull Publisher source3, @NonNull Publisher source4, + @NonNull Publisher source5, @NonNull Publisher source6, + @NonNull Publisher source7, @NonNull Publisher source8, + @NonNull Publisher source9, @NonNull Function9 combiner) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -1167,7 +1184,7 @@ public static Flowable combineLatest( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concat(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources) { + public static <@NonNull T> Flowable concat(@NonNull Iterable<@NonNull ? extends Publisher> sources) { Objects.requireNonNull(sources, "sources is null"); // unlike general sources, fromIterable can only throw on a boundary because it is consumed only there return fromIterable(sources).concatMapDelayError((Function)Functions.identity(), false, 2); @@ -1199,7 +1216,7 @@ public static Flowable concat(@NonNull Iterable<@NonNull ? extends Publis @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable concat(@NonNull Publisher<@NonNull ? extends Publisher<@NonNull ? extends T>> sources) { + public static <@NonNull T> Flowable concat(@NonNull Publisher<@NonNull ? extends Publisher> sources) { return concat(sources, bufferSize()); } @@ -1233,7 +1250,7 @@ public static Flowable concat(@NonNull Publisher<@NonNull ? extends Publi @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable concat(@NonNull Publisher<@NonNull ? extends Publisher<@NonNull ? extends T>> sources, int prefetch) { + public static <@NonNull T> Flowable concat(@NonNull Publisher<@NonNull ? extends Publisher> sources, int prefetch) { return fromPublisher(sources).concatMap((Function)Functions.identity(), prefetch); } @@ -1265,7 +1282,7 @@ public static Flowable concat(@NonNull Publisher<@NonNull ? extends Publi @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concat(@NonNull Publisher<@NonNull ? extends T> source1, @NonNull Publisher<@NonNull ? extends T> source2) { + public static <@NonNull T> Flowable concat(@NonNull Publisher source1, @NonNull Publisher source2) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); return concatArray(source1, source2); @@ -1301,9 +1318,9 @@ public static Flowable concat(@NonNull Publisher<@NonNull ? extends T> so @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concat( - @NonNull Publisher<@NonNull ? extends T> source1, @NonNull Publisher<@NonNull ? extends T> source2, - @NonNull Publisher<@NonNull ? extends T> source3) { + public static <@NonNull T> Flowable concat( + @NonNull Publisher source1, @NonNull Publisher source2, + @NonNull Publisher source3) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); Objects.requireNonNull(source3, "source3 is null"); @@ -1342,9 +1359,9 @@ public static Flowable concat( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concat( - @NonNull Publisher<@NonNull ? extends T> source1, @NonNull Publisher<@NonNull ? extends T> source2, - @NonNull Publisher<@NonNull ? extends T> source3, @NonNull Publisher<@NonNull ? extends T> source4) { + public static <@NonNull T> Flowable concat( + @NonNull Publisher source1, @NonNull Publisher source2, + @NonNull Publisher source3, @NonNull Publisher source4) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); Objects.requireNonNull(source3, "source3 is null"); @@ -1377,7 +1394,7 @@ public static Flowable concat( @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs @NonNull - public static Flowable concatArray(@NonNull Publisher<@NonNull ? extends T>... sources) { + public static <@NonNull T> Flowable concatArray(@NonNull Publisher... sources) { Objects.requireNonNull(sources, "sources is null"); if (sources.length == 0) { return empty(); @@ -1412,7 +1429,7 @@ public static Flowable concatArray(@NonNull Publisher<@NonNull ? extends @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs @NonNull - public static Flowable concatArrayDelayError(@NonNull Publisher<@NonNull ? extends T>... sources) { + public static <@NonNull T> Flowable concatArrayDelayError(@NonNull Publisher... sources) { Objects.requireNonNull(sources, "sources is null"); if (sources.length == 0) { return empty(); @@ -1451,7 +1468,7 @@ public static Flowable concatArrayDelayError(@NonNull Publisher<@NonNull @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs @NonNull - public static Flowable concatArrayEager(@NonNull Publisher<@NonNull ? extends T>... sources) { + public static <@NonNull T> Flowable concatArrayEager(@NonNull Publisher... sources) { return concatArrayEager(bufferSize(), bufferSize(), sources); } @@ -1488,7 +1505,7 @@ public static Flowable concatArrayEager(@NonNull Publisher<@NonNull ? ext @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings({ "rawtypes", "unchecked" }) @SafeVarargs - public static Flowable concatArrayEager(int maxConcurrency, int prefetch, @NonNull Publisher<@NonNull ? extends T>... sources) { + public static <@NonNull T> Flowable concatArrayEager(int maxConcurrency, int prefetch, @NonNull Publisher... sources) { Objects.requireNonNull(sources, "sources is null"); ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); ObjectHelper.verifyPositive(prefetch, "prefetch"); @@ -1524,7 +1541,7 @@ public static Flowable concatArrayEager(int maxConcurrency, int prefetch, @BackpressureSupport(BackpressureKind.FULL) @SafeVarargs @NonNull - public static Flowable concatArrayEagerDelayError(@NonNull Publisher<@NonNull ? extends T>... sources) { + public static <@NonNull T> Flowable concatArrayEagerDelayError(@NonNull Publisher... sources) { return concatArrayEagerDelayError(bufferSize(), bufferSize(), sources); } @@ -1562,7 +1579,7 @@ public static Flowable concatArrayEagerDelayError(@NonNull Publisher<@Non @BackpressureSupport(BackpressureKind.FULL) @SafeVarargs @NonNull - public static Flowable concatArrayEagerDelayError(int maxConcurrency, int prefetch, @NonNull Publisher<@NonNull ? extends T>... sources) { + public static <@NonNull T> Flowable concatArrayEagerDelayError(int maxConcurrency, int prefetch, @NonNull Publisher... sources) { return fromArray(sources).concatMapEagerDelayError((Function)Functions.identity(), true, maxConcurrency, prefetch); } @@ -1590,7 +1607,7 @@ public static Flowable concatArrayEagerDelayError(int maxConcurrency, int @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concatDelayError(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources) { + public static <@NonNull T> Flowable concatDelayError(@NonNull Iterable<@NonNull ? extends Publisher> sources) { Objects.requireNonNull(sources, "sources is null"); return fromIterable(sources).concatMapDelayError((Function)Functions.identity()); } @@ -1615,7 +1632,7 @@ public static Flowable concatDelayError(@NonNull Iterable<@NonNull ? exte @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable concatDelayError(@NonNull Publisher<@NonNull ? extends Publisher<@NonNull ? extends T>> sources) { + public static <@NonNull T> Flowable concatDelayError(@NonNull Publisher<@NonNull ? extends Publisher> sources) { return concatDelayError(sources, bufferSize(), true); } @@ -1644,7 +1661,7 @@ public static Flowable concatDelayError(@NonNull Publisher<@NonNull ? ext @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable concatDelayError(@NonNull Publisher<@NonNull ? extends Publisher<@NonNull ? extends T>> sources, int prefetch, boolean tillTheEnd) { + public static <@NonNull T> Flowable concatDelayError(@NonNull Publisher<@NonNull ? extends Publisher> sources, int prefetch, boolean tillTheEnd) { return fromPublisher(sources).concatMapDelayError((Function)Functions.identity(), tillTheEnd, prefetch); } @@ -1674,7 +1691,7 @@ public static Flowable concatDelayError(@NonNull Publisher<@NonNull ? ext @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable concatEager(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources) { + public static <@NonNull T> Flowable concatEager(@NonNull Iterable<@NonNull ? extends Publisher> sources) { return concatEager(sources, bufferSize(), bufferSize()); } @@ -1710,7 +1727,7 @@ public static Flowable concatEager(@NonNull Iterable<@NonNull ? extends P @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings({ "rawtypes", "unchecked" }) - public static Flowable concatEager(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources, int maxConcurrency, int prefetch) { + public static <@NonNull T> Flowable concatEager(@NonNull Iterable<@NonNull ? extends Publisher> sources, int maxConcurrency, int prefetch) { Objects.requireNonNull(sources, "sources is null"); ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); ObjectHelper.verifyPositive(prefetch, "prefetch"); @@ -1743,7 +1760,7 @@ public static Flowable concatEager(@NonNull Iterable<@NonNull ? extends P @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable concatEager(@NonNull Publisher<@NonNull ? extends Publisher<@NonNull ? extends T>> sources) { + public static <@NonNull T> Flowable concatEager(@NonNull Publisher<@NonNull ? extends Publisher> sources) { return concatEager(sources, bufferSize(), bufferSize()); } @@ -1779,7 +1796,7 @@ public static Flowable concatEager(@NonNull Publisher<@NonNull ? extends @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings({ "rawtypes", "unchecked" }) - public static Flowable concatEager(@NonNull Publisher<@NonNull ? extends Publisher<@NonNull ? extends T>> sources, int maxConcurrency, int prefetch) { + public static <@NonNull T> Flowable concatEager(@NonNull Publisher<@NonNull ? extends Publisher> sources, int maxConcurrency, int prefetch) { Objects.requireNonNull(sources, "sources is null"); ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); ObjectHelper.verifyPositive(prefetch, "prefetch"); @@ -1813,7 +1830,7 @@ public static Flowable concatEager(@NonNull Publisher<@NonNull ? extends @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable concatEagerDelayError(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources) { + public static <@NonNull T> Flowable concatEagerDelayError(@NonNull Iterable<@NonNull ? extends Publisher> sources) { return concatEagerDelayError(sources, bufferSize(), bufferSize()); } @@ -1850,7 +1867,7 @@ public static Flowable concatEagerDelayError(@NonNull Iterable<@NonNull ? @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings({ "rawtypes", "unchecked" }) - public static Flowable concatEagerDelayError(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources, int maxConcurrency, int prefetch) { + public static <@NonNull T> Flowable concatEagerDelayError(@NonNull Iterable<@NonNull ? extends Publisher> sources, int maxConcurrency, int prefetch) { Objects.requireNonNull(sources, "sources is null"); ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); ObjectHelper.verifyPositive(prefetch, "prefetch"); @@ -1884,7 +1901,7 @@ public static Flowable concatEagerDelayError(@NonNull Iterable<@NonNull ? @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable concatEagerDelayError(@NonNull Publisher<@NonNull ? extends Publisher<@NonNull ? extends T>> sources) { + public static <@NonNull T> Flowable concatEagerDelayError(@NonNull Publisher<@NonNull ? extends Publisher> sources) { return concatEagerDelayError(sources, bufferSize(), bufferSize()); } @@ -1921,7 +1938,7 @@ public static Flowable concatEagerDelayError(@NonNull Publisher<@NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings({ "rawtypes", "unchecked" }) - public static Flowable concatEagerDelayError(@NonNull Publisher<@NonNull ? extends Publisher<@NonNull ? extends T>> sources, int maxConcurrency, int prefetch) { + public static <@NonNull T> Flowable concatEagerDelayError(@NonNull Publisher<@NonNull ? extends Publisher> sources, int maxConcurrency, int prefetch) { Objects.requireNonNull(sources, "sources is null"); ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); ObjectHelper.verifyPositive(prefetch, "prefetch"); @@ -1986,7 +2003,7 @@ public static Flowable concatEagerDelayError(@NonNull Publisher<@NonNull @NonNull @BackpressureSupport(BackpressureKind.SPECIAL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable create(@NonNull FlowableOnSubscribe source, @NonNull BackpressureStrategy mode) { + public static <@NonNull T> Flowable create(@NonNull FlowableOnSubscribe source, @NonNull BackpressureStrategy mode) { Objects.requireNonNull(source, "source is null"); Objects.requireNonNull(mode, "mode is null"); return RxJavaPlugins.onAssembly(new FlowableCreate<>(source, mode)); @@ -2023,7 +2040,7 @@ public static Flowable create(@NonNull FlowableOnSubscribe source, @No @NonNull @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable defer(@NonNull Supplier> supplier) { + public static <@NonNull T> Flowable defer(@NonNull Supplier> supplier) { Objects.requireNonNull(supplier, "supplier is null"); return RxJavaPlugins.onAssembly(new FlowableDefer<>(supplier)); } @@ -2050,7 +2067,7 @@ public static Flowable defer(@NonNull Supplier Flowable empty() { + public static <@NonNull T> Flowable empty() { return RxJavaPlugins.onAssembly((Flowable) FlowableEmpty.INSTANCE); } @@ -2078,7 +2095,7 @@ public static Flowable empty() { @NonNull @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable error(@NonNull Supplier supplier) { + public static <@NonNull T> Flowable error(@NonNull Supplier supplier) { Objects.requireNonNull(supplier, "supplier is null"); return RxJavaPlugins.onAssembly(new FlowableError<>(supplier)); } @@ -2107,7 +2124,7 @@ public static Flowable error(@NonNull Supplier suppl @NonNull @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable error(@NonNull Throwable throwable) { + public static <@NonNull T> Flowable error(@NonNull Throwable throwable) { Objects.requireNonNull(throwable, "throwable is null"); return error(Functions.justSupplier(throwable)); } @@ -2140,7 +2157,7 @@ public static Flowable error(@NonNull Throwable throwable) { @NonNull @SchedulerSupport(SchedulerSupport.NONE) @BackpressureSupport(BackpressureKind.PASS_THROUGH) - public static Flowable fromAction(@NonNull Action action) { + public static <@NonNull T> Flowable fromAction(@NonNull Action action) { Objects.requireNonNull(action, "action is null"); return RxJavaPlugins.onAssembly(new FlowableFromAction<>(action)); } @@ -2242,7 +2259,7 @@ public static Flowable fromAction(@NonNull Action action) { @NonNull @SchedulerSupport(SchedulerSupport.NONE) @BackpressureSupport(BackpressureKind.PASS_THROUGH) - public static Flowable fromCompletable(@NonNull CompletableSource completableSource) { + public static <@NonNull T> Flowable fromCompletable(@NonNull CompletableSource completableSource) { Objects.requireNonNull(completableSource, "completableSource is null"); return RxJavaPlugins.onAssembly(new FlowableFromCompletable<>(completableSource)); } @@ -2362,7 +2379,7 @@ public static Flowable fromCompletable(@NonNull CompletableSource complet @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static <@NonNull T> Flowable fromIterable(@NonNull Iterable<@NonNull ? extends T> source) { + public static <@NonNull T> Flowable fromIterable(@NonNull Iterable source) { Objects.requireNonNull(source, "source is null"); return RxJavaPlugins.onAssembly(new FlowableFromIterable<>(source)); } @@ -2389,7 +2406,7 @@ public static Flowable fromCompletable(@NonNull CompletableSource complet @NonNull @SchedulerSupport(SchedulerSupport.NONE) @BackpressureSupport(BackpressureKind.FULL) - public static Flowable fromMaybe(@NonNull MaybeSource maybe) { + public static <@NonNull T> Flowable fromMaybe(@NonNull MaybeSource maybe) { Objects.requireNonNull(maybe, "maybe is null"); return RxJavaPlugins.onAssembly(new MaybeToFlowable<>(maybe)); } @@ -2437,7 +2454,7 @@ public static Flowable fromMaybe(@NonNull MaybeSource maybe) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable fromObservable(@NonNull ObservableSource source, @NonNull BackpressureStrategy strategy) { + public static <@NonNull T> Flowable fromObservable(@NonNull ObservableSource source, @NonNull BackpressureStrategy strategy) { Objects.requireNonNull(source, "source is null"); Objects.requireNonNull(strategy, "strategy is null"); Flowable f = new FlowableFromObservable<>(source); @@ -2487,7 +2504,7 @@ public static Flowable fromObservable(@NonNull ObservableSource source @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings("unchecked") - public static Flowable fromPublisher(@NonNull Publisher<@NonNull ? extends T> publisher) { + public static <@NonNull T> Flowable fromPublisher(@NonNull Publisher publisher) { if (publisher instanceof Flowable) { return RxJavaPlugins.onAssembly((Flowable)publisher); } @@ -2530,7 +2547,7 @@ public static Flowable fromPublisher(@NonNull Publisher<@NonNull ? extend @NonNull @SchedulerSupport(SchedulerSupport.NONE) @BackpressureSupport(BackpressureKind.PASS_THROUGH) - public static Flowable fromRunnable(@NonNull Runnable run) { + public static <@NonNull T> Flowable fromRunnable(@NonNull Runnable run) { Objects.requireNonNull(run, "run is null"); return RxJavaPlugins.onAssembly(new FlowableFromRunnable<>(run)); } @@ -2556,7 +2573,7 @@ public static Flowable fromRunnable(@NonNull Runnable run) { @NonNull @SchedulerSupport(SchedulerSupport.NONE) @BackpressureSupport(BackpressureKind.FULL) - public static Flowable fromSingle(@NonNull SingleSource source) { + public static <@NonNull T> Flowable fromSingle(@NonNull SingleSource source) { Objects.requireNonNull(source, "source is null"); return RxJavaPlugins.onAssembly(new SingleToFlowable<>(source)); } @@ -2629,7 +2646,7 @@ public static Flowable fromSingle(@NonNull SingleSource source) { @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable generate(@NonNull Consumer<@NonNull Emitter> generator) { + public static <@NonNull T> Flowable generate(@NonNull Consumer<@NonNull Emitter> generator) { Objects.requireNonNull(generator, "generator is null"); return generate(Functions.nullSupplier(), FlowableInternalHelper.simpleGenerator(generator), @@ -2664,7 +2681,7 @@ public static Flowable generate(@NonNull Consumer<@NonNull Emitter> ge @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable generate(@NonNull Supplier initialState, @NonNull BiConsumer> generator) { + public static <@NonNull T, @NonNull S> Flowable generate(@NonNull Supplier initialState, @NonNull BiConsumer> generator) { Objects.requireNonNull(generator, "generator is null"); return generate(initialState, FlowableInternalHelper.simpleBiGenerator(generator), Functions.emptyConsumer()); @@ -2700,7 +2717,7 @@ public static Flowable generate(@NonNull Supplier initialState, @No @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable generate(@NonNull Supplier initialState, @NonNull BiConsumer> generator, + public static <@NonNull T, @NonNull S> Flowable generate(@NonNull Supplier initialState, @NonNull BiConsumer> generator, @NonNull Consumer disposeState) { Objects.requireNonNull(generator, "generator is null"); return generate(initialState, FlowableInternalHelper.simpleBiGenerator(generator), disposeState); @@ -2735,7 +2752,7 @@ public static Flowable generate(@NonNull Supplier initialState, @No @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable generate(@NonNull Supplier initialState, @NonNull BiFunction, S> generator) { + public static <@NonNull T, @NonNull S> Flowable generate(@NonNull Supplier initialState, @NonNull BiFunction, S> generator) { return generate(initialState, generator, Functions.emptyConsumer()); } @@ -2770,7 +2787,7 @@ public static Flowable generate(@NonNull Supplier initialState, @No @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable generate(@NonNull Supplier initialState, @NonNull BiFunction, S> generator, @NonNull Consumer disposeState) { + public static <@NonNull T, @NonNull S> Flowable generate(@NonNull Supplier initialState, @NonNull BiFunction, S> generator, @NonNull Consumer disposeState) { Objects.requireNonNull(initialState, "initialState is null"); Objects.requireNonNull(generator, "generator is null"); Objects.requireNonNull(disposeState, "disposeState is null"); @@ -3477,7 +3494,7 @@ public static Flowable intervalRange(long start, long count, long initialD @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable merge(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources, int maxConcurrency, int bufferSize) { + public static <@NonNull T> Flowable merge(@NonNull Iterable<@NonNull ? extends Publisher> sources, int maxConcurrency, int bufferSize) { return fromIterable(sources).flatMap((Function)Functions.identity(), false, maxConcurrency, bufferSize); } @@ -3530,7 +3547,7 @@ public static Flowable merge(@NonNull Iterable<@NonNull ? extends Publish @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs @NonNull - public static Flowable mergeArray(int maxConcurrency, int bufferSize, @NonNull Publisher<@NonNull ? extends T>... sources) { + public static <@NonNull T> Flowable mergeArray(int maxConcurrency, int bufferSize, @NonNull Publisher... sources) { return fromArray(sources).flatMap((Function)Functions.identity(), false, maxConcurrency, bufferSize); } @@ -3575,7 +3592,7 @@ public static Flowable mergeArray(int maxConcurrency, int bufferSize, @No @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable merge(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources) { + public static <@NonNull T> Flowable merge(@NonNull Iterable<@NonNull ? extends Publisher> sources) { return fromIterable(sources).flatMap((Function)Functions.identity()); } @@ -3625,7 +3642,7 @@ public static Flowable merge(@NonNull Iterable<@NonNull ? extends Publish @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable merge(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources, int maxConcurrency) { + public static <@NonNull T> Flowable merge(@NonNull Iterable<@NonNull ? extends Publisher> sources, int maxConcurrency) { return fromIterable(sources).flatMap((Function)Functions.identity(), maxConcurrency); } @@ -3671,7 +3688,7 @@ public static Flowable merge(@NonNull Iterable<@NonNull ? extends Publish @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable merge(@NonNull Publisher<@NonNull ? extends Publisher<@NonNull ? extends T>> sources) { + public static <@NonNull T> Flowable merge(@NonNull Publisher<@NonNull ? extends Publisher> sources) { return merge(sources, bufferSize()); } @@ -3723,7 +3740,7 @@ public static Flowable merge(@NonNull Publisher<@NonNull ? extends Publis @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable merge(@NonNull Publisher<@NonNull ? extends Publisher<@NonNull ? extends T>> sources, int maxConcurrency) { + public static <@NonNull T> Flowable merge(@NonNull Publisher<@NonNull ? extends Publisher> sources, int maxConcurrency) { return fromPublisher(sources).flatMap((Function)Functions.identity(), maxConcurrency); } @@ -3769,7 +3786,7 @@ public static Flowable merge(@NonNull Publisher<@NonNull ? extends Publis @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs @NonNull - public static Flowable mergeArray(@NonNull Publisher<@NonNull ? extends T>... sources) { + public static <@NonNull T> Flowable mergeArray(@NonNull Publisher... sources) { return fromArray(sources).flatMap((Function)Functions.identity(), sources.length); } @@ -3816,7 +3833,7 @@ public static Flowable mergeArray(@NonNull Publisher<@NonNull ? extends T @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable merge(@NonNull Publisher<@NonNull ? extends T> source1, @NonNull Publisher<@NonNull ? extends T> source2) { + public static <@NonNull T> Flowable merge(@NonNull Publisher source1, @NonNull Publisher source2) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); return fromArray(source1, source2).flatMap((Function)Functions.identity(), false, 2); @@ -3867,7 +3884,7 @@ public static Flowable merge(@NonNull Publisher<@NonNull ? extends T> sou @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable merge(@NonNull Publisher<@NonNull ? extends T> source1, @NonNull Publisher<@NonNull ? extends T> source2, @NonNull Publisher<@NonNull ? extends T> source3) { + public static <@NonNull T> Flowable merge(@NonNull Publisher source1, @NonNull Publisher source2, @NonNull Publisher source3) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); Objects.requireNonNull(source3, "source3 is null"); @@ -3921,9 +3938,9 @@ public static Flowable merge(@NonNull Publisher<@NonNull ? extends T> sou @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable merge( - @NonNull Publisher<@NonNull ? extends T> source1, @NonNull Publisher<@NonNull ? extends T> source2, - @NonNull Publisher<@NonNull ? extends T> source3, @NonNull Publisher<@NonNull ? extends T> source4) { + public static <@NonNull T> Flowable merge( + @NonNull Publisher source1, @NonNull Publisher source2, + @NonNull Publisher source3, @NonNull Publisher source4) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); Objects.requireNonNull(source3, "source3 is null"); @@ -3964,7 +3981,7 @@ public static Flowable merge( @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable mergeDelayError(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources) { + public static <@NonNull T> Flowable mergeDelayError(@NonNull Iterable<@NonNull ? extends Publisher> sources) { return fromIterable(sources).flatMap((Function)Functions.identity(), true); } @@ -4006,7 +4023,7 @@ public static Flowable mergeDelayError(@NonNull Iterable<@NonNull ? exten @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable mergeDelayError(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources, int maxConcurrency, int bufferSize) { + public static <@NonNull T> Flowable mergeDelayError(@NonNull Iterable<@NonNull ? extends Publisher> sources, int maxConcurrency, int bufferSize) { return fromIterable(sources).flatMap((Function)Functions.identity(), true, maxConcurrency, bufferSize); } @@ -4049,7 +4066,7 @@ public static Flowable mergeDelayError(@NonNull Iterable<@NonNull ? exten @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs @NonNull - public static Flowable mergeArrayDelayError(int maxConcurrency, int bufferSize, @NonNull Publisher<@NonNull ? extends T>... sources) { + public static <@NonNull T> Flowable mergeArrayDelayError(int maxConcurrency, int bufferSize, @NonNull Publisher... sources) { return fromArray(sources).flatMap((Function)Functions.identity(), true, maxConcurrency, bufferSize); } @@ -4089,7 +4106,7 @@ public static Flowable mergeArrayDelayError(int maxConcurrency, int buffe @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable mergeDelayError(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources, int maxConcurrency) { + public static <@NonNull T> Flowable mergeDelayError(@NonNull Iterable<@NonNull ? extends Publisher> sources, int maxConcurrency) { return fromIterable(sources).flatMap((Function)Functions.identity(), true, maxConcurrency); } @@ -4126,7 +4143,7 @@ public static Flowable mergeDelayError(@NonNull Iterable<@NonNull ? exten @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable mergeDelayError(@NonNull Publisher<@NonNull ? extends Publisher<@NonNull ? extends T>> sources) { + public static <@NonNull T> Flowable mergeDelayError(@NonNull Publisher<@NonNull ? extends Publisher> sources) { return mergeDelayError(sources, bufferSize()); } @@ -4168,7 +4185,7 @@ public static Flowable mergeDelayError(@NonNull Publisher<@NonNull ? exte @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable mergeDelayError(@NonNull Publisher<@NonNull ? extends Publisher<@NonNull ? extends T>> sources, int maxConcurrency) { + public static <@NonNull T> Flowable mergeDelayError(@NonNull Publisher<@NonNull ? extends Publisher> sources, int maxConcurrency) { return fromPublisher(sources).flatMap((Function)Functions.identity(), true, maxConcurrency); } @@ -4206,7 +4223,7 @@ public static Flowable mergeDelayError(@NonNull Publisher<@NonNull ? exte @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs @NonNull - public static Flowable mergeArrayDelayError(@NonNull Publisher<@NonNull ? extends T>... sources) { + public static <@NonNull T> Flowable mergeArrayDelayError(@NonNull Publisher... sources) { return fromArray(sources).flatMap((Function)Functions.identity(), true, sources.length); } @@ -4245,7 +4262,7 @@ public static Flowable mergeArrayDelayError(@NonNull Publisher<@NonNull ? @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable mergeDelayError(@NonNull Publisher<@NonNull ? extends T> source1, @NonNull Publisher<@NonNull ? extends T> source2) { + public static <@NonNull T> Flowable mergeDelayError(@NonNull Publisher source1, @NonNull Publisher source2) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); return fromArray(source1, source2).flatMap((Function)Functions.identity(), true, 2); @@ -4289,7 +4306,7 @@ public static Flowable mergeDelayError(@NonNull Publisher<@NonNull ? exte @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable mergeDelayError(@NonNull Publisher<@NonNull ? extends T> source1, @NonNull Publisher<@NonNull ? extends T> source2, @NonNull Publisher<@NonNull ? extends T> source3) { + public static <@NonNull T> Flowable mergeDelayError(@NonNull Publisher source1, @NonNull Publisher source2, @NonNull Publisher source3) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); Objects.requireNonNull(source3, "source3 is null"); @@ -4336,9 +4353,9 @@ public static Flowable mergeDelayError(@NonNull Publisher<@NonNull ? exte @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable mergeDelayError( - @NonNull Publisher<@NonNull ? extends T> source1, @NonNull Publisher<@NonNull ? extends T> source2, - @NonNull Publisher<@NonNull ? extends T> source3, @NonNull Publisher<@NonNull ? extends T> source4) { + public static <@NonNull T> Flowable mergeDelayError( + @NonNull Publisher source1, @NonNull Publisher source2, + @NonNull Publisher source3, @NonNull Publisher source4) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); Objects.requireNonNull(source3, "source3 is null"); @@ -4369,7 +4386,7 @@ public static Flowable mergeDelayError( @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings("unchecked") @NonNull - public static Flowable never() { + public static <@NonNull T> Flowable never() { return RxJavaPlugins.onAssembly((Flowable) FlowableNever.INSTANCE); } @@ -4489,7 +4506,7 @@ public static Flowable rangeLong(long start, long count) { @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Single sequenceEqual(@NonNull Publisher<@NonNull ? extends T> source1, @NonNull Publisher<@NonNull ? extends T> source2) { + public static <@NonNull T> Single sequenceEqual(@NonNull Publisher source1, @NonNull Publisher source2) { return sequenceEqual(source1, source2, ObjectHelper.equalsPredicate(), bufferSize()); } @@ -4523,7 +4540,7 @@ public static Single sequenceEqual(@NonNull Publisher<@NonNull ? ex @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Single sequenceEqual(@NonNull Publisher<@NonNull ? extends T> source1, @NonNull Publisher<@NonNull ? extends T> source2, + public static <@NonNull T> Single sequenceEqual(@NonNull Publisher source1, @NonNull Publisher source2, @NonNull BiPredicate isEqual) { return sequenceEqual(source1, source2, isEqual, bufferSize()); } @@ -4561,7 +4578,7 @@ public static Single sequenceEqual(@NonNull Publisher<@NonNull ? ex @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Single sequenceEqual(@NonNull Publisher<@NonNull ? extends T> source1, @NonNull Publisher<@NonNull ? extends T> source2, + public static <@NonNull T> Single sequenceEqual(@NonNull Publisher source1, @NonNull Publisher source2, @NonNull BiPredicate isEqual, int bufferSize) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -4600,7 +4617,7 @@ public static Single sequenceEqual(@NonNull Publisher<@NonNull ? ex @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Single sequenceEqual(@NonNull Publisher<@NonNull ? extends T> source1, @NonNull Publisher<@NonNull ? extends T> source2, int bufferSize) { + public static <@NonNull T> Single sequenceEqual(@NonNull Publisher source1, @NonNull Publisher source2, int bufferSize) { return sequenceEqual(source1, source2, ObjectHelper.equalsPredicate(), bufferSize); } @@ -4642,7 +4659,7 @@ public static Single sequenceEqual(@NonNull Publisher<@NonNull ? ex @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable switchOnNext(@NonNull Publisher<@NonNull ? extends Publisher<@NonNull ? extends T>> sources, int bufferSize) { + public static <@NonNull T> Flowable switchOnNext(@NonNull Publisher> sources, int bufferSize) { return fromPublisher(sources).switchMap((Function)Functions.identity(), bufferSize); } @@ -4681,7 +4698,7 @@ public static Flowable switchOnNext(@NonNull Publisher<@NonNull ? extends @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable switchOnNext(@NonNull Publisher<@NonNull ? extends Publisher<@NonNull ? extends T>> sources) { + public static <@NonNull T> Flowable switchOnNext(@NonNull Publisher<@NonNull ? extends Publisher> sources) { return fromPublisher(sources).switchMap((Function)Functions.identity()); } @@ -4721,7 +4738,7 @@ public static Flowable switchOnNext(@NonNull Publisher<@NonNull ? extends @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable switchOnNextDelayError(@NonNull Publisher<@NonNull ? extends Publisher<@NonNull ? extends T>> sources) { + public static <@NonNull T> Flowable switchOnNextDelayError(@NonNull Publisher<@NonNull ? extends Publisher> sources) { return switchOnNextDelayError(sources, bufferSize()); } @@ -4764,8 +4781,8 @@ public static Flowable switchOnNextDelayError(@NonNull Publisher<@NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable switchOnNextDelayError(@NonNull Publisher<@NonNull ? extends Publisher<@NonNull ? extends T>> sources, int prefetch) { - return fromPublisher(sources).switchMapDelayError(Functions.>identity(), prefetch); + public static <@NonNull T> Flowable switchOnNextDelayError(@NonNull Publisher<@NonNull ? extends Publisher> sources, int prefetch) { + return fromPublisher(sources).switchMapDelayError(Functions.>identity(), prefetch); } /** @@ -4853,7 +4870,7 @@ public static Flowable timer(long delay, @NonNull TimeUnit unit, @NonNull @NonNull @BackpressureSupport(BackpressureKind.NONE) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable unsafeCreate(@NonNull Publisher onSubscribe) { + public static <@NonNull T> Flowable unsafeCreate(@NonNull Publisher onSubscribe) { Objects.requireNonNull(onSubscribe, "onSubscribe is null"); if (onSubscribe instanceof Flowable) { throw new IllegalArgumentException("unsafeCreate(Flowable) should be upgraded"); @@ -4891,9 +4908,9 @@ public static Flowable unsafeCreate(@NonNull Publisher onSubscribe) { @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable using( + public static <@NonNull T, @NonNull D> Flowable using( @NonNull Supplier resourceSupplier, - @NonNull Function> sourceSupplier, + @NonNull Function> sourceSupplier, @NonNull Consumer resourceCleanup) { return using(resourceSupplier, sourceSupplier, resourceCleanup, true); } @@ -4934,9 +4951,9 @@ public static Flowable using( @NonNull @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable using( + public static <@NonNull T, @NonNull D> Flowable using( @NonNull Supplier resourceSupplier, - @NonNull Function> sourceSupplier, + @NonNull Function> sourceSupplier, @NonNull Consumer resourceCleanup, boolean eager) { Objects.requireNonNull(resourceSupplier, "resourceSupplier is null"); @@ -4994,7 +5011,7 @@ public static Flowable using( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable zip(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources, @NonNull Function zipper) { + public static <@NonNull T, @NonNull R> Flowable zip(@NonNull Iterable<@NonNull ? extends Publisher> sources, @NonNull Function zipper) { Objects.requireNonNull(zipper, "zipper is null"); Objects.requireNonNull(sources, "sources is null"); return RxJavaPlugins.onAssembly(new FlowableZip<>(null, sources, zipper, bufferSize(), false)); @@ -5055,7 +5072,7 @@ public static Flowable zip(@NonNull Iterable<@NonNull ? extends Publis @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable zip(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources, + public static <@NonNull T, @NonNull R> Flowable zip(@NonNull Iterable<@NonNull ? extends Publisher> sources, @NonNull Function zipper, boolean delayError, int bufferSize) { Objects.requireNonNull(zipper, "zipper is null"); @@ -5117,8 +5134,8 @@ public static Flowable zip(@NonNull Iterable<@NonNull ? extends Publis @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable zip( - @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2, + public static <@NonNull T1, @NonNull T2, @NonNull R> Flowable zip( + @NonNull Publisher source1, @NonNull Publisher source2, @NonNull BiFunction zipper) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -5180,8 +5197,8 @@ public static Flowable zip( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable zip( - @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2, + public static <@NonNull T1, @NonNull T2, @NonNull R> Flowable zip( + @NonNull Publisher source1, @NonNull Publisher source2, @NonNull BiFunction zipper, boolean delayError) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -5245,8 +5262,8 @@ public static Flowable zip( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable zip( - @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2, + public static <@NonNull T1, @NonNull T2, @NonNull R> Flowable zip( + @NonNull Publisher source1, @NonNull Publisher source2, @NonNull BiFunction zipper, boolean delayError, int bufferSize) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -5311,8 +5328,8 @@ public static Flowable zip( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable zip( - @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2, @NonNull Publisher<@NonNull ? extends T3> source3, + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull R> Flowable zip( + @NonNull Publisher source1, @NonNull Publisher source2, @NonNull Publisher source3, @NonNull Function3 zipper) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -5382,9 +5399,9 @@ public static Flowable zip( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable zip( - @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2, @NonNull Publisher<@NonNull ? extends T3> source3, - @NonNull Publisher<@NonNull ? extends T4> source4, + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull R> Flowable zip( + @NonNull Publisher source1, @NonNull Publisher source2, @NonNull Publisher source3, + @NonNull Publisher source4, @NonNull Function4 zipper) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -5458,9 +5475,9 @@ public static Flowable zip( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable zip( - @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2, @NonNull Publisher<@NonNull ? extends T3> source3, - @NonNull Publisher<@NonNull ? extends T4> source4, @NonNull Publisher<@NonNull ? extends T5> source5, + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull R> Flowable zip( + @NonNull Publisher source1, @NonNull Publisher source2, @NonNull Publisher source3, + @NonNull Publisher source4, @NonNull Publisher source5, @NonNull Function5 zipper) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -5538,9 +5555,9 @@ public static Flowable zip( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable zip( - @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2, @NonNull Publisher<@NonNull ? extends T3> source3, - @NonNull Publisher<@NonNull ? extends T4> source4, @NonNull Publisher<@NonNull ? extends T5> source5, @NonNull Publisher<@NonNull ? extends T6> source6, + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull R> Flowable zip( + @NonNull Publisher source1, @NonNull Publisher source2, @NonNull Publisher source3, + @NonNull Publisher source4, @NonNull Publisher source5, @NonNull Publisher source6, @NonNull Function6 zipper) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -5622,10 +5639,10 @@ public static Flowable zip( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable zip( - @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2, @NonNull Publisher<@NonNull ? extends T3> source3, - @NonNull Publisher<@NonNull ? extends T4> source4, @NonNull Publisher<@NonNull ? extends T5> source5, @NonNull Publisher<@NonNull ? extends T6> source6, - @NonNull Publisher<@NonNull ? extends T7> source7, + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull R> Flowable zip( + @NonNull Publisher source1, @NonNull Publisher source2, @NonNull Publisher source3, + @NonNull Publisher source4, @NonNull Publisher source5, @NonNull Publisher source6, + @NonNull Publisher source7, @NonNull Function7 zipper) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -5711,10 +5728,10 @@ public static Flowable zip( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable zip( - @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2, @NonNull Publisher<@NonNull ? extends T3> source3, - @NonNull Publisher<@NonNull ? extends T4> source4, @NonNull Publisher<@NonNull ? extends T5> source5, @NonNull Publisher<@NonNull ? extends T6> source6, - @NonNull Publisher<@NonNull ? extends T7> source7, @NonNull Publisher<@NonNull ? extends T8> source8, + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull T8, @NonNull R> Flowable zip( + @NonNull Publisher source1, @NonNull Publisher source2, @NonNull Publisher source3, + @NonNull Publisher source4, @NonNull Publisher source5, @NonNull Publisher source6, + @NonNull Publisher source7, @NonNull Publisher source8, @NonNull Function8 zipper) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -5805,10 +5822,10 @@ public static Flowable zip( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable zip( - @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2, @NonNull Publisher<@NonNull ? extends T3> source3, - @NonNull Publisher<@NonNull ? extends T4> source4, @NonNull Publisher<@NonNull ? extends T5> source5, @NonNull Publisher<@NonNull ? extends T6> source6, - @NonNull Publisher<@NonNull ? extends T7> source7, @NonNull Publisher<@NonNull ? extends T8> source8, @NonNull Publisher<@NonNull ? extends T9> source9, + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull T8, @NonNull T9, @NonNull R> Flowable zip( + @NonNull Publisher source1, @NonNull Publisher source2, @NonNull Publisher source3, + @NonNull Publisher source4, @NonNull Publisher source5, @NonNull Publisher source6, + @NonNull Publisher source7, @NonNull Publisher source8, @NonNull Publisher source9, @NonNull Function9 zipper) { Objects.requireNonNull(source1, "source1 is null"); @@ -5880,8 +5897,8 @@ public static Flowable zip( @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs - public static Flowable zipArray(@NonNull Function zipper, - boolean delayError, int bufferSize, @NonNull Publisher<@NonNull ? extends T>... sources) { + public static <@NonNull T, @NonNull R> Flowable zipArray(@NonNull Function zipper, + boolean delayError, int bufferSize, @NonNull Publisher... sources) { Objects.requireNonNull(sources, "sources is null"); if (sources.length == 0) { return empty(); @@ -5927,13 +5944,22 @@ public final Single all(@NonNull Predicate predicate) { * Mirrors the {@link Publisher} (current or provided) that first either emits an item or sends a termination * notification. *

- * + * + *

+ * When the current {@code Flowable} signals an item or terminates first, the subscription to the other + * {@code Publisher} is canceled. If the other {@code Publisher} signals an item or terminates first, + * the subscription to the current {@code Flowable} is canceled. *

*
Backpressure:
*
The operator itself doesn't interfere with backpressure which is determined by the winning * {@code Publisher}'s backpressure behavior.
*
Scheduler:
*
{@code ambWith} does not operate by default on a particular {@link Scheduler}.
+ *
Error handling:
+ *
+ * If the losing {@code Publisher} signals an error, the error is routed to the global + * error handler via {@link RxJavaPlugins#onError(Throwable)}. + *
*
* * @param other @@ -5947,7 +5973,7 @@ public final Single all(@NonNull Predicate predicate) { @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable ambWith(@NonNull Publisher<@NonNull ? extends T> other) { + public final Flowable ambWith(@NonNull Publisher other) { Objects.requireNonNull(other, "other is null"); return ambArray(this, other); } @@ -6655,7 +6681,7 @@ public final void blockingSubscribe(@NonNull Consumer onNext, @NonNul */ @BackpressureSupport(BackpressureKind.SPECIAL) @SchedulerSupport(SchedulerSupport.NONE) - public final void blockingSubscribe(@NonNull Subscriber<@NonNull ? super T> subscriber) { + public final void blockingSubscribe(@NonNull Subscriber subscriber) { Objects.requireNonNull(subscriber, "subscriber is null"); FlowableBlockingSubscribe.subscribe(this, subscriber); } @@ -6762,7 +6788,7 @@ public final Flowable> buffer(int count, int skip) { @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final > Flowable buffer(int count, int skip, @NonNull Supplier bufferSupplier) { + public final <@NonNull U extends Collection> Flowable buffer(int count, int skip, @NonNull Supplier bufferSupplier) { ObjectHelper.verifyPositive(count, "count"); ObjectHelper.verifyPositive(skip, "skip"); Objects.requireNonNull(bufferSupplier, "bufferSupplier is null"); @@ -6801,7 +6827,7 @@ public final > Flowable buffer(int count, int @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final > Flowable buffer(int count, @NonNull Supplier bufferSupplier) { + public final <@NonNull U extends Collection> Flowable buffer(int count, @NonNull Supplier bufferSupplier) { return buffer(count, count, bufferSupplier); } @@ -6916,7 +6942,7 @@ public final Flowable> buffer(long timespan, long timeskip, @NonNull Tim @NonNull @BackpressureSupport(BackpressureKind.ERROR) @SchedulerSupport(SchedulerSupport.CUSTOM) - public final > Flowable buffer(long timespan, long timeskip, @NonNull TimeUnit unit, + public final <@NonNull U extends Collection> Flowable buffer(long timespan, long timeskip, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull Supplier bufferSupplier) { Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); @@ -7077,7 +7103,7 @@ public final Flowable> buffer(long timespan, @NonNull TimeUnit unit, @No @BackpressureSupport(BackpressureKind.ERROR) @SchedulerSupport(SchedulerSupport.CUSTOM) @NonNull - public final > Flowable buffer( + public final <@NonNull U extends Collection> Flowable buffer( long timespan, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, int count, @NonNull Supplier bufferSupplier, @@ -7156,9 +7182,9 @@ public final Flowable> buffer(long timespan, @NonNull TimeUnit unit, @No @BackpressureSupport(BackpressureKind.ERROR) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable> buffer( - @NonNull Publisher<@NonNull ? extends TOpening> openingIndicator, - @NonNull Function> closingIndicator) { + public final <@NonNull TOpening, @NonNull TClosing> Flowable> buffer( + @NonNull Publisher openingIndicator, + @NonNull Function> closingIndicator) { return buffer(openingIndicator, closingIndicator, ArrayListSupplier.asSupplier()); } @@ -7197,9 +7223,9 @@ public final Flowable> buffer( @BackpressureSupport(BackpressureKind.ERROR) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final > Flowable buffer( - @NonNull Publisher<@NonNull ? extends TOpening> openingIndicator, - @NonNull Function> closingIndicator, + public final <@NonNull TOpening, @NonNull TClosing, @NonNull U extends Collection> Flowable buffer( + @NonNull Publisher openingIndicator, + @NonNull Function> closingIndicator, @NonNull Supplier bufferSupplier) { Objects.requireNonNull(openingIndicator, "openingIndicator is null"); Objects.requireNonNull(closingIndicator, "closingIndicator is null"); @@ -7238,7 +7264,7 @@ public final > Flowable b @BackpressureSupport(BackpressureKind.ERROR) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable> buffer(@NonNull Publisher boundaryIndicator) { + public final <@NonNull B> Flowable> buffer(@NonNull Publisher boundaryIndicator) { return buffer(boundaryIndicator, ArrayListSupplier.asSupplier()); } @@ -7276,7 +7302,7 @@ public final Flowable> buffer(@NonNull Publisher boundaryIndicato @BackpressureSupport(BackpressureKind.ERROR) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable> buffer(@NonNull Publisher boundaryIndicator, int initialCapacity) { + public final <@NonNull B> Flowable> buffer(@NonNull Publisher boundaryIndicator, int initialCapacity) { ObjectHelper.verifyPositive(initialCapacity, "initialCapacity"); return buffer(boundaryIndicator, Functions.createArrayList(initialCapacity)); } @@ -7316,7 +7342,7 @@ public final Flowable> buffer(@NonNull Publisher boundaryIndicato @BackpressureSupport(BackpressureKind.ERROR) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final > Flowable buffer(@NonNull Publisher boundaryIndicator, @NonNull Supplier bufferSupplier) { + public final <@NonNull B, @NonNull U extends Collection> Flowable buffer(@NonNull Publisher boundaryIndicator, @NonNull Supplier bufferSupplier) { Objects.requireNonNull(boundaryIndicator, "boundaryIndicator is null"); Objects.requireNonNull(bufferSupplier, "bufferSupplier is null"); return RxJavaPlugins.onAssembly(new FlowableBufferExactBoundary<>(this, boundaryIndicator, bufferSupplier)); @@ -7449,8 +7475,10 @@ public final Flowable cacheWithInitialCapacity(int initialCapacity) { } /** - * Returns a {@code Flowable} that emits the items emitted by the current {@code Flowable}, converted to the specified - * type. + * Returns a {@code Flowable} that emits the upstream items while + * they can be cast via {@link Class#cast(Object)} until the upstream terminates, + * or until the upstream signals an item which can't be cast, + * resulting in a {@link ClassCastException} to be signaled to the downstream. *

* *

@@ -7463,8 +7491,7 @@ public final Flowable cacheWithInitialCapacity(int initialCapacity) { * * @param the output value type cast to * @param clazz - * the target class type that {@code cast} will cast the items emitted by the current {@code Flowable} - * into before emitting them from the resulting {@code Flowable} + * the target class to use to try and cast the upstream items into * @return the new {@code Flowable} instance * @throws NullPointerException if {@code clazz} is {@code null} * @see ReactiveX operators documentation: Map @@ -7473,7 +7500,7 @@ public final Flowable cacheWithInitialCapacity(int initialCapacity) { @NonNull @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable cast(@NonNull Class clazz) { + public final <@NonNull U> Flowable cast(@NonNull Class clazz) { Objects.requireNonNull(clazz, "clazz is null"); return map(Functions.castFunction(clazz)); } @@ -7512,7 +7539,7 @@ public final Flowable cast(@NonNull Class clazz) { @NonNull @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) @SchedulerSupport(SchedulerSupport.NONE) - public final Single collect(@NonNull Supplier initialItemSupplier, @NonNull BiConsumer collector) { + public final <@NonNull U> Single collect(@NonNull Supplier initialItemSupplier, @NonNull BiConsumer collector) { Objects.requireNonNull(initialItemSupplier, "initialItemSupplier is null"); Objects.requireNonNull(collector, "collector is null"); return RxJavaPlugins.onAssembly(new FlowableCollectSingle<>(this, initialItemSupplier, collector)); @@ -7584,7 +7611,7 @@ public final Single collect(@NonNull Supplier initialItemSup @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable compose(@NonNull FlowableTransformer composer) { + public final <@NonNull R> Flowable compose(@NonNull FlowableTransformer composer) { return fromPublisher(((FlowableTransformer) Objects.requireNonNull(composer, "composer is null")).apply(this)); } @@ -7621,7 +7648,7 @@ public final Flowable compose(@NonNull FlowableTransformer Flowable concatMap(@NonNull Function> mapper) { + public final <@NonNull R> Flowable concatMap(@NonNull Function> mapper) { return concatMap(mapper, 2); } @@ -7662,7 +7689,7 @@ public final Flowable concatMap(@NonNull Function Flowable concatMap(@NonNull Function> mapper, int prefetch) { + public final <@NonNull R> Flowable concatMap(@NonNull Function> mapper, int prefetch) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); if (this instanceof ScalarSupplier) { @@ -7716,7 +7743,7 @@ public final Flowable concatMap(@NonNull Function Flowable concatMap(@NonNull Function> mapper, int prefetch, @NonNull Scheduler scheduler) { + public final <@NonNull R> Flowable concatMap(@NonNull Function> mapper, int prefetch, @NonNull Scheduler scheduler) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); Objects.requireNonNull(scheduler, "scheduler is null"); @@ -7927,7 +7954,7 @@ public final Completable concatMapCompletableDelayError(@NonNull Function Flowable concatMapDelayError(@NonNull Function> mapper) { + public final <@NonNull R> Flowable concatMapDelayError(@NonNull Function> mapper) { return concatMapDelayError(mapper, true, 2); } @@ -7968,7 +7995,7 @@ public final Flowable concatMapDelayError(@NonNull Function Flowable concatMapDelayError(@NonNull Function> mapper, + public final <@NonNull R> Flowable concatMapDelayError(@NonNull Function> mapper, boolean tillTheEnd, int prefetch) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); @@ -8022,7 +8049,7 @@ public final Flowable concatMapDelayError(@NonNull Function Flowable concatMapDelayError(@NonNull Function> mapper, + public final <@NonNull R> Flowable concatMapDelayError(@NonNull Function> mapper, boolean tillTheEnd, int prefetch, @NonNull Scheduler scheduler) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); @@ -8055,7 +8082,7 @@ public final Flowable concatMapDelayError(@NonNull Function Flowable concatMapEager(@NonNull Function> mapper) { + public final <@NonNull R> Flowable concatMapEager(@NonNull Function> mapper) { return concatMapEager(mapper, bufferSize(), bufferSize()); } @@ -8087,7 +8114,7 @@ public final Flowable concatMapEager(@NonNull Function Flowable concatMapEager(@NonNull Function> mapper, + public final <@NonNull R> Flowable concatMapEager(@NonNull Function> mapper, int maxConcurrency, int prefetch) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); @@ -8123,7 +8150,7 @@ public final Flowable concatMapEager(@NonNull Function Flowable concatMapEagerDelayError(@NonNull Function> mapper, + public final <@NonNull R> Flowable concatMapEagerDelayError(@NonNull Function> mapper, boolean tillTheEnd) { return concatMapEagerDelayError(mapper, tillTheEnd, bufferSize(), bufferSize()); } @@ -8161,7 +8188,7 @@ public final Flowable concatMapEagerDelayError(@NonNull Function Flowable concatMapEagerDelayError(@NonNull Function> mapper, + public final <@NonNull R> Flowable concatMapEagerDelayError(@NonNull Function> mapper, boolean tillTheEnd, int maxConcurrency, int prefetch) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); @@ -8195,7 +8222,7 @@ public final Flowable concatMapEagerDelayError(@NonNull Function Flowable concatMapIterable(@NonNull Function> mapper) { + public final <@NonNull U> Flowable concatMapIterable(@NonNull Function> mapper) { return concatMapIterable(mapper, 2); } @@ -8228,7 +8255,7 @@ public final Flowable concatMapIterable(@NonNull Function Flowable concatMapIterable(@NonNull Function> mapper, int prefetch) { + public final <@NonNull U> Flowable concatMapIterable(@NonNull Function> mapper, int prefetch) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); return RxJavaPlugins.onAssembly(new FlowableFlattenIterable<>(this, mapper, prefetch)); @@ -8239,7 +8266,7 @@ public final Flowable concatMapIterable(@NonNull Function - * + * *
*
Backpressure:
*
The operator expects the upstream to support backpressure and honors @@ -8263,7 +8290,7 @@ public final Flowable concatMapIterable(@NonNull Function Flowable concatMapMaybe(@NonNull Function> mapper) { + public final <@NonNull R> Flowable concatMapMaybe(@NonNull Function> mapper) { return concatMapMaybe(mapper, 2); } @@ -8272,7 +8299,7 @@ public final Flowable concatMapMaybe(@NonNull Function - * + * *
*
Backpressure:
*
The operator expects the upstream to support backpressure and honors @@ -8301,7 +8328,7 @@ public final Flowable concatMapMaybe(@NonNull Function Flowable concatMapMaybe(@NonNull Function> mapper, int prefetch) { + public final <@NonNull R> Flowable concatMapMaybe(@NonNull Function> mapper, int prefetch) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); return RxJavaPlugins.onAssembly(new FlowableConcatMapMaybe<>(this, mapper, ErrorMode.IMMEDIATE, prefetch)); @@ -8312,7 +8339,7 @@ public final Flowable concatMapMaybe(@NonNull Function - * + * *
*
Backpressure:
*
The operator expects the upstream to support backpressure and honors @@ -8336,7 +8363,7 @@ public final Flowable concatMapMaybe(@NonNull Function Flowable concatMapMaybeDelayError(@NonNull Function> mapper) { + public final <@NonNull R> Flowable concatMapMaybeDelayError(@NonNull Function> mapper) { return concatMapMaybeDelayError(mapper, true, 2); } @@ -8345,7 +8372,7 @@ public final Flowable concatMapMaybeDelayError(@NonNull Function - * + * *
*
Backpressure:
*
The operator expects the upstream to support backpressure and honors @@ -8375,7 +8402,7 @@ public final Flowable concatMapMaybeDelayError(@NonNull Function Flowable concatMapMaybeDelayError(@NonNull Function> mapper, boolean tillTheEnd) { + public final <@NonNull R> Flowable concatMapMaybeDelayError(@NonNull Function> mapper, boolean tillTheEnd) { return concatMapMaybeDelayError(mapper, tillTheEnd, 2); } @@ -8384,7 +8411,7 @@ public final Flowable concatMapMaybeDelayError(@NonNull Function - * + * *
*
Backpressure:
*
The operator expects the upstream to support backpressure and honors @@ -8418,7 +8445,7 @@ public final Flowable concatMapMaybeDelayError(@NonNull Function Flowable concatMapMaybeDelayError(@NonNull Function> mapper, boolean tillTheEnd, int prefetch) { + public final <@NonNull R> Flowable concatMapMaybeDelayError(@NonNull Function> mapper, boolean tillTheEnd, int prefetch) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); return RxJavaPlugins.onAssembly(new FlowableConcatMapMaybe<>(this, mapper, tillTheEnd ? ErrorMode.END : ErrorMode.BOUNDARY, prefetch)); @@ -8429,7 +8456,7 @@ public final Flowable concatMapMaybeDelayError(@NonNull Function - * + * *
*
Backpressure:
*
The operator expects the upstream to support backpressure and honors @@ -8453,7 +8480,7 @@ public final Flowable concatMapMaybeDelayError(@NonNull Function Flowable concatMapSingle(@NonNull Function> mapper) { + public final <@NonNull R> Flowable concatMapSingle(@NonNull Function> mapper) { return concatMapSingle(mapper, 2); } @@ -8462,7 +8489,7 @@ public final Flowable concatMapSingle(@NonNull Function - * + * *
*
Backpressure:
*
The operator expects the upstream to support backpressure and honors @@ -8491,7 +8518,7 @@ public final Flowable concatMapSingle(@NonNull Function Flowable concatMapSingle(@NonNull Function> mapper, int prefetch) { + public final <@NonNull R> Flowable concatMapSingle(@NonNull Function> mapper, int prefetch) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); return RxJavaPlugins.onAssembly(new FlowableConcatMapSingle<>(this, mapper, ErrorMode.IMMEDIATE, prefetch)); @@ -8502,7 +8529,7 @@ public final Flowable concatMapSingle(@NonNull Function - * + * *
*
Backpressure:
*
The operator expects the upstream to support backpressure and honors @@ -8526,7 +8553,7 @@ public final Flowable concatMapSingle(@NonNull Function Flowable concatMapSingleDelayError(@NonNull Function> mapper) { + public final <@NonNull R> Flowable concatMapSingleDelayError(@NonNull Function> mapper) { return concatMapSingleDelayError(mapper, true, 2); } @@ -8535,7 +8562,7 @@ public final Flowable concatMapSingleDelayError(@NonNull Function - * + * *
*
Backpressure:
*
The operator expects the upstream to support backpressure and honors @@ -8565,7 +8592,7 @@ public final Flowable concatMapSingleDelayError(@NonNull Function Flowable concatMapSingleDelayError(@NonNull Function> mapper, boolean tillTheEnd) { + public final <@NonNull R> Flowable concatMapSingleDelayError(@NonNull Function> mapper, boolean tillTheEnd) { return concatMapSingleDelayError(mapper, tillTheEnd, 2); } @@ -8574,7 +8601,7 @@ public final Flowable concatMapSingleDelayError(@NonNull Function - * + * *
*
Backpressure:
*
The operator expects the upstream to support backpressure and honors @@ -8608,7 +8635,7 @@ public final Flowable concatMapSingleDelayError(@NonNull Function Flowable concatMapSingleDelayError(@NonNull Function> mapper, boolean tillTheEnd, int prefetch) { + public final <@NonNull R> Flowable concatMapSingleDelayError(@NonNull Function> mapper, boolean tillTheEnd, int prefetch) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); return RxJavaPlugins.onAssembly(new FlowableConcatMapSingle<>(this, mapper, tillTheEnd ? ErrorMode.END : ErrorMode.BOUNDARY, prefetch)); @@ -8638,7 +8665,7 @@ public final Flowable concatMapSingleDelayError(@NonNull Function concatWith(@NonNull Publisher<@NonNull ? extends T> other) { + public final Flowable concatWith(@NonNull Publisher other) { Objects.requireNonNull(other, "other is null"); return concat(this, other); } @@ -8812,7 +8839,7 @@ public final Single count() { @NonNull @BackpressureSupport(BackpressureKind.ERROR) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable debounce(@NonNull Function> debounceIndicator) { + public final <@NonNull U> Flowable debounce(@NonNull Function> debounceIndicator) { Objects.requireNonNull(debounceIndicator, "debounceIndicator is null"); return RxJavaPlugins.onAssembly(new FlowableDebounce<>(this, debounceIndicator)); } @@ -8904,7 +8931,59 @@ public final Flowable debounce(long timeout, @NonNull TimeUnit unit) { public final Flowable debounce(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); - return RxJavaPlugins.onAssembly(new FlowableDebounceTimed<>(this, timeout, unit, scheduler)); + return RxJavaPlugins.onAssembly(new FlowableDebounceTimed<>(this, timeout, unit, scheduler, null)); + } + + /** + * Returns a {@code Flowable} that mirrors the current {@code Flowable}, except that it drops items emitted by the + * current {@code Flowable} that are followed by newer items before a timeout value expires on a specified + * {@link Scheduler}. The timer resets on each emission. + *

+ * Note: If items keep being emitted by the current {@code Flowable} faster than the timeout then no items + * will be emitted by the resulting {@code Flowable}. + *

+ * + *

+ * Delivery of the item after the grace period happens on the given {@code Scheduler}'s + * {@code Worker} which if takes too long, a newer item may arrive from the upstream, causing the + * {@code Worker}'s task to get disposed, which may also interrupt any downstream blocking operation + * (yielding an {@code InterruptedException}). It is recommended processing items + * that may take long time to be moved to another thread via {@link #observeOn} applied after + * {@code debounce} itself. + *

+ *
Backpressure:
+ *
This operator does not support backpressure as it uses time to control data flow.
+ *
Scheduler:
+ *
You specify which {@code Scheduler} this operator will use.
+ *
+ * + * @param timeout + * the time each item has to be "the most recent" of those emitted by the current {@code Flowable} to + * ensure that it's not dropped + * @param unit + * the unit of time for the specified {@code timeout} + * @param scheduler + * the {@code Scheduler} to use internally to manage the timers that handle the timeout for each + * item + * @param onDropped + * called with the current entry when it has been replaced by a new one + * @return the new {@code Flowable} instance + * @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null} or {@code onDropped} is {@code null} + * @see ReactiveX operators documentation: Debounce + * @see RxJava wiki: Backpressure + * @see #throttleWithTimeout(long, TimeUnit, Scheduler, Consumer) + * @since 3.1.6 - Experimental + */ + @CheckReturnValue + @NonNull + @BackpressureSupport(BackpressureKind.ERROR) + @SchedulerSupport(SchedulerSupport.CUSTOM) + @Experimental + public final Flowable debounce(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull Consumer onDropped) { + Objects.requireNonNull(unit, "unit is null"); + Objects.requireNonNull(scheduler, "scheduler is null"); + Objects.requireNonNull(onDropped, "onDropped is null"); + return RxJavaPlugins.onAssembly(new FlowableDebounceTimed<>(this, timeout, unit, scheduler, onDropped)); } /** @@ -8968,7 +9047,7 @@ public final Flowable defaultIfEmpty(@NonNull T defaultItem) { @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable delay(@NonNull Function> itemDelayIndicator) { + public final <@NonNull U> Flowable delay(@NonNull Function> itemDelayIndicator) { Objects.requireNonNull(itemDelayIndicator, "itemDelayIndicator is null"); return flatMap(FlowableInternalHelper.itemDelay(itemDelayIndicator)); } @@ -9134,8 +9213,8 @@ public final Flowable delay(long time, @NonNull TimeUnit unit, @NonNull Sched @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable delay(@NonNull Publisher subscriptionIndicator, - @NonNull Function> itemDelayIndicator) { + public final <@NonNull U, @NonNull V> Flowable delay(@NonNull Publisher subscriptionIndicator, + @NonNull Function> itemDelayIndicator) { return delaySubscription(subscriptionIndicator).delay(itemDelayIndicator); } @@ -9161,7 +9240,7 @@ public final Flowable delay(@NonNull Publisher subscriptionIndicato @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable delaySubscription(@NonNull Publisher subscriptionIndicator) { + public final <@NonNull U> Flowable delaySubscription(@NonNull Publisher subscriptionIndicator) { Objects.requireNonNull(subscriptionIndicator, "subscriptionIndicator is null"); return RxJavaPlugins.onAssembly(new FlowableDelaySubscriptionOther<>(this, subscriptionIndicator)); } @@ -9277,7 +9356,7 @@ public final Flowable delaySubscription(long time, @NonNull TimeUnit unit, @N @NonNull @SchedulerSupport(SchedulerSupport.NONE) @BackpressureSupport(BackpressureKind.PASS_THROUGH) - public final Flowable dematerialize(@NonNull Function<@NonNull ? super T, @NonNull Notification> selector) { + public final <@NonNull R> Flowable dematerialize(@NonNull Function<@NonNull ? super T, @NonNull Notification> selector) { Objects.requireNonNull(selector, "selector is null"); return RxJavaPlugins.onAssembly(new FlowableDematerialize<>(this, selector)); } @@ -9364,7 +9443,7 @@ public final Flowable distinct() { @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable distinct(@NonNull Function keySelector) { + public final <@NonNull K> Flowable distinct(@NonNull Function keySelector) { return distinct(keySelector, Functions.createHashSet()); } @@ -9400,7 +9479,7 @@ public final Flowable distinct(@NonNull Function keySelecto @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable distinct(@NonNull Function keySelector, + public final <@NonNull K> Flowable distinct(@NonNull Function keySelector, @NonNull Supplier> collectionSupplier) { Objects.requireNonNull(keySelector, "keySelector is null"); Objects.requireNonNull(collectionSupplier, "collectionSupplier is null"); @@ -9491,7 +9570,7 @@ public final Flowable distinctUntilChanged() { @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable distinctUntilChanged(@NonNull Function keySelector) { + public final <@NonNull K> Flowable distinctUntilChanged(@NonNull Function keySelector) { Objects.requireNonNull(keySelector, "keySelector is null"); return RxJavaPlugins.onAssembly(new FlowableDistinctUntilChanged<>(this, keySelector, ObjectHelper.equalsPredicate())); } @@ -9697,6 +9776,10 @@ public final Flowable doOnComplete(@NonNull Action onComplete) { *
{@code doOnEach} does not operate by default on a particular {@link Scheduler}.
*
* + * @param onNext the {@link Consumer} to invoke when the current {@code Flowable} calls {@code onNext} + * @param onError the {@code Consumer} to invoke when the current {@code Flowable} calls {@code onError} + * @param onComplete the {@link Action} to invoke when the current {@code Flowable} calls {@code onComplete} + * @param onAfterTerminate the {@code Action} to invoke when the current {@code Flowable} calls {@code onAfterTerminate} * @return the new {@code Flowable} instance * @throws NullPointerException if {@code onNext}, {@code onError}, {@code onComplete} or {@code onAfterTerminate} is {@code null} * @see ReactiveX operators documentation: Do @@ -9776,7 +9859,7 @@ public final Flowable doOnEach(@NonNull Consumer<@NonNull ? super Notificatio @NonNull @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable doOnEach(@NonNull Subscriber<@NonNull ? super T> subscriber) { + public final Flowable doOnEach(@NonNull Subscriber subscriber) { Objects.requireNonNull(subscriber, "subscriber is null"); return doOnEach( FlowableInternalHelper.subscriberOnNext(subscriber), @@ -10118,7 +10201,7 @@ public final Maybe firstElement() { * Returns a {@link Single} that emits only the very first item emitted by this {@code Flowable}, or a default * item if this {@code Flowable} completes without emitting anything. *

- * + * *

*
Backpressure:
*
The operator honors backpressure from downstream and consumes the current {@code Flowable} in a bounded manner.
@@ -10191,7 +10274,7 @@ public final Single firstOrError() { @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable flatMap(@NonNull Function> mapper) { + public final <@NonNull R> Flowable flatMap(@NonNull Function> mapper) { return flatMap(mapper, false, bufferSize(), bufferSize()); } @@ -10226,7 +10309,7 @@ public final Flowable flatMap(@NonNull Function Flowable flatMap(@NonNull Function> mapper, boolean delayErrors) { + public final <@NonNull R> Flowable flatMap(@NonNull Function> mapper, boolean delayErrors) { return flatMap(mapper, delayErrors, bufferSize(), bufferSize()); } @@ -10263,7 +10346,7 @@ public final Flowable flatMap(@NonNull Function Flowable flatMap(@NonNull Function> mapper, int maxConcurrency) { + public final <@NonNull R> Flowable flatMap(@NonNull Function> mapper, int maxConcurrency) { return flatMap(mapper, false, maxConcurrency, bufferSize()); } @@ -10303,7 +10386,7 @@ public final Flowable flatMap(@NonNull Function Flowable flatMap(@NonNull Function> mapper, boolean delayErrors, int maxConcurrency) { + public final <@NonNull R> Flowable flatMap(@NonNull Function> mapper, boolean delayErrors, int maxConcurrency) { return flatMap(mapper, delayErrors, maxConcurrency, bufferSize()); } @@ -10345,7 +10428,7 @@ public final Flowable flatMap(@NonNull Function Flowable flatMap(@NonNull Function> mapper, + public final <@NonNull R> Flowable flatMap(@NonNull Function> mapper, boolean delayErrors, int maxConcurrency, int bufferSize) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); @@ -10394,10 +10477,10 @@ public final Flowable flatMap(@NonNull Function Flowable flatMap( - @NonNull Function> onNextMapper, - @NonNull Function> onErrorMapper, - @NonNull Supplier> onCompleteSupplier) { + public final <@NonNull R> Flowable flatMap( + @NonNull Function> onNextMapper, + @NonNull Function> onErrorMapper, + @NonNull Supplier> onCompleteSupplier) { Objects.requireNonNull(onNextMapper, "onNextMapper is null"); Objects.requireNonNull(onErrorMapper, "onErrorMapper is null"); Objects.requireNonNull(onCompleteSupplier, "onCompleteSupplier is null"); @@ -10442,10 +10525,10 @@ public final Flowable flatMap( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable flatMap( - @NonNull Function> onNextMapper, - @NonNull Function> onErrorMapper, - @NonNull Supplier> onCompleteSupplier, + public final <@NonNull R> Flowable flatMap( + @NonNull Function> onNextMapper, + @NonNull Function> onErrorMapper, + @NonNull Supplier> onCompleteSupplier, int maxConcurrency) { Objects.requireNonNull(onNextMapper, "onNextMapper is null"); Objects.requireNonNull(onErrorMapper, "onErrorMapper is null"); @@ -10486,7 +10569,7 @@ public final Flowable flatMap( @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable flatMap(@NonNull Function> mapper, + public final <@NonNull U, @NonNull R> Flowable flatMap(@NonNull Function> mapper, @NonNull BiFunction combiner) { return flatMap(mapper, combiner, false, bufferSize(), bufferSize()); } @@ -10526,7 +10609,7 @@ public final Flowable flatMap(@NonNull Function Flowable flatMap(@NonNull Function> mapper, + public final <@NonNull U, @NonNull R> Flowable flatMap(@NonNull Function> mapper, @NonNull BiFunction combiner, boolean delayErrors) { return flatMap(mapper, combiner, delayErrors, bufferSize(), bufferSize()); } @@ -10571,7 +10654,7 @@ public final Flowable flatMap(@NonNull Function Flowable flatMap(@NonNull Function> mapper, + public final <@NonNull U, @NonNull R> Flowable flatMap(@NonNull Function> mapper, @NonNull BiFunction combiner, boolean delayErrors, int maxConcurrency) { return flatMap(mapper, combiner, delayErrors, maxConcurrency, bufferSize()); } @@ -10618,7 +10701,7 @@ public final Flowable flatMap(@NonNull Function Flowable flatMap(@NonNull Function> mapper, + public final <@NonNull U, @NonNull R> Flowable flatMap(@NonNull Function> mapper, @NonNull BiFunction combiner, boolean delayErrors, int maxConcurrency, int bufferSize) { Objects.requireNonNull(mapper, "mapper is null"); Objects.requireNonNull(combiner, "combiner is null"); @@ -10664,7 +10747,7 @@ public final Flowable flatMap(@NonNull Function Flowable flatMap(@NonNull Function> mapper, + public final <@NonNull U, @NonNull R> Flowable flatMap(@NonNull Function> mapper, @NonNull BiFunction combiner, int maxConcurrency) { return flatMap(mapper, combiner, false, maxConcurrency, bufferSize()); } @@ -10746,7 +10829,7 @@ public final Completable flatMapCompletable(@NonNull Function Flowable flatMapIterable(@NonNull Function> mapper) { + public final <@NonNull U> Flowable flatMapIterable(@NonNull Function> mapper) { return flatMapIterable(mapper, bufferSize()); } @@ -10780,7 +10863,7 @@ public final Flowable flatMapIterable(@NonNull Function Flowable flatMapIterable(@NonNull Function> mapper, int bufferSize) { + public final <@NonNull U> Flowable flatMapIterable(@NonNull Function> mapper, int bufferSize) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); return RxJavaPlugins.onAssembly(new FlowableFlattenIterable<>(this, mapper, bufferSize)); @@ -10819,7 +10902,7 @@ public final Flowable flatMapIterable(@NonNull Function Flowable flatMapIterable(@NonNull Function> mapper, + public final <@NonNull U, @NonNull V> Flowable flatMapIterable(@NonNull Function> mapper, @NonNull BiFunction combiner) { Objects.requireNonNull(mapper, "mapper is null"); Objects.requireNonNull(combiner, "combiner is null"); @@ -10864,7 +10947,7 @@ public final Flowable flatMapIterable(@NonNull Function Flowable flatMapIterable(@NonNull Function> mapper, + public final <@NonNull U, @NonNull V> Flowable flatMapIterable(@NonNull Function> mapper, @NonNull BiFunction combiner, int prefetch) { Objects.requireNonNull(mapper, "mapper is null"); Objects.requireNonNull(combiner, "combiner is null"); @@ -10874,6 +10957,8 @@ public final Flowable flatMapIterable(@NonNull Function + * *
*
Backpressure:
*
The operator consumes the upstream in an unbounded manner.
@@ -10889,7 +10974,7 @@ public final Flowable flatMapIterable(@NonNull Function Flowable flatMapMaybe(@NonNull Function> mapper) { + public final <@NonNull R> Flowable flatMapMaybe(@NonNull Function> mapper) { return flatMapMaybe(mapper, false, Integer.MAX_VALUE); } @@ -10897,6 +10982,8 @@ public final Flowable flatMapMaybe(@NonNull Function + * *
*
Backpressure:
*
If {@code maxConcurrency == }{@link Integer#MAX_VALUE} the operator consumes the upstream in an unbounded manner. @@ -10918,7 +11005,7 @@ public final Flowable flatMapMaybe(@NonNull Function Flowable flatMapMaybe(@NonNull Function> mapper, boolean delayErrors, int maxConcurrency) { + public final <@NonNull R> Flowable flatMapMaybe(@NonNull Function> mapper, boolean delayErrors, int maxConcurrency) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); return RxJavaPlugins.onAssembly(new FlowableFlatMapMaybe<>(this, mapper, delayErrors, maxConcurrency)); @@ -10942,7 +11029,7 @@ public final Flowable flatMapMaybe(@NonNull Function Flowable flatMapSingle(@NonNull Function> mapper) { + public final <@NonNull R> Flowable flatMapSingle(@NonNull Function> mapper) { return flatMapSingle(mapper, false, Integer.MAX_VALUE); } @@ -10971,7 +11058,7 @@ public final Flowable flatMapSingle(@NonNull Function Flowable flatMapSingle(@NonNull Function> mapper, boolean delayErrors, int maxConcurrency) { + public final <@NonNull R> Flowable flatMapSingle(@NonNull Function> mapper, boolean delayErrors, int maxConcurrency) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); return RxJavaPlugins.onAssembly(new FlowableFlatMapSingle<>(this, mapper, delayErrors, maxConcurrency)); @@ -11157,7 +11244,7 @@ public final Disposable forEachWhile(@NonNull Predicate onNext, @NonN @BackpressureSupport(BackpressureKind.ERROR) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable> groupBy(@NonNull Function keySelector) { + public final <@NonNull K> Flowable> groupBy(@NonNull Function keySelector) { return groupBy(keySelector, Functions.identity(), false, bufferSize()); } @@ -11216,7 +11303,7 @@ public final Flowable> groupBy(@NonNull Function Flowable> groupBy(@NonNull Function keySelector, boolean delayError) { + public final <@NonNull K> Flowable> groupBy(@NonNull Function keySelector, boolean delayError) { return groupBy(keySelector, Functions.identity(), delayError, bufferSize()); } @@ -11279,7 +11366,7 @@ public final Flowable> groupBy(@NonNull Function Flowable> groupBy(@NonNull Function keySelector, + public final <@NonNull K, @NonNull V> Flowable> groupBy(@NonNull Function keySelector, @NonNull Function valueSelector) { return groupBy(keySelector, valueSelector, false, bufferSize()); } @@ -11344,7 +11431,7 @@ public final Flowable> groupBy(@NonNull Function Flowable> groupBy(@NonNull Function keySelector, + public final <@NonNull K, @NonNull V> Flowable> groupBy(@NonNull Function keySelector, @NonNull Function valueSelector, boolean delayError) { return groupBy(keySelector, valueSelector, delayError, bufferSize()); } @@ -11411,7 +11498,7 @@ public final Flowable> groupBy(@NonNull Function Flowable> groupBy(@NonNull Function keySelector, + public final <@NonNull K, @NonNull V> Flowable> groupBy(@NonNull Function keySelector, @NonNull Function valueSelector, boolean delayError, int bufferSize) { Objects.requireNonNull(keySelector, "keySelector is null"); @@ -11532,7 +11619,7 @@ public final Flowable> groupBy(@NonNull Function Flowable> groupBy(@NonNull Function keySelector, + public final <@NonNull K, @NonNull V> Flowable> groupBy(@NonNull Function keySelector, @NonNull Function valueSelector, boolean delayError, int bufferSize, @NonNull Function, ? extends Map> evictingMapFactory) { @@ -11582,10 +11669,10 @@ public final Flowable> groupBy(@NonNull Function Flowable groupJoin( - @NonNull Publisher<@NonNull ? extends TRight> other, - @NonNull Function> leftEnd, - @NonNull Function> rightEnd, + public final <@NonNull TRight, @NonNull TLeftEnd, @NonNull TRightEnd, @NonNull R> Flowable groupJoin( + @NonNull Publisher other, + @NonNull Function> leftEnd, + @NonNull Function> rightEnd, @NonNull BiFunction, ? extends R> resultSelector) { Objects.requireNonNull(other, "other is null"); Objects.requireNonNull(leftEnd, "leftEnd is null"); @@ -11706,10 +11793,10 @@ public final Single isEmpty() { @NonNull @BackpressureSupport(BackpressureKind.ERROR) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable join( - @NonNull Publisher<@NonNull ? extends TRight> other, - @NonNull Function> leftEnd, - @NonNull Function> rightEnd, + public final <@NonNull TRight, @NonNull TLeftEnd, @NonNull TRightEnd, @NonNull R> Flowable join( + @NonNull Publisher other, + @NonNull Function> leftEnd, + @NonNull Function> rightEnd, @NonNull BiFunction resultSelector) { Objects.requireNonNull(other, "other is null"); Objects.requireNonNull(leftEnd, "leftEnd is null"); @@ -11946,7 +12033,7 @@ public final Single lastOrError() { @NonNull @BackpressureSupport(BackpressureKind.SPECIAL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable lift(@NonNull FlowableOperator lifter) { + public final <@NonNull R> Flowable lift(@NonNull FlowableOperator lifter) { Objects.requireNonNull(lifter, "lifter is null"); return RxJavaPlugins.onAssembly(new FlowableLift<>(this, lifter)); } @@ -12031,7 +12118,7 @@ public final Flowable> materialize() { @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable mergeWith(@NonNull Publisher<@NonNull ? extends T> other) { + public final Flowable mergeWith(@NonNull Publisher other) { Objects.requireNonNull(other, "other is null"); return merge(this, other); } @@ -12304,7 +12391,7 @@ public final Flowable observeOn(@NonNull Scheduler scheduler, boolean delayEr @NonNull @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable ofType(@NonNull Class clazz) { + public final <@NonNull U> Flowable ofType(@NonNull Class clazz) { Objects.requireNonNull(clazz, "clazz is null"); return filter(Functions.isInstanceOf(clazz)).cast(clazz); } @@ -12464,7 +12551,7 @@ public final Flowable onBackpressureBuffer(int capacity, boolean delayError) @NonNull public final Flowable onBackpressureBuffer(int capacity, boolean delayError, boolean unbounded) { ObjectHelper.verifyPositive(capacity, "capacity"); - return RxJavaPlugins.onAssembly(new FlowableOnBackpressureBuffer<>(this, capacity, unbounded, delayError, Functions.EMPTY_ACTION)); + return RxJavaPlugins.onAssembly(new FlowableOnBackpressureBuffer<>(this, capacity, unbounded, delayError, Functions.EMPTY_ACTION, Functions.emptyConsumer())); } /** @@ -12495,6 +12582,7 @@ public final Flowable onBackpressureBuffer(int capacity, boolean delayError, * @throws NullPointerException if {@code onOverflow} is {@code null} * @throws IllegalArgumentException if {@code capacity} is non-positive * @see ReactiveX operators documentation: backpressure operators + * @see #onBackpressureBuffer(int, boolean, boolean, Action, Consumer) * @since 1.1.0 */ @CheckReturnValue @@ -12505,7 +12593,51 @@ public final Flowable onBackpressureBuffer(int capacity, boolean delayError, @NonNull Action onOverflow) { Objects.requireNonNull(onOverflow, "onOverflow is null"); ObjectHelper.verifyPositive(capacity, "capacity"); - return RxJavaPlugins.onAssembly(new FlowableOnBackpressureBuffer<>(this, capacity, unbounded, delayError, onOverflow)); + return RxJavaPlugins.onAssembly(new FlowableOnBackpressureBuffer<>(this, capacity, unbounded, delayError, onOverflow, Functions.emptyConsumer())); + } + + /** + * Buffers an optionally unlimited number of items from the current {@code Flowable} and allows it to emit as fast it can while allowing the + * downstream to consume the items at its own place. + * If {@code unbounded} is {@code true}, the resulting {@code Flowable} will signal a + * {@link MissingBackpressureException} via {@code onError} as soon as the buffer's capacity is exceeded, dropping all undelivered + * items, canceling the flow and calling the {@code onOverflow} action. + *

+ * + *

+ *
Backpressure:
+ *
The operator honors backpressure from downstream and consumes the current {@code Flowable} in an unbounded + * manner (i.e., not applying backpressure to it).
+ *
Scheduler:
+ *
{@code onBackpressureBuffer} does not operate by default on a particular {@link Scheduler}.
+ *
+ * + * @param capacity number of slots available in the buffer. + * @param delayError + * if {@code true}, an exception from the current {@code Flowable} is delayed until all buffered elements have been + * consumed by the downstream; if {@code false}, an exception is immediately signaled to the downstream, skipping + * any buffered element + * @param unbounded + * if {@code true}, the capacity value is interpreted as the internal "island" size of the unbounded buffer + * @param onOverflow action to execute if an item needs to be buffered, but there are no available slots. + * @param onDropped the {@link Consumer} to be called with the item that could not be buffered due to capacity constraints. + * @return the new {@code Flowable} instance + * @throws NullPointerException if {@code onOverflow} or {@code onDropped} is {@code null} + * @throws IllegalArgumentException if {@code capacity} is non-positive + * @see ReactiveX operators documentation: backpressure operators + * @since 3.1.7 + */ + @CheckReturnValue + @NonNull + @BackpressureSupport(BackpressureKind.SPECIAL) + @SchedulerSupport(SchedulerSupport.NONE) + @Experimental + public final Flowable onBackpressureBuffer(int capacity, boolean delayError, boolean unbounded, + @NonNull Action onOverflow, @NonNull Consumer onDropped) { + Objects.requireNonNull(onOverflow, "onOverflow is null"); + Objects.requireNonNull(onDropped, "onDropped is null"); + ObjectHelper.verifyPositive(capacity, "capacity"); + return RxJavaPlugins.onAssembly(new FlowableOnBackpressureBuffer<>(this, capacity, unbounded, delayError, onOverflow, onDropped)); } /** @@ -12571,6 +12703,7 @@ public final Flowable onBackpressureBuffer(int capacity, @NonNull Action onOv * @throws NullPointerException if {@code onOverflow} or {@code overflowStrategy} is {@code null} * @throws IllegalArgumentException if {@code capacity} is non-positive * @see ReactiveX operators documentation: backpressure operators + * @see #onBackpressureBuffer(long, Action, BackpressureOverflowStrategy) * @since 2.0 */ @CheckReturnValue @@ -12580,9 +12713,55 @@ public final Flowable onBackpressureBuffer(int capacity, @NonNull Action onOv public final Flowable onBackpressureBuffer(long capacity, @Nullable Action onOverflow, @NonNull BackpressureOverflowStrategy overflowStrategy) { Objects.requireNonNull(overflowStrategy, "overflowStrategy is null"); ObjectHelper.verifyPositive(capacity, "capacity"); - return RxJavaPlugins.onAssembly(new FlowableOnBackpressureBufferStrategy<>(this, capacity, onOverflow, overflowStrategy)); + return RxJavaPlugins.onAssembly(new FlowableOnBackpressureBufferStrategy<>(this, capacity, onOverflow, overflowStrategy, null)); } + /** + * Buffers an optionally unlimited number of items from the current {@code Flowable} and allows it to emit as fast it can while allowing the + * downstream to consume the items at its own place. + * The resulting {@code Flowable} will behave as determined by {@code overflowStrategy} if the buffer capacity is exceeded: + *
    + *
  • {@link BackpressureOverflowStrategy#ERROR} (default) will call {@code onError} dropping all undelivered items, + * canceling the source, and notifying the producer with {@code onOverflow}.
  • + *
  • {@link BackpressureOverflowStrategy#DROP_LATEST} will drop any new items emitted by the producer while + * the buffer is full, without generating any {@code onError}. Each drop will, however, invoke {@code onOverflow} + * to signal the overflow to the producer.
  • + *
  • {@link BackpressureOverflowStrategy#DROP_OLDEST} will drop the oldest items in the buffer in order to make + * room for newly emitted ones. Overflow will not generate an {@code onError}, but each drop will invoke + * {@code onOverflow} to signal the overflow to the producer.
  • + *
+ * + *

+ * + *

+ *
Backpressure:
+ *
The operator honors backpressure from downstream and consumes the current {@code Flowable} in an unbounded + * manner (i.e., not applying backpressure to it).
+ *
Scheduler:
+ *
{@code onBackpressureBuffer} does not operate by default on a particular {@link Scheduler}.
+ *
+ * + * @param capacity number of slots available in the buffer. + * @param onOverflow action to execute if an item needs to be buffered, but there are no available slots, {@code null} is allowed. + * @param overflowStrategy how should the resulting {@code Flowable} react to buffer overflows, {@code null} is not allowed. + * @param onDropped the {@link Consumer} to be called with the item that could not be buffered due to capacity constraints. + * @return the new {@code Flowable} instance + * @throws NullPointerException if {@code onOverflow}, {@code overflowStrategy} or {@code onDropped} is {@code null} + * @throws IllegalArgumentException if {@code capacity} is non-positive + * @see ReactiveX operators documentation: backpressure operators + * @since 3.1.7 + */ + @CheckReturnValue + @NonNull + @BackpressureSupport(BackpressureKind.SPECIAL) + @SchedulerSupport(SchedulerSupport.NONE) + @Experimental + public final Flowable onBackpressureBuffer(long capacity, @Nullable Action onOverflow, @NonNull BackpressureOverflowStrategy overflowStrategy, @NonNull Consumer onDropped) { + Objects.requireNonNull(overflowStrategy, "overflowStrategy is null"); + Objects.requireNonNull(onDropped, "onDropped is null"); + ObjectHelper.verifyPositive(capacity, "capacity"); + return RxJavaPlugins.onAssembly(new FlowableOnBackpressureBufferStrategy<>(this, capacity, onOverflow, overflowStrategy, onDropped)); + } /** * Drops items from the current {@code Flowable} if the downstream is not ready to receive new items (indicated * by a lack of {@link Subscription#request(long)} calls from it). @@ -12673,7 +12852,127 @@ public final Flowable onBackpressureDrop(@NonNull Consumer onDrop) @SchedulerSupport(SchedulerSupport.NONE) @NonNull public final Flowable onBackpressureLatest() { - return RxJavaPlugins.onAssembly(new FlowableOnBackpressureLatest<>(this)); + return RxJavaPlugins.onAssembly(new FlowableOnBackpressureLatest<>(this, null)); + } + + /** + * Drops all but the latest item emitted by the current {@code Flowable} if the downstream is not ready to receive + * new items (indicated by a lack of {@link Subscription#request(long)} calls from it) and emits this latest + * item when the downstream becomes ready. + *

+ * + *

+ * Its behavior is logically equivalent to {@code blockingLatest()} with the exception that + * the downstream is not blocking while requesting more values. + *

+ * Note that if the current {@code Flowable} does support backpressure, this operator ignores that capability + * and doesn't propagate any backpressure requests from downstream. + *

+ * Note that due to the nature of how backpressure requests are propagated through subscribeOn/observeOn, + * requesting more than 1 from downstream doesn't guarantee a continuous delivery of {@code onNext} events. + *

+ *
Backpressure:
+ *
The operator honors backpressure from downstream and consumes the current {@code Flowable} in an unbounded + * manner (i.e., not applying backpressure to it).
+ *
Scheduler:
+ *
{@code onBackpressureLatest} does not operate by default on a particular {@link Scheduler}.
+ *
+ * + * @param onDropped + * called with the current entry when it has been replaced by a new one + * @throws NullPointerException if {@code onDropped} is {@code null} + * @return the new {@code Flowable} instance + * @since 3.1.7 + */ + @CheckReturnValue + @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) + @SchedulerSupport(SchedulerSupport.NONE) + @NonNull + @Experimental + public final Flowable onBackpressureLatest(@NonNull Consumer onDropped) { + Objects.requireNonNull(onDropped, "onDropped is null"); + return RxJavaPlugins.onAssembly(new FlowableOnBackpressureLatest<>(this, onDropped)); + } + + /** + * Reduces a sequence of two not emitted values via a function into a single value if the downstream is not ready to receive + * new items (indicated by a lack of {@link Subscription#request(long)} calls from it) and emits this latest + * item when the downstream becomes ready. + *

+ * + *

+ * Note that if the current {@code Flowable} does support backpressure, this operator ignores that capability + * and doesn't propagate any backpressure requests from downstream. + *

+ * Note that due to the nature of how backpressure requests are propagated through subscribeOn/observeOn, + * requesting more than 1 from downstream doesn't guarantee a continuous delivery of {@code onNext} events. + *

+ *
Backpressure:
+ *
The operator honors backpressure from downstream and consumes the current {@code Flowable} in an unbounded + * manner (i.e., not applying backpressure to it).
+ *
Scheduler:
+ *
{@code onBackpressureReduce} does not operate by default on a particular {@link Scheduler}.
+ *
+ *

History: 3.0.9 - experimental + * @param reducer the bi-function to call when there is more than one non-emitted value to downstream, + * the first argument of the bi-function is previous item and the second one is currently + * emitting from upstream + * @return the new {@code Flowable} instance + * @throws NullPointerException if {@code reducer} is {@code null} + * @since 3.1.0 + * @see #onBackpressureReduce(Supplier, BiFunction) + */ + @CheckReturnValue + @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) + @SchedulerSupport(SchedulerSupport.NONE) + @NonNull + public final Flowable onBackpressureReduce(@NonNull BiFunction reducer) { + Objects.requireNonNull(reducer, "reducer is null"); + return RxJavaPlugins.onAssembly(new FlowableOnBackpressureReduce<>(this, reducer)); + } + + /** + * Reduces upstream values into an aggregate value, provided by a supplier and combined via a reducer function, + * while the downstream is not ready to receive items, then emits this aggregate value when the downstream becomes ready. + *

+ * + *

+ * Note that even if the downstream is ready to receive an item, the upstream item will always be aggregated into the output type, + * calling both the supplier and the reducer to produce the output value. + *

+ * Note that if the current {@code Flowable} does support backpressure, this operator ignores that capability + * and doesn't propagate any backpressure requests from downstream. + *

+ * Note that due to the nature of how backpressure requests are propagated through subscribeOn/observeOn, + * requesting more than 1 from downstream doesn't guarantee a continuous delivery of {@code onNext} events. + *

+ *
Backpressure:
+ *
The operator honors backpressure from downstream and consumes the current {@code Flowable} in an unbounded + * manner (i.e., not applying backpressure to it).
+ *
Scheduler:
+ *
{@code onBackpressureReduce} does not operate by default on a particular {@link Scheduler}.
+ *
+ *

History: 3.0.9 - experimental + * @param the aggregate type emitted when the downstream requests more items + * @param supplier the factory to call to create new item of type R to pass it as the first argument to {@code reducer}. + * It is called when previous returned value by {@code reducer} already sent to + * downstream or the very first update from upstream received. + * @param reducer the bi-function to call to reduce excessive updates which downstream is not ready to receive. + * The first argument of type R is the object returned by {@code supplier} or result of previous + * {@code reducer} invocation. The second argument of type T is the current update from upstream. + * @return the new {@code Flowable} instance + * @throws NullPointerException if {@code supplier} or {@code reducer} is {@code null} + * @see #onBackpressureReduce(BiFunction) + * @since 3.1.0 + */ + @CheckReturnValue + @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) + @SchedulerSupport(SchedulerSupport.NONE) + @NonNull + public final <@NonNull R> Flowable onBackpressureReduce(@NonNull Supplier supplier, @NonNull BiFunction reducer) { + Objects.requireNonNull(supplier, "supplier is null"); + Objects.requireNonNull(reducer, "reducer is null"); + return RxJavaPlugins.onAssembly(new FlowableOnBackpressureReduceWith<>(this, supplier, reducer)); } /** @@ -12767,7 +13066,7 @@ public final Flowable onErrorComplete(@NonNull Predicate p @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable onErrorResumeNext(@NonNull Function> fallbackSupplier) { + public final Flowable onErrorResumeNext(@NonNull Function> fallbackSupplier) { Objects.requireNonNull(fallbackSupplier, "fallbackSupplier is null"); return RxJavaPlugins.onAssembly(new FlowableOnErrorNext<>(this, fallbackSupplier)); } @@ -12812,7 +13111,7 @@ public final Flowable onErrorResumeNext(@NonNull Function onErrorResumeWith(@NonNull Publisher<@NonNull ? extends T> fallback) { + public final Flowable onErrorResumeWith(@NonNull Publisher fallback) { Objects.requireNonNull(fallback, "fallback is null"); return onErrorResumeNext(Functions.justFunction(fallback)); } @@ -13072,7 +13371,7 @@ public final ConnectableFlowable publish() { @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable publish(@NonNull Function, ? extends Publisher> selector) { + public final <@NonNull R> Flowable publish(@NonNull Function, @NonNull ? extends Publisher> selector) { return publish(selector, bufferSize()); } @@ -13109,7 +13408,7 @@ public final Flowable publish(@NonNull Function, ? ex @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable publish(@NonNull Function, ? extends Publisher<@NonNull ? extends R>> selector, int prefetch) { + public final <@NonNull R> Flowable publish(@NonNull Function, @NonNull ? extends Publisher> selector, int prefetch) { Objects.requireNonNull(selector, "selector is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); return RxJavaPlugins.onAssembly(new FlowablePublishMulticast<>(this, selector, prefetch, false)); @@ -13435,7 +13734,7 @@ public final Flowable repeatUntil(@NonNull BooleanSupplier stop) { @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable repeatWhen(@NonNull Function, ? extends Publisher<@NonNull ?>> handler) { + public final Flowable repeatWhen(@NonNull Function, @NonNull ? extends Publisher<@NonNull ?>> handler) { Objects.requireNonNull(handler, "handler is null"); return RxJavaPlugins.onAssembly(new FlowableRepeatWhen<>(this, handler)); } @@ -13494,7 +13793,7 @@ public final ConnectableFlowable replay() { @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable replay(@NonNull Function, ? extends Publisher> selector) { + public final <@NonNull R> Flowable replay(@NonNull Function, @NonNull ? extends Publisher> selector) { Objects.requireNonNull(selector, "selector is null"); return FlowableReplay.multicastSelector(FlowableInternalHelper.replaySupplier(this), selector); } @@ -13534,7 +13833,7 @@ public final Flowable replay(@NonNull Function, ? ext @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable replay(@NonNull Function, ? extends Publisher> selector, int bufferSize) { + public final <@NonNull R> Flowable replay(@NonNull Function, @NonNull ? extends Publisher> selector, int bufferSize) { Objects.requireNonNull(selector, "selector is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); return FlowableReplay.multicastSelector(FlowableInternalHelper.replaySupplier(this, bufferSize, false), selector); @@ -13577,7 +13876,7 @@ public final Flowable replay(@NonNull Function, ? ext @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable replay(@NonNull Function, ? extends Publisher> selector, int bufferSize, boolean eagerTruncate) { + public final <@NonNull R> Flowable replay(@NonNull Function, @NonNull ? extends Publisher> selector, int bufferSize, boolean eagerTruncate) { Objects.requireNonNull(selector, "selector is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); return FlowableReplay.multicastSelector(FlowableInternalHelper.replaySupplier(this, bufferSize, eagerTruncate), selector); @@ -13621,7 +13920,7 @@ public final Flowable replay(@NonNull Function, ? ext @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.COMPUTATION) @NonNull - public final Flowable replay(@NonNull Function, ? extends Publisher> selector, int bufferSize, long time, @NonNull TimeUnit unit) { + public final <@NonNull R> Flowable replay(@NonNull Function, @NonNull ? extends Publisher> selector, int bufferSize, long time, @NonNull TimeUnit unit) { return replay(selector, bufferSize, time, unit, Schedulers.computation()); } @@ -13667,7 +13966,7 @@ public final Flowable replay(@NonNull Function, ? ext @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.CUSTOM) - public final Flowable replay(@NonNull Function, ? extends Publisher> selector, int bufferSize, long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { + public final <@NonNull R> Flowable replay(@NonNull Function, @NonNull ? extends Publisher> selector, int bufferSize, long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { Objects.requireNonNull(selector, "selector is null"); Objects.requireNonNull(unit, "unit is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); @@ -13720,7 +14019,7 @@ public final Flowable replay(@NonNull Function, ? ext @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.CUSTOM) - public final Flowable replay(@NonNull Function, ? extends Publisher> selector, int bufferSize, long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean eagerTruncate) { + public final <@NonNull R> Flowable replay(@NonNull Function, @NonNull ? extends Publisher> selector, int bufferSize, long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean eagerTruncate) { Objects.requireNonNull(selector, "selector is null"); Objects.requireNonNull(unit, "unit is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); @@ -13761,7 +14060,7 @@ public final Flowable replay(@NonNull Function, ? ext @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.COMPUTATION) @NonNull - public final Flowable replay(@NonNull Function, ? extends Publisher> selector, long time, @NonNull TimeUnit unit) { + public final <@NonNull R> Flowable replay(@NonNull Function, @NonNull ? extends Publisher> selector, long time, @NonNull TimeUnit unit) { return replay(selector, time, unit, Schedulers.computation()); } @@ -13800,7 +14099,7 @@ public final Flowable replay(@NonNull Function, ? ext @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.CUSTOM) - public final Flowable replay(@NonNull Function, ? extends Publisher> selector, long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { + public final <@NonNull R> Flowable replay(@NonNull Function, @NonNull ? extends Publisher> selector, long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { Objects.requireNonNull(selector, "selector is null"); Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); @@ -13844,7 +14143,7 @@ public final Flowable replay(@NonNull Function, ? ext @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.CUSTOM) - public final Flowable replay(@NonNull Function, ? extends Publisher> selector, long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean eagerTruncate) { + public final <@NonNull R> Flowable replay(@NonNull Function, @NonNull ? extends Publisher> selector, long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean eagerTruncate) { Objects.requireNonNull(selector, "selector is null"); Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); @@ -14433,7 +14732,7 @@ public final Flowable retryUntil(@NonNull BooleanSupplier stop) { @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) public final Flowable retryWhen( - @NonNull Function, ? extends Publisher<@NonNull ?>> handler) { + @NonNull Function, @NonNull ? extends Publisher<@NonNull ?>> handler) { Objects.requireNonNull(handler, "handler is null"); return RxJavaPlugins.onAssembly(new FlowableRetryWhen<>(this, handler)); @@ -14455,10 +14754,10 @@ public final Flowable retryWhen( */ @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) - public final void safeSubscribe(@NonNull Subscriber<@NonNull ? super T> subscriber) { + public final void safeSubscribe(@NonNull Subscriber subscriber) { Objects.requireNonNull(subscriber, "subscriber is null"); if (subscriber instanceof SafeSubscriber) { - subscribe((SafeSubscriber<@NonNull ? super T>)subscriber); + subscribe((SafeSubscriber)subscriber); } else { subscribe(new SafeSubscriber<>(subscriber)); } @@ -14561,7 +14860,7 @@ public final Flowable sample(long period, @NonNull TimeUnit unit, boolean emi public final Flowable sample(long period, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); - return RxJavaPlugins.onAssembly(new FlowableSampleTimed<>(this, period, unit, scheduler, false)); + return RxJavaPlugins.onAssembly(new FlowableSampleTimed<>(this, period, unit, scheduler, false, null)); } /** @@ -14602,7 +14901,51 @@ public final Flowable sample(long period, @NonNull TimeUnit unit, @NonNull Sc public final Flowable sample(long period, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean emitLast) { Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); - return RxJavaPlugins.onAssembly(new FlowableSampleTimed<>(this, period, unit, scheduler, emitLast)); + return RxJavaPlugins.onAssembly(new FlowableSampleTimed<>(this, period, unit, scheduler, emitLast, null)); + } + + /** + * Returns a {@code Flowable} that emits the most recently emitted item (if any) emitted by the current {@code Flowable} + * within periodic time intervals, where the intervals are defined on a particular {@link Scheduler} + * and optionally emit the very last upstream item when the upstream completes. + *

+ * + *

+ *
Backpressure:
+ *
This operator does not support backpressure as it uses time to control data flow.
+ *
Scheduler:
+ *
You specify which {@code Scheduler} this operator will use.
+ *
+ * + * @param period + * the sampling rate + * @param unit + * the {@link TimeUnit} in which {@code period} is defined + * @param scheduler + * the {@code Scheduler} to use when sampling + * @param emitLast + * if {@code true} and the upstream completes while there is still an unsampled item available, + * that item is emitted to downstream before completion + * if {@code false}, an unsampled last item is ignored. + * @param onDropped + * called with the current entry when it has been replaced by a new one + * @return the new {@code Flowable} instance + * @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null} or {@code onDropped} is {@code null} + * @see ReactiveX operators documentation: Sample + * @see RxJava wiki: Backpressure + * @see #throttleLast(long, TimeUnit, Scheduler) + * @since 3.1.6 - Experimental + */ + @CheckReturnValue + @NonNull + @BackpressureSupport(BackpressureKind.ERROR) + @SchedulerSupport(SchedulerSupport.CUSTOM) + @Experimental + public final Flowable sample(long period, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean emitLast, @NonNull Consumer onDropped) { + Objects.requireNonNull(unit, "unit is null"); + Objects.requireNonNull(scheduler, "scheduler is null"); + Objects.requireNonNull(onDropped, "onDropped is null"); + return RxJavaPlugins.onAssembly(new FlowableSampleTimed<>(this, period, unit, scheduler, emitLast, onDropped)); } /** @@ -14631,7 +14974,7 @@ public final Flowable sample(long period, @NonNull TimeUnit unit, @NonNull Sc @NonNull @BackpressureSupport(BackpressureKind.ERROR) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable sample(@NonNull Publisher sampler) { + public final <@NonNull U> Flowable sample(@NonNull Publisher sampler) { Objects.requireNonNull(sampler, "sampler is null"); return RxJavaPlugins.onAssembly(new FlowableSamplePublisher<>(this, sampler, false)); } @@ -14669,16 +15012,15 @@ public final Flowable sample(@NonNull Publisher sampler) { @NonNull @BackpressureSupport(BackpressureKind.ERROR) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable sample(@NonNull Publisher sampler, boolean emitLast) { + public final <@NonNull U> Flowable sample(@NonNull Publisher sampler, boolean emitLast) { Objects.requireNonNull(sampler, "sampler is null"); return RxJavaPlugins.onAssembly(new FlowableSamplePublisher<>(this, sampler, emitLast)); } /** - * Returns a {@code Flowable} that applies a specified accumulator function to the first item emitted by the current - * {@code Flowable}, then feeds the result of that function along with the second item emitted by the current - * {@code Floawble} into the same function, and so on until all items have been emitted by the current {@code Flowable}, - * emitting the result of each of these iterations. + * Returns a {@code Flowable} that emits the first value emitted by the current {@code Flowable}, then emits one value + * for each subsequent value emitted by the current {@code Flowable}. Each emission after the first is the result of + * applying the specified accumulator function to the previous emission and the corresponding value from the current {@code Flowable}. *

* *

@@ -14709,10 +15051,9 @@ public final Flowable scan(@NonNull BiFunction accumulator) { } /** - * Returns a {@code Flowable} that applies a specified accumulator function to the first item emitted by the current - * {@code Flowable} and a seed value, then feeds the result of that function along with the second item emitted by - * the current {@code Flowable} into the same function, and so on until all items have been emitted by the current - * {@code Flowable}, emitting the result of each of these iterations. + * Returns a {@code Flowable} that emits the provided initial (seed) value, then emits one value for each value emitted + * by the current {@code Flowable}. Each emission after the first is the result of applying the specified accumulator + * function to the previous emission and the corresponding value from the current {@code Flowable}. *

* *

@@ -14737,7 +15078,9 @@ public final Flowable scan(@NonNull BiFunction accumulator) { *

*
Backpressure:
*
The operator honors downstream backpressure and expects the current {@code Flowable} to honor backpressure as well. - * Violating this expectation, a {@link MissingBackpressureException} may get signaled somewhere downstream.
+ * Violating this expectation, a {@link MissingBackpressureException} may get signaled somewhere downstream. + * The downstream request pattern is not preserved across this operator. + * The upstream is requested {@link #bufferSize()} - 1 upfront and 75% of {@link #bufferSize()} thereafter.
*
Scheduler:
*
{@code scan} does not operate by default on a particular {@link Scheduler}.
*
@@ -14763,10 +15106,9 @@ public final Flowable scan(@NonNull BiFunction accumulator) { } /** - * Returns a {@code Flowable} that applies a specified accumulator function to the first item emitted by the current - * {@code Flowable} and a seed value, then feeds the result of that function along with the second item emitted by - * the current {@code Flowable} into the same function, and so on until all items have been emitted by the current - * {@code Flowable}, emitting the result of each of these iterations. + * Returns a {@code Flowable} that emits the provided initial (seed) value, then emits one value for each value emitted + * by the current {@code Flowable}. Each emission after the first is the result of applying the specified accumulator + * function to the previous emission and the corresponding value from the current {@code Flowable}. *

* *

@@ -14777,7 +15119,9 @@ public final Flowable scan(@NonNull BiFunction accumulator) { *

*
Backpressure:
*
The operator honors downstream backpressure and expects the current {@code Flowable} to honor backpressure as well. - * Violating this expectation, a {@link MissingBackpressureException} may get signaled somewhere downstream.
+ * Violating this expectation, a {@link MissingBackpressureException} may get signaled somewhere downstream. + * The downstream request pattern is not preserved across this operator. + * The upstream is requested {@link #bufferSize()} - 1 upfront and 75% of {@link #bufferSize()} thereafter.
*
Scheduler:
*
{@code scanWith} does not operate by default on a particular {@link Scheduler}.
*
@@ -15278,7 +15622,7 @@ public final Flowable skipLast(long time, @NonNull TimeUnit unit, @NonNull Sc @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable skipUntil(@NonNull Publisher other) { + public final <@NonNull U> Flowable skipUntil(@NonNull Publisher other) { Objects.requireNonNull(other, "other is null"); return RxJavaPlugins.onAssembly(new FlowableSkipUntil<>(this, other)); } @@ -15396,7 +15740,7 @@ public final Flowable sorted(@NonNull Comparator<@NonNull ? super T> comparat @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable startWithIterable(@NonNull Iterable<@NonNull ? extends T> items) { + public final Flowable startWithIterable(@NonNull Iterable items) { return concatArray(fromIterable(items), this); } @@ -15499,7 +15843,7 @@ public final Flowable startWith(@NonNull MaybeSource other) { @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable startWith(@NonNull Publisher<@NonNull ? extends T> other) { + public final Flowable startWith(@NonNull Publisher other) { Objects.requireNonNull(other, "other is null"); return concatArray(other, this); } @@ -15587,6 +15931,7 @@ public final Flowable startWithArray(@NonNull T... items) { * * @return the new {@link Disposable} instance that allows cancelling the flow * @see ReactiveX operators documentation: Subscribe + * @see #subscribe(Consumer, Consumer, Action, DisposableContainer) */ @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) @SchedulerSupport(SchedulerSupport.NONE) @@ -15615,6 +15960,7 @@ public final Disposable subscribe() { * @throws NullPointerException * if {@code onNext} is {@code null} * @see ReactiveX operators documentation: Subscribe + * @see #subscribe(Consumer, Consumer, Action, DisposableContainer) */ @CheckReturnValue @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) @@ -15641,9 +15987,10 @@ public final Disposable subscribe(@NonNull Consumer onNext) { * the {@code Consumer} you have designed to accept any error notification from the * current {@code Flowable} * @return the new {@link Disposable} instance that allows cancelling the flow - * @see ReactiveX operators documentation: Subscribe * @throws NullPointerException * if {@code onNext} or {@code onError} is {@code null} + * @see ReactiveX operators documentation: Subscribe + * @see #subscribe(Consumer, Consumer, Action, DisposableContainer) */ @CheckReturnValue @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) @@ -15676,6 +16023,7 @@ public final Disposable subscribe(@NonNull Consumer onNext, @NonNull * @throws NullPointerException * if {@code onNext}, {@code onError} or {@code onComplete} is {@code null} * @see ReactiveX operators documentation: Subscribe + * @see #subscribe(Consumer, Consumer, Action, DisposableContainer) */ @CheckReturnValue @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) @@ -15694,12 +16042,57 @@ public final Disposable subscribe(@NonNull Consumer onNext, @NonNull return ls; } + /** + * Wraps the given onXXX callbacks into a {@link Disposable} {@link Subscriber}, + * adds it to the given {@link DisposableContainer} and ensures, that if the upstream + * terminates or this particular {@code Disposable} is disposed, the {@code Subscriber} is removed + * from the given container. + *

+ * The {@code Subscriber} will be removed after the callback for the terminal event has been invoked. + *

+ *
Backpressure:
+ *
The operator consumes the current {@code Flowable} in an unbounded manner (i.e., no + * backpressure is applied to it).
+ *
Scheduler:
+ *
{@code subscribe} does not operate by default on a particular {@link Scheduler}.
+ *
+ * @param onNext the callback for upstream items + * @param onError the callback for an upstream error if any + * @param onComplete the callback for the upstream completion if any + * @param container the {@code DisposableContainer} (such as {@link CompositeDisposable}) to add and remove the + * created {@code Disposable} {@code Subscriber} + * @return the {@code Disposable} that allows disposing the particular subscription. + * @throws NullPointerException + * if {@code onNext}, {@code onError}, + * {@code onComplete} or {@code container} is {@code null} + * @since 3.1.0 + */ + @BackpressureSupport(BackpressureKind.SPECIAL) + @SchedulerSupport(SchedulerSupport.NONE) + @NonNull + public final Disposable subscribe( + @NonNull Consumer onNext, + @NonNull Consumer onError, + @NonNull Action onComplete, + @NonNull DisposableContainer container) { + Objects.requireNonNull(onNext, "onNext is null"); + Objects.requireNonNull(onError, "onError is null"); + Objects.requireNonNull(onComplete, "onComplete is null"); + Objects.requireNonNull(container, "container is null"); + + DisposableAutoReleaseSubscriber subscriber = new DisposableAutoReleaseSubscriber<>( + container, onNext, onError, onComplete); + container.add(subscriber); + subscribe(subscriber); + return subscriber; + } + @BackpressureSupport(BackpressureKind.SPECIAL) @SchedulerSupport(SchedulerSupport.NONE) @Override - public final void subscribe(@NonNull Subscriber<@NonNull ? super T> subscriber) { + public final void subscribe(@NonNull Subscriber subscriber) { if (subscriber instanceof FlowableSubscriber) { - subscribe((FlowableSubscriber<@NonNull ? super T>)subscriber); + subscribe((FlowableSubscriber)subscriber); } else { Objects.requireNonNull(subscriber, "subscriber is null"); subscribe(new StrictSubscriber<>(subscriber)); @@ -15746,10 +16139,10 @@ public final void subscribe(@NonNull Subscriber<@NonNull ? super T> subscriber) */ @BackpressureSupport(BackpressureKind.SPECIAL) @SchedulerSupport(SchedulerSupport.NONE) - public final void subscribe(@NonNull FlowableSubscriber<@NonNull ? super T> subscriber) { + public final void subscribe(@NonNull FlowableSubscriber subscriber) { Objects.requireNonNull(subscriber, "subscriber is null"); try { - Subscriber<@NonNull ? super T> flowableSubscriber = RxJavaPlugins.onSubscribe(this, subscriber); + Subscriber flowableSubscriber = RxJavaPlugins.onSubscribe(this, subscriber); Objects.requireNonNull(flowableSubscriber, "The RxJavaPlugins.onSubscribe hook returned a null FlowableSubscriber. Please check the handler provided to RxJavaPlugins.setOnFlowableSubscribe for invalid null returns. Further reading: https://github.com/ReactiveX/RxJava/wiki/Plugins"); @@ -15776,7 +16169,7 @@ public final void subscribe(@NonNull FlowableSubscriber<@NonNull ? super T> subs * applied by {@link #subscribe(Subscriber)} before this method gets called. * @param subscriber the incoming {@code Subscriber}, never {@code null} */ - protected abstract void subscribeActual(@NonNull Subscriber<@NonNull ? super T> subscriber); + protected abstract void subscribeActual(@NonNull Subscriber subscriber); /** * Subscribes a given {@link Subscriber} (subclass) to this {@code Flowable} and returns the given @@ -15809,7 +16202,7 @@ public final void subscribe(@NonNull FlowableSubscriber<@NonNull ? super T> subs @BackpressureSupport(BackpressureKind.SPECIAL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final <@NonNull E extends Subscriber<@NonNull ? super T>> E subscribeWith(E subscriber) { + public final <@NonNull E extends Subscriber> E subscribeWith(E subscriber) { subscribe(subscriber); return subscriber; } @@ -15912,7 +16305,7 @@ public final Flowable subscribeOn(@NonNull Scheduler scheduler, boolean reque @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable switchIfEmpty(@NonNull Publisher<@NonNull ? extends T> other) { + public final Flowable switchIfEmpty(@NonNull Publisher other) { Objects.requireNonNull(other, "other is null"); return RxJavaPlugins.onAssembly(new FlowableSwitchIfEmpty<>(this, other)); } @@ -15949,7 +16342,7 @@ public final Flowable switchIfEmpty(@NonNull Publisher<@NonNull ? extends T> @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable switchMap(@NonNull Function> mapper) { + public final <@NonNull R> Flowable switchMap(@NonNull Function> mapper) { return switchMap(mapper, bufferSize()); } @@ -15988,7 +16381,7 @@ public final Flowable switchMap(@NonNull Function Flowable switchMap(@NonNull Function> mapper, int bufferSize) { + public final <@NonNull R> Flowable switchMap(@NonNull Function> mapper, int bufferSize) { return switchMap0(mapper, bufferSize, false); } @@ -16121,7 +16514,7 @@ public final Completable switchMapCompletableDelayError(@NonNull Function Flowable switchMapDelayError(@NonNull Function> mapper) { + public final <@NonNull R> Flowable switchMapDelayError(@NonNull Function> mapper) { return switchMapDelayError(mapper, bufferSize()); } @@ -16162,11 +16555,11 @@ public final Flowable switchMapDelayError(@NonNull Function Flowable switchMapDelayError(@NonNull Function> mapper, int bufferSize) { + public final <@NonNull R> Flowable switchMapDelayError(@NonNull Function> mapper, int bufferSize) { return switchMap0(mapper, bufferSize, true); } - Flowable switchMap0(Function> mapper, int bufferSize, boolean delayError) { + Flowable switchMap0(Function> mapper, int bufferSize, boolean delayError) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); if (this instanceof ScalarSupplier) { @@ -16217,7 +16610,7 @@ Flowable switchMap0(Function Flowable switchMapMaybe(@NonNull Function> mapper) { + public final <@NonNull R> Flowable switchMapMaybe(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new FlowableSwitchMapMaybe<>(this, mapper, false)); } @@ -16249,7 +16642,7 @@ public final Flowable switchMapMaybe(@NonNull Function Flowable switchMapMaybeDelayError(@NonNull Function> mapper) { + public final <@NonNull R> Flowable switchMapMaybeDelayError(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new FlowableSwitchMapMaybe<>(this, mapper, true)); } @@ -16291,7 +16684,7 @@ public final Flowable switchMapMaybeDelayError(@NonNull Function Flowable switchMapSingle(@NonNull Function> mapper) { + public final <@NonNull R> Flowable switchMapSingle(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new FlowableSwitchMapSingle<>(this, mapper, false)); } @@ -16323,14 +16716,14 @@ public final Flowable switchMapSingle(@NonNull Function Flowable switchMapSingleDelayError(@NonNull Function> mapper) { + public final <@NonNull R> Flowable switchMapSingleDelayError(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new FlowableSwitchMapSingle<>(this, mapper, true)); } /** - * Returns a {@code Flowable} that emits only the first {@code count} items emitted by the current {@code Flowable}. If the source emits fewer than - * {@code count} items then all of its items are emitted. + * Returns a {@code Flowable} that emits only the first {@code count} items emitted by the current {@code Flowable}. + * If the source emits fewer than {@code count} items then all of its items are emitted. *

* *

@@ -16343,15 +16736,15 @@ public final Flowable switchMapSingleDelayError(@NonNull Function * The operator requests at most the given {@code count} of items from upstream even - * if the downstream requests more than that. For example, given a {@code limit(5)}, + * if the downstream requests more than that. For example, given a {@code take(5)}, * if the downstream requests 1, a request of 1 is submitted to the upstream * and the operator remembers that only 4 items can be requested now on. A request * of 5 at this point will request 4 from the upstream and any subsequent requests will * be ignored. *

- * Note that requests are negotiated on an operator boundary and {@code limit}'s amount + * Note that requests are negotiated on an operator boundary and {@code take}'s amount * may not be preserved further upstream. For example, - * {@code source.observeOn(Schedulers.computation()).limit(5)} will still request the + * {@code source.observeOn(Schedulers.computation()).take(5)} will still request the * default (128) elements from the given {@code source}. *

*
Backpressure:
@@ -16811,9 +17204,9 @@ public final Flowable takeUntil(@NonNull Predicate stopPredicate) /** * Returns a {@code Flowable} that emits the items emitted by the current {@code Flowable} until a second {@link Publisher} - * emits an item. + * emits an item or completes. *

- * + * *

*
Backpressure:
*
The operator doesn't interfere with backpressure which is determined by the current {@code Flowable}'s backpressure @@ -16823,7 +17216,7 @@ public final Flowable takeUntil(@NonNull Predicate stopPredicate) *
* * @param other - * the {@code Publisher} whose first emitted item will cause {@code takeUntil} to stop emitting items + * the {@code Publisher} whose first emitted item or completion will cause {@code takeUntil} to stop emitting items * from the current {@code Flowable} * @param * the type of items emitted by {@code other} @@ -16835,7 +17228,7 @@ public final Flowable takeUntil(@NonNull Predicate stopPredicate) @NonNull @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable takeUntil(@NonNull Publisher other) { + public final <@NonNull U> Flowable takeUntil(@NonNull Publisher other) { Objects.requireNonNull(other, "other is null"); return RxJavaPlugins.onAssembly(new FlowableTakeUntil<>(this, other)); } @@ -16935,7 +17328,50 @@ public final Flowable throttleFirst(long windowDuration, @NonNull TimeUnit un public final Flowable throttleFirst(long skipDuration, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); - return RxJavaPlugins.onAssembly(new FlowableThrottleFirstTimed<>(this, skipDuration, unit, scheduler)); + return RxJavaPlugins.onAssembly(new FlowableThrottleFirstTimed<>(this, skipDuration, unit, scheduler, null)); + } + + /** + * Returns a {@code Flowable} that emits only the first item emitted by the current {@code Flowable} during sequential + * time windows of a specified duration, where the windows are managed by a specified {@link Scheduler}. + *

+ * This differs from {@link #throttleLast} in that this only tracks the passage of time whereas + * {@link #throttleLast} ticks at scheduled intervals. + *

+ * + *

+ *
Backpressure:
+ *
This operator does not support backpressure as it uses time to control data flow.
+ *
Scheduler:
+ *
You specify which {@code Scheduler} this operator will use.
+ *
+ * + * @param skipDuration + * time to wait before emitting another item after emitting the last item + * @param unit + * the unit of time of {@code skipDuration} + * @param scheduler + * the {@code Scheduler} to use internally to manage the timers that handle timeout for each + * event + * @param onDropped + * called when an item doesn't get delivered to the downstream + * + * @return the new {@code Flowable} instance + * @throws NullPointerException if {@code unit} or {@code scheduler} or {@code onDropped} is {@code null} + * @see ReactiveX operators documentation: Sample + * @see RxJava wiki: Backpressure + * @since 3.1.6 - Experimental + */ + @CheckReturnValue + @NonNull + @BackpressureSupport(BackpressureKind.ERROR) + @SchedulerSupport(SchedulerSupport.CUSTOM) + @Experimental + public final Flowable throttleFirst(long skipDuration, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull Consumer onDropped) { + Objects.requireNonNull(unit, "unit is null"); + Objects.requireNonNull(scheduler, "scheduler is null"); + Objects.requireNonNull(onDropped, "onDropped is null"); + return RxJavaPlugins.onAssembly(new FlowableThrottleFirstTimed<>(this, skipDuration, unit, scheduler, onDropped)); } /** @@ -17009,6 +17445,47 @@ public final Flowable throttleLast(long intervalDuration, @NonNull TimeUnit u return sample(intervalDuration, unit, scheduler); } + /** + * Returns a {@code Flowable} that emits only the last item emitted by the current {@code Flowable} during sequential + * time windows of a specified duration, where the duration is governed by a specified {@link Scheduler}. + *

+ * This differs from {@link #throttleFirst(long, TimeUnit, Scheduler)} in that this ticks along at a scheduled interval whereas + * {@code throttleFirst} does not tick, it just tracks the passage of time. + *

+ * + *

+ *
Backpressure:
+ *
This operator does not support backpressure as it uses time to control data flow.
+ *
Scheduler:
+ *
You specify which {@code Scheduler} this operator will use.
+ *
+ * + * @param intervalDuration + * duration of windows within which the last item emitted by the current {@code Flowable} will be + * emitted + * @param unit + * the unit of time of {@code intervalDuration} + * @param scheduler + * the {@code Scheduler} to use internally to manage the timers that handle timeout for each + * event + * @param onDropped + * called with the current entry when it has been replaced by a new one + * @return the new {@code Flowable} instance + * @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null} or {@code onDropped} is {@code null} + * @see ReactiveX operators documentation: Sample + * @see RxJava wiki: Backpressure + * @see #sample(long, TimeUnit, Scheduler) + * @since 3.1.6 - Experimental + */ + @CheckReturnValue + @BackpressureSupport(BackpressureKind.ERROR) + @SchedulerSupport(SchedulerSupport.CUSTOM) + @NonNull + @Experimental + public final Flowable throttleLast(long intervalDuration, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull Consumer onDropped) { + return sample(intervalDuration, unit, scheduler, false, onDropped); + } + /** * Throttles items from the upstream {@code Flowable} by first emitting the next * item from upstream, then periodically emitting the latest item (if any) when @@ -17166,7 +17643,61 @@ public final Flowable throttleLatest(long timeout, @NonNull TimeUnit unit, @N public final Flowable throttleLatest(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean emitLast) { Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); - return RxJavaPlugins.onAssembly(new FlowableThrottleLatest<>(this, timeout, unit, scheduler, emitLast)); + return RxJavaPlugins.onAssembly(new FlowableThrottleLatest<>(this, timeout, unit, scheduler, emitLast, null)); + } + + /** + * Throttles items from the upstream {@code Flowable} by first emitting the next + * item from upstream, then periodically emitting the latest item (if any) when + * the specified timeout elapses between them, invoking the consumer for any dropped item. + *

+ * + *

+ * If no items were emitted from the upstream during this timeout phase, the next + * upstream item is emitted immediately and the timeout window starts from then. + *

+ *
Backpressure:
+ *
This operator does not support backpressure as it uses time to control data flow. + * If the downstream is not ready to receive items, a + * {@link io.reactivex.rxjava3.exceptions.MissingBackpressureException MissingBackpressureException} + * will be signaled.
+ *
Scheduler:
+ *
You specify which {@link Scheduler} this operator will use.
+ *
Error handling:
+ *
+ * If the upstream signals an {@code onError} or {@code onDropped} callback crashes, + * the error is delivered immediately to the downstream. If both happen, a {@link CompositeException} + * is created, containing both the upstream and the callback error. + * If the {@code onDropped} callback crashes during cancellation, the exception is forwarded + * to the global error handler via {@link RxJavaPlugins#onError(Throwable)}. + *
+ *
+ * @param timeout the time to wait after an item emission towards the downstream + * before trying to emit the latest item from upstream again + * @param unit the time unit + * @param scheduler the {@code Scheduler} where the timed wait and latest item + * emission will be performed + * @param emitLast If {@code true}, the very last item from the upstream will be emitted + * immediately when the upstream completes, regardless if there is + * a timeout window active or not. If {@code false}, the very last + * upstream item is ignored and the flow terminates. + * @param onDropped called when an item is replaced by a newer item that doesn't get delivered + * to the downstream, including the very last item if {@code emitLast} is {@code false} + * and the current undelivered item when the sequence gets canceled. + * @return the new {@code Flowable} instance + * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code onDropped} is {@code null} + * @since 3.1.6 - Experimental + */ + @CheckReturnValue + @NonNull + @BackpressureSupport(BackpressureKind.ERROR) + @SchedulerSupport(SchedulerSupport.CUSTOM) + @Experimental + public final Flowable throttleLatest(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean emitLast, @NonNull Consumer onDropped) { + Objects.requireNonNull(unit, "unit is null"); + Objects.requireNonNull(scheduler, "scheduler is null"); + Objects.requireNonNull(onDropped, "onDropped is null"); + return RxJavaPlugins.onAssembly(new FlowableThrottleLatest<>(this, timeout, unit, scheduler, emitLast, onDropped)); } /** @@ -17244,6 +17775,49 @@ public final Flowable throttleWithTimeout(long timeout, @NonNull TimeUnit uni return debounce(timeout, unit, scheduler); } + /** + * Returns a {@code Flowable} that mirrors the current {@code Flowable}, except that it drops items emitted by the + * current {@code Flowable} that are followed by newer items before a timeout value expires on a specified + * {@link Scheduler}. The timer resets on each emission (alias to {@link #debounce(long, TimeUnit, Scheduler, Consumer)}). + *

+ * Note: If items keep being emitted by the current {@code Flowable} faster than the timeout then no items + * will be emitted by the resulting {@code Flowable}. + *

+ * + *

+ *
Backpressure:
+ *
This operator does not support backpressure as it uses time to control data flow.
+ *
Scheduler:
+ *
You specify which {@code Scheduler} this operator will use.
+ *
+ * + * @param timeout + * the length of the window of time that must pass after the emission of an item from the current + * {@code Flowable} in which it emits no items in order for the item to be emitted by the + * resulting {@code Flowable} + * @param unit + * the unit of time for the specified {@code timeout} + * @param scheduler + * the {@code Scheduler} to use internally to manage the timers that handle the timeout for each + * item + * @param onDropped + * called with the current entry when it has been replaced by a new one + * @return the new {@code Flowable} instance + * @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null} or {@code onDropped} is {@code null} + * @see ReactiveX operators documentation: Debounce + * @see RxJava wiki: Backpressure + * @see #debounce(long, TimeUnit, Scheduler, Consumer) + * @since 3.1.6 - Experimental + */ + @CheckReturnValue + @BackpressureSupport(BackpressureKind.ERROR) + @SchedulerSupport(SchedulerSupport.CUSTOM) + @NonNull + @Experimental + public final Flowable throttleWithTimeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull Consumer onDropped) { + return debounce(timeout, unit, scheduler, onDropped); + } + /** * Returns a {@code Flowable} that emits records of the time interval between consecutive items emitted by the * current {@code Flowable}. @@ -17387,7 +17961,7 @@ public final Flowable> timeInterval(@NonNull TimeUnit unit, @NonNull Sc @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable timeout(@NonNull Function> itemTimeoutIndicator) { + public final <@NonNull V> Flowable timeout(@NonNull Function> itemTimeoutIndicator) { return timeout0(null, itemTimeoutIndicator, null); } @@ -17425,7 +17999,7 @@ public final Flowable timeout(@NonNull Function Flowable timeout(@NonNull Function> itemTimeoutIndicator, @NonNull Publisher<@NonNull ? extends T> fallback) { + public final <@NonNull V> Flowable timeout(@NonNull Function> itemTimeoutIndicator, @NonNull Publisher fallback) { Objects.requireNonNull(fallback, "fallback is null"); return timeout0(null, itemTimeoutIndicator, fallback); } @@ -17490,7 +18064,7 @@ public final Flowable timeout(long timeout, @NonNull TimeUnit unit) { @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.COMPUTATION) - public final Flowable timeout(long timeout, @NonNull TimeUnit unit, @NonNull Publisher<@NonNull ? extends T> fallback) { + public final Flowable timeout(long timeout, @NonNull TimeUnit unit, @NonNull Publisher fallback) { Objects.requireNonNull(fallback, "fallback is null"); return timeout0(timeout, unit, fallback, Schedulers.computation()); } @@ -17528,7 +18102,7 @@ public final Flowable timeout(long timeout, @NonNull TimeUnit unit, @NonNull @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.CUSTOM) - public final Flowable timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull Publisher<@NonNull ? extends T> fallback) { + public final Flowable timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull Publisher fallback) { Objects.requireNonNull(fallback, "fallback is null"); return timeout0(timeout, unit, fallback, scheduler); } @@ -17600,8 +18174,8 @@ public final Flowable timeout(long timeout, @NonNull TimeUnit unit, @NonNull @NonNull @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable timeout(@NonNull Publisher firstTimeoutIndicator, - @NonNull Function> itemTimeoutIndicator) { + public final <@NonNull U, @NonNull V> Flowable timeout(@NonNull Publisher firstTimeoutIndicator, + @NonNull Function> itemTimeoutIndicator) { Objects.requireNonNull(firstTimeoutIndicator, "firstTimeoutIndicator is null"); return timeout0(firstTimeoutIndicator, itemTimeoutIndicator, null); } @@ -17643,26 +18217,26 @@ public final Flowable timeout(@NonNull Publisher firstTimeoutIndica @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable timeout( + public final <@NonNull U, @NonNull V> Flowable timeout( @NonNull Publisher firstTimeoutIndicator, - @NonNull Function> itemTimeoutIndicator, - @NonNull Publisher<@NonNull ? extends T> fallback) { + @NonNull Function> itemTimeoutIndicator, + @NonNull Publisher fallback) { Objects.requireNonNull(firstTimeoutIndicator, "firstTimeoutIndicator is null"); Objects.requireNonNull(fallback, "fallback is null"); return timeout0(firstTimeoutIndicator, itemTimeoutIndicator, fallback); } - private Flowable timeout0(long timeout, TimeUnit unit, Publisher<@NonNull ? extends T> fallback, + private Flowable timeout0(long timeout, TimeUnit unit, Publisher fallback, Scheduler scheduler) { Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); return RxJavaPlugins.onAssembly(new FlowableTimeoutTimed<>(this, timeout, unit, scheduler, fallback)); } - private Flowable timeout0( + private <@NonNull U, @NonNull V> Flowable timeout0( Publisher firstTimeoutIndicator, - Function> itemTimeoutIndicator, - Publisher<@NonNull ? extends T> fallback) { + Function> itemTimeoutIndicator, + Publisher fallback) { Objects.requireNonNull(itemTimeoutIndicator, "itemTimeoutIndicator is null"); return RxJavaPlugins.onAssembly(new FlowableTimeout<>(this, firstTimeoutIndicator, itemTimeoutIndicator, fallback)); } @@ -17798,7 +18372,7 @@ public final Flowable> timestamp(@NonNull TimeUnit unit, @NonNull Sched @CheckReturnValue @BackpressureSupport(BackpressureKind.SPECIAL) @SchedulerSupport(SchedulerSupport.NONE) - public final R to(@NonNull FlowableConverter converter) { + public final <@NonNull R> R to(@NonNull FlowableConverter converter) { return Objects.requireNonNull(converter, "converter is null").apply(this); } @@ -17908,7 +18482,7 @@ public final Single> toList(int capacityHint) { @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final > Single toList(@NonNull Supplier collectionSupplier) { + public final <@NonNull U extends Collection> Single toList(@NonNull Supplier collectionSupplier) { Objects.requireNonNull(collectionSupplier, "collectionSupplier is null"); return RxJavaPlugins.onAssembly(new FlowableToListSingle<>(this, collectionSupplier)); } @@ -17943,7 +18517,7 @@ public final > Single toList(@NonNull Supplie @NonNull @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) @SchedulerSupport(SchedulerSupport.NONE) - public final Single> toMap(@NonNull Function keySelector) { + public final <@NonNull K> Single> toMap(@NonNull Function keySelector) { Objects.requireNonNull(keySelector, "keySelector is null"); return collect(HashMapSupplier.asSupplier(), Functions.toMapKeySelector(keySelector)); } @@ -17982,7 +18556,7 @@ public final Single> toMap(@NonNull Function Single> toMap(@NonNull Function keySelector, @NonNull Function valueSelector) { + public final <@NonNull K, @NonNull V> Single> toMap(@NonNull Function keySelector, @NonNull Function valueSelector) { Objects.requireNonNull(keySelector, "keySelector is null"); Objects.requireNonNull(valueSelector, "valueSelector is null"); return collect(HashMapSupplier.asSupplier(), Functions.toMapKeyValueSelector(keySelector, valueSelector)); @@ -18021,7 +18595,7 @@ public final Single> toMap(@NonNull Function Single> toMap(@NonNull Function keySelector, + public final <@NonNull K, @NonNull V> Single> toMap(@NonNull Function keySelector, @NonNull Function valueSelector, @NonNull Supplier> mapSupplier) { Objects.requireNonNull(keySelector, "keySelector is null"); @@ -18056,7 +18630,7 @@ public final Single> toMap(@NonNull Function Single>> toMultimap(@NonNull Function keySelector) { + public final <@NonNull K> Single>> toMultimap(@NonNull Function keySelector) { Function valueSelector = Functions.identity(); Supplier>> mapSupplier = HashMapSupplier.asSupplier(); Function> collectionFactory = ArrayListSupplier.asFunction(); @@ -18095,7 +18669,7 @@ public final Single>> toMultimap(@NonNull Function Single>> toMultimap(@NonNull Function keySelector, @NonNull Function valueSelector) { + public final <@NonNull K, @NonNull V> Single>> toMultimap(@NonNull Function keySelector, @NonNull Function valueSelector) { Supplier>> mapSupplier = HashMapSupplier.asSupplier(); Function> collectionFactory = ArrayListSupplier.asFunction(); return toMultimap(keySelector, valueSelector, mapSupplier, collectionFactory); @@ -18137,7 +18711,7 @@ public final Single>> toMultimap(@NonNull Function Single>> toMultimap( + public final <@NonNull K, @NonNull V> Single>> toMultimap( @NonNull Function keySelector, @NonNull Function valueSelector, @NonNull Supplier>> mapSupplier, @@ -18183,7 +18757,7 @@ public final Single>> toMultimap( @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Single>> toMultimap( + public final <@NonNull K, @NonNull V> Single>> toMultimap( @NonNull Function keySelector, @NonNull Function valueSelector, @NonNull Supplier>> mapSupplier @@ -18982,7 +19556,7 @@ public final Flowable> window( @BackpressureSupport(BackpressureKind.ERROR) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable> window(@NonNull Publisher boundaryIndicator) { + public final <@NonNull B> Flowable> window(@NonNull Publisher boundaryIndicator) { return window(boundaryIndicator, bufferSize()); } @@ -19020,7 +19594,7 @@ public final Flowable> window(@NonNull Publisher boundaryIndi @NonNull @BackpressureSupport(BackpressureKind.ERROR) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable> window(@NonNull Publisher boundaryIndicator, int bufferSize) { + public final <@NonNull B> Flowable> window(@NonNull Publisher boundaryIndicator, int bufferSize) { Objects.requireNonNull(boundaryIndicator, "boundaryIndicator is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); return RxJavaPlugins.onAssembly(new FlowableWindowBoundary<>(this, boundaryIndicator, bufferSize)); @@ -19063,9 +19637,9 @@ public final Flowable> window(@NonNull Publisher boundaryIndi @BackpressureSupport(BackpressureKind.ERROR) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable> window( + public final <@NonNull U, @NonNull V> Flowable> window( @NonNull Publisher openingIndicator, - @NonNull Function> closingIndicator) { + @NonNull Function> closingIndicator) { return window(openingIndicator, closingIndicator, bufferSize()); } @@ -19109,9 +19683,9 @@ public final Flowable> window( @NonNull @BackpressureSupport(BackpressureKind.ERROR) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable> window( + public final <@NonNull U, @NonNull V> Flowable> window( @NonNull Publisher openingIndicator, - @NonNull Function> closingIndicator, int bufferSize) { + @NonNull Function> closingIndicator, int bufferSize) { Objects.requireNonNull(openingIndicator, "openingIndicator is null"); Objects.requireNonNull(closingIndicator, "closingIndicator is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); @@ -19121,6 +19695,13 @@ public final Flowable> window( /** * Merges the specified {@link Publisher} into the current {@code Flowable} sequence by using the {@code resultSelector} * function only when the current {@code Flowable} (this instance) emits an item. + * + *

Note that this operator doesn't emit anything until the other source has produced at + * least one value. The resulting emission only happens when the current {@code Flowable} emits (and + * not when the other source emits, unlike combineLatest). + * If the other source doesn't produce any value and just completes, the sequence is completed immediately. + * If the upstream completes before the other source has produced at least one value, the sequence completes + * without emission. *

* * @@ -19149,7 +19730,7 @@ public final Flowable> window( @NonNull @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable withLatestFrom(@NonNull Publisher<@NonNull ? extends U> other, + public final <@NonNull U, @NonNull R> Flowable withLatestFrom(@NonNull Publisher other, @NonNull BiFunction combiner) { Objects.requireNonNull(other, "other is null"); Objects.requireNonNull(combiner, "combiner is null"); @@ -19165,6 +19746,8 @@ public final Flowable> window( * least one value. The resulting emission only happens when the current {@code Flowable} emits (and * not when any of the other sources emit, unlike combineLatest). * If a source doesn't produce any value and just completes, the sequence is completed immediately. + * If the upstream completes before all other sources have produced at least one value, the sequence completes + * without emission. * *

*
Backpressure:
@@ -19188,7 +19771,7 @@ public final Flowable> window( @NonNull @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable withLatestFrom(@NonNull Publisher source1, @NonNull Publisher source2, + public final <@NonNull T1, @NonNull T2, @NonNull R> Flowable withLatestFrom(@NonNull Publisher source1, @NonNull Publisher source2, @NonNull Function3 combiner) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -19205,6 +19788,8 @@ public final Flowable> window( * least one value. The resulting emission only happens when the current {@code Flowable} emits (and * not when any of the other sources emit, unlike combineLatest). * If a source doesn't produce any value and just completes, the sequence is completed immediately. + * If the upstream completes before all other sources have produced at least one value, the sequence completes + * without emission. * *
*
Backpressure:
@@ -19230,7 +19815,7 @@ public final Flowable> window( @NonNull @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable withLatestFrom( + public final <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull R> Flowable withLatestFrom( @NonNull Publisher source1, @NonNull Publisher source2, @NonNull Publisher source3, @NonNull Function4 combiner) { @@ -19250,6 +19835,8 @@ public final Flowable> window( * least one value. The resulting emission only happens when the current {@code Flowable} emits (and * not when any of the other sources emit, unlike combineLatest). * If a source doesn't produce any value and just completes, the sequence is completed immediately. + * If the upstream completes before all other sources have produced at least one value, the sequence completes + * without emission. * *
*
Backpressure:
@@ -19278,7 +19865,7 @@ public final Flowable> window( @NonNull @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable withLatestFrom( + public final <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull R> Flowable withLatestFrom( @NonNull Publisher source1, @NonNull Publisher source2, @NonNull Publisher source3, @NonNull Publisher source4, @NonNull Function5 combiner) { @@ -19299,6 +19886,8 @@ public final Flowable> window( * least one value. The resulting emission only happens when the current {@code Flowable} emits (and * not when any of the other sources emit, unlike combineLatest). * If a source doesn't produce any value and just completes, the sequence is completed immediately. + * If the upstream completes before all other sources have produced at least one value, the sequence completes + * without emission. * *
*
Backpressure:
@@ -19333,6 +19922,8 @@ public final Flowable> window( * least one value. The resulting emission only happens when the current {@code Flowable} emits (and * not when any of the other sources emit, unlike combineLatest). * If a source doesn't produce any value and just completes, the sequence is completed immediately. + * If the upstream completes before all other sources have produced at least one value, the sequence completes + * without emission. * *
*
Backpressure:
@@ -19353,7 +19944,7 @@ public final Flowable> window( @NonNull @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable withLatestFrom(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ?>> others, @NonNull Function combiner) { + public final <@NonNull R> Flowable withLatestFrom(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ?>> others, @NonNull Function combiner) { Objects.requireNonNull(others, "others is null"); Objects.requireNonNull(combiner, "combiner is null"); return RxJavaPlugins.onAssembly(new FlowableWithLatestFromMany<>(this, others, combiner)); @@ -19393,7 +19984,7 @@ public final Flowable withLatestFrom(@NonNull Iterable<@NonNull ? extends @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final <@NonNull U, R> Flowable zipWith(@NonNull Iterable other, @NonNull BiFunction zipper) { + public final <@NonNull U, @NonNull R> Flowable zipWith(@NonNull Iterable other, @NonNull BiFunction zipper) { Objects.requireNonNull(other, "other is null"); Objects.requireNonNull(zipper, "zipper is null"); return RxJavaPlugins.onAssembly(new FlowableZipIterable<>(this, other, zipper)); @@ -19442,7 +20033,7 @@ public final Flowable withLatestFrom(@NonNull Iterable<@NonNull ? extends @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable zipWith(@NonNull Publisher<@NonNull ? extends U> other, @NonNull BiFunction zipper) { + public final <@NonNull U, @NonNull R> Flowable zipWith(@NonNull Publisher other, @NonNull BiFunction zipper) { Objects.requireNonNull(other, "other is null"); return zip(this, other, zipper); } @@ -19493,7 +20084,7 @@ public final Flowable zipWith(@NonNull Publisher<@NonNull ? extends U> @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable zipWith(@NonNull Publisher<@NonNull ? extends U> other, + public final <@NonNull U, @NonNull R> Flowable zipWith(@NonNull Publisher other, @NonNull BiFunction zipper, boolean delayError) { return zip(this, other, zipper, delayError); } @@ -19547,7 +20138,7 @@ public final Flowable zipWith(@NonNull Publisher<@NonNull ? extends U> @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable zipWith(@NonNull Publisher<@NonNull ? extends U> other, + public final <@NonNull U, @NonNull R> Flowable zipWith(@NonNull Publisher other, @NonNull BiFunction zipper, boolean delayError, int bufferSize) { return zip(this, other, zipper, delayError, bufferSize); } @@ -19662,7 +20253,7 @@ public final TestSubscriber test(long initialRequest, boolean cancel) { // No @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable<@NonNull T> fromOptional(@NonNull Optional optional) { + public static <@NonNull T> Flowable<@NonNull T> fromOptional(@NonNull Optional optional) { Objects.requireNonNull(optional, "optional is null"); return optional.map(Flowable::just).orElseGet(Flowable::empty); } @@ -19673,7 +20264,7 @@ public final TestSubscriber test(long initialRequest, boolean cancel) { // No * *

* Note that the operator takes an already instantiated, running or terminated {@code CompletionStage}. - * If the optional is to be created per consumer upon subscription, use {@link #defer(Supplier)} + * If the {@code CompletionStage} is to be created per consumer upon subscription, use {@link #defer(Supplier)} * around {@code fromCompletionStage}: *


      * Flowable.defer(() -> Flowable.fromCompletionStage(createCompletionStage()));
@@ -19700,7 +20291,7 @@ public final TestSubscriber test(long initialRequest, boolean cancel) { // No
     @BackpressureSupport(BackpressureKind.FULL)
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
-    public static  Flowable<@NonNull T> fromCompletionStage(@NonNull CompletionStage stage) {
+    public static <@NonNull T> Flowable<@NonNull T> fromCompletionStage(@NonNull CompletionStage stage) {
         Objects.requireNonNull(stage, "stage is null");
         return RxJavaPlugins.onAssembly(new FlowableFromCompletionStage<>(stage));
     }
@@ -19747,7 +20338,7 @@ public final TestSubscriber test(long initialRequest, boolean cancel) { // No
     @BackpressureSupport(BackpressureKind.FULL)
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
-    public static  Flowable<@NonNull T> fromStream(@NonNull Stream stream) {
+    public static <@NonNull T> Flowable<@NonNull T> fromStream(@NonNull Stream stream) {
         Objects.requireNonNull(stream, "stream is null");
         return RxJavaPlugins.onAssembly(new FlowableFromStream<>(stream));
     }
@@ -19808,7 +20399,7 @@ public final TestSubscriber test(long initialRequest, boolean cancel) { // No
     @BackpressureSupport(BackpressureKind.UNBOUNDED_IN)
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
-    public final <@NonNull R, A> Single collect(@NonNull Collector collector) {
+    public final <@NonNull R, @Nullable A> Single collect(@NonNull Collector collector) {
         Objects.requireNonNull(collector, "collector is null");
         return RxJavaPlugins.onAssembly(new FlowableCollectWithCollectorSingle<>(this, collector));
     }
@@ -20134,7 +20725,7 @@ public final Stream blockingStream(int prefetch) {
     @BackpressureSupport(BackpressureKind.FULL)
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
-    public final <@NonNull R> Flowable concatMapStream(@NonNull Function> mapper) {
+    public final <@NonNull R> Flowable concatMapStream(@NonNull Function> mapper) {
         return flatMapStream(mapper, bufferSize());
     }
 
@@ -20189,7 +20780,7 @@ public final Stream blockingStream(int prefetch) {
     @BackpressureSupport(BackpressureKind.FULL)
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
-    public final <@NonNull R> Flowable concatMapStream(@NonNull Function> mapper, int prefetch) {
+    public final <@NonNull R> Flowable concatMapStream(@NonNull Function> mapper, int prefetch) {
         Objects.requireNonNull(mapper, "mapper is null");
         ObjectHelper.verifyPositive(prefetch, "prefetch");
         return RxJavaPlugins.onAssembly(new FlowableFlatMapStream<>(this, mapper, prefetch));
@@ -20245,7 +20836,7 @@ public final Stream blockingStream(int prefetch) {
     @BackpressureSupport(BackpressureKind.FULL)
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
-    public final <@NonNull R> Flowable flatMapStream(@NonNull Function> mapper) {
+    public final <@NonNull R> Flowable flatMapStream(@NonNull Function> mapper) {
         return flatMapStream(mapper, bufferSize());
     }
 
@@ -20300,7 +20891,7 @@ public final Stream blockingStream(int prefetch) {
     @BackpressureSupport(BackpressureKind.FULL)
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
-    public final <@NonNull R> Flowable flatMapStream(@NonNull Function> mapper, int prefetch) {
+    public final <@NonNull R> Flowable flatMapStream(@NonNull Function> mapper, int prefetch) {
         Objects.requireNonNull(mapper, "mapper is null");
         ObjectHelper.verifyPositive(prefetch, "prefetch");
         return RxJavaPlugins.onAssembly(new FlowableFlatMapStream<>(this, mapper, prefetch));
diff --git a/src/main/java/io/reactivex/rxjava3/core/FlowableConverter.java b/src/main/java/io/reactivex/rxjava3/core/FlowableConverter.java
index d0b1814fb8..1db19b9144 100644
--- a/src/main/java/io/reactivex/rxjava3/core/FlowableConverter.java
+++ b/src/main/java/io/reactivex/rxjava3/core/FlowableConverter.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/FlowableEmitter.java b/src/main/java/io/reactivex/rxjava3/core/FlowableEmitter.java
index 8304edca71..5ad6850389 100644
--- a/src/main/java/io/reactivex/rxjava3/core/FlowableEmitter.java
+++ b/src/main/java/io/reactivex/rxjava3/core/FlowableEmitter.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/FlowableOnSubscribe.java b/src/main/java/io/reactivex/rxjava3/core/FlowableOnSubscribe.java
index 129c6ac7b6..6c5263b779 100644
--- a/src/main/java/io/reactivex/rxjava3/core/FlowableOnSubscribe.java
+++ b/src/main/java/io/reactivex/rxjava3/core/FlowableOnSubscribe.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
@@ -10,13 +10,14 @@
  * 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 io.reactivex.rxjava3.core;
 
 import io.reactivex.rxjava3.annotations.NonNull;
 
 /**
  * A functional interface that has a {@code subscribe()} method that receives
- * an instance of a {@link FlowableEmitter} instance that allows pushing
+ * a {@link FlowableEmitter} instance that allows pushing
  * events in a backpressure-safe and cancellation-safe manner.
  *
  * @param  the value type pushed
diff --git a/src/main/java/io/reactivex/rxjava3/core/FlowableOperator.java b/src/main/java/io/reactivex/rxjava3/core/FlowableOperator.java
index aed58cff89..aa2d5ff0e7 100644
--- a/src/main/java/io/reactivex/rxjava3/core/FlowableOperator.java
+++ b/src/main/java/io/reactivex/rxjava3/core/FlowableOperator.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/FlowableSubscriber.java b/src/main/java/io/reactivex/rxjava3/core/FlowableSubscriber.java
index 38b5bf3459..f97eadbd37 100644
--- a/src/main/java/io/reactivex/rxjava3/core/FlowableSubscriber.java
+++ b/src/main/java/io/reactivex/rxjava3/core/FlowableSubscriber.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
@@ -18,8 +18,10 @@
 import io.reactivex.rxjava3.annotations.NonNull;
 
 /**
- * Represents a Reactive-Streams inspired {@link Subscriber} that is RxJava 2 only
- * and weakens rules §1.3 and §3.9 of the specification for gaining performance.
+ * Represents a Reactive-Streams inspired {@link Subscriber} that is RxJava 3 only
+ * and weakens the Reactive Streams rules §1.3
+ * and §3.9 of the specification
+ * for gaining performance.
  *
  * 

History: 2.0.7 - experimental; 2.1 - beta * @param the value type diff --git a/src/main/java/io/reactivex/rxjava3/core/FlowableTransformer.java b/src/main/java/io/reactivex/rxjava3/core/FlowableTransformer.java index 8aa444afcc..fe51a2d5d7 100644 --- a/src/main/java/io/reactivex/rxjava3/core/FlowableTransformer.java +++ b/src/main/java/io/reactivex/rxjava3/core/FlowableTransformer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/core/Maybe.java b/src/main/java/io/reactivex/rxjava3/core/Maybe.java index 161f7a69d1..8ae4137c83 100644 --- a/src/main/java/io/reactivex/rxjava3/core/Maybe.java +++ b/src/main/java/io/reactivex/rxjava3/core/Maybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -20,7 +20,7 @@ import org.reactivestreams.*; import io.reactivex.rxjava3.annotations.*; -import io.reactivex.rxjava3.disposables.Disposable; +import io.reactivex.rxjava3.disposables.*; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.*; @@ -110,7 +110,7 @@ * @since 2.0 * @see io.reactivex.rxjava3.observers.DisposableMaybeObserver */ -public abstract class Maybe implements MaybeSource { +public abstract class Maybe<@NonNull T> implements MaybeSource { /** * Runs multiple {@link MaybeSource}s provided by an {@link Iterable} sequence and @@ -130,7 +130,7 @@ public abstract class Maybe implements MaybeSource { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe amb(@NonNull Iterable<@NonNull ? extends MaybeSource> sources) { + public static <@NonNull T> Maybe amb(@NonNull Iterable<@NonNull ? extends MaybeSource> sources) { Objects.requireNonNull(sources, "sources is null"); return RxJavaPlugins.onAssembly(new MaybeAmb<>(null, sources)); } @@ -154,7 +154,7 @@ public static Maybe amb(@NonNull Iterable<@NonNull ? extends MaybeSource< @SchedulerSupport(SchedulerSupport.NONE) @NonNull @SafeVarargs - public static Maybe ambArray(@NonNull MaybeSource... sources) { + public static <@NonNull T> Maybe ambArray(@NonNull MaybeSource... sources) { Objects.requireNonNull(sources, "sources is null"); if (sources.length == 0) { return empty(); @@ -187,7 +187,7 @@ public static Maybe ambArray(@NonNull MaybeSource... sources @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concat(@NonNull Iterable<@NonNull ? extends MaybeSource> sources) { + public static <@NonNull T> Flowable concat(@NonNull Iterable<@NonNull ? extends MaybeSource> sources) { Objects.requireNonNull(sources, "sources is null"); return RxJavaPlugins.onAssembly(new MaybeConcatIterable<>(sources)); } @@ -216,7 +216,7 @@ public static Flowable concat(@NonNull Iterable<@NonNull ? extends MaybeS @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concat(@NonNull MaybeSource source1, @NonNull MaybeSource source2) { + public static <@NonNull T> Flowable concat(@NonNull MaybeSource source1, @NonNull MaybeSource source2) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); return concatArray(source1, source2); @@ -248,7 +248,7 @@ public static Flowable concat(@NonNull MaybeSource source1, @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concat( + public static <@NonNull T> Flowable concat( @NonNull MaybeSource source1, @NonNull MaybeSource source2, @NonNull MaybeSource source3) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -284,7 +284,7 @@ public static Flowable concat( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concat( + public static <@NonNull T> Flowable concat( @NonNull MaybeSource source1, @NonNull MaybeSource source2, @NonNull MaybeSource source3, @NonNull MaybeSource source4) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -315,7 +315,7 @@ public static Flowable concat( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable concat(@NonNull Publisher<@NonNull ? extends MaybeSource> sources) { + public static <@NonNull T> Flowable concat(@NonNull Publisher<@NonNull ? extends MaybeSource> sources) { return concat(sources, 2); } @@ -343,7 +343,7 @@ public static Flowable concat(@NonNull Publisher<@NonNull ? extends Maybe @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concat(@NonNull Publisher<@NonNull ? extends MaybeSource> sources, int prefetch) { + public static <@NonNull T> Flowable concat(@NonNull Publisher<@NonNull ? extends MaybeSource> sources, int prefetch) { Objects.requireNonNull(sources, "sources is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); return RxJavaPlugins.onAssembly(new FlowableConcatMapMaybePublisher<>(sources, Functions.identity(), ErrorMode.IMMEDIATE, prefetch)); @@ -370,7 +370,7 @@ public static Flowable concat(@NonNull Publisher<@NonNull ? extends Maybe @NonNull @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs - public static Flowable concatArray(@NonNull MaybeSource... sources) { + public static <@NonNull T> Flowable concatArray(@NonNull MaybeSource... sources) { Objects.requireNonNull(sources, "sources is null"); if (sources.length == 0) { return Flowable.empty(); @@ -404,7 +404,7 @@ public static Flowable concatArray(@NonNull MaybeSource... s @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs @NonNull - public static Flowable concatArrayDelayError(@NonNull MaybeSource... sources) { + public static <@NonNull T> Flowable concatArrayDelayError(@NonNull MaybeSource... sources) { Objects.requireNonNull(sources, "sources is null"); if (sources.length == 0) { return Flowable.empty(); @@ -442,7 +442,7 @@ public static Flowable concatArrayDelayError(@NonNull MaybeSource Flowable concatArrayEager(@NonNull MaybeSource... sources) { + public static <@NonNull T> Flowable concatArrayEager(@NonNull MaybeSource... sources) { return Flowable.fromArray(sources).concatMapEager((Function)MaybeToPublisher.instance()); } /** @@ -471,7 +471,7 @@ public static Flowable concatArrayEager(@NonNull MaybeSource @SchedulerSupport(SchedulerSupport.NONE) @NonNull @SafeVarargs - public static Flowable concatArrayEagerDelayError(@NonNull MaybeSource... sources) { + public static <@NonNull T> Flowable concatArrayEagerDelayError(@NonNull MaybeSource... sources) { return Flowable.fromArray(sources).concatMapEagerDelayError((Function)MaybeToPublisher.instance(), true); } @@ -497,7 +497,7 @@ public static Flowable concatArrayEagerDelayError(@NonNull MaybeSource Flowable concatDelayError(@NonNull Iterable<@NonNull ? extends MaybeSource> sources) { + public static <@NonNull T> Flowable concatDelayError(@NonNull Iterable<@NonNull ? extends MaybeSource> sources) { return Flowable.fromIterable(sources).concatMapMaybeDelayError(Functions.identity()); } @@ -523,7 +523,7 @@ public static Flowable concatDelayError(@NonNull Iterable<@NonNull ? exte @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable concatDelayError(@NonNull Publisher<@NonNull ? extends MaybeSource> sources) { + public static <@NonNull T> Flowable concatDelayError(@NonNull Publisher<@NonNull ? extends MaybeSource> sources) { return Flowable.fromPublisher(sources).concatMapMaybeDelayError(Functions.identity()); } /** @@ -554,7 +554,7 @@ public static Flowable concatDelayError(@NonNull Publisher<@NonNull ? ext @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable concatDelayError(@NonNull Publisher<@NonNull ? extends MaybeSource> sources, int prefetch) { + public static <@NonNull T> Flowable concatDelayError(@NonNull Publisher<@NonNull ? extends MaybeSource> sources, int prefetch) { return Flowable.fromPublisher(sources).concatMapMaybeDelayError(Functions.identity(), true, prefetch); } @@ -582,7 +582,7 @@ public static Flowable concatDelayError(@NonNull Publisher<@NonNull ? ext @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable concatEager(@NonNull Iterable<@NonNull ? extends MaybeSource> sources) { + public static <@NonNull T> Flowable concatEager(@NonNull Iterable<@NonNull ? extends MaybeSource> sources) { return Flowable.fromIterable(sources).concatMapEagerDelayError((Function)MaybeToPublisher.instance(), false); } @@ -615,7 +615,7 @@ public static Flowable concatEager(@NonNull Iterable<@NonNull ? extends M @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable concatEager(@NonNull Iterable<@NonNull ? extends MaybeSource> sources, int maxConcurrency) { + public static <@NonNull T> Flowable concatEager(@NonNull Iterable<@NonNull ? extends MaybeSource> sources, int maxConcurrency) { return Flowable.fromIterable(sources).concatMapEagerDelayError((Function)MaybeToPublisher.instance(), false, maxConcurrency, 1); } @@ -645,7 +645,7 @@ public static Flowable concatEager(@NonNull Iterable<@NonNull ? extends M @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable concatEager(@NonNull Publisher<@NonNull ? extends MaybeSource> sources) { + public static <@NonNull T> Flowable concatEager(@NonNull Publisher<@NonNull ? extends MaybeSource> sources) { return Flowable.fromPublisher(sources).concatMapEager((Function)MaybeToPublisher.instance()); } @@ -680,7 +680,7 @@ public static Flowable concatEager(@NonNull Publisher<@NonNull ? extends @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable concatEager(@NonNull Publisher<@NonNull ? extends MaybeSource> sources, int maxConcurrency) { + public static <@NonNull T> Flowable concatEager(@NonNull Publisher<@NonNull ? extends MaybeSource> sources, int maxConcurrency) { return Flowable.fromPublisher(sources).concatMapEager((Function)MaybeToPublisher.instance(), maxConcurrency, 1); } @@ -710,7 +710,7 @@ public static Flowable concatEager(@NonNull Publisher<@NonNull ? extends @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable concatEagerDelayError(@NonNull Iterable<@NonNull ? extends MaybeSource> sources) { + public static <@NonNull T> Flowable concatEagerDelayError(@NonNull Iterable<@NonNull ? extends MaybeSource> sources) { return Flowable.fromIterable(sources).concatMapEagerDelayError((Function)MaybeToPublisher.instance(), true); } @@ -744,7 +744,7 @@ public static Flowable concatEagerDelayError(@NonNull Iterable<@NonNull ? @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable concatEagerDelayError(@NonNull Iterable<@NonNull ? extends MaybeSource> sources, int maxConcurrency) { + public static <@NonNull T> Flowable concatEagerDelayError(@NonNull Iterable<@NonNull ? extends MaybeSource> sources, int maxConcurrency) { return Flowable.fromIterable(sources).concatMapEagerDelayError((Function)MaybeToPublisher.instance(), true, maxConcurrency, 1); } @@ -776,7 +776,7 @@ public static Flowable concatEagerDelayError(@NonNull Iterable<@NonNull ? @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable concatEagerDelayError(@NonNull Publisher<@NonNull ? extends MaybeSource> sources) { + public static <@NonNull T> Flowable concatEagerDelayError(@NonNull Publisher<@NonNull ? extends MaybeSource> sources) { return Flowable.fromPublisher(sources).concatMapEagerDelayError((Function)MaybeToPublisher.instance(), true); } @@ -812,7 +812,7 @@ public static Flowable concatEagerDelayError(@NonNull Publisher<@NonNull @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable concatEagerDelayError(@NonNull Publisher<@NonNull ? extends MaybeSource> sources, int maxConcurrency) { + public static <@NonNull T> Flowable concatEagerDelayError(@NonNull Publisher<@NonNull ? extends MaybeSource> sources, int maxConcurrency) { return Flowable.fromPublisher(sources).concatMapEagerDelayError((Function)MaybeToPublisher.instance(), true, maxConcurrency, 1); } @@ -866,7 +866,7 @@ public static Flowable concatEagerDelayError(@NonNull Publisher<@NonNull @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe create(@NonNull MaybeOnSubscribe onSubscribe) { + public static <@NonNull T> Maybe create(@NonNull MaybeOnSubscribe onSubscribe) { Objects.requireNonNull(onSubscribe, "onSubscribe is null"); return RxJavaPlugins.onAssembly(new MaybeCreate<>(onSubscribe)); } @@ -889,7 +889,7 @@ public static Maybe create(@NonNull MaybeOnSubscribe onSubscribe) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe defer(@NonNull Supplier> supplier) { + public static <@NonNull T> Maybe defer(@NonNull Supplier> supplier) { Objects.requireNonNull(supplier, "supplier is null"); return RxJavaPlugins.onAssembly(new MaybeDefer<>(supplier)); } @@ -910,7 +910,7 @@ public static Maybe defer(@NonNull Supplier Maybe empty() { + public static <@NonNull T> Maybe empty() { return RxJavaPlugins.onAssembly((Maybe)MaybeEmpty.INSTANCE); } @@ -935,7 +935,7 @@ public static Maybe empty() { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe error(@NonNull Throwable throwable) { + public static <@NonNull T> Maybe error(@NonNull Throwable throwable) { Objects.requireNonNull(throwable, "throwable is null"); return RxJavaPlugins.onAssembly(new MaybeError<>(throwable)); } @@ -961,7 +961,7 @@ public static Maybe error(@NonNull Throwable throwable) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe error(@NonNull Supplier supplier) { + public static <@NonNull T> Maybe error(@NonNull Supplier supplier) { Objects.requireNonNull(supplier, "supplier is null"); return RxJavaPlugins.onAssembly(new MaybeErrorCallable<>(supplier)); } @@ -990,7 +990,7 @@ public static Maybe error(@NonNull Supplier supplier @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe fromAction(@NonNull Action action) { + public static <@NonNull T> Maybe fromAction(@NonNull Action action) { Objects.requireNonNull(action, "action is null"); return RxJavaPlugins.onAssembly(new MaybeFromAction<>(action)); } @@ -1011,7 +1011,7 @@ public static Maybe fromAction(@NonNull Action action) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe fromCompletable(@NonNull CompletableSource completableSource) { + public static <@NonNull T> Maybe fromCompletable(@NonNull CompletableSource completableSource) { Objects.requireNonNull(completableSource, "completableSource is null"); return RxJavaPlugins.onAssembly(new MaybeFromCompletable<>(completableSource)); } @@ -1032,7 +1032,7 @@ public static Maybe fromCompletable(@NonNull CompletableSource completabl @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe fromSingle(@NonNull SingleSource single) { + public static <@NonNull T> Maybe fromSingle(@NonNull SingleSource single) { Objects.requireNonNull(single, "single is null"); return RxJavaPlugins.onAssembly(new MaybeFromSingle<>(single)); } @@ -1079,7 +1079,7 @@ public static Maybe fromSingle(@NonNull SingleSource single) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static <@NonNull T> Maybe fromCallable(@NonNull Callable callable) { + public static Maybe<@NonNull T> fromCallable(@NonNull Callable callable) { Objects.requireNonNull(callable, "callable is null"); return RxJavaPlugins.onAssembly(new MaybeFromCallable<>(callable)); } @@ -1109,6 +1109,7 @@ public static Maybe fromSingle(@NonNull SingleSource single) { * @return the new {@code Maybe} instance * @throws NullPointerException if {@code future} is {@code null} * @see ReactiveX operators documentation: From + * @see #fromCompletionStage(CompletionStage) */ @CheckReturnValue @NonNull @@ -1147,6 +1148,7 @@ public static Maybe fromSingle(@NonNull SingleSource single) { * @return the new {@code Maybe} instance * @throws NullPointerException if {@code future} or {@code unit} is {@code null} * @see ReactiveX operators documentation: From + * @see #fromCompletionStage(CompletionStage) */ @CheckReturnValue @NonNull @@ -1175,7 +1177,7 @@ public static Maybe fromSingle(@NonNull SingleSource single) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe fromObservable(@NonNull ObservableSource source) { + public static <@NonNull T> Maybe fromObservable(@NonNull ObservableSource source) { Objects.requireNonNull(source, "source is null"); return RxJavaPlugins.onAssembly(new ObservableElementAtMaybe<>(source, 0L)); } @@ -1202,7 +1204,7 @@ public static Maybe fromObservable(@NonNull ObservableSource source) { @NonNull @SchedulerSupport(SchedulerSupport.NONE) @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) - public static Maybe fromPublisher(@NonNull Publisher source) { + public static <@NonNull T> Maybe fromPublisher(@NonNull Publisher source) { Objects.requireNonNull(source, "source is null"); return RxJavaPlugins.onAssembly(new FlowableElementAtMaybePublisher<>(source, 0L)); } @@ -1237,7 +1239,7 @@ public static Maybe fromPublisher(@NonNull Publisher source) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe fromRunnable(@NonNull Runnable run) { + public static <@NonNull T> Maybe fromRunnable(@NonNull Runnable run) { Objects.requireNonNull(run, "run is null"); return RxJavaPlugins.onAssembly(new MaybeFromRunnable<>(run)); } @@ -1285,7 +1287,7 @@ public static Maybe fromRunnable(@NonNull Runnable run) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static <@NonNull T> Maybe fromSupplier(@NonNull Supplier supplier) { + public static Maybe<@NonNull T> fromSupplier(@NonNull Supplier supplier) { Objects.requireNonNull(supplier, "supplier is null"); return RxJavaPlugins.onAssembly(new MaybeFromSupplier<>(supplier)); } @@ -1352,7 +1354,7 @@ public static Maybe fromRunnable(@NonNull Runnable run) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable merge(@NonNull Iterable<@NonNull ? extends MaybeSource> sources) { + public static <@NonNull T> Flowable merge(@NonNull Iterable<@NonNull ? extends MaybeSource> sources) { return Flowable.fromIterable(sources).flatMapMaybe(Functions.identity(), false, Integer.MAX_VALUE); } @@ -1390,7 +1392,7 @@ public static Flowable merge(@NonNull Iterable<@NonNull ? extends MaybeSo @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable merge(@NonNull Publisher<@NonNull ? extends MaybeSource> sources) { + public static <@NonNull T> Flowable merge(@NonNull Publisher<@NonNull ? extends MaybeSource> sources) { return merge(sources, Integer.MAX_VALUE); } @@ -1430,7 +1432,7 @@ public static Flowable merge(@NonNull Publisher<@NonNull ? extends MaybeS @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable merge(@NonNull Publisher<@NonNull ? extends MaybeSource> sources, int maxConcurrency) { + public static <@NonNull T> Flowable merge(@NonNull Publisher<@NonNull ? extends MaybeSource> sources, int maxConcurrency) { Objects.requireNonNull(sources, "sources is null"); ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); return RxJavaPlugins.onAssembly(new FlowableFlatMapMaybePublisher<>(sources, Functions.identity(), false, maxConcurrency)); @@ -1463,7 +1465,7 @@ public static Flowable merge(@NonNull Publisher<@NonNull ? extends MaybeS @NonNull @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings({ "unchecked", "rawtypes" }) - public static Maybe merge(@NonNull MaybeSource> source) { + public static <@NonNull T> Maybe merge(@NonNull MaybeSource> source) { Objects.requireNonNull(source, "source is null"); return RxJavaPlugins.onAssembly(new MaybeFlatten(source, Functions.identity())); } @@ -1509,7 +1511,7 @@ public static Maybe merge(@NonNull MaybeSource Flowable merge( + public static <@NonNull T> Flowable merge( @NonNull MaybeSource source1, @NonNull MaybeSource source2 ) { Objects.requireNonNull(source1, "source1 is null"); @@ -1560,7 +1562,7 @@ public static Flowable merge( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable merge( + public static <@NonNull T> Flowable merge( @NonNull MaybeSource source1, @NonNull MaybeSource source2, @NonNull MaybeSource source3 ) { @@ -1615,7 +1617,7 @@ public static Flowable merge( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable merge( + public static <@NonNull T> Flowable merge( @NonNull MaybeSource source1, @NonNull MaybeSource source2, @NonNull MaybeSource source3, @NonNull MaybeSource source4 ) { @@ -1661,7 +1663,7 @@ public static Flowable merge( @NonNull @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs - public static Flowable mergeArray(MaybeSource... sources) { + public static <@NonNull T> Flowable mergeArray(MaybeSource... sources) { Objects.requireNonNull(sources, "sources is null"); if (sources.length == 0) { return Flowable.empty(); @@ -1706,7 +1708,7 @@ public static Flowable mergeArray(MaybeSource... sources) { @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs @NonNull - public static Flowable mergeArrayDelayError(@NonNull MaybeSource... sources) { + public static <@NonNull T> Flowable mergeArrayDelayError(@NonNull MaybeSource... sources) { Objects.requireNonNull(sources, "sources is null"); return Flowable.fromArray(sources).flatMapMaybe(Functions.identity(), true, Math.max(1, sources.length)); } @@ -1744,7 +1746,7 @@ public static Flowable mergeArrayDelayError(@NonNull MaybeSource Flowable mergeDelayError(@NonNull Iterable<@NonNull ? extends MaybeSource> sources) { + public static <@NonNull T> Flowable mergeDelayError(@NonNull Iterable<@NonNull ? extends MaybeSource> sources) { return Flowable.fromIterable(sources).flatMapMaybe(Functions.identity(), true, Integer.MAX_VALUE); } @@ -1780,7 +1782,7 @@ public static Flowable mergeDelayError(@NonNull Iterable<@NonNull ? exten @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable mergeDelayError(@NonNull Publisher<@NonNull ? extends MaybeSource> sources) { + public static <@NonNull T> Flowable mergeDelayError(@NonNull Publisher<@NonNull ? extends MaybeSource> sources) { return mergeDelayError(sources, Integer.MAX_VALUE); } @@ -1819,7 +1821,7 @@ public static Flowable mergeDelayError(@NonNull Publisher<@NonNull ? exte @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable mergeDelayError(@NonNull Publisher<@NonNull ? extends MaybeSource> sources, int maxConcurrency) { + public static <@NonNull T> Flowable mergeDelayError(@NonNull Publisher<@NonNull ? extends MaybeSource> sources, int maxConcurrency) { Objects.requireNonNull(sources, "sources is null"); ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); return RxJavaPlugins.onAssembly(new FlowableFlatMapMaybePublisher<>(sources, Functions.identity(), true, maxConcurrency)); @@ -1858,7 +1860,7 @@ public static Flowable mergeDelayError(@NonNull Publisher<@NonNull ? exte @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable mergeDelayError(@NonNull MaybeSource source1, @NonNull MaybeSource source2) { + public static <@NonNull T> Flowable mergeDelayError(@NonNull MaybeSource source1, @NonNull MaybeSource source2) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); return mergeArrayDelayError(source1, source2); @@ -1900,7 +1902,7 @@ public static Flowable mergeDelayError(@NonNull MaybeSource @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable mergeDelayError(@NonNull MaybeSource source1, + public static <@NonNull T> Flowable mergeDelayError(@NonNull MaybeSource source1, @NonNull MaybeSource source2, @NonNull MaybeSource source3) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -1946,7 +1948,7 @@ public static Flowable mergeDelayError(@NonNull MaybeSource @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable mergeDelayError( + public static <@NonNull T> Flowable mergeDelayError( @NonNull MaybeSource source1, @NonNull MaybeSource source2, @NonNull MaybeSource source3, @NonNull MaybeSource source4) { Objects.requireNonNull(source1, "source1 is null"); @@ -1976,7 +1978,7 @@ public static Flowable mergeDelayError( @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings("unchecked") @NonNull - public static Maybe never() { + public static <@NonNull T> Maybe never() { return RxJavaPlugins.onAssembly((Maybe)MaybeNever.INSTANCE); } @@ -2003,7 +2005,7 @@ public static Maybe never() { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Single sequenceEqual(@NonNull MaybeSource source1, @NonNull MaybeSource source2) { + public static <@NonNull T> Single sequenceEqual(@NonNull MaybeSource source1, @NonNull MaybeSource source2) { return sequenceEqual(source1, source2, ObjectHelper.equalsPredicate()); } @@ -2033,7 +2035,7 @@ public static Single sequenceEqual(@NonNull MaybeSource Single sequenceEqual(@NonNull MaybeSource source1, @NonNull MaybeSource source2, + public static <@NonNull T> Single sequenceEqual(@NonNull MaybeSource source1, @NonNull MaybeSource source2, @NonNull BiPredicate isEqual) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -2070,7 +2072,7 @@ public static Single sequenceEqual(@NonNull MaybeSource Flowable switchOnNext(@NonNull Publisher<@NonNull ? extends MaybeSource> sources) { + public static <@NonNull T> Flowable switchOnNext(@NonNull Publisher<@NonNull ? extends MaybeSource> sources) { Objects.requireNonNull(sources, "sources is null"); return RxJavaPlugins.onAssembly(new FlowableSwitchMapMaybePublisher<>(sources, Functions.identity(), false)); } @@ -2105,7 +2107,7 @@ public static Flowable switchOnNext(@NonNull Publisher<@NonNull ? extends @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable switchOnNextDelayError(@NonNull Publisher<@NonNull ? extends MaybeSource> sources) { + public static <@NonNull T> Flowable switchOnNextDelayError(@NonNull Publisher<@NonNull ? extends MaybeSource> sources) { Objects.requireNonNull(sources, "sources is null"); return RxJavaPlugins.onAssembly(new FlowableSwitchMapMaybePublisher<>(sources, Functions.identity(), true)); } @@ -2181,7 +2183,7 @@ public static Maybe timer(long delay, @NonNull TimeUnit unit, @NonNull Sch @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe unsafeCreate(@NonNull MaybeSource onSubscribe) { + public static <@NonNull T> Maybe unsafeCreate(@NonNull MaybeSource onSubscribe) { if (onSubscribe instanceof Maybe) { throw new IllegalArgumentException("unsafeCreate(Maybe) should be upgraded"); } @@ -2214,7 +2216,7 @@ public static Maybe unsafeCreate(@NonNull MaybeSource onSubscribe) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Maybe using(@NonNull Supplier resourceSupplier, + public static <@NonNull T, @NonNull D> Maybe using(@NonNull Supplier resourceSupplier, @NonNull Function> sourceSupplier, @NonNull Consumer resourceCleanup) { return using(resourceSupplier, sourceSupplier, resourceCleanup, true); @@ -2253,7 +2255,7 @@ public static Maybe using(@NonNull Supplier resourceSuppl @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe using(@NonNull Supplier resourceSupplier, + public static <@NonNull T, @NonNull D> Maybe using(@NonNull Supplier resourceSupplier, @NonNull Function> sourceSupplier, @NonNull Consumer resourceCleanup, boolean eager) { Objects.requireNonNull(resourceSupplier, "resourceSupplier is null"); @@ -2279,7 +2281,7 @@ public static Maybe using(@NonNull Supplier resourceSuppl @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe wrap(@NonNull MaybeSource source) { + public static <@NonNull T> Maybe wrap(@NonNull MaybeSource source) { if (source instanceof Maybe) { return RxJavaPlugins.onAssembly((Maybe)source); } @@ -2318,7 +2320,7 @@ public static Maybe wrap(@NonNull MaybeSource source) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe zip(@NonNull Iterable<@NonNull ? extends MaybeSource> sources, @NonNull Function zipper) { + public static <@NonNull T, @NonNull R> Maybe zip(@NonNull Iterable<@NonNull ? extends MaybeSource> sources, @NonNull Function zipper) { Objects.requireNonNull(zipper, "zipper is null"); Objects.requireNonNull(sources, "sources is null"); return RxJavaPlugins.onAssembly(new MaybeZipIterable<>(sources, zipper)); @@ -2354,7 +2356,7 @@ public static Maybe zip(@NonNull Iterable<@NonNull ? extends MaybeSour @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe zip( + public static <@NonNull T1, @NonNull T2, @NonNull R> Maybe zip( @NonNull MaybeSource source1, @NonNull MaybeSource source2, @NonNull BiFunction zipper) { Objects.requireNonNull(source1, "source1 is null"); @@ -2396,7 +2398,7 @@ public static Maybe zip( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe zip( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull R> Maybe zip( @NonNull MaybeSource source1, @NonNull MaybeSource source2, @NonNull MaybeSource source3, @NonNull Function3 zipper) { Objects.requireNonNull(source1, "source1 is null"); @@ -2443,7 +2445,7 @@ public static Maybe zip( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe zip( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull R> Maybe zip( @NonNull MaybeSource source1, @NonNull MaybeSource source2, @NonNull MaybeSource source3, @NonNull MaybeSource source4, @NonNull Function4 zipper) { @@ -2495,7 +2497,7 @@ public static Maybe zip( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe zip( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull R> Maybe zip( @NonNull MaybeSource source1, @NonNull MaybeSource source2, @NonNull MaybeSource source3, @NonNull MaybeSource source4, @NonNull MaybeSource source5, @NonNull Function5 zipper) { @@ -2551,7 +2553,7 @@ public static Maybe zip( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe zip( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull R> Maybe zip( @NonNull MaybeSource source1, @NonNull MaybeSource source2, @NonNull MaybeSource source3, @NonNull MaybeSource source4, @NonNull MaybeSource source5, @NonNull MaybeSource source6, @NonNull Function6 zipper) { @@ -2612,7 +2614,7 @@ public static Maybe zip( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe zip( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull R> Maybe zip( @NonNull MaybeSource source1, @NonNull MaybeSource source2, @NonNull MaybeSource source3, @NonNull MaybeSource source4, @NonNull MaybeSource source5, @NonNull MaybeSource source6, @NonNull MaybeSource source7, @@ -2678,7 +2680,7 @@ public static Maybe zip( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe zip( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull T8, @NonNull R> Maybe zip( @NonNull MaybeSource source1, @NonNull MaybeSource source2, @NonNull MaybeSource source3, @NonNull MaybeSource source4, @NonNull MaybeSource source5, @NonNull MaybeSource source6, @NonNull MaybeSource source7, @NonNull MaybeSource source8, @@ -2747,7 +2749,7 @@ public static Maybe zip( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe zip( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull T8, @NonNull T9, @NonNull R> Maybe zip( @NonNull MaybeSource source1, @NonNull MaybeSource source2, @NonNull MaybeSource source3, @NonNull MaybeSource source4, @NonNull MaybeSource source5, @NonNull MaybeSource source6, @NonNull MaybeSource source7, @NonNull MaybeSource source8, @NonNull MaybeSource source9, @@ -2798,7 +2800,7 @@ public static Maybe zip( @NonNull @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs - public static Maybe zipArray(@NonNull Function zipper, + public static <@NonNull T, @NonNull R> Maybe zipArray(@NonNull Function zipper, @NonNull MaybeSource... sources) { Objects.requireNonNull(sources, "sources is null"); if (sources.length == 0) { @@ -3058,7 +3060,7 @@ public final Maybe cache() { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Maybe cast(@NonNull Class clazz) { + public final <@NonNull U> Maybe cast(@NonNull Class clazz) { Objects.requireNonNull(clazz, "clazz is null"); return map(Functions.castFunction(clazz)); } @@ -3088,7 +3090,7 @@ public final Maybe cast(@NonNull Class clazz) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Maybe compose(@NonNull MaybeTransformer transformer) { + public final <@NonNull R> Maybe compose(@NonNull MaybeTransformer transformer) { return wrap(((MaybeTransformer) Objects.requireNonNull(transformer, "transformer is null")).apply(this)); } @@ -3113,7 +3115,7 @@ public final Maybe compose(@NonNull MaybeTransformer Maybe concatMap(@NonNull Function> mapper) { + public final <@NonNull R> Maybe concatMap(@NonNull Function> mapper) { return flatMap(mapper); } @@ -3169,7 +3171,7 @@ public final Completable concatMapCompletable(@NonNull Function Maybe concatMapSingle(@NonNull Function> mapper) { + public final <@NonNull R> Maybe concatMapSingle(@NonNull Function> mapper) { return flatMapSingle(mapper); } @@ -3444,7 +3446,7 @@ public final Maybe delay(long time, @NonNull TimeUnit unit, @NonNull Schedule @NonNull @SchedulerSupport(SchedulerSupport.NONE) @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) - public final Maybe delay(@NonNull Publisher delayIndicator) { + public final <@NonNull U> Maybe delay(@NonNull Publisher delayIndicator) { Objects.requireNonNull(delayIndicator, "delayIndicator is null"); return RxJavaPlugins.onAssembly(new MaybeDelayOtherPublisher<>(this, delayIndicator)); } @@ -3471,7 +3473,7 @@ public final Maybe delay(@NonNull Publisher delayIndicator) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Maybe delaySubscription(@NonNull Publisher subscriptionIndicator) { + public final <@NonNull U> Maybe delaySubscription(@NonNull Publisher subscriptionIndicator) { Objects.requireNonNull(subscriptionIndicator, "subscriptionIndicator is null"); return RxJavaPlugins.onAssembly(new MaybeDelaySubscriptionOtherPublisher<>(this, subscriptionIndicator)); } @@ -3875,7 +3877,7 @@ public final Maybe filter(@NonNull Predicate predicate) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Maybe flatMap(@NonNull Function> mapper) { + public final <@NonNull R> Maybe flatMap(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new MaybeFlatten<>(this, mapper)); } @@ -3905,7 +3907,7 @@ public final Maybe flatMap(@NonNull Function Maybe flatMap( + public final <@NonNull R> Maybe flatMap( @NonNull Function> onSuccessMapper, @NonNull Function> onErrorMapper, @NonNull Supplier> onCompleteSupplier) { @@ -3941,7 +3943,7 @@ public final Maybe flatMap( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Maybe flatMap(@NonNull Function> mapper, + public final <@NonNull U, @NonNull R> Maybe flatMap(@NonNull Function> mapper, @NonNull BiFunction combiner) { Objects.requireNonNull(mapper, "mapper is null"); Objects.requireNonNull(combiner, "combiner is null"); @@ -3974,7 +3976,7 @@ public final Maybe flatMap(@NonNull Function Flowable flattenAsFlowable(@NonNull Function> mapper) { + public final <@NonNull U> Flowable flattenAsFlowable(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new MaybeFlatMapIterableFlowable<>(this, mapper)); } @@ -4001,7 +4003,7 @@ public final Flowable flattenAsFlowable(@NonNull Function Observable flattenAsObservable(@NonNull Function> mapper) { + public final <@NonNull U> Observable flattenAsObservable(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new MaybeFlatMapIterableObservable<>(this, mapper)); } @@ -4026,7 +4028,7 @@ public final Observable flattenAsObservable(@NonNull Function Observable flatMapObservable(@NonNull Function> mapper) { + public final <@NonNull R> Observable flatMapObservable(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new MaybeFlatMapObservable<>(this, mapper)); } @@ -4055,7 +4057,7 @@ public final Observable flatMapObservable(@NonNull Function Flowable flatMapPublisher(@NonNull Function> mapper) { + public final <@NonNull R> Flowable flatMapPublisher(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new MaybeFlatMapPublisher<>(this, mapper)); } @@ -4084,7 +4086,7 @@ public final Flowable flatMapPublisher(@NonNull Function Maybe flatMapSingle(@NonNull Function> mapper) { + public final <@NonNull R> Maybe flatMapSingle(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new MaybeFlatMapSingle<>(this, mapper)); } @@ -4324,7 +4326,7 @@ public final Single isEmpty() { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Maybe lift(@NonNull MaybeOperator lift) { + public final <@NonNull R> Maybe lift(@NonNull MaybeOperator lift) { Objects.requireNonNull(lift, "lift is null"); return RxJavaPlugins.onAssembly(new MaybeLift<>(this, lift)); } @@ -4349,7 +4351,7 @@ public final Maybe lift(@NonNull MaybeOperator li @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Maybe map(@NonNull Function mapper) { + public final <@NonNull R> Maybe map(@NonNull Function mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new MaybeMap<>(this, mapper)); } @@ -4451,7 +4453,7 @@ public final Maybe observeOn(@NonNull Scheduler scheduler) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Maybe ofType(@NonNull Class clazz) { + public final <@NonNull U> Maybe ofType(@NonNull Class clazz) { Objects.requireNonNull(clazz, "clazz is null"); return filter(Functions.isInstanceOf(clazz)).cast(clazz); } @@ -4843,7 +4845,7 @@ public final Flowable repeatUntil(@NonNull BooleanSupplier stop) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable repeatWhen(@NonNull Function, ? extends Publisher<@NonNull ?>> handler) { + public final Flowable repeatWhen(@NonNull Function, @NonNull ? extends Publisher<@NonNull ?>> handler) { return toFlowable().repeatWhen(handler); } @@ -5061,7 +5063,7 @@ public final Maybe retryUntil(@NonNull BooleanSupplier stop) { @SchedulerSupport(SchedulerSupport.NONE) @NonNull public final Maybe retryWhen( - @NonNull Function, ? extends Publisher<@NonNull ?>> handler) { + @NonNull Function, @NonNull ? extends Publisher<@NonNull ?>> handler) { return toFlowable().retryWhen(handler).singleElement(); } @@ -5226,6 +5228,7 @@ public final Flowable startWith(@NonNull Publisher other) { * * @return the new {@link Disposable} instance that can be used for disposing the subscription at any time * @see ReactiveX operators documentation: Subscribe + * @see #subscribe(Consumer, Consumer, Action, DisposableContainer) */ @SchedulerSupport(SchedulerSupport.NONE) @NonNull @@ -5250,6 +5253,7 @@ public final Disposable subscribe() { * @throws NullPointerException * if {@code onSuccess} is {@code null} * @see ReactiveX operators documentation: Subscribe + * @see #subscribe(Consumer, Consumer, Action, DisposableContainer) */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @@ -5272,10 +5276,11 @@ public final Disposable subscribe(@NonNull Consumer onSuccess) { * the {@code Consumer} you have designed to accept any error notification from the * {@code Maybe} * @return the new {@link Disposable} instance that can be used for disposing the subscription at any time - * @see ReactiveX operators documentation: Subscribe * @throws NullPointerException * if {@code onSuccess} is {@code null}, or * if {@code onError} is {@code null} + * @see ReactiveX operators documentation: Subscribe + * @see #subscribe(Consumer, Consumer, Action, DisposableContainer) */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @@ -5305,6 +5310,7 @@ public final Disposable subscribe(@NonNull Consumer onSuccess, @NonNu * if {@code onSuccess}, {@code onError} or * {@code onComplete} is {@code null} * @see ReactiveX operators documentation: Subscribe + * @see #subscribe(Consumer, Consumer, Action, DisposableContainer) */ @CheckReturnValue @NonNull @@ -5317,6 +5323,47 @@ public final Disposable subscribe(@NonNull Consumer onSuccess, @NonNu return subscribeWith(new MaybeCallbackObserver<>(onSuccess, onError, onComplete)); } + /** + * Wraps the given onXXX callbacks into a {@link Disposable} {@link MaybeObserver}, + * adds it to the given {@link DisposableContainer} and ensures, that if the upstream + * terminates or this particular {@code Disposable} is disposed, the {@code MaybeObserver} is removed + * from the given composite. + *

+ * The {@code MaybeObserver} will be removed after the callback for the terminal event has been invoked. + *

+ *
Scheduler:
+ *
{@code subscribe} does not operate by default on a particular {@link Scheduler}.
+ *
+ * @param onSuccess the callback for upstream items + * @param onError the callback for an upstream error + * @param onComplete the callback for an upstream completion without any value or error + * @param container the {@code DisposableContainer} (such as {@link CompositeDisposable}) to add and remove the + * created {@code Disposable} {@code MaybeObserver} + * @return the {@code Disposable} that allows disposing the particular subscription. + * @throws NullPointerException + * if {@code onSuccess}, {@code onError}, + * {@code onComplete} or {@code container} is {@code null} + * @since 3.1.0 + */ + @SchedulerSupport(SchedulerSupport.NONE) + @NonNull + public final Disposable subscribe( + @NonNull Consumer onSuccess, + @NonNull Consumer onError, + @NonNull Action onComplete, + @NonNull DisposableContainer container) { + Objects.requireNonNull(onSuccess, "onSuccess is null"); + Objects.requireNonNull(onError, "onError is null"); + Objects.requireNonNull(onComplete, "onComplete is null"); + Objects.requireNonNull(container, "container is null"); + + DisposableAutoReleaseMultiObserver observer = new DisposableAutoReleaseMultiObserver<>( + container, onSuccess, onError, onComplete); + container.add(observer); + subscribe(observer); + return observer; + } + @SchedulerSupport(SchedulerSupport.NONE) @Override public final void subscribe(@NonNull MaybeObserver observer) { @@ -5472,7 +5519,7 @@ public final Single switchIfEmpty(@NonNull SingleSource other) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Maybe takeUntil(@NonNull MaybeSource other) { + public final <@NonNull U> Maybe takeUntil(@NonNull MaybeSource other) { Objects.requireNonNull(other, "other is null"); return RxJavaPlugins.onAssembly(new MaybeTakeUntilMaybe<>(this, other)); } @@ -5503,7 +5550,7 @@ public final Maybe takeUntil(@NonNull MaybeSource other) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Maybe takeUntil(@NonNull Publisher other) { + public final <@NonNull U> Maybe takeUntil(@NonNull Publisher other) { Objects.requireNonNull(other, "other is null"); return RxJavaPlugins.onAssembly(new MaybeTakeUntilPublisher<>(this, other)); } @@ -5868,7 +5915,7 @@ public final Maybe timeout(long timeout, @NonNull TimeUnit unit, @NonNull Sch @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Maybe timeout(@NonNull MaybeSource timeoutIndicator) { + public final <@NonNull U> Maybe timeout(@NonNull MaybeSource timeoutIndicator) { Objects.requireNonNull(timeoutIndicator, "timeoutIndicator is null"); return RxJavaPlugins.onAssembly(new MaybeTimeoutMaybe<>(this, timeoutIndicator, null)); } @@ -5893,7 +5940,7 @@ public final Maybe timeout(@NonNull MaybeSource timeoutIndicator) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Maybe timeout(@NonNull MaybeSource timeoutIndicator, @NonNull MaybeSource fallback) { + public final <@NonNull U> Maybe timeout(@NonNull MaybeSource timeoutIndicator, @NonNull MaybeSource fallback) { Objects.requireNonNull(timeoutIndicator, "timeoutIndicator is null"); Objects.requireNonNull(fallback, "fallback is null"); return RxJavaPlugins.onAssembly(new MaybeTimeoutMaybe<>(this, timeoutIndicator, fallback)); @@ -5921,7 +5968,7 @@ public final Maybe timeout(@NonNull MaybeSource timeoutIndicator, @Non @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Maybe timeout(@NonNull Publisher timeoutIndicator) { + public final <@NonNull U> Maybe timeout(@NonNull Publisher timeoutIndicator) { Objects.requireNonNull(timeoutIndicator, "timeoutIndicator is null"); return RxJavaPlugins.onAssembly(new MaybeTimeoutPublisher<>(this, timeoutIndicator, null)); } @@ -5950,7 +5997,7 @@ public final Maybe timeout(@NonNull Publisher timeoutIndicator) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Maybe timeout(@NonNull Publisher timeoutIndicator, @NonNull MaybeSource fallback) { + public final <@NonNull U> Maybe timeout(@NonNull Publisher timeoutIndicator, @NonNull MaybeSource fallback) { Objects.requireNonNull(timeoutIndicator, "timeoutIndicator is null"); Objects.requireNonNull(fallback, "fallback is null"); return RxJavaPlugins.onAssembly(new MaybeTimeoutPublisher<>(this, timeoutIndicator, fallback)); @@ -6007,7 +6054,7 @@ public final Maybe unsubscribeOn(@NonNull Scheduler scheduler) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Maybe zipWith(@NonNull MaybeSource other, @NonNull BiFunction zipper) { + public final <@NonNull U, @NonNull R> Maybe zipWith(@NonNull MaybeSource other, @NonNull BiFunction zipper) { Objects.requireNonNull(other, "other is null"); return zip(this, other, zipper); } @@ -6089,7 +6136,7 @@ public final TestObserver test(boolean dispose) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Maybe<@NonNull T> fromOptional(@NonNull Optional optional) { + public static <@NonNull T> Maybe<@NonNull T> fromOptional(@NonNull Optional optional) { Objects.requireNonNull(optional, "optional is null"); return optional.map(Maybe::just).orElseGet(Maybe::empty); } @@ -6100,7 +6147,7 @@ public final TestObserver test(boolean dispose) { * *

* Note that the operator takes an already instantiated, running or terminated {@code CompletionStage}. - * If the optional is to be created per consumer upon subscription, use {@link #defer(Supplier)} + * If the {@code CompletionStage} is to be created per consumer upon subscription, use {@link #defer(Supplier)} * around {@code fromCompletionStage}: *


      * Maybe.defer(() -> Maybe.fromCompletionStage(createCompletionStage()));
@@ -6123,7 +6170,7 @@ public final TestObserver test(boolean dispose) {
     @CheckReturnValue
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
-    public static  Maybe<@NonNull T> fromCompletionStage(@NonNull CompletionStage stage) {
+    public static <@NonNull T> Maybe<@NonNull T> fromCompletionStage(@NonNull CompletionStage stage) {
         Objects.requireNonNull(stage, "stage is null");
         return RxJavaPlugins.onAssembly(new MaybeFromCompletionStage<>(stage));
     }
@@ -6259,7 +6306,7 @@ public final CompletionStage toCompletionStage(@Nullable T defaultItem) {
     @SchedulerSupport(SchedulerSupport.NONE)
     @BackpressureSupport(BackpressureKind.FULL)
     @NonNull
-    public final  Flowable flattenStreamAsFlowable(@NonNull Function> mapper) {
+    public final <@NonNull R> Flowable flattenStreamAsFlowable(@NonNull Function> mapper) {
         Objects.requireNonNull(mapper, "mapper is null");
         return RxJavaPlugins.onAssembly(new MaybeFlattenStreamAsFlowable<>(this, mapper));
     }
@@ -6299,7 +6346,7 @@ public final  Flowable flattenStreamAsFlowable(@NonNull Function Observable flattenStreamAsObservable(@NonNull Function> mapper) {
+    public final <@NonNull R> Observable flattenStreamAsObservable(@NonNull Function> mapper) {
         Objects.requireNonNull(mapper, "mapper is null");
         return RxJavaPlugins.onAssembly(new MaybeFlattenStreamAsObservable<>(this, mapper));
     }
diff --git a/src/main/java/io/reactivex/rxjava3/core/MaybeConverter.java b/src/main/java/io/reactivex/rxjava3/core/MaybeConverter.java
index 221e8a671a..6ef529de7e 100644
--- a/src/main/java/io/reactivex/rxjava3/core/MaybeConverter.java
+++ b/src/main/java/io/reactivex/rxjava3/core/MaybeConverter.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/MaybeEmitter.java b/src/main/java/io/reactivex/rxjava3/core/MaybeEmitter.java
index eb7f1f7241..57d7f5a219 100644
--- a/src/main/java/io/reactivex/rxjava3/core/MaybeEmitter.java
+++ b/src/main/java/io/reactivex/rxjava3/core/MaybeEmitter.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/MaybeObserver.java b/src/main/java/io/reactivex/rxjava3/core/MaybeObserver.java
index b0974fa97c..f6567dc94e 100644
--- a/src/main/java/io/reactivex/rxjava3/core/MaybeObserver.java
+++ b/src/main/java/io/reactivex/rxjava3/core/MaybeObserver.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/MaybeOnSubscribe.java b/src/main/java/io/reactivex/rxjava3/core/MaybeOnSubscribe.java
index f02756199e..67994d3d40 100644
--- a/src/main/java/io/reactivex/rxjava3/core/MaybeOnSubscribe.java
+++ b/src/main/java/io/reactivex/rxjava3/core/MaybeOnSubscribe.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
@@ -10,13 +10,14 @@
  * 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 io.reactivex.rxjava3.core;
 
 import io.reactivex.rxjava3.annotations.NonNull;
 
 /**
  * A functional interface that has a {@code subscribe()} method that receives
- * an instance of a {@link MaybeEmitter} instance that allows pushing
+ * a {@link MaybeEmitter} instance that allows pushing
  * an event in a cancellation-safe manner.
  *
  * @param  the value type pushed
diff --git a/src/main/java/io/reactivex/rxjava3/core/MaybeOperator.java b/src/main/java/io/reactivex/rxjava3/core/MaybeOperator.java
index 4ddb18d1f7..7cea758dd9 100644
--- a/src/main/java/io/reactivex/rxjava3/core/MaybeOperator.java
+++ b/src/main/java/io/reactivex/rxjava3/core/MaybeOperator.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
@@ -10,6 +10,7 @@
  * 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 io.reactivex.rxjava3.core;
 
 import io.reactivex.rxjava3.annotations.NonNull;
diff --git a/src/main/java/io/reactivex/rxjava3/core/MaybeSource.java b/src/main/java/io/reactivex/rxjava3/core/MaybeSource.java
index da9dbf0658..a15ea2c89d 100644
--- a/src/main/java/io/reactivex/rxjava3/core/MaybeSource.java
+++ b/src/main/java/io/reactivex/rxjava3/core/MaybeSource.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
@@ -10,6 +10,7 @@
  * 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 io.reactivex.rxjava3.core;
 
 import io.reactivex.rxjava3.annotations.NonNull;
diff --git a/src/main/java/io/reactivex/rxjava3/core/MaybeTransformer.java b/src/main/java/io/reactivex/rxjava3/core/MaybeTransformer.java
index 620076d722..770497fe3c 100644
--- a/src/main/java/io/reactivex/rxjava3/core/MaybeTransformer.java
+++ b/src/main/java/io/reactivex/rxjava3/core/MaybeTransformer.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/Notification.java b/src/main/java/io/reactivex/rxjava3/core/Notification.java
index 086ffafc8e..7f5896209f 100644
--- a/src/main/java/io/reactivex/rxjava3/core/Notification.java
+++ b/src/main/java/io/reactivex/rxjava3/core/Notification.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
@@ -26,7 +26,9 @@ public final class Notification {
 
     final Object value;
 
-    /** Not meant to be implemented externally. */
+    /** Not meant to be implemented externally.
+     * @param value the value to carry around in the notification, not {@code null}
+     */
     private Notification(@Nullable Object value) {
         this.value = value;
     }
diff --git a/src/main/java/io/reactivex/rxjava3/core/Observable.java b/src/main/java/io/reactivex/rxjava3/core/Observable.java
index 366e2bdd51..fcf809cdf6 100644
--- a/src/main/java/io/reactivex/rxjava3/core/Observable.java
+++ b/src/main/java/io/reactivex/rxjava3/core/Observable.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
@@ -20,11 +20,10 @@
 import org.reactivestreams.Publisher;
 
 import io.reactivex.rxjava3.annotations.*;
-import io.reactivex.rxjava3.disposables.Disposable;
+import io.reactivex.rxjava3.disposables.*;
 import io.reactivex.rxjava3.exceptions.*;
 import io.reactivex.rxjava3.functions.*;
 import io.reactivex.rxjava3.internal.functions.*;
-import io.reactivex.rxjava3.internal.fuseable.ScalarSupplier;
 import io.reactivex.rxjava3.internal.jdk8.*;
 import io.reactivex.rxjava3.internal.observers.*;
 import io.reactivex.rxjava3.internal.operators.flowable.*;
@@ -35,6 +34,7 @@
 import io.reactivex.rxjava3.internal.util.*;
 import io.reactivex.rxjava3.observables.*;
 import io.reactivex.rxjava3.observers.*;
+import io.reactivex.rxjava3.operators.ScalarSupplier;
 import io.reactivex.rxjava3.plugins.RxJavaPlugins;
 import io.reactivex.rxjava3.schedulers.*;
 
@@ -105,10 +105,18 @@ public abstract class Observable<@NonNull T> implements ObservableSource {
      * Mirrors the one {@link ObservableSource} in an {@link Iterable} of several {@code ObservableSource}s that first either emits an item or sends
      * a termination notification.
      * 

- * + * + *

+ * When one of the {@code ObservableSource}s signal an item or terminates first, all subscriptions to the other + * {@code ObservableSource}s are disposed. *

*
Scheduler:
*
{@code amb} does not operate by default on a particular {@link Scheduler}.
+ *
Error handling:
+ *
+ * If any of the losing {@code ObservableSource}s signals an error, the error is routed to the global + * error handler via {@link RxJavaPlugins#onError(Throwable)}. + *
*
* * @param the common element type @@ -122,7 +130,7 @@ public abstract class Observable<@NonNull T> implements ObservableSource { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable amb(@NonNull Iterable<@NonNull ? extends ObservableSource> sources) { + public static <@NonNull T> Observable amb(@NonNull Iterable<@NonNull ? extends ObservableSource> sources) { Objects.requireNonNull(sources, "sources is null"); return RxJavaPlugins.onAssembly(new ObservableAmb<>(null, sources)); } @@ -131,10 +139,18 @@ public static Observable amb(@NonNull Iterable<@NonNull ? extends Observa * Mirrors the one {@link ObservableSource} in an array of several {@code ObservableSource}s that first either emits an item or sends * a termination notification. *

- * + * + *

+ * When one of the {@code ObservableSource}s signal an item or terminates first, all subscriptions to the other + * {@code ObservableSource}s are disposed. *

*
Scheduler:
*
{@code ambArray} does not operate by default on a particular {@link Scheduler}.
+ *
Error handling:
+ *
+ * If any of the losing {@code ObservableSource}s signals an error, the error is routed to the global + * error handler via {@link RxJavaPlugins#onError(Throwable)}. + *
*
* * @param the common element type @@ -150,7 +166,7 @@ public static Observable amb(@NonNull Iterable<@NonNull ? extends Observa @NonNull @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs - public static Observable ambArray(@NonNull ObservableSource... sources) { + public static <@NonNull T> Observable ambArray(@NonNull ObservableSource... sources) { Objects.requireNonNull(sources, "sources is null"); int len = sources.length; if (len == 0) { @@ -212,7 +228,7 @@ public static int bufferSize() { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable combineLatest( + public static <@NonNull T, @NonNull R> Observable combineLatest( @NonNull Iterable<@NonNull ? extends ObservableSource> sources, @NonNull Function combiner) { return combineLatest(sources, combiner, bufferSize()); @@ -259,7 +275,7 @@ public static Observable combineLatest( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable combineLatest( + public static <@NonNull T, @NonNull R> Observable combineLatest( @NonNull Iterable<@NonNull ? extends ObservableSource> sources, @NonNull Function combiner, int bufferSize) { Objects.requireNonNull(sources, "sources is null"); @@ -309,7 +325,7 @@ public static Observable combineLatest( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable combineLatestArray( + public static <@NonNull T, @NonNull R> Observable combineLatestArray( @NonNull ObservableSource[] sources, @NonNull Function combiner) { return combineLatestArray(sources, combiner, bufferSize()); @@ -356,7 +372,7 @@ public static Observable combineLatestArray( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable combineLatestArray( + public static <@NonNull T, @NonNull R> Observable combineLatestArray( @NonNull ObservableSource[] sources, @NonNull Function combiner, int bufferSize) { Objects.requireNonNull(sources, "sources is null"); @@ -403,7 +419,7 @@ public static Observable combineLatestArray( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable combineLatest( + public static <@NonNull T1, @NonNull T2, @NonNull R> Observable combineLatest( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull BiFunction combiner) { Objects.requireNonNull(source1, "source1 is null"); @@ -447,7 +463,7 @@ public static Observable combineLatest( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable combineLatest( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull R> Observable combineLatest( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3, @NonNull Function3 combiner) { @@ -497,7 +513,7 @@ public static Observable combineLatest( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable combineLatest( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull R> Observable combineLatest( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3, @NonNull ObservableSource source4, @NonNull Function4 combiner) { @@ -551,7 +567,7 @@ public static Observable combineLatest( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable combineLatest( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull R> Observable combineLatest( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3, @NonNull ObservableSource source4, @NonNull ObservableSource source5, @@ -610,7 +626,7 @@ public static Observable combineLatest( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable combineLatest( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull R> Observable combineLatest( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3, @NonNull ObservableSource source4, @NonNull ObservableSource source5, @NonNull ObservableSource source6, @@ -674,7 +690,7 @@ public static Observable combineLatest( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable combineLatest( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull R> Observable combineLatest( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3, @NonNull ObservableSource source4, @NonNull ObservableSource source5, @NonNull ObservableSource source6, @@ -743,7 +759,7 @@ public static Observable combineLatest( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable combineLatest( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull T8, @NonNull R> Observable combineLatest( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3, @NonNull ObservableSource source4, @NonNull ObservableSource source5, @NonNull ObservableSource source6, @@ -816,7 +832,7 @@ public static Observable combineLatest( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable combineLatest( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull T8, @NonNull T9, @NonNull R> Observable combineLatest( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3, @NonNull ObservableSource source4, @NonNull ObservableSource source5, @NonNull ObservableSource source6, @@ -874,7 +890,7 @@ public static Observable combineLates @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable combineLatestArrayDelayError( + public static <@NonNull T, @NonNull R> Observable combineLatestArrayDelayError( @NonNull ObservableSource[] sources, @NonNull Function combiner) { return combineLatestArrayDelayError(sources, combiner, bufferSize()); @@ -922,7 +938,7 @@ public static Observable combineLatestArrayDelayError( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable combineLatestArrayDelayError(@NonNull ObservableSource[] sources, + public static <@NonNull T, @NonNull R> Observable combineLatestArrayDelayError(@NonNull ObservableSource[] sources, @NonNull Function combiner, int bufferSize) { Objects.requireNonNull(sources, "sources is null"); Objects.requireNonNull(combiner, "combiner is null"); @@ -974,7 +990,7 @@ public static Observable combineLatestArrayDelayError(@NonNull Observa @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable combineLatestDelayError(@NonNull Iterable<@NonNull ? extends ObservableSource> sources, + public static <@NonNull T, @NonNull R> Observable combineLatestDelayError(@NonNull Iterable<@NonNull ? extends ObservableSource> sources, @NonNull Function combiner) { return combineLatestDelayError(sources, combiner, bufferSize()); } @@ -1021,7 +1037,7 @@ public static Observable combineLatestDelayError(@NonNull Iterable<@No @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable combineLatestDelayError(@NonNull Iterable<@NonNull ? extends ObservableSource> sources, + public static <@NonNull T, @NonNull R> Observable combineLatestDelayError(@NonNull Iterable<@NonNull ? extends ObservableSource> sources, @NonNull Function combiner, int bufferSize) { Objects.requireNonNull(sources, "sources is null"); Objects.requireNonNull(combiner, "combiner is null"); @@ -1050,7 +1066,7 @@ public static Observable combineLatestDelayError(@NonNull Iterable<@No @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable concat(@NonNull Iterable<@NonNull ? extends ObservableSource> sources) { + public static <@NonNull T> Observable concat(@NonNull Iterable<@NonNull ? extends ObservableSource> sources) { Objects.requireNonNull(sources, "sources is null"); return fromIterable(sources).concatMapDelayError((Function)Functions.identity(), false, bufferSize()); } @@ -1075,7 +1091,7 @@ public static Observable concat(@NonNull Iterable<@NonNull ? extends Obse @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable concat(@NonNull ObservableSource> sources) { + public static <@NonNull T> Observable concat(@NonNull ObservableSource> sources) { return concat(sources, bufferSize()); } @@ -1103,7 +1119,7 @@ public static Observable concat(@NonNull ObservableSource Observable concat(@NonNull ObservableSource> sources, int bufferSize) { + public static <@NonNull T> Observable concat(@NonNull ObservableSource> sources, int bufferSize) { Objects.requireNonNull(sources, "sources is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); return RxJavaPlugins.onAssembly(new ObservableConcatMap(sources, Functions.identity(), bufferSize, ErrorMode.IMMEDIATE)); @@ -1131,7 +1147,7 @@ public static Observable concat(@NonNull ObservableSource Observable concat(@NonNull ObservableSource source1, ObservableSource source2) { + public static <@NonNull T> Observable concat(@NonNull ObservableSource source1, ObservableSource source2) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); return concatArray(source1, source2); @@ -1161,7 +1177,7 @@ public static Observable concat(@NonNull ObservableSource so @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable concat( + public static <@NonNull T> Observable concat( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3) { Objects.requireNonNull(source1, "source1 is null"); @@ -1196,7 +1212,7 @@ public static Observable concat( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable concat( + public static <@NonNull T> Observable concat( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3, @NonNull ObservableSource source4) { Objects.requireNonNull(source1, "source1 is null"); @@ -1226,7 +1242,7 @@ public static Observable concat( @SchedulerSupport(SchedulerSupport.NONE) @NonNull @SafeVarargs - public static Observable concatArray(@NonNull ObservableSource... sources) { + public static <@NonNull T> Observable concatArray(@NonNull ObservableSource... sources) { Objects.requireNonNull(sources, "sources is null"); if (sources.length == 0) { return empty(); @@ -1255,7 +1271,7 @@ public static Observable concatArray(@NonNull ObservableSource Observable concatArrayDelayError(@NonNull ObservableSource... sources) { + public static <@NonNull T> Observable concatArrayDelayError(@NonNull ObservableSource... sources) { Objects.requireNonNull(sources, "sources is null"); if (sources.length == 0) { return empty(); @@ -1290,7 +1306,7 @@ public static Observable concatArrayDelayError(@NonNull ObservableSource< @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs @NonNull - public static Observable concatArrayEager(@NonNull ObservableSource... sources) { + public static <@NonNull T> Observable concatArrayEager(@NonNull ObservableSource... sources) { return concatArrayEager(bufferSize(), bufferSize(), sources); } @@ -1321,7 +1337,7 @@ public static Observable concatArrayEager(@NonNull ObservableSource Observable concatArrayEager(int maxConcurrency, int bufferSize, @NonNull ObservableSource... sources) { + public static <@NonNull T> Observable concatArrayEager(int maxConcurrency, int bufferSize, @NonNull ObservableSource... sources) { return fromArray(sources).concatMapEagerDelayError((Function)Functions.identity(), false, maxConcurrency, bufferSize); } @@ -1348,7 +1364,7 @@ public static Observable concatArrayEager(int maxConcurrency, int bufferS @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs @NonNull - public static Observable concatArrayEagerDelayError(@NonNull ObservableSource... sources) { + public static <@NonNull T> Observable concatArrayEagerDelayError(@NonNull ObservableSource... sources) { return concatArrayEagerDelayError(bufferSize(), bufferSize(), sources); } @@ -1380,7 +1396,7 @@ public static Observable concatArrayEagerDelayError(@NonNull ObservableSo @SchedulerSupport(SchedulerSupport.NONE) @NonNull @SafeVarargs - public static Observable concatArrayEagerDelayError(int maxConcurrency, int bufferSize, @NonNull ObservableSource... sources) { + public static <@NonNull T> Observable concatArrayEagerDelayError(int maxConcurrency, int bufferSize, @NonNull ObservableSource... sources) { return fromArray(sources).concatMapEagerDelayError((Function)Functions.identity(), true, maxConcurrency, bufferSize); } @@ -1403,7 +1419,7 @@ public static Observable concatArrayEagerDelayError(int maxConcurrency, i @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable concatDelayError(@NonNull Iterable<@NonNull ? extends ObservableSource> sources) { + public static <@NonNull T> Observable concatDelayError(@NonNull Iterable<@NonNull ? extends ObservableSource> sources) { Objects.requireNonNull(sources, "sources is null"); return concatDelayError(fromIterable(sources)); } @@ -1427,7 +1443,7 @@ public static Observable concatDelayError(@NonNull Iterable<@NonNull ? ex @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable concatDelayError(@NonNull ObservableSource> sources) { + public static <@NonNull T> Observable concatDelayError(@NonNull ObservableSource> sources) { return concatDelayError(sources, bufferSize(), true); } @@ -1454,7 +1470,7 @@ public static Observable concatDelayError(@NonNull ObservableSource Observable concatDelayError(@NonNull ObservableSource> sources, int bufferSize, boolean tillTheEnd) { + public static <@NonNull T> Observable concatDelayError(@NonNull ObservableSource> sources, int bufferSize, boolean tillTheEnd) { Objects.requireNonNull(sources, "sources is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize is null"); return RxJavaPlugins.onAssembly(new ObservableConcatMap(sources, Functions.identity(), bufferSize, tillTheEnd ? ErrorMode.END : ErrorMode.BOUNDARY)); @@ -1481,7 +1497,7 @@ public static Observable concatDelayError(@NonNull ObservableSource Observable concatEager(@NonNull Iterable<@NonNull ? extends ObservableSource> sources) { + public static <@NonNull T> Observable concatEager(@NonNull Iterable<@NonNull ? extends ObservableSource> sources) { return concatEager(sources, bufferSize(), bufferSize()); } @@ -1512,7 +1528,7 @@ public static Observable concatEager(@NonNull Iterable<@NonNull ? extends @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable concatEager(@NonNull Iterable<@NonNull ? extends ObservableSource> sources, int maxConcurrency, int bufferSize) { + public static <@NonNull T> Observable concatEager(@NonNull Iterable<@NonNull ? extends ObservableSource> sources, int maxConcurrency, int bufferSize) { return fromIterable(sources).concatMapEagerDelayError((Function)Functions.identity(), false, maxConcurrency, bufferSize); } @@ -1537,7 +1553,7 @@ public static Observable concatEager(@NonNull Iterable<@NonNull ? extends @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable concatEager(@NonNull ObservableSource> sources) { + public static <@NonNull T> Observable concatEager(@NonNull ObservableSource> sources) { return concatEager(sources, bufferSize(), bufferSize()); } @@ -1569,7 +1585,7 @@ public static Observable concatEager(@NonNull ObservableSource Observable concatEager(@NonNull ObservableSource> sources, int maxConcurrency, int bufferSize) { + public static <@NonNull T> Observable concatEager(@NonNull ObservableSource> sources, int maxConcurrency, int bufferSize) { return wrap(sources).concatMapEager((Function)Functions.identity(), maxConcurrency, bufferSize); } @@ -1595,7 +1611,7 @@ public static Observable concatEager(@NonNull ObservableSource Observable concatEagerDelayError(@NonNull Iterable<@NonNull ? extends ObservableSource> sources) { + public static <@NonNull T> Observable concatEagerDelayError(@NonNull Iterable<@NonNull ? extends ObservableSource> sources) { return concatEagerDelayError(sources, bufferSize(), bufferSize()); } @@ -1627,7 +1643,7 @@ public static Observable concatEagerDelayError(@NonNull Iterable<@NonNull @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable concatEagerDelayError(@NonNull Iterable<@NonNull ? extends ObservableSource> sources, int maxConcurrency, int bufferSize) { + public static <@NonNull T> Observable concatEagerDelayError(@NonNull Iterable<@NonNull ? extends ObservableSource> sources, int maxConcurrency, int bufferSize) { return fromIterable(sources).concatMapEagerDelayError((Function)Functions.identity(), true, maxConcurrency, bufferSize); } @@ -1653,7 +1669,7 @@ public static Observable concatEagerDelayError(@NonNull Iterable<@NonNull @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable concatEagerDelayError(@NonNull ObservableSource> sources) { + public static <@NonNull T> Observable concatEagerDelayError(@NonNull ObservableSource> sources) { return concatEagerDelayError(sources, bufferSize(), bufferSize()); } @@ -1684,7 +1700,7 @@ public static Observable concatEagerDelayError(@NonNull ObservableSource< @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable concatEagerDelayError(@NonNull ObservableSource> sources, int maxConcurrency, int bufferSize) { + public static <@NonNull T> Observable concatEagerDelayError(@NonNull ObservableSource> sources, int maxConcurrency, int bufferSize) { return wrap(sources).concatMapEagerDelayError((Function)Functions.identity(), true, maxConcurrency, bufferSize); } @@ -1742,7 +1758,7 @@ public static Observable concatEagerDelayError(@NonNull ObservableSource< @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable create(@NonNull ObservableOnSubscribe source) { + public static <@NonNull T> Observable create(@NonNull ObservableOnSubscribe source) { Objects.requireNonNull(source, "source is null"); return RxJavaPlugins.onAssembly(new ObservableCreate<>(source)); } @@ -1774,7 +1790,7 @@ public static Observable create(@NonNull ObservableOnSubscribe source) @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable defer(@NonNull Supplier> supplier) { + public static <@NonNull T> Observable defer(@NonNull Supplier> supplier) { Objects.requireNonNull(supplier, "supplier is null"); return RxJavaPlugins.onAssembly(new ObservableDefer<>(supplier)); } @@ -1798,7 +1814,7 @@ public static Observable defer(@NonNull Supplier Observable empty() { + public static <@NonNull T> Observable empty() { return RxJavaPlugins.onAssembly((Observable) ObservableEmpty.INSTANCE); } @@ -1823,7 +1839,7 @@ public static Observable empty() { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable error(@NonNull Supplier supplier) { + public static <@NonNull T> Observable error(@NonNull Supplier supplier) { Objects.requireNonNull(supplier, "supplier is null"); return RxJavaPlugins.onAssembly(new ObservableError<>(supplier)); } @@ -1849,7 +1865,7 @@ public static Observable error(@NonNull Supplier sup @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable error(@NonNull Throwable throwable) { + public static <@NonNull T> Observable error(@NonNull Throwable throwable) { Objects.requireNonNull(throwable, "throwable is null"); return error(Functions.justSupplier(throwable)); } @@ -1879,7 +1895,7 @@ public static Observable error(@NonNull Throwable throwable) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable fromAction(@NonNull Action action) { + public static <@NonNull T> Observable fromAction(@NonNull Action action) { Objects.requireNonNull(action, "action is null"); return RxJavaPlugins.onAssembly(new ObservableFromAction<>(action)); } @@ -1905,7 +1921,7 @@ public static Observable fromAction(@NonNull Action action) { @SchedulerSupport(SchedulerSupport.NONE) @NonNull @SafeVarargs - public static Observable fromArray(@NonNull T... items) { + public static <@NonNull T> Observable fromArray(@NonNull T... items) { Objects.requireNonNull(items, "items is null"); if (items.length == 0) { return empty(); @@ -1949,7 +1965,7 @@ public static Observable fromArray(@NonNull T... items) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable fromCallable(@NonNull Callable callable) { + public static <@NonNull T> Observable fromCallable(@NonNull Callable callable) { Objects.requireNonNull(callable, "callable is null"); return RxJavaPlugins.onAssembly(new ObservableFromCallable<>(callable)); } @@ -1970,7 +1986,7 @@ public static Observable fromCallable(@NonNull Callable call @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable fromCompletable(@NonNull CompletableSource completableSource) { + public static <@NonNull T> Observable fromCompletable(@NonNull CompletableSource completableSource) { Objects.requireNonNull(completableSource, "completableSource is null"); return RxJavaPlugins.onAssembly(new ObservableFromCompletable<>(completableSource)); } @@ -2004,11 +2020,12 @@ public static Observable fromCompletable(@NonNull CompletableSource compl * @return the new {@code Observable} instance * @throws NullPointerException if {@code future} is {@code null} * @see ReactiveX operators documentation: From + * @see #fromCompletionStage(CompletionStage) */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable fromFuture(@NonNull Future future) { + public static <@NonNull T> Observable fromFuture(@NonNull Future future) { Objects.requireNonNull(future, "future is null"); return RxJavaPlugins.onAssembly(new ObservableFromFuture<>(future, 0L, null)); } @@ -2046,11 +2063,12 @@ public static Observable fromFuture(@NonNull Future future) * @return the new {@code Observable} instance * @throws NullPointerException if {@code future} or {@code unit} is {@code null} * @see ReactiveX operators documentation: From + * @see #fromCompletionStage(CompletionStage) */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable fromFuture(@NonNull Future future, long timeout, @NonNull TimeUnit unit) { + public static <@NonNull T> Observable fromFuture(@NonNull Future future, long timeout, @NonNull TimeUnit unit) { Objects.requireNonNull(future, "future is null"); Objects.requireNonNull(unit, "unit is null"); return RxJavaPlugins.onAssembly(new ObservableFromFuture<>(future, timeout, unit)); @@ -2078,7 +2096,7 @@ public static Observable fromFuture(@NonNull Future future, @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable fromIterable(@NonNull Iterable<@NonNull ? extends T> source) { + public static <@NonNull T> Observable fromIterable(@NonNull Iterable source) { Objects.requireNonNull(source, "source is null"); return RxJavaPlugins.onAssembly(new ObservableFromIterable<>(source)); } @@ -2102,7 +2120,7 @@ public static Observable fromIterable(@NonNull Iterable<@NonNull ? extend @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable fromMaybe(@NonNull MaybeSource maybe) { + public static <@NonNull T> Observable fromMaybe(@NonNull MaybeSource maybe) { Objects.requireNonNull(maybe, "maybe is null"); return RxJavaPlugins.onAssembly(new MaybeToObservable<>(maybe)); } @@ -2139,7 +2157,7 @@ public static Observable fromMaybe(@NonNull MaybeSource maybe) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable fromPublisher(@NonNull Publisher<@NonNull ? extends T> publisher) { + public static <@NonNull T> Observable fromPublisher(@NonNull Publisher publisher) { Objects.requireNonNull(publisher, "publisher is null"); return RxJavaPlugins.onAssembly(new ObservableFromPublisher<>(publisher)); } @@ -2175,7 +2193,7 @@ public static Observable fromPublisher(@NonNull Publisher<@NonNull ? exte @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable fromRunnable(@NonNull Runnable run) { + public static <@NonNull T> Observable fromRunnable(@NonNull Runnable run) { Objects.requireNonNull(run, "run is null"); return RxJavaPlugins.onAssembly(new ObservableFromRunnable<>(run)); } @@ -2198,7 +2216,7 @@ public static Observable fromRunnable(@NonNull Runnable run) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable fromSingle(@NonNull SingleSource source) { + public static <@NonNull T> Observable fromSingle(@NonNull SingleSource source) { Objects.requireNonNull(source, "source is null"); return RxJavaPlugins.onAssembly(new SingleToObservable<>(source)); } @@ -2236,7 +2254,7 @@ public static Observable fromSingle(@NonNull SingleSource source) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable fromSupplier(@NonNull Supplier supplier) { + public static <@NonNull T> Observable fromSupplier(@NonNull Supplier supplier) { Objects.requireNonNull(supplier, "supplier is null"); return RxJavaPlugins.onAssembly(new ObservableFromSupplier<>(supplier)); } @@ -2266,7 +2284,7 @@ public static Observable fromSupplier(@NonNull Supplier supp @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable generate(@NonNull Consumer> generator) { + public static <@NonNull T> Observable generate(@NonNull Consumer> generator) { Objects.requireNonNull(generator, "generator is null"); return generate(Functions.nullSupplier(), ObservableInternalHelper.simpleGenerator(generator), Functions.emptyConsumer()); @@ -2299,7 +2317,7 @@ public static Observable generate(@NonNull Consumer> generator @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable generate(@NonNull Supplier initialState, @NonNull BiConsumer> generator) { + public static <@NonNull T, @NonNull S> Observable generate(@NonNull Supplier initialState, @NonNull BiConsumer> generator) { Objects.requireNonNull(generator, "generator is null"); return generate(initialState, ObservableInternalHelper.simpleBiGenerator(generator), Functions.emptyConsumer()); } @@ -2333,7 +2351,7 @@ public static Observable generate(@NonNull Supplier initialState, @ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable generate( + public static <@NonNull T, @NonNull S> Observable generate( @NonNull Supplier initialState, @NonNull BiConsumer> generator, @NonNull Consumer disposeState) { @@ -2369,7 +2387,7 @@ public static Observable generate( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable generate(@NonNull Supplier initialState, @NonNull BiFunction, S> generator) { + public static <@NonNull T, @NonNull S> Observable generate(@NonNull Supplier initialState, @NonNull BiFunction, S> generator) { return generate(initialState, generator, Functions.emptyConsumer()); } @@ -2403,7 +2421,7 @@ public static Observable generate(@NonNull Supplier initialState, @ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable generate(@NonNull Supplier initialState, @NonNull BiFunction, S> generator, + public static <@NonNull T, @NonNull S> Observable generate(@NonNull Supplier initialState, @NonNull BiFunction, S> generator, @NonNull Consumer disposeState) { Objects.requireNonNull(initialState, "initialState is null"); Objects.requireNonNull(generator, "generator is null"); @@ -2627,7 +2645,7 @@ public static Observable intervalRange(long start, long count, long initia @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable just(@NonNull T item) { + public static <@NonNull T> Observable just(@NonNull T item) { Objects.requireNonNull(item, "item is null"); return RxJavaPlugins.onAssembly(new ObservableJust<>(item)); } @@ -2654,7 +2672,7 @@ public static Observable just(@NonNull T item) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable just(@NonNull T item1, @NonNull T item2) { + public static <@NonNull T> Observable just(@NonNull T item1, @NonNull T item2) { Objects.requireNonNull(item1, "item1 is null"); Objects.requireNonNull(item2, "item2 is null"); @@ -2685,7 +2703,7 @@ public static Observable just(@NonNull T item1, @NonNull T item2) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable just(@NonNull T item1, @NonNull T item2, @NonNull T item3) { + public static <@NonNull T> Observable just(@NonNull T item1, @NonNull T item2, @NonNull T item3) { Objects.requireNonNull(item1, "item1 is null"); Objects.requireNonNull(item2, "item2 is null"); Objects.requireNonNull(item3, "item3 is null"); @@ -2719,7 +2737,7 @@ public static Observable just(@NonNull T item1, @NonNull T item2, @NonNul @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable just(@NonNull T item1, @NonNull T item2, @NonNull T item3, @NonNull T item4) { + public static <@NonNull T> Observable just(@NonNull T item1, @NonNull T item2, @NonNull T item3, @NonNull T item4) { Objects.requireNonNull(item1, "item1 is null"); Objects.requireNonNull(item2, "item2 is null"); Objects.requireNonNull(item3, "item3 is null"); @@ -2757,7 +2775,7 @@ public static Observable just(@NonNull T item1, @NonNull T item2, @NonNul @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable just(@NonNull T item1, @NonNull T item2, @NonNull T item3, @NonNull T item4, @NonNull T item5) { + public static <@NonNull T> Observable just(@NonNull T item1, @NonNull T item2, @NonNull T item3, @NonNull T item4, @NonNull T item5) { Objects.requireNonNull(item1, "item1 is null"); Objects.requireNonNull(item2, "item2 is null"); Objects.requireNonNull(item3, "item3 is null"); @@ -2798,7 +2816,7 @@ public static Observable just(@NonNull T item1, @NonNull T item2, @NonNul @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable just(@NonNull T item1, @NonNull T item2, @NonNull T item3, @NonNull T item4, @NonNull T item5, @NonNull T item6) { + public static <@NonNull T> Observable just(@NonNull T item1, @NonNull T item2, @NonNull T item3, @NonNull T item4, @NonNull T item5, @NonNull T item6) { Objects.requireNonNull(item1, "item1 is null"); Objects.requireNonNull(item2, "item2 is null"); Objects.requireNonNull(item3, "item3 is null"); @@ -2843,7 +2861,7 @@ public static Observable just(@NonNull T item1, @NonNull T item2, @NonNul @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable just(@NonNull T item1, @NonNull T item2, @NonNull T item3, @NonNull T item4, @NonNull T item5, @NonNull T item6, @NonNull T item7) { + public static <@NonNull T> Observable just(@NonNull T item1, @NonNull T item2, @NonNull T item3, @NonNull T item4, @NonNull T item5, @NonNull T item6, @NonNull T item7) { Objects.requireNonNull(item1, "item1 is null"); Objects.requireNonNull(item2, "item2 is null"); Objects.requireNonNull(item3, "item3 is null"); @@ -2891,7 +2909,7 @@ public static Observable just(@NonNull T item1, @NonNull T item2, @NonNul @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable just(@NonNull T item1, @NonNull T item2, @NonNull T item3, @NonNull T item4, @NonNull T item5, @NonNull T item6, @NonNull T item7, @NonNull T item8) { + public static <@NonNull T> Observable just(@NonNull T item1, @NonNull T item2, @NonNull T item3, @NonNull T item4, @NonNull T item5, @NonNull T item6, @NonNull T item7, @NonNull T item8) { Objects.requireNonNull(item1, "item1 is null"); Objects.requireNonNull(item2, "item2 is null"); Objects.requireNonNull(item3, "item3 is null"); @@ -2942,7 +2960,7 @@ public static Observable just(@NonNull T item1, @NonNull T item2, @NonNul @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable just(@NonNull T item1, @NonNull T item2, @NonNull T item3, @NonNull T item4, @NonNull T item5, @NonNull T item6, @NonNull T item7, @NonNull T item8, @NonNull T item9) { + public static <@NonNull T> Observable just(@NonNull T item1, @NonNull T item2, @NonNull T item3, @NonNull T item4, @NonNull T item5, @NonNull T item6, @NonNull T item7, @NonNull T item8, @NonNull T item9) { Objects.requireNonNull(item1, "item1 is null"); Objects.requireNonNull(item2, "item2 is null"); Objects.requireNonNull(item3, "item3 is null"); @@ -2997,7 +3015,7 @@ public static Observable just(@NonNull T item1, @NonNull T item2, @NonNul @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable just(@NonNull T item1, @NonNull T item2, @NonNull T item3, @NonNull T item4, @NonNull T item5, @NonNull T item6, @NonNull T item7, @NonNull T item8, @NonNull T item9, @NonNull T item10) { + public static <@NonNull T> Observable just(@NonNull T item1, @NonNull T item2, @NonNull T item3, @NonNull T item4, @NonNull T item5, @NonNull T item6, @NonNull T item7, @NonNull T item8, @NonNull T item9, @NonNull T item10) { Objects.requireNonNull(item1, "item1 is null"); Objects.requireNonNull(item2, "item2 is null"); Objects.requireNonNull(item3, "item3 is null"); @@ -3056,7 +3074,7 @@ public static Observable just(@NonNull T item1, @NonNull T item2, @NonNul @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable merge(@NonNull Iterable<@NonNull ? extends ObservableSource> sources, int maxConcurrency, int bufferSize) { + public static <@NonNull T> Observable merge(@NonNull Iterable<@NonNull ? extends ObservableSource> sources, int maxConcurrency, int bufferSize) { return fromIterable(sources).flatMap((Function)Functions.identity(), false, maxConcurrency, bufferSize); } @@ -3105,7 +3123,7 @@ public static Observable merge(@NonNull Iterable<@NonNull ? extends Obser @SchedulerSupport(SchedulerSupport.NONE) @NonNull @SafeVarargs - public static Observable mergeArray(int maxConcurrency, int bufferSize, @NonNull ObservableSource... sources) { + public static <@NonNull T> Observable mergeArray(int maxConcurrency, int bufferSize, @NonNull ObservableSource... sources) { return fromArray(sources).flatMap((Function)Functions.identity(), false, maxConcurrency, bufferSize); } @@ -3146,7 +3164,7 @@ public static Observable mergeArray(int maxConcurrency, int bufferSize, @ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable merge(@NonNull Iterable<@NonNull ? extends ObservableSource> sources) { + public static <@NonNull T> Observable merge(@NonNull Iterable<@NonNull ? extends ObservableSource> sources) { return fromIterable(sources).flatMap((Function)Functions.identity()); } @@ -3192,7 +3210,7 @@ public static Observable merge(@NonNull Iterable<@NonNull ? extends Obser @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable merge(@NonNull Iterable<@NonNull ? extends ObservableSource> sources, int maxConcurrency) { + public static <@NonNull T> Observable merge(@NonNull Iterable<@NonNull ? extends ObservableSource> sources, int maxConcurrency) { return fromIterable(sources).flatMap((Function)Functions.identity(), maxConcurrency); } @@ -3234,7 +3252,7 @@ public static Observable merge(@NonNull Iterable<@NonNull ? extends Obser @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings({ "unchecked", "rawtypes" }) @NonNull - public static Observable merge(@NonNull ObservableSource> sources) { + public static <@NonNull T> Observable merge(@NonNull ObservableSource> sources) { Objects.requireNonNull(sources, "sources is null"); return RxJavaPlugins.onAssembly(new ObservableFlatMap(sources, Functions.identity(), false, Integer.MAX_VALUE, bufferSize())); } @@ -3283,7 +3301,7 @@ public static Observable merge(@NonNull ObservableSource Observable merge(@NonNull ObservableSource> sources, int maxConcurrency) { + public static <@NonNull T> Observable merge(@NonNull ObservableSource> sources, int maxConcurrency) { Objects.requireNonNull(sources, "sources is null"); ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); return RxJavaPlugins.onAssembly(new ObservableFlatMap(sources, Functions.identity(), false, maxConcurrency, bufferSize())); @@ -3328,7 +3346,7 @@ public static Observable merge(@NonNull ObservableSource Observable merge(@NonNull ObservableSource source1, @NonNull ObservableSource source2) { + public static <@NonNull T> Observable merge(@NonNull ObservableSource source1, @NonNull ObservableSource source2) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); return fromArray(source1, source2).flatMap((Function)Functions.identity(), false, 2); @@ -3375,7 +3393,7 @@ public static Observable merge(@NonNull ObservableSource sou @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable merge( + public static <@NonNull T> Observable merge( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3) { Objects.requireNonNull(source1, "source1 is null"); @@ -3427,7 +3445,7 @@ public static Observable merge( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable merge( + public static <@NonNull T> Observable merge( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3, @NonNull ObservableSource source4) { Objects.requireNonNull(source1, "source1 is null"); @@ -3475,7 +3493,7 @@ public static Observable merge( @SchedulerSupport(SchedulerSupport.NONE) @NonNull @SafeVarargs - public static Observable mergeArray(@NonNull ObservableSource... sources) { + public static <@NonNull T> Observable mergeArray(@NonNull ObservableSource... sources) { return fromArray(sources).flatMap((Function)Functions.identity(), sources.length); } @@ -3508,7 +3526,7 @@ public static Observable mergeArray(@NonNull ObservableSource Observable mergeDelayError(@NonNull Iterable<@NonNull ? extends ObservableSource> sources) { + public static <@NonNull T> Observable mergeDelayError(@NonNull Iterable<@NonNull ? extends ObservableSource> sources) { return fromIterable(sources).flatMap((Function)Functions.identity(), true); } @@ -3546,7 +3564,7 @@ public static Observable mergeDelayError(@NonNull Iterable<@NonNull ? ext @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable mergeDelayError(@NonNull Iterable<@NonNull ? extends ObservableSource> sources, int maxConcurrency, int bufferSize) { + public static <@NonNull T> Observable mergeDelayError(@NonNull Iterable<@NonNull ? extends ObservableSource> sources, int maxConcurrency, int bufferSize) { return fromIterable(sources).flatMap((Function)Functions.identity(), true, maxConcurrency, bufferSize); } @@ -3585,7 +3603,7 @@ public static Observable mergeDelayError(@NonNull Iterable<@NonNull ? ext @SchedulerSupport(SchedulerSupport.NONE) @NonNull @SafeVarargs - public static Observable mergeArrayDelayError(int maxConcurrency, int bufferSize, @NonNull ObservableSource... sources) { + public static <@NonNull T> Observable mergeArrayDelayError(int maxConcurrency, int bufferSize, @NonNull ObservableSource... sources) { return fromArray(sources).flatMap((Function)Functions.identity(), true, maxConcurrency, bufferSize); } @@ -3621,7 +3639,7 @@ public static Observable mergeArrayDelayError(int maxConcurrency, int buf @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable mergeDelayError(@NonNull Iterable<@NonNull ? extends ObservableSource> sources, int maxConcurrency) { + public static <@NonNull T> Observable mergeDelayError(@NonNull Iterable<@NonNull ? extends ObservableSource> sources, int maxConcurrency) { return fromIterable(sources).flatMap((Function)Functions.identity(), true, maxConcurrency); } @@ -3654,7 +3672,7 @@ public static Observable mergeDelayError(@NonNull Iterable<@NonNull ? ext @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings({ "unchecked", "rawtypes" }) @NonNull - public static Observable mergeDelayError(@NonNull ObservableSource> sources) { + public static <@NonNull T> Observable mergeDelayError(@NonNull ObservableSource> sources) { Objects.requireNonNull(sources, "sources is null"); return RxJavaPlugins.onAssembly(new ObservableFlatMap(sources, Functions.identity(), true, Integer.MAX_VALUE, bufferSize())); } @@ -3693,7 +3711,7 @@ public static Observable mergeDelayError(@NonNull ObservableSource Observable mergeDelayError(@NonNull ObservableSource> sources, int maxConcurrency) { + public static <@NonNull T> Observable mergeDelayError(@NonNull ObservableSource> sources, int maxConcurrency) { Objects.requireNonNull(sources, "sources is null"); ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); return RxJavaPlugins.onAssembly(new ObservableFlatMap(sources, Functions.identity(), true, maxConcurrency, bufferSize())); @@ -3730,7 +3748,7 @@ public static Observable mergeDelayError(@NonNull ObservableSource Observable mergeDelayError( + public static <@NonNull T> Observable mergeDelayError( @NonNull ObservableSource source1, @NonNull ObservableSource source2) { Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); @@ -3771,7 +3789,7 @@ public static Observable mergeDelayError( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable mergeDelayError( + public static <@NonNull T> Observable mergeDelayError( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3) { Objects.requireNonNull(source1, "source1 is null"); @@ -3816,7 +3834,7 @@ public static Observable mergeDelayError( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable mergeDelayError( + public static <@NonNull T> Observable mergeDelayError( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3, @NonNull ObservableSource source4) { Objects.requireNonNull(source1, "source1 is null"); @@ -3856,7 +3874,7 @@ public static Observable mergeDelayError( @SchedulerSupport(SchedulerSupport.NONE) @NonNull @SafeVarargs - public static Observable mergeArrayDelayError(@NonNull ObservableSource... sources) { + public static <@NonNull T> Observable mergeArrayDelayError(@NonNull ObservableSource... sources) { return fromArray(sources).flatMap((Function)Functions.identity(), true, sources.length); } @@ -3880,7 +3898,7 @@ public static Observable mergeArrayDelayError(@NonNull ObservableSource Observable never() { + public static <@NonNull T> Observable never() { return RxJavaPlugins.onAssembly((Observable) ObservableNever.INSTANCE); } @@ -3991,7 +4009,7 @@ public static Observable rangeLong(long start, long count) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Single sequenceEqual(@NonNull ObservableSource source1, @NonNull ObservableSource source2) { + public static <@NonNull T> Single sequenceEqual(@NonNull ObservableSource source1, @NonNull ObservableSource source2) { return sequenceEqual(source1, source2, ObjectHelper.equalsPredicate(), bufferSize()); } @@ -4021,7 +4039,7 @@ public static Single sequenceEqual(@NonNull ObservableSource Single sequenceEqual( + public static <@NonNull T> Single sequenceEqual( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull BiPredicate isEqual) { return sequenceEqual(source1, source2, isEqual, bufferSize()); @@ -4056,7 +4074,7 @@ public static Single sequenceEqual( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Single sequenceEqual( + public static <@NonNull T> Single sequenceEqual( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull BiPredicate isEqual, int bufferSize) { Objects.requireNonNull(source1, "source1 is null"); @@ -4092,7 +4110,7 @@ public static Single sequenceEqual( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Single sequenceEqual(@NonNull ObservableSource source1, @NonNull ObservableSource source2, + public static <@NonNull T> Single sequenceEqual(@NonNull ObservableSource source1, @NonNull ObservableSource source2, int bufferSize) { return sequenceEqual(source1, source2, ObjectHelper.equalsPredicate(), bufferSize); } @@ -4129,7 +4147,7 @@ public static Single sequenceEqual(@NonNull ObservableSource Observable switchOnNext(@NonNull ObservableSource> sources, int bufferSize) { + public static <@NonNull T> Observable switchOnNext(@NonNull ObservableSource> sources, int bufferSize) { Objects.requireNonNull(sources, "sources is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); return RxJavaPlugins.onAssembly(new ObservableSwitchMap(sources, Functions.identity(), bufferSize, false)); @@ -4163,7 +4181,7 @@ public static Observable switchOnNext(@NonNull ObservableSource Observable switchOnNext(@NonNull ObservableSource> sources) { + public static <@NonNull T> Observable switchOnNext(@NonNull ObservableSource> sources) { return switchOnNext(sources, bufferSize()); } @@ -4197,7 +4215,7 @@ public static Observable switchOnNext(@NonNull ObservableSource Observable switchOnNextDelayError(@NonNull ObservableSource> sources) { + public static <@NonNull T> Observable switchOnNextDelayError(@NonNull ObservableSource> sources) { return switchOnNextDelayError(sources, bufferSize()); } @@ -4235,7 +4253,7 @@ public static Observable switchOnNextDelayError(@NonNull ObservableSource @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable switchOnNextDelayError(@NonNull ObservableSource> sources, int bufferSize) { + public static <@NonNull T> Observable switchOnNextDelayError(@NonNull ObservableSource> sources, int bufferSize) { Objects.requireNonNull(sources, "sources is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); return RxJavaPlugins.onAssembly(new ObservableSwitchMap(sources, Functions.identity(), bufferSize, true)); @@ -4315,7 +4333,7 @@ public static Observable timer(long delay, @NonNull TimeUnit unit, @NonNul @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable unsafeCreate(@NonNull ObservableSource onSubscribe) { + public static <@NonNull T> Observable unsafeCreate(@NonNull ObservableSource onSubscribe) { Objects.requireNonNull(onSubscribe, "onSubscribe is null"); if (onSubscribe instanceof Observable) { throw new IllegalArgumentException("unsafeCreate(Observable) should be upgraded"); @@ -4349,7 +4367,7 @@ public static Observable unsafeCreate(@NonNull ObservableSource onSubs @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable using( + public static <@NonNull T, @NonNull D> Observable using( @NonNull Supplier resourceSupplier, @NonNull Function> sourceSupplier, @NonNull Consumer resourceCleanup) { @@ -4388,7 +4406,7 @@ public static Observable using( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable using( + public static <@NonNull T, @NonNull D> Observable using( @NonNull Supplier resourceSupplier, @NonNull Function> sourceSupplier, @NonNull Consumer resourceCleanup, boolean eager) { @@ -4414,7 +4432,7 @@ public static Observable using( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable wrap(@NonNull ObservableSource source) { + public static <@NonNull T> Observable wrap(@NonNull ObservableSource source) { Objects.requireNonNull(source, "source is null"); if (source instanceof Observable) { return RxJavaPlugins.onAssembly((Observable)source); @@ -4471,7 +4489,7 @@ public static Observable wrap(@NonNull ObservableSource source) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable zip(@NonNull Iterable<@NonNull ? extends ObservableSource> sources, @NonNull Function zipper) { + public static <@NonNull T, @NonNull R> Observable zip(@NonNull Iterable<@NonNull ? extends ObservableSource> sources, @NonNull Function zipper) { Objects.requireNonNull(zipper, "zipper is null"); Objects.requireNonNull(sources, "sources is null"); return RxJavaPlugins.onAssembly(new ObservableZip<>(null, sources, zipper, bufferSize(), false)); @@ -4532,7 +4550,7 @@ public static Observable zip(@NonNull Iterable<@NonNull ? extends Obse @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable zip(@NonNull Iterable<@NonNull ? extends ObservableSource> sources, + public static <@NonNull T, @NonNull R> Observable zip(@NonNull Iterable<@NonNull ? extends ObservableSource> sources, @NonNull Function zipper, boolean delayError, int bufferSize) { Objects.requireNonNull(zipper, "zipper is null"); @@ -4589,7 +4607,7 @@ public static Observable zip(@NonNull Iterable<@NonNull ? extends Obse @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable zip( + public static <@NonNull T1, @NonNull T2, @NonNull R> Observable zip( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull BiFunction zipper) { Objects.requireNonNull(source1, "source1 is null"); @@ -4647,7 +4665,7 @@ public static Observable zip( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable zip( + public static <@NonNull T1, @NonNull T2, @NonNull R> Observable zip( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull BiFunction zipper, boolean delayError) { Objects.requireNonNull(source1, "source1 is null"); @@ -4707,7 +4725,7 @@ public static Observable zip( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable zip( + public static <@NonNull T1, @NonNull T2, @NonNull R> Observable zip( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull BiFunction zipper, boolean delayError, int bufferSize) { Objects.requireNonNull(source1, "source1 is null"); @@ -4768,7 +4786,7 @@ public static Observable zip( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable zip( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull R> Observable zip( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3, @NonNull Function3 zipper) { @@ -4835,7 +4853,7 @@ public static Observable zip( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable zip( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull R> Observable zip( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3, @NonNull ObservableSource source4, @NonNull Function4 zipper) { @@ -4906,7 +4924,7 @@ public static Observable zip( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable zip( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull R> Observable zip( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3, @NonNull ObservableSource source4, @NonNull ObservableSource source5, @NonNull Function5 zipper) { @@ -4980,7 +4998,7 @@ public static Observable zip( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable zip( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull R> Observable zip( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3, @NonNull ObservableSource source4, @NonNull ObservableSource source5, @NonNull ObservableSource source6, @NonNull Function6 zipper) { @@ -5059,7 +5077,7 @@ public static Observable zip( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable zip( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull R> Observable zip( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3, @NonNull ObservableSource source4, @NonNull ObservableSource source5, @NonNull ObservableSource source6, @NonNull ObservableSource source7, @@ -5143,7 +5161,7 @@ public static Observable zip( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable zip( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull T8, @NonNull R> Observable zip( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3, @NonNull ObservableSource source4, @NonNull ObservableSource source5, @NonNull ObservableSource source6, @NonNull ObservableSource source7, @NonNull ObservableSource source8, @@ -5231,7 +5249,7 @@ public static Observable zip( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable zip( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull T8, @NonNull T9, @NonNull R> Observable zip( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3, @NonNull ObservableSource source4, @NonNull ObservableSource source5, @NonNull ObservableSource source6, @NonNull ObservableSource source7, @NonNull ObservableSource source8, @NonNull ObservableSource source9, @@ -5305,7 +5323,7 @@ public static Observable zip( @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs @NonNull - public static Observable zipArray( + public static <@NonNull T, @NonNull R> Observable zipArray( @NonNull Function zipper, boolean delayError, int bufferSize, @NonNull ObservableSource... sources) { @@ -5350,10 +5368,19 @@ public final Single all(@NonNull Predicate predicate) { * Mirrors the current {@code Observable} or the other {@link ObservableSource} provided of which the first either emits an item or sends a termination * notification. *

- * + * + *

+ * When the current {@code Observable} signals an item or terminates first, the subscription to the other + * {@code ObservableSource} is disposed. If the other {@code ObservableSource} signals an item or terminates first, + * the subscription to the current {@code Observable} is disposed. *

*
Scheduler:
*
{@code ambWith} does not operate by default on a particular {@link Scheduler}.
+ *
Error handling:
+ *
+ * If the losing {@code ObservableSource} signals an error, the error is routed to the global + * error handler via {@link RxJavaPlugins#onError(Throwable)}. + *
*
* * @param other @@ -5495,7 +5522,6 @@ public final T blockingFirst(@NonNull T defaultItem) { * @see #blockingForEach(Consumer, int) */ @SchedulerSupport(SchedulerSupport.NONE) - @NonNull public final void blockingForEach(@NonNull Consumer onNext) { blockingForEach(onNext, bufferSize()); } @@ -5535,7 +5561,6 @@ public final void blockingForEach(@NonNull Consumer onNext) { * @see #subscribe(Consumer) */ @SchedulerSupport(SchedulerSupport.NONE) - @NonNull public final void blockingForEach(@NonNull Consumer onNext, int capacityHint) { Objects.requireNonNull(onNext, "onNext is null"); Iterator it = blockingIterable(capacityHint).iterator(); @@ -6021,7 +6046,7 @@ public final void blockingSubscribe(@NonNull Observer observer) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final > Observable buffer(int count, int skip, @NonNull Supplier bufferSupplier) { + public final <@NonNull U extends Collection> Observable buffer(int count, int skip, @NonNull Supplier bufferSupplier) { ObjectHelper.verifyPositive(count, "count"); ObjectHelper.verifyPositive(skip, "skip"); Objects.requireNonNull(bufferSupplier, "bufferSupplier is null"); @@ -6374,7 +6399,7 @@ public final > Observable buffer(int count, i @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable<@NonNull List> buffer( + public final <@NonNull TOpening, @NonNull TClosing> Observable<@NonNull List> buffer( @NonNull ObservableSource openingIndicator, @NonNull Function> closingIndicator) { return buffer(openingIndicator, closingIndicator, ArrayListSupplier.asSupplier()); @@ -6411,7 +6436,7 @@ public final > Observable buffer(int count, i @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final > Observable buffer( + public final <@NonNull TOpening, @NonNull TClosing, @NonNull U extends Collection> Observable buffer( @NonNull ObservableSource openingIndicator, @NonNull Function> closingIndicator, @NonNull Supplier bufferSupplier) { @@ -6448,7 +6473,7 @@ public final > Observable buffer(int count, i @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable<@NonNull List> buffer(@NonNull ObservableSource boundaryIndicator) { + public final <@NonNull B> Observable<@NonNull List> buffer(@NonNull ObservableSource boundaryIndicator) { return buffer(boundaryIndicator, ArrayListSupplier.asSupplier()); } @@ -6482,7 +6507,7 @@ public final > Observable buffer(int count, i @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable<@NonNull List> buffer(@NonNull ObservableSource boundaryIndicator, int initialCapacity) { + public final <@NonNull B> Observable<@NonNull List> buffer(@NonNull ObservableSource boundaryIndicator, int initialCapacity) { ObjectHelper.verifyPositive(initialCapacity, "initialCapacity"); return buffer(boundaryIndicator, Functions.createArrayList(initialCapacity)); } @@ -6518,7 +6543,7 @@ public final > Observable buffer(int count, i @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final > Observable buffer(@NonNull ObservableSource boundaryIndicator, @NonNull Supplier bufferSupplier) { + public final <@NonNull B, @NonNull U extends Collection> Observable buffer(@NonNull ObservableSource boundaryIndicator, @NonNull Supplier bufferSupplier) { Objects.requireNonNull(boundaryIndicator, "boundaryIndicator is null"); Objects.requireNonNull(bufferSupplier, "bufferSupplier is null"); return RxJavaPlugins.onAssembly(new ObservableBufferExactBoundary<>(this, boundaryIndicator, bufferSupplier)); @@ -6643,8 +6668,10 @@ public final Observable cacheWithInitialCapacity(int initialCapacity) { } /** - * Returns an {@code Observable} that emits the items emitted by the current {@code Observable}, converted to the specified - * type. + * Returns an {@code Observable} that emits the upstream items while + * they can be cast via {@link Class#cast(Object)} until the upstream terminates, + * or until the upstream signals an item which can't be cast, + * resulting in a {@link ClassCastException} to be signaled to the downstream. *

* *

@@ -6654,8 +6681,7 @@ public final Observable cacheWithInitialCapacity(int initialCapacity) { * * @param the output value type cast to * @param clazz - * the target class type that {@code cast} will cast the items emitted by the current {@code Observable} - * into before emitting them from the resulting {@code Observable} + * the target class to use to try and cast the upstream items into * @return the new {@code Observable} instance * @throws NullPointerException if {@code clazz} is {@code null} * @see ReactiveX operators documentation: Map @@ -6663,7 +6689,7 @@ public final Observable cacheWithInitialCapacity(int initialCapacity) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable cast(@NonNull Class clazz) { + public final <@NonNull U> Observable cast(@NonNull Class clazz) { Objects.requireNonNull(clazz, "clazz is null"); return map(Functions.castFunction(clazz)); } @@ -6697,7 +6723,7 @@ public final Observable cast(@NonNull Class clazz) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Single collect(@NonNull Supplier initialItemSupplier, @NonNull BiConsumer collector) { + public final <@NonNull U> Single collect(@NonNull Supplier initialItemSupplier, @NonNull BiConsumer collector) { Objects.requireNonNull(initialItemSupplier, "initialItemSupplier is null"); Objects.requireNonNull(collector, "collector is null"); return RxJavaPlugins.onAssembly(new ObservableCollectSingle<>(this, initialItemSupplier, collector)); @@ -6732,7 +6758,7 @@ public final Single collect(@NonNull Supplier initialItemSup @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Single collectInto(@NonNull U initialItem, @NonNull BiConsumer collector) { + public final <@NonNull U> Single collectInto(@NonNull U initialItem, @NonNull BiConsumer collector) { Objects.requireNonNull(initialItem, "initialItem is null"); return collect(Functions.justSupplier(initialItem), collector); } @@ -6761,7 +6787,7 @@ public final Single collectInto(@NonNull U initialItem, @NonNull BiConsum @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable compose(@NonNull ObservableTransformer composer) { + public final <@NonNull R> Observable compose(@NonNull ObservableTransformer composer) { return wrap(((ObservableTransformer) Objects.requireNonNull(composer, "composer is null")).apply(this)); } @@ -6792,7 +6818,7 @@ public final Observable compose(@NonNull ObservableTransformer Observable concatMap(@NonNull Function> mapper) { + public final <@NonNull R> Observable concatMap(@NonNull Function> mapper) { return concatMap(mapper, 2); } @@ -6826,7 +6852,7 @@ public final Observable concatMap(@NonNull Function Observable concatMap(@NonNull Function> mapper, int bufferSize) { + public final <@NonNull R> Observable concatMap(@NonNull Function> mapper, int bufferSize) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); if (this instanceof ScalarSupplier) { @@ -6871,7 +6897,7 @@ public final Observable concatMap(@NonNull Function Observable concatMap(@NonNull Function> mapper, int bufferSize, @NonNull Scheduler scheduler) { + public final <@NonNull R> Observable concatMap(@NonNull Function> mapper, int bufferSize, @NonNull Scheduler scheduler) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); Objects.requireNonNull(scheduler, "scheduler is null"); @@ -6903,7 +6929,7 @@ public final Observable concatMap(@NonNull Function Observable concatMapDelayError(@NonNull Function> mapper) { + public final <@NonNull R> Observable concatMapDelayError(@NonNull Function> mapper) { return concatMapDelayError(mapper, true, bufferSize()); } @@ -6938,7 +6964,7 @@ public final Observable concatMapDelayError(@NonNull Function Observable concatMapDelayError(@NonNull Function> mapper, + public final <@NonNull R> Observable concatMapDelayError(@NonNull Function> mapper, boolean tillTheEnd, int bufferSize) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); @@ -6983,7 +7009,7 @@ public final Observable concatMapDelayError(@NonNull Function Observable concatMapDelayError(@NonNull Function> mapper, + public final <@NonNull R> Observable concatMapDelayError(@NonNull Function> mapper, boolean tillTheEnd, int bufferSize, @NonNull Scheduler scheduler) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); @@ -7014,7 +7040,7 @@ public final Observable concatMapDelayError(@NonNull Function Observable concatMapEager(@NonNull Function> mapper) { + public final <@NonNull R> Observable concatMapEager(@NonNull Function> mapper) { return concatMapEager(mapper, Integer.MAX_VALUE, bufferSize()); } @@ -7044,7 +7070,7 @@ public final Observable concatMapEager(@NonNull Function Observable concatMapEager(@NonNull Function> mapper, + public final <@NonNull R> Observable concatMapEager(@NonNull Function> mapper, int maxConcurrency, int bufferSize) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); @@ -7078,7 +7104,7 @@ public final Observable concatMapEager(@NonNull Function Observable concatMapEagerDelayError(@NonNull Function> mapper, + public final <@NonNull R> Observable concatMapEagerDelayError(@NonNull Function> mapper, boolean tillTheEnd) { return concatMapEagerDelayError(mapper, tillTheEnd, Integer.MAX_VALUE, bufferSize()); } @@ -7114,7 +7140,7 @@ public final Observable concatMapEagerDelayError(@NonNull Function Observable concatMapEagerDelayError(@NonNull Function> mapper, + public final <@NonNull R> Observable concatMapEagerDelayError(@NonNull Function> mapper, boolean tillTheEnd, int maxConcurrency, int bufferSize) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); @@ -7293,7 +7319,7 @@ public final Completable concatMapCompletableDelayError(@NonNull Function Observable concatMapIterable(@NonNull Function> mapper) { + public final <@NonNull U> Observable concatMapIterable(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new ObservableFlattenIterable<>(this, mapper)); } @@ -7303,7 +7329,7 @@ public final Observable concatMapIterable(@NonNull Function - * + * *
*
Scheduler:
*
{@code concatMapMaybe} does not operate by default on a particular {@link Scheduler}.
@@ -7322,7 +7348,7 @@ public final Observable concatMapIterable(@NonNull Function Observable concatMapMaybe(@NonNull Function> mapper) { + public final <@NonNull R> Observable concatMapMaybe(@NonNull Function> mapper) { return concatMapMaybe(mapper, 2); } @@ -7331,7 +7357,7 @@ public final Observable concatMapMaybe(@NonNull Function - * + * *
*
Scheduler:
*
{@code concatMapMaybe} does not operate by default on a particular {@link Scheduler}.
@@ -7353,7 +7379,7 @@ public final Observable concatMapMaybe(@NonNull Function Observable concatMapMaybe(@NonNull Function> mapper, int bufferSize) { + public final <@NonNull R> Observable concatMapMaybe(@NonNull Function> mapper, int bufferSize) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); return RxJavaPlugins.onAssembly(new ObservableConcatMapMaybe<>(this, mapper, ErrorMode.IMMEDIATE, bufferSize)); @@ -7364,7 +7390,7 @@ public final Observable concatMapMaybe(@NonNull Function - * + * *
*
Scheduler:
*
{@code concatMapMaybeDelayError} does not operate by default on a particular {@link Scheduler}.
@@ -7383,7 +7409,7 @@ public final Observable concatMapMaybe(@NonNull Function Observable concatMapMaybeDelayError(@NonNull Function> mapper) { + public final <@NonNull R> Observable concatMapMaybeDelayError(@NonNull Function> mapper) { return concatMapMaybeDelayError(mapper, true, 2); } @@ -7392,7 +7418,7 @@ public final Observable concatMapMaybeDelayError(@NonNull Function - * + * *
*
Scheduler:
*
{@code concatMapMaybeDelayError} does not operate by default on a particular {@link Scheduler}.
@@ -7417,7 +7443,7 @@ public final Observable concatMapMaybeDelayError(@NonNull Function Observable concatMapMaybeDelayError(@NonNull Function> mapper, boolean tillTheEnd) { + public final <@NonNull R> Observable concatMapMaybeDelayError(@NonNull Function> mapper, boolean tillTheEnd) { return concatMapMaybeDelayError(mapper, tillTheEnd, 2); } @@ -7426,7 +7452,7 @@ public final Observable concatMapMaybeDelayError(@NonNull Function - * + * *
*
Scheduler:
*
{@code concatMapMaybeDelayError} does not operate by default on a particular {@link Scheduler}.
@@ -7453,7 +7479,7 @@ public final Observable concatMapMaybeDelayError(@NonNull Function Observable concatMapMaybeDelayError(@NonNull Function> mapper, boolean tillTheEnd, int bufferSize) { + public final <@NonNull R> Observable concatMapMaybeDelayError(@NonNull Function> mapper, boolean tillTheEnd, int bufferSize) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); return RxJavaPlugins.onAssembly(new ObservableConcatMapMaybe<>(this, mapper, tillTheEnd ? ErrorMode.END : ErrorMode.BOUNDARY, bufferSize)); @@ -7464,7 +7490,7 @@ public final Observable concatMapMaybeDelayError(@NonNull Function - * + * *
*
Scheduler:
*
{@code concatMapSingle} does not operate by default on a particular {@link Scheduler}.
@@ -7483,7 +7509,7 @@ public final Observable concatMapMaybeDelayError(@NonNull Function Observable concatMapSingle(@NonNull Function> mapper) { + public final <@NonNull R> Observable concatMapSingle(@NonNull Function> mapper) { return concatMapSingle(mapper, 2); } @@ -7492,7 +7518,7 @@ public final Observable concatMapSingle(@NonNull Function - * + * *
*
Scheduler:
*
{@code concatMapSingle} does not operate by default on a particular {@link Scheduler}.
@@ -7514,7 +7540,7 @@ public final Observable concatMapSingle(@NonNull Function Observable concatMapSingle(@NonNull Function> mapper, int bufferSize) { + public final <@NonNull R> Observable concatMapSingle(@NonNull Function> mapper, int bufferSize) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); return RxJavaPlugins.onAssembly(new ObservableConcatMapSingle<>(this, mapper, ErrorMode.IMMEDIATE, bufferSize)); @@ -7525,7 +7551,7 @@ public final Observable concatMapSingle(@NonNull Function - * + * *
*
Scheduler:
*
{@code concatMapSingleDelayError} does not operate by default on a particular {@link Scheduler}.
@@ -7544,7 +7570,7 @@ public final Observable concatMapSingle(@NonNull Function Observable concatMapSingleDelayError(@NonNull Function> mapper) { + public final <@NonNull R> Observable concatMapSingleDelayError(@NonNull Function> mapper) { return concatMapSingleDelayError(mapper, true, 2); } @@ -7553,7 +7579,7 @@ public final Observable concatMapSingleDelayError(@NonNull Function - * + * *
*
Scheduler:
*
{@code concatMapSingleDelayError} does not operate by default on a particular {@link Scheduler}.
@@ -7578,7 +7604,7 @@ public final Observable concatMapSingleDelayError(@NonNull Function Observable concatMapSingleDelayError(@NonNull Function> mapper, boolean tillTheEnd) { + public final <@NonNull R> Observable concatMapSingleDelayError(@NonNull Function> mapper, boolean tillTheEnd) { return concatMapSingleDelayError(mapper, tillTheEnd, 2); } @@ -7587,7 +7613,7 @@ public final Observable concatMapSingleDelayError(@NonNull Function - * + * *
*
Scheduler:
*
{@code concatMapSingleDelayError} does not operate by default on a particular {@link Scheduler}.
@@ -7614,7 +7640,7 @@ public final Observable concatMapSingleDelayError(@NonNull Function Observable concatMapSingleDelayError(@NonNull Function> mapper, boolean tillTheEnd, int bufferSize) { + public final <@NonNull R> Observable concatMapSingleDelayError(@NonNull Function> mapper, boolean tillTheEnd, int bufferSize) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); return RxJavaPlugins.onAssembly(new ObservableConcatMapSingle<>(this, mapper, tillTheEnd ? ErrorMode.END : ErrorMode.BOUNDARY, bufferSize)); @@ -7787,7 +7813,7 @@ public final Single count() { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable debounce(@NonNull Function> debounceIndicator) { + public final <@NonNull U> Observable debounce(@NonNull Function> debounceIndicator) { Objects.requireNonNull(debounceIndicator, "debounceIndicator is null"); return RxJavaPlugins.onAssembly(new ObservableDebounce<>(this, debounceIndicator)); } @@ -7871,7 +7897,55 @@ public final Observable debounce(long timeout, @NonNull TimeUnit unit) { public final Observable debounce(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); - return RxJavaPlugins.onAssembly(new ObservableDebounceTimed<>(this, timeout, unit, scheduler)); + return RxJavaPlugins.onAssembly(new ObservableDebounceTimed<>(this, timeout, unit, scheduler, null)); + } + + /** + * Returns an {@code Observable} that mirrors the current {@code Observable}, except that it drops items emitted by the + * current {@code Observable} that are followed by newer items before a timeout value expires on a specified + * {@link Scheduler}. The timer resets on each emission. + *

+ * Note: If items keep being emitted by the current {@code Observable} faster than the timeout then no items + * will be emitted by the resulting {@code Observable}. + *

+ * + *

+ * Delivery of the item after the grace period happens on the given {@code Scheduler}'s + * {@code Worker} which if takes too long, a newer item may arrive from the upstream, causing the + * {@code Worker}'s task to get disposed, which may also interrupt any downstream blocking operation + * (yielding an {@code InterruptedException}). It is recommended processing items + * that may take long time to be moved to another thread via {@link #observeOn} applied after + * {@code debounce} itself. + *

+ *
Scheduler:
+ *
You specify which {@code Scheduler} this operator will use.
+ *
+ * + * @param timeout + * the time each item has to be "the most recent" of those emitted by the current {@code Observable} to + * ensure that it's not dropped + * @param unit + * the unit of time for the specified {@code timeout} + * @param scheduler + * the {@code Scheduler} to use internally to manage the timers that handle the timeout for each + * item + * @param onDropped + * called with the current entry when it has been replaced by a new one + * @return the new {@code Observable} instance + * @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null} } or {@code onDropped} is {@code null} + * @see ReactiveX operators documentation: Debounce + * @see #throttleWithTimeout(long, TimeUnit, Scheduler, Consumer) + * @since 3.1.6 - Experimental + */ + @CheckReturnValue + @SchedulerSupport(SchedulerSupport.CUSTOM) + @NonNull + @Experimental + public final Observable debounce(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull Consumer onDropped) { + Objects.requireNonNull(unit, "unit is null"); + Objects.requireNonNull(scheduler, "scheduler is null"); + Objects.requireNonNull(onDropped, "onDropped is null"); + return RxJavaPlugins.onAssembly(new ObservableDebounceTimed<>(this, timeout, unit, scheduler, onDropped)); } /** @@ -7924,7 +7998,7 @@ public final Observable defaultIfEmpty(@NonNull T defaultItem) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable delay(@NonNull Function> itemDelayIndicator) { + public final <@NonNull U> Observable delay(@NonNull Function> itemDelayIndicator) { Objects.requireNonNull(itemDelayIndicator, "itemDelayIndicator is null"); return flatMap(ObservableInternalHelper.itemDelay(itemDelayIndicator)); } @@ -8076,7 +8150,7 @@ public final Observable delay(long time, @NonNull TimeUnit unit, @NonNull Sch @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable delay(@NonNull ObservableSource subscriptionIndicator, + public final <@NonNull U, @NonNull V> Observable delay(@NonNull ObservableSource subscriptionIndicator, @NonNull Function> itemDelayIndicator) { return delaySubscription(subscriptionIndicator).delay(itemDelayIndicator); } @@ -8101,7 +8175,7 @@ public final Observable delay(@NonNull ObservableSource subscriptio @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable delaySubscription(@NonNull ObservableSource subscriptionIndicator) { + public final <@NonNull U> Observable delaySubscription(@NonNull ObservableSource subscriptionIndicator) { Objects.requireNonNull(subscriptionIndicator, "subscriptionIndicator is null"); return RxJavaPlugins.onAssembly(new ObservableDelaySubscriptionOther<>(this, subscriptionIndicator)); } @@ -8207,7 +8281,7 @@ public final Observable delaySubscription(long time, @NonNull TimeUnit unit, @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable dematerialize(@NonNull Function> selector) { + public final <@NonNull R> Observable dematerialize(@NonNull Function> selector) { Objects.requireNonNull(selector, "selector is null"); return RxJavaPlugins.onAssembly(new ObservableDematerialize<>(this, selector)); } @@ -8287,7 +8361,7 @@ public final Observable distinct() { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable distinct(@NonNull Function keySelector) { + public final <@NonNull K> Observable distinct(@NonNull Function keySelector) { return distinct(keySelector, Functions.createHashSet()); } @@ -8320,7 +8394,7 @@ public final Observable distinct(@NonNull Function keySelec @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable distinct(@NonNull Function keySelector, @NonNull Supplier> collectionSupplier) { + public final <@NonNull K> Observable distinct(@NonNull Function keySelector, @NonNull Supplier> collectionSupplier) { Objects.requireNonNull(keySelector, "keySelector is null"); Objects.requireNonNull(collectionSupplier, "collectionSupplier is null"); return RxJavaPlugins.onAssembly(new ObservableDistinct<>(this, keySelector, collectionSupplier)); @@ -8402,7 +8476,7 @@ public final Observable distinctUntilChanged() { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable distinctUntilChanged(@NonNull Function keySelector) { + public final <@NonNull K> Observable distinctUntilChanged(@NonNull Function keySelector) { Objects.requireNonNull(keySelector, "keySelector is null"); return RxJavaPlugins.onAssembly(new ObservableDistinctUntilChanged<>(this, keySelector, ObjectHelper.equalsPredicate())); } @@ -8583,6 +8657,10 @@ public final Observable doOnComplete(@NonNull Action onComplete) { *
{@code doOnEach} does not operate by default on a particular {@link Scheduler}.
*
* + * @param onNext the {@link Consumer} to invoke when the current {@code Observable} calls {@code onNext} + * @param onError the {@code Consumer} to invoke when the current {@code Observable} calls {@code onError} + * @param onComplete the {@link Action} to invoke when the current {@code Observable} calls {@code onComplete} + * @param onAfterTerminate the {@code Action} to invoke when the current {@code Observable} calls {@code onAfterTerminate} * @return the new {@code Observable} instance * @throws NullPointerException if {@code onNext}, {@code onError}, {@code onComplete} or {@code onAfterTerminate} is {@code null} * @see ReactiveX operators documentation: Do @@ -8924,7 +9002,7 @@ public final Maybe firstElement() { * Returns a {@link Single} that emits only the very first item emitted by the current {@code Observable}, or a default item * if the current {@code Observable} completes without emitting any items. *

- * + * *

*
Scheduler:
*
{@code first} does not operate by default on a particular {@link Scheduler}.
@@ -8985,7 +9063,7 @@ public final Single firstOrError() { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable flatMap(@NonNull Function> mapper) { + public final <@NonNull R> Observable flatMap(@NonNull Function> mapper) { return flatMap(mapper, false); } @@ -9014,7 +9092,7 @@ public final Observable flatMap(@NonNull Function Observable flatMap(@NonNull Function> mapper, boolean delayErrors) { + public final <@NonNull R> Observable flatMap(@NonNull Function> mapper, boolean delayErrors) { return flatMap(mapper, delayErrors, Integer.MAX_VALUE); } @@ -9048,7 +9126,7 @@ public final Observable flatMap(@NonNull Function Observable flatMap(@NonNull Function> mapper, boolean delayErrors, int maxConcurrency) { + public final <@NonNull R> Observable flatMap(@NonNull Function> mapper, boolean delayErrors, int maxConcurrency) { return flatMap(mapper, delayErrors, maxConcurrency, bufferSize()); } @@ -9084,7 +9162,7 @@ public final Observable flatMap(@NonNull Function Observable flatMap(@NonNull Function> mapper, + public final <@NonNull R> Observable flatMap(@NonNull Function> mapper, boolean delayErrors, int maxConcurrency, int bufferSize) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); @@ -9127,7 +9205,7 @@ public final Observable flatMap(@NonNull Function Observable flatMap( + public final <@NonNull R> Observable flatMap( @NonNull Function> onNextMapper, @NonNull Function> onErrorMapper, @NonNull Supplier> onCompleteSupplier) { @@ -9169,7 +9247,7 @@ public final Observable flatMap( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable flatMap( + public final <@NonNull R> Observable flatMap( @NonNull Function> onNextMapper, @NonNull Function> onErrorMapper, @NonNull Supplier> onCompleteSupplier, @@ -9207,7 +9285,7 @@ public final Observable flatMap( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable flatMap(@NonNull Function> mapper, int maxConcurrency) { + public final <@NonNull R> Observable flatMap(@NonNull Function> mapper, int maxConcurrency) { return flatMap(mapper, false, maxConcurrency, bufferSize()); } @@ -9237,7 +9315,7 @@ public final Observable flatMap(@NonNull Function Observable flatMap(@NonNull Function> mapper, + public final <@NonNull U, @NonNull R> Observable flatMap(@NonNull Function> mapper, @NonNull BiFunction combiner) { return flatMap(mapper, combiner, false, bufferSize(), bufferSize()); } @@ -9271,7 +9349,7 @@ public final Observable flatMap(@NonNull Function Observable flatMap(@NonNull Function> mapper, + public final <@NonNull U, @NonNull R> Observable flatMap(@NonNull Function> mapper, @NonNull BiFunction combiner, boolean delayErrors) { return flatMap(mapper, combiner, delayErrors, bufferSize(), bufferSize()); } @@ -9310,7 +9388,7 @@ public final Observable flatMap(@NonNull Function Observable flatMap(@NonNull Function> mapper, + public final <@NonNull U, @NonNull R> Observable flatMap(@NonNull Function> mapper, @NonNull BiFunction combiner, boolean delayErrors, int maxConcurrency) { return flatMap(mapper, combiner, delayErrors, maxConcurrency, bufferSize()); } @@ -9351,7 +9429,7 @@ public final Observable flatMap(@NonNull Function Observable flatMap(@NonNull Function> mapper, + public final <@NonNull U, @NonNull R> Observable flatMap(@NonNull Function> mapper, @NonNull BiFunction combiner, boolean delayErrors, int maxConcurrency, int bufferSize) { Objects.requireNonNull(mapper, "mapper is null"); Objects.requireNonNull(combiner, "combiner is null"); @@ -9389,7 +9467,7 @@ public final Observable flatMap(@NonNull Function Observable flatMap(@NonNull Function> mapper, + public final <@NonNull U, @NonNull R> Observable flatMap(@NonNull Function> mapper, @NonNull BiFunction combiner, int maxConcurrency) { return flatMap(mapper, combiner, false, maxConcurrency, bufferSize()); } @@ -9459,7 +9537,7 @@ public final Completable flatMapCompletable(@NonNull Function Observable flatMapIterable(@NonNull Function> mapper) { + public final <@NonNull U> Observable flatMapIterable(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new ObservableFlattenIterable<>(this, mapper)); } @@ -9493,7 +9571,7 @@ public final Observable flatMapIterable(@NonNull Function Observable flatMapIterable(@NonNull Function> mapper, + public final <@NonNull U, @NonNull V> Observable flatMapIterable(@NonNull Function> mapper, @NonNull BiFunction combiner) { Objects.requireNonNull(mapper, "mapper is null"); Objects.requireNonNull(combiner, "combiner is null"); @@ -9517,7 +9595,7 @@ public final Observable flatMapIterable(@NonNull Function Observable flatMapMaybe(@NonNull Function> mapper) { + public final <@NonNull R> Observable flatMapMaybe(@NonNull Function> mapper) { return flatMapMaybe(mapper, false); } @@ -9541,7 +9619,7 @@ public final Observable flatMapMaybe(@NonNull Function Observable flatMapMaybe(@NonNull Function> mapper, boolean delayErrors) { + public final <@NonNull R> Observable flatMapMaybe(@NonNull Function> mapper, boolean delayErrors) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new ObservableFlatMapMaybe<>(this, mapper, delayErrors)); } @@ -9563,7 +9641,7 @@ public final Observable flatMapMaybe(@NonNull Function Observable flatMapSingle(@NonNull Function> mapper) { + public final <@NonNull R> Observable flatMapSingle(@NonNull Function> mapper) { return flatMapSingle(mapper, false); } @@ -9587,7 +9665,7 @@ public final Observable flatMapSingle(@NonNull Function Observable flatMapSingle(@NonNull Function> mapper, boolean delayErrors) { + public final <@NonNull R> Observable flatMapSingle(@NonNull Function> mapper, boolean delayErrors) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new ObservableFlatMapSingle<>(this, mapper, delayErrors)); } @@ -9746,7 +9824,7 @@ public final Disposable forEachWhile(@NonNull Predicate onNext, @NonN @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable> groupBy(@NonNull Function keySelector) { + public final <@NonNull K> Observable> groupBy(@NonNull Function keySelector) { return groupBy(keySelector, (Function)Functions.identity(), false, bufferSize()); } @@ -9791,7 +9869,7 @@ public final Observable> groupBy(@NonNull Function Observable> groupBy(@NonNull Function keySelector, boolean delayError) { + public final <@NonNull K> Observable> groupBy(@NonNull Function keySelector, boolean delayError) { return groupBy(keySelector, (Function)Functions.identity(), delayError, bufferSize()); } @@ -9836,7 +9914,7 @@ public final Observable> groupBy(@NonNull Function Observable> groupBy(@NonNull Function keySelector, + public final <@NonNull K, @NonNull V> Observable> groupBy(@NonNull Function keySelector, Function valueSelector) { return groupBy(keySelector, valueSelector, false, bufferSize()); } @@ -9885,7 +9963,7 @@ public final Observable> groupBy(@NonNull Functio @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable> groupBy(@NonNull Function keySelector, + public final <@NonNull K, @NonNull V> Observable> groupBy(@NonNull Function keySelector, @NonNull Function valueSelector, boolean delayError) { return groupBy(keySelector, valueSelector, delayError, bufferSize()); } @@ -9937,7 +10015,7 @@ public final Observable> groupBy(@NonNull Functio @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable> groupBy(@NonNull Function keySelector, + public final <@NonNull K, @NonNull V> Observable> groupBy(@NonNull Function keySelector, @NonNull Function valueSelector, boolean delayError, int bufferSize) { Objects.requireNonNull(keySelector, "keySelector is null"); @@ -9981,7 +10059,7 @@ public final Observable> groupBy(@NonNull Functio @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable groupJoin( + public final <@NonNull TRight, @NonNull TLeftEnd, @NonNull TRightEnd, @NonNull R> Observable groupJoin( @NonNull ObservableSource other, @NonNull Function> leftEnd, @NonNull Function> rightEnd, @@ -10093,7 +10171,7 @@ public final Single isEmpty() { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable join( + public final <@NonNull TRight, @NonNull TLeftEnd, @NonNull TRightEnd, @NonNull R> Observable join( @NonNull ObservableSource other, @NonNull Function> leftEnd, @NonNull Function> rightEnd, @@ -10317,7 +10395,7 @@ public final Single lastOrError() { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable lift(@NonNull ObservableOperator lifter) { + public final <@NonNull R> Observable lift(@NonNull ObservableOperator lifter) { Objects.requireNonNull(lifter, "lifter is null"); return RxJavaPlugins.onAssembly(new ObservableLift<>(this, lifter)); } @@ -10342,7 +10420,7 @@ public final Observable lift(@NonNull ObservableOperator Observable map(@NonNull Function mapper) { + public final <@NonNull R> Observable map(@NonNull Function mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new ObservableMap<>(this, mapper)); } @@ -10607,7 +10685,7 @@ public final Observable observeOn(@NonNull Scheduler scheduler, boolean delay @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable ofType(@NonNull Class clazz) { + public final <@NonNull U> Observable ofType(@NonNull Class clazz) { Objects.requireNonNull(clazz, "clazz is null"); return filter(Functions.isInstanceOf(clazz)).cast(clazz); } @@ -10864,7 +10942,7 @@ public final ConnectableObservable publish() { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable publish(@NonNull Function, ? extends ObservableSource> selector) { + public final <@NonNull R> Observable publish(@NonNull Function, ? extends ObservableSource> selector) { Objects.requireNonNull(selector, "selector is null"); return RxJavaPlugins.onAssembly(new ObservablePublishSelector<>(this, selector)); } @@ -11154,7 +11232,7 @@ public final ConnectableObservable replay() { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable replay(@NonNull Function, ? extends ObservableSource> selector) { + public final <@NonNull R> Observable replay(@NonNull Function, ? extends ObservableSource> selector) { Objects.requireNonNull(selector, "selector is null"); return ObservableReplay.multicastSelector(ObservableInternalHelper.replaySupplier(this), selector); } @@ -11189,7 +11267,7 @@ public final Observable replay(@NonNull Function, ? @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable replay(@NonNull Function, ? extends ObservableSource> selector, int bufferSize) { + public final <@NonNull R> Observable replay(@NonNull Function, ? extends ObservableSource> selector, int bufferSize) { Objects.requireNonNull(selector, "selector is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); return ObservableReplay.multicastSelector(ObservableInternalHelper.replaySupplier(this, bufferSize, false), selector); @@ -11227,7 +11305,7 @@ public final Observable replay(@NonNull Function, ? @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable replay(@NonNull Function, ? extends ObservableSource> selector, int bufferSize, boolean eagerTruncate) { + public final <@NonNull R> Observable replay(@NonNull Function, ? extends ObservableSource> selector, int bufferSize, boolean eagerTruncate) { Objects.requireNonNull(selector, "selector is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); return ObservableReplay.multicastSelector(ObservableInternalHelper.replaySupplier(this, bufferSize, eagerTruncate), selector); @@ -11266,7 +11344,7 @@ public final Observable replay(@NonNull Function, ? @CheckReturnValue @SchedulerSupport(SchedulerSupport.COMPUTATION) @NonNull - public final Observable replay(@NonNull Function, ? extends ObservableSource> selector, int bufferSize, long time, @NonNull TimeUnit unit) { + public final <@NonNull R> Observable replay(@NonNull Function, ? extends ObservableSource> selector, int bufferSize, long time, @NonNull TimeUnit unit) { return replay(selector, bufferSize, time, unit, Schedulers.computation()); } @@ -11308,7 +11386,7 @@ public final Observable replay(@NonNull Function, ? @CheckReturnValue @SchedulerSupport(SchedulerSupport.CUSTOM) @NonNull - public final Observable replay(@NonNull Function, ? extends ObservableSource> selector, int bufferSize, long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { + public final <@NonNull R> Observable replay(@NonNull Function, ? extends ObservableSource> selector, int bufferSize, long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { Objects.requireNonNull(selector, "selector is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); Objects.requireNonNull(unit, "unit is null"); @@ -11356,7 +11434,7 @@ public final Observable replay(@NonNull Function, ? @CheckReturnValue @SchedulerSupport(SchedulerSupport.CUSTOM) @NonNull - public final Observable replay(@NonNull Function, ? extends ObservableSource> selector, int bufferSize, long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean eagerTruncate) { + public final <@NonNull R> Observable replay(@NonNull Function, ? extends ObservableSource> selector, int bufferSize, long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean eagerTruncate) { Objects.requireNonNull(selector, "selector is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); Objects.requireNonNull(unit, "unit is null"); @@ -11392,7 +11470,7 @@ public final Observable replay(@NonNull Function, ? @CheckReturnValue @SchedulerSupport(SchedulerSupport.COMPUTATION) @NonNull - public final Observable replay(@NonNull Function, ? extends ObservableSource> selector, long time, @NonNull TimeUnit unit) { + public final <@NonNull R> Observable replay(@NonNull Function, ? extends ObservableSource> selector, long time, @NonNull TimeUnit unit) { return replay(selector, time, unit, Schedulers.computation()); } @@ -11426,7 +11504,7 @@ public final Observable replay(@NonNull Function, ? @CheckReturnValue @SchedulerSupport(SchedulerSupport.CUSTOM) @NonNull - public final Observable replay(@NonNull Function, ? extends ObservableSource> selector, long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { + public final <@NonNull R> Observable replay(@NonNull Function, ? extends ObservableSource> selector, long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { Objects.requireNonNull(selector, "selector is null"); Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); @@ -11465,7 +11543,7 @@ public final Observable replay(@NonNull Function, ? @CheckReturnValue @SchedulerSupport(SchedulerSupport.CUSTOM) @NonNull - public final Observable replay(@NonNull Function, ? extends ObservableSource> selector, long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean eagerTruncate) { + public final <@NonNull R> Observable replay(@NonNull Function, ? extends ObservableSource> selector, long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean eagerTruncate) { Objects.requireNonNull(selector, "selector is null"); Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); @@ -12007,7 +12085,6 @@ public final Observable retryWhen( * @throws NullPointerException if {@code observer} is {@code null} */ @SchedulerSupport(SchedulerSupport.NONE) - @NonNull public final void safeSubscribe(@NonNull Observer observer) { Objects.requireNonNull(observer, "observer is null"); if (observer instanceof SafeObserver) { @@ -12102,7 +12179,7 @@ public final Observable sample(long period, @NonNull TimeUnit unit, boolean e public final Observable sample(long period, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); - return RxJavaPlugins.onAssembly(new ObservableSampleTimed<>(this, period, unit, scheduler, false)); + return RxJavaPlugins.onAssembly(new ObservableSampleTimed<>(this, period, unit, scheduler, false, null)); } /** @@ -12139,7 +12216,46 @@ public final Observable sample(long period, @NonNull TimeUnit unit, @NonNull public final Observable sample(long period, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean emitLast) { Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); - return RxJavaPlugins.onAssembly(new ObservableSampleTimed<>(this, period, unit, scheduler, emitLast)); + return RxJavaPlugins.onAssembly(new ObservableSampleTimed<>(this, period, unit, scheduler, emitLast, null)); + } + + /** + * Returns an {@code Observable} that emits the most recently emitted item (if any) emitted by the current {@code Observable} + * within periodic time intervals, where the intervals are defined on a particular {@link Scheduler}. + *

+ * + *

+ *
Scheduler:
+ *
You specify which {@code Scheduler} this operator will use.
+ *
+ * + * @param period + * the sampling rate + * @param unit + * the {@link TimeUnit} in which {@code period} is defined + * @param scheduler + * the {@code Scheduler} to use when sampling + * @param emitLast + * if {@code true} and the upstream completes while there is still an unsampled item available, + * that item is emitted to downstream before completion + * if {@code false}, an unsampled last item is ignored. + * @param onDropped + * called with the current entry when it has been replaced by a new one + * @return the new {@code Observable} instance + * @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null} or {@code onDropped} is {@code null} + * @see ReactiveX operators documentation: Sample + * @see #throttleLast(long, TimeUnit, Scheduler) + * @since 3.1.6 - Experimental + */ + @CheckReturnValue + @SchedulerSupport(SchedulerSupport.CUSTOM) + @NonNull + @Experimental + public final Observable sample(long period, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean emitLast, @NonNull Consumer onDropped) { + Objects.requireNonNull(unit, "unit is null"); + Objects.requireNonNull(scheduler, "scheduler is null"); + Objects.requireNonNull(onDropped, "onDropped is null"); + return RxJavaPlugins.onAssembly(new ObservableSampleTimed<>(this, period, unit, scheduler, emitLast, onDropped)); } /** @@ -12163,7 +12279,7 @@ public final Observable sample(long period, @NonNull TimeUnit unit, @NonNull @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable sample(@NonNull ObservableSource sampler) { + public final <@NonNull U> Observable sample(@NonNull ObservableSource sampler) { Objects.requireNonNull(sampler, "sampler is null"); return RxJavaPlugins.onAssembly(new ObservableSampleWithObservable<>(this, sampler, false)); } @@ -12196,16 +12312,15 @@ public final Observable sample(@NonNull ObservableSource sampler) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable sample(@NonNull ObservableSource sampler, boolean emitLast) { + public final <@NonNull U> Observable sample(@NonNull ObservableSource sampler, boolean emitLast) { Objects.requireNonNull(sampler, "sampler is null"); return RxJavaPlugins.onAssembly(new ObservableSampleWithObservable<>(this, sampler, emitLast)); } /** - * Returns an {@code Observable} that applies a specified accumulator function to the first item emitted by the current - * {@code Observable}, then feeds the result of that function along with the second item emitted by the current - * {@code Observable} into the same function, and so on until all items have been emitted by the current {@code Observable}, - * emitting the result of each of these iterations. + * Returns an {@code Observable} that emits the first value emitted by the current {@code Observable}, then emits one value + * for each subsequent value emitted by the current {@code Observable}. Each emission after the first is the result of + * applying the specified accumulator function to the previous emission and the corresponding value from the current {@code Observable}. *

* *

@@ -12232,10 +12347,9 @@ public final Observable scan(@NonNull BiFunction accumulator) { } /** - * Returns an {@code Observable} that applies a specified accumulator function to the first item emitted by the current - * {@code Observable} and a seed value, then feeds the result of that function along with the second item emitted by - * the current {@code Observable} into the same function, and so on until all items have been emitted by the current - * {@code Observable}, emitting the result of each of these iterations. + * Returns an {@code Observable} that emits the provided initial (seed) value, then emits one value for each value emitted + * by the current {@code Observable}. Each emission after the first is the result of applying the specified accumulator + * function to the previous emission and the corresponding value from the current {@code Observable}. *

* *

@@ -12276,16 +12390,15 @@ public final Observable scan(@NonNull BiFunction accumulator) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable scan(@NonNull R initialValue, @NonNull BiFunction accumulator) { + public final <@NonNull R> Observable scan(@NonNull R initialValue, @NonNull BiFunction accumulator) { Objects.requireNonNull(initialValue, "initialValue is null"); return scanWith(Functions.justSupplier(initialValue), accumulator); } /** - * Returns an {@code Observable} that applies a specified accumulator function to the first item emitted by the current - * {@code Observable} and a seed value, then feeds the result of that function along with the second item emitted by - * the current {@code Observable} into the same function, and so on until all items have been emitted by the current - * {@code Observable}, emitting the result of each of these iterations. + * Returns an {@code Observable} that emits the provided initial (seed) value, then emits one value for each value emitted + * by the current {@code Observable}. Each emission after the first is the result of applying the specified accumulator + * function to the previous emission and the corresponding value from the current {@code Observable}. *

* *

@@ -12312,7 +12425,7 @@ public final Observable scan(@NonNull R initialValue, @NonNull BiFunction @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable scanWith(@NonNull Supplier seedSupplier, @NonNull BiFunction accumulator) { + public final <@NonNull R> Observable scanWith(@NonNull Supplier seedSupplier, @NonNull BiFunction accumulator) { Objects.requireNonNull(seedSupplier, "seedSupplier is null"); Objects.requireNonNull(accumulator, "accumulator is null"); return RxJavaPlugins.onAssembly(new ObservableScanSeed<>(this, seedSupplier, accumulator)); @@ -12732,7 +12845,7 @@ public final Observable skipLast(long time, @NonNull TimeUnit unit, @NonNull @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable skipUntil(@NonNull ObservableSource other) { + public final <@NonNull U> Observable skipUntil(@NonNull ObservableSource other) { Objects.requireNonNull(other, "other is null"); return RxJavaPlugins.onAssembly(new ObservableSkipUntil<>(this, other)); } @@ -12836,7 +12949,7 @@ public final Observable sorted(@NonNull Comparator comparator) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable startWithIterable(@NonNull Iterable<@NonNull ? extends T> items) { + public final Observable startWithIterable(@NonNull Iterable items) { return concatArray(fromIterable(items), this); } @@ -12999,6 +13112,7 @@ public final Observable startWithArray(@NonNull T... items) { * * @return the new {@link Disposable} instance that can be used to dispose the subscription at any time * @see ReactiveX operators documentation: Subscribe + * @see #subscribe(Consumer, Consumer, Action, DisposableContainer) */ @SchedulerSupport(SchedulerSupport.NONE) @NonNull @@ -13023,6 +13137,7 @@ public final Disposable subscribe() { * @throws NullPointerException * if {@code onNext} is {@code null} * @see ReactiveX operators documentation: Subscribe + * @see #subscribe(Consumer, Consumer, Action, DisposableContainer) */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @@ -13045,9 +13160,10 @@ public final Disposable subscribe(@NonNull Consumer onNext) { * the {@code Consumer} you have designed to accept any error notification from the current * {@code Observable} * @return the new {@link Disposable} instance that can be used to dispose the subscription at any time - * @see ReactiveX operators documentation: Subscribe * @throws NullPointerException * if {@code onNext} or {@code onError} is {@code null} + * @see ReactiveX operators documentation: Subscribe + * @see #subscribe(Consumer, Consumer, Action, DisposableContainer) */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @@ -13076,6 +13192,7 @@ public final Disposable subscribe(@NonNull Consumer onNext, @NonNull * @throws NullPointerException * if {@code onNext}, {@code onError} or {@code onComplete} is {@code null} * @see ReactiveX operators documentation: Subscribe + * @see #subscribe(Consumer, Consumer, Action, DisposableContainer) */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @@ -13093,6 +13210,47 @@ public final Disposable subscribe(@NonNull Consumer onNext, @NonNull return ls; } + /** + * Wraps the given onXXX callbacks into a {@link Disposable} {@link Observer}, + * adds it to the given {@code DisposableContainer} and ensures, that if the upstream + * terminates or this particular {@code Disposable} is disposed, the {@code Observer} is removed + * from the given container. + *

+ * The {@code Observer} will be removed after the callback for the terminal event has been invoked. + *

+ *
Scheduler:
+ *
{@code subscribe} does not operate by default on a particular {@link Scheduler}.
+ *
+ * @param onNext the callback for upstream items + * @param onError the callback for an upstream error if any + * @param onComplete the callback for the upstream completion if any + * @param container the {@code DisposableContainer} (such as {@link CompositeDisposable}) to add and remove the + * created {@code Disposable} {@code Observer} + * @return the {@code Disposable} that allows disposing the particular subscription. + * @throws NullPointerException + * if {@code onNext}, {@code onError}, + * {@code onComplete} or {@code container} is {@code null} + * @since 3.1.0 + */ + @SchedulerSupport(SchedulerSupport.NONE) + @NonNull + public final Disposable subscribe( + @NonNull Consumer onNext, + @NonNull Consumer onError, + @NonNull Action onComplete, + @NonNull DisposableContainer container) { + Objects.requireNonNull(onNext, "onNext is null"); + Objects.requireNonNull(onError, "onError is null"); + Objects.requireNonNull(onComplete, "onComplete is null"); + Objects.requireNonNull(container, "container is null"); + + DisposableAutoReleaseObserver observer = new DisposableAutoReleaseObserver<>( + container, onNext, onError, onComplete); + container.add(observer); + subscribe(observer); + return observer; + } + @SchedulerSupport(SchedulerSupport.NONE) @Override public final void subscribe(@NonNull Observer observer) { @@ -13234,7 +13392,7 @@ public final Observable switchIfEmpty(@NonNull ObservableSource @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable switchMap(@NonNull Function> mapper) { + public final <@NonNull R> Observable switchMap(@NonNull Function> mapper) { return switchMap(mapper, bufferSize()); } @@ -13267,7 +13425,7 @@ public final Observable switchMap(@NonNull Function Observable switchMap(@NonNull Function> mapper, int bufferSize) { + public final <@NonNull R> Observable switchMap(@NonNull Function> mapper, int bufferSize) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); if (this instanceof ScalarSupplier) { @@ -13401,7 +13559,7 @@ public final Completable switchMapCompletableDelayError(@NonNull Function Observable switchMapMaybe(@NonNull Function> mapper) { + public final <@NonNull R> Observable switchMapMaybe(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new ObservableSwitchMapMaybe<>(this, mapper, false)); } @@ -13429,7 +13587,7 @@ public final Observable switchMapMaybe(@NonNull Function Observable switchMapMaybeDelayError(@NonNull Function> mapper) { + public final <@NonNull R> Observable switchMapMaybeDelayError(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new ObservableSwitchMapMaybe<>(this, mapper, true)); } @@ -13461,7 +13619,7 @@ public final Observable switchMapMaybeDelayError(@NonNull Function Observable switchMapSingle(@NonNull Function> mapper) { + public final <@NonNull R> Observable switchMapSingle(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new ObservableSwitchMapSingle<>(this, mapper, false)); } @@ -13494,7 +13652,7 @@ public final Observable switchMapSingle(@NonNull Function Observable switchMapSingleDelayError(@NonNull Function> mapper) { + public final <@NonNull R> Observable switchMapSingleDelayError(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new ObservableSwitchMapSingle<>(this, mapper, true)); } @@ -13527,7 +13685,7 @@ public final Observable switchMapSingleDelayError(@NonNull Function Observable switchMapDelayError(@NonNull Function> mapper) { + public final <@NonNull R> Observable switchMapDelayError(@NonNull Function> mapper) { return switchMapDelayError(mapper, bufferSize()); } @@ -13562,7 +13720,7 @@ public final Observable switchMapDelayError(@NonNull Function Observable switchMapDelayError(@NonNull Function> mapper, int bufferSize) { + public final <@NonNull R> Observable switchMapDelayError(@NonNull Function> mapper, int bufferSize) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); if (this instanceof ScalarSupplier) { @@ -13957,16 +14115,16 @@ public final Observable takeLast(long time, @NonNull TimeUnit unit, @NonNull /** * Returns an {@code Observable} that emits the items emitted by the current {@code Observable} until a second {@link ObservableSource} - * emits an item. + * emits an item or completes. *

- * + * *

*
Scheduler:
*
{@code takeUntil} does not operate by default on a particular {@link Scheduler}.
*
* * @param other - * the {@code ObservableSource} whose first emitted item will cause {@code takeUntil} to stop emitting items + * the {@code ObservableSource} whose first emitted item or completion will cause {@code takeUntil} to stop emitting items * from the current {@code Observable} * @param * the type of items emitted by {@code other} @@ -13977,7 +14135,7 @@ public final Observable takeLast(long time, @NonNull TimeUnit unit, @NonNull @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable takeUntil(@NonNull ObservableSource other) { + public final <@NonNull U> Observable takeUntil(@NonNull ObservableSource other) { Objects.requireNonNull(other, "other is null"); return RxJavaPlugins.onAssembly(new ObservableTakeUntil<>(this, other)); } @@ -14095,7 +14253,46 @@ public final Observable throttleFirst(long windowDuration, @NonNull TimeUnit public final Observable throttleFirst(long skipDuration, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); - return RxJavaPlugins.onAssembly(new ObservableThrottleFirstTimed<>(this, skipDuration, unit, scheduler)); + return RxJavaPlugins.onAssembly(new ObservableThrottleFirstTimed<>(this, skipDuration, unit, scheduler, null)); + } + + /** + * Returns an {@code Observable} that emits only the first item emitted by the current {@code Observable} during sequential + * time windows of a specified duration, where the windows are managed by a specified {@link Scheduler}. + *

+ * This differs from {@link #throttleLast} in that this only tracks passage of time whereas + * {@code throttleLast} ticks at scheduled intervals. + *

+ * + *

+ *
Scheduler:
+ *
You specify which {@code Scheduler} this operator will use.
+ *
+ * + * @param skipDuration + * time to wait before emitting another item after emitting the last item + * @param unit + * the unit of time of {@code skipDuration} + * @param scheduler + * the {@code Scheduler} to use internally to manage the timers that handle timeout for each + * event + * @param onDropped + * called when an item doesn't get delivered to the downstream + * + * @return the new {@code Observable} instance + * @throws NullPointerException if {@code unit} or {@code scheduler} or {@code onDropped} is {@code null} + * @see ReactiveX operators documentation: Sample + * @since 3.1.6 - Experimental + */ + @CheckReturnValue + @SchedulerSupport(SchedulerSupport.CUSTOM) + @NonNull + @Experimental + public final Observable throttleFirst(long skipDuration, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull Consumer onDropped) { + Objects.requireNonNull(unit, "unit is null"); + Objects.requireNonNull(scheduler, "scheduler is null"); + Objects.requireNonNull(onDropped, "onDropped is null"); + return RxJavaPlugins.onAssembly(new ObservableThrottleFirstTimed<>(this, skipDuration, unit, scheduler, onDropped)); } /** @@ -14128,6 +14325,43 @@ public final Observable throttleLast(long intervalDuration, @NonNull TimeUnit return sample(intervalDuration, unit); } + /** + * Returns an {@code Observable} that emits only the last item emitted by the current {@code Observable} during sequential + * time windows of a specified duration, where the duration is governed by a specified {@link Scheduler}. + *

+ * This differs from {@link #throttleFirst} in that this ticks along at a scheduled interval whereas + * {@code throttleFirst} does not tick, it just tracks passage of time. + *

+ * + *

+ *
Scheduler:
+ *
You specify which {@code Scheduler} this operator will use.
+ *
+ * + * @param intervalDuration + * duration of windows within which the last item emitted by the current {@code Observable} will be + * emitted + * @param unit + * the unit of time of {@code intervalDuration} + * @param scheduler + * the {@code Scheduler} to use internally to manage the timers that handle timeout for each + * event + * @param onDropped + * called with the current entry when it has been replaced by a new one + * @return the new {@code Observable} instance + * @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null} or {@code onDropped} is {@code null} + * @see ReactiveX operators documentation: Sample + * @see #sample(long, TimeUnit, Scheduler) + * @since 3.1.6 - Experimental + */ + @CheckReturnValue + @SchedulerSupport(SchedulerSupport.CUSTOM) + @NonNull + @Experimental + public final Observable throttleLast(long intervalDuration, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull Consumer onDropped) { + return sample(intervalDuration, unit, scheduler, false, onDropped); + } + /** * Returns an {@code Observable} that emits only the last item emitted by the current {@code Observable} during sequential * time windows of a specified duration, where the duration is governed by a specified {@link Scheduler}. @@ -14294,7 +14528,55 @@ public final Observable throttleLatest(long timeout, @NonNull TimeUnit unit, public final Observable throttleLatest(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean emitLast) { Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); - return RxJavaPlugins.onAssembly(new ObservableThrottleLatest<>(this, timeout, unit, scheduler, emitLast)); + return RxJavaPlugins.onAssembly(new ObservableThrottleLatest<>(this, timeout, unit, scheduler, emitLast, null)); + } + + /** + * Throttles items from the current {@code Observable} by first emitting the next + * item from upstream, then periodically emitting the latest item (if any) when + * the specified timeout elapses between them, invoking the consumer for any dropped item. + *

+ * + *

+ * If no items were emitted from the upstream during this timeout phase, the next + * upstream item is emitted immediately and the timeout window starts from then. + *

+ *
Scheduler:
+ *
You specify which {@link Scheduler} this operator will use.
+ *
Error handling:
+ *
+ * If the upstream signals an {@code onError} or {@code onDropped} callback crashes, + * the error is delivered immediately to the downstream. If both happen, a {@link CompositeException} + * is created, containing both the upstream and the callback error. + * If the {@code onDropped} callback crashes when the sequence gets disposed, the exception is forwarded + * to the global error handler via {@link RxJavaPlugins#onError(Throwable)}. + *
+ *
+ * @param timeout the time to wait after an item emission towards the downstream + * before trying to emit the latest item from upstream again + * @param unit the time unit + * @param scheduler the {@code Scheduler} where the timed wait and latest item + * emission will be performed + * @param emitLast If {@code true}, the very last item from the upstream will be emitted + * immediately when the upstream completes, regardless if there is + * a timeout window active or not. If {@code false}, the very last + * upstream item is ignored and the flow terminates. + * @param onDropped called when an item is replaced by a newer item that doesn't get delivered + * to the downstream, including the very last item if {@code emitLast} is {@code false} + * and the current undelivered item when the sequence gets disposed. + * @return the new {@code Observable} instance + * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code onDropped} is {@code null} + * @since 3.1.6 - Experimental + */ + @CheckReturnValue + @SchedulerSupport(SchedulerSupport.CUSTOM) + @NonNull + @Experimental + public final Observable throttleLatest(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean emitLast, @NonNull Consumer onDropped) { + Objects.requireNonNull(unit, "unit is null"); + Objects.requireNonNull(scheduler, "scheduler is null"); + Objects.requireNonNull(onDropped, "onDropped is null"); + return RxJavaPlugins.onAssembly(new ObservableThrottleLatest<>(this, timeout, unit, scheduler, emitLast, onDropped)); } /** @@ -14364,6 +14646,45 @@ public final Observable throttleWithTimeout(long timeout, @NonNull TimeUnit u return debounce(timeout, unit, scheduler); } + /** + * Returns an {@code Observable} that mirrors the current {@code Observable}, except that it drops items emitted by the + * current {@code Observable} that are followed by newer items before a timeout value expires on a specified + * {@link Scheduler}. The timer resets on each emission (Alias to {@link #debounce(long, TimeUnit, Scheduler)}). + *

+ * Note: If items keep being emitted by the current {@code Observable} faster than the timeout then no items + * will be emitted by the resulting {@code Observable}. + *

+ * + *

+ *
Scheduler:
+ *
You specify which {@code Scheduler} this operator will use.
+ *
+ * + * @param timeout + * the length of the window of time that must pass after the emission of an item from the current + * {@code Observable}, in which the current {@code Observable} emits no items, in order for the item to be emitted by the + * resulting {@code Observable} + * @param unit + * the unit of time for the specified {@code timeout} + * @param scheduler + * the {@code Scheduler} to use internally to manage the timers that handle the timeout for each + * item + * @param onDropped + * called with the current entry when it has been replaced by a new one + * @return the new {@code Observable} instance + * @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null} or {@code onDropped} is {@code null} + * @see ReactiveX operators documentation: Debounce + * @see #debounce(long, TimeUnit, Scheduler, Consumer) + * @since 3.1.6 - Experimental + */ + @CheckReturnValue + @SchedulerSupport(SchedulerSupport.CUSTOM) + @NonNull + @Experimental + public final Observable throttleWithTimeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull Consumer onDropped) { + return debounce(timeout, unit, scheduler, onDropped); + } + /** * Returns an {@code Observable} that emits records of the time interval between consecutive items emitted by the * current {@code Observable}. @@ -14485,7 +14806,7 @@ public final Observable> timeInterval(@NonNull TimeUnit unit, @NonNull @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable timeout(@NonNull Function> itemTimeoutIndicator) { + public final <@NonNull V> Observable timeout(@NonNull Function> itemTimeoutIndicator) { return timeout0(null, itemTimeoutIndicator, null); } @@ -14517,7 +14838,7 @@ public final Observable timeout(@NonNull Function Observable timeout(@NonNull Function> itemTimeoutIndicator, + public final <@NonNull V> Observable timeout(@NonNull Function> itemTimeoutIndicator, @NonNull ObservableSource fallback) { Objects.requireNonNull(fallback, "fallback is null"); return timeout0(null, itemTimeoutIndicator, fallback); @@ -14669,7 +14990,7 @@ public final Observable timeout(long timeout, @NonNull TimeUnit unit, @NonNul @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable timeout(@NonNull ObservableSource firstTimeoutIndicator, + public final <@NonNull U, @NonNull V> Observable timeout(@NonNull ObservableSource firstTimeoutIndicator, @NonNull Function> itemTimeoutIndicator) { Objects.requireNonNull(firstTimeoutIndicator, "firstTimeoutIndicator is null"); return timeout0(firstTimeoutIndicator, itemTimeoutIndicator, null); @@ -14707,7 +15028,7 @@ public final Observable timeout(@NonNull ObservableSource firstTime @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable timeout( + public final <@NonNull U, @NonNull V> Observable timeout( @NonNull ObservableSource firstTimeoutIndicator, @NonNull Function> itemTimeoutIndicator, @NonNull ObservableSource fallback) { @@ -14847,7 +15168,7 @@ public final Observable> timestamp(@NonNull TimeUnit unit, @NonNull Sch @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final R to(@NonNull ObservableConverter converter) { + public final <@NonNull R> R to(@NonNull ObservableConverter converter) { return Objects.requireNonNull(converter, "converter is null").apply(this); } @@ -14977,7 +15298,7 @@ public final R to(@NonNull ObservableConverter converter) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Single<@NonNull Map> toMap(@NonNull Function keySelector) { + public final <@NonNull K> Single<@NonNull Map> toMap(@NonNull Function keySelector) { Objects.requireNonNull(keySelector, "keySelector is null"); return collect(HashMapSupplier.asSupplier(), Functions.toMapKeySelector(keySelector)); } @@ -15012,7 +15333,7 @@ public final R to(@NonNull ObservableConverter converter) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Single> toMap( + public final <@NonNull K, @NonNull V> Single> toMap( @NonNull Function keySelector, @NonNull Function valueSelector) { Objects.requireNonNull(keySelector, "keySelector is null"); @@ -15049,7 +15370,7 @@ public final Single> toMap( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Single> toMap( + public final <@NonNull K, @NonNull V> Single> toMap( @NonNull Function keySelector, @NonNull Function valueSelector, @NonNull Supplier> mapSupplier) { @@ -15083,7 +15404,7 @@ public final Single> toMap( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Single<@NonNull Map>> toMultimap(@NonNull Function keySelector) { + public final <@NonNull K> Single<@NonNull Map>> toMultimap(@NonNull Function keySelector) { Function valueSelector = Functions.identity(); Supplier>> mapSupplier = HashMapSupplier.asSupplier(); Function> collectionFactory = ArrayListSupplier.asFunction(); @@ -15118,7 +15439,7 @@ public final Single> toMap( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Single<@NonNull Map>> toMultimap(@NonNull Function keySelector, Function valueSelector) { + public final <@NonNull K, @NonNull V> Single<@NonNull Map>> toMultimap(@NonNull Function keySelector, Function valueSelector) { Supplier>> mapSupplier = HashMapSupplier.asSupplier(); Function> collectionFactory = ArrayListSupplier.asFunction(); return toMultimap(keySelector, valueSelector, mapSupplier, collectionFactory); @@ -15156,7 +15477,7 @@ public final Single> toMap( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Single<@NonNull Map>> toMultimap( + public final <@NonNull K, @NonNull V> Single<@NonNull Map>> toMultimap( @NonNull Function keySelector, @NonNull Function valueSelector, @NonNull Supplier>> mapSupplier, @@ -15198,7 +15519,7 @@ public final Single> toMap( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Single<@NonNull Map>> toMultimap( + public final <@NonNull K, @NonNull V> Single<@NonNull Map>> toMultimap( @NonNull Function keySelector, @NonNull Function valueSelector, @NonNull Supplier>> mapSupplier @@ -15925,7 +16246,7 @@ public final Observable> window( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable> window(@NonNull ObservableSource boundaryIndicator) { + public final <@NonNull B> Observable> window(@NonNull ObservableSource boundaryIndicator) { return window(boundaryIndicator, bufferSize()); } @@ -15959,7 +16280,7 @@ public final Observable> window(@NonNull ObservableSource b @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable> window(@NonNull ObservableSource boundaryIndicator, int bufferSize) { + public final <@NonNull B> Observable> window(@NonNull ObservableSource boundaryIndicator, int bufferSize) { Objects.requireNonNull(boundaryIndicator, "boundaryIndicator is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); return RxJavaPlugins.onAssembly(new ObservableWindowBoundary<>(this, boundaryIndicator, bufferSize)); @@ -15996,7 +16317,7 @@ public final Observable> window(@NonNull ObservableSource b @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable> window( + public final <@NonNull U, @NonNull V> Observable> window( @NonNull ObservableSource openingIndicator, @NonNull Function> closingIndicator) { return window(openingIndicator, closingIndicator, bufferSize()); @@ -16036,7 +16357,7 @@ public final Observable> window( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable> window( + public final <@NonNull U, @NonNull V> Observable> window( @NonNull ObservableSource openingIndicator, @NonNull Function> closingIndicator, int bufferSize) { Objects.requireNonNull(openingIndicator, "openingIndicator is null"); @@ -16048,6 +16369,13 @@ public final Observable> window( /** * Merges the specified {@link ObservableSource} into the current {@code Observable} sequence by using the {@code resultSelector} * function only when the current {@code Observable} emits an item. + * + *

Note that this operator doesn't emit anything until the other source has produced at + * least one value. The resulting emission only happens when the current {@code Observable} emits (and + * not when the other source emits, unlike combineLatest). + * If the other source doesn't produce any value and just completes, the sequence is completed immediately. + * If the upstream completes before the other source has produced at least one value, the sequence completes + * without emission. *

* * @@ -16071,7 +16399,7 @@ public final Observable> window( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable withLatestFrom(@NonNull ObservableSource other, @NonNull BiFunction combiner) { + public final <@NonNull U, @NonNull R> Observable withLatestFrom(@NonNull ObservableSource other, @NonNull BiFunction combiner) { Objects.requireNonNull(other, "other is null"); Objects.requireNonNull(combiner, "combiner is null"); @@ -16086,6 +16414,8 @@ public final Observable withLatestFrom(@NonNull ObservableSource * *

@@ -16106,7 +16436,7 @@ public final Observable withLatestFrom(@NonNull ObservableSource Observable withLatestFrom( + public final <@NonNull T1, @NonNull T2, @NonNull R> Observable withLatestFrom( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull Function3 combiner) { Objects.requireNonNull(source1, "source1 is null"); @@ -16124,6 +16454,8 @@ public final Observable withLatestFrom( * least one value. The resulting emission only happens when the current {@code Observable} emits (and * not when any of the other sources emit, unlike combineLatest). * If a source doesn't produce any value and just completes, the sequence is completed immediately. + * If the upstream completes before all other sources have produced at least one value, the sequence completes + * without emission. *

* *

@@ -16146,7 +16478,7 @@ public final Observable withLatestFrom( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable withLatestFrom( + public final <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull R> Observable withLatestFrom( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3, @NonNull Function4 combiner) { @@ -16166,6 +16498,8 @@ public final Observable withLatestFrom( * least one value. The resulting emission only happens when the current {@code Observable} emits (and * not when any of the other sources emit, unlike combineLatest). * If a source doesn't produce any value and just completes, the sequence is completed immediately. + * If the upstream completes before all other sources have produced at least one value, the sequence completes + * without emission. *

* *

@@ -16191,7 +16525,7 @@ public final Observable withLatestFrom( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable withLatestFrom( + public final <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull R> Observable withLatestFrom( @NonNull ObservableSource source1, @NonNull ObservableSource source2, @NonNull ObservableSource source3, @NonNull ObservableSource source4, @NonNull Function5 combiner) { @@ -16212,6 +16546,8 @@ public final Observable withLatestFrom( * least one value. The resulting emission only happens when the current {@code Observable} emits (and * not when any of the other sources emit, unlike combineLatest). * If a source doesn't produce any value and just completes, the sequence is completed immediately. + * If the upstream completes before all other sources have produced at least one value, the sequence completes + * without emission. *

* *

@@ -16229,7 +16565,7 @@ public final Observable withLatestFrom( @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable withLatestFrom(@NonNull ObservableSource[] others, @NonNull Function combiner) { + public final <@NonNull R> Observable withLatestFrom(@NonNull ObservableSource[] others, @NonNull Function combiner) { Objects.requireNonNull(others, "others is null"); Objects.requireNonNull(combiner, "combiner is null"); return RxJavaPlugins.onAssembly(new ObservableWithLatestFromMany<>(this, others, combiner)); @@ -16243,6 +16579,8 @@ public final Observable withLatestFrom(@NonNull ObservableSource[] oth * least one value. The resulting emission only happens when the current {@code Observable} emits (and * not when any of the other sources emit, unlike {@code combineLatest}). * If a source doesn't produce any value and just completes, the sequence is completed immediately. + * If the upstream completes before all other sources have produced at least one value, the sequence completes + * without emission. *

* *

@@ -16260,7 +16598,7 @@ public final Observable withLatestFrom(@NonNull ObservableSource[] oth @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable withLatestFrom(@NonNull Iterable<@NonNull ? extends ObservableSource> others, @NonNull Function combiner) { + public final <@NonNull R> Observable withLatestFrom(@NonNull Iterable<@NonNull ? extends ObservableSource> others, @NonNull Function combiner) { Objects.requireNonNull(others, "others is null"); Objects.requireNonNull(combiner, "combiner is null"); return RxJavaPlugins.onAssembly(new ObservableWithLatestFromMany<>(this, others, combiner)); @@ -16295,7 +16633,7 @@ public final Observable withLatestFrom(@NonNull Iterable<@NonNull ? exten @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final <@NonNull U, R> Observable zipWith(@NonNull Iterable other, @NonNull BiFunction zipper) { + public final <@NonNull U, @NonNull R> Observable zipWith(@NonNull Iterable other, @NonNull BiFunction zipper) { Objects.requireNonNull(other, "other is null"); Objects.requireNonNull(zipper, "zipper is null"); return RxJavaPlugins.onAssembly(new ObservableZipIterable<>(this, other, zipper)); @@ -16339,7 +16677,7 @@ public final Observable withLatestFrom(@NonNull Iterable<@NonNull ? exten @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable zipWith(@NonNull ObservableSource other, + public final <@NonNull U, @NonNull R> Observable zipWith(@NonNull ObservableSource other, @NonNull BiFunction zipper) { Objects.requireNonNull(other, "other is null"); return zip(this, other, zipper); @@ -16386,7 +16724,7 @@ public final Observable zipWith(@NonNull ObservableSource @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable zipWith(@NonNull ObservableSource other, + public final <@NonNull U, @NonNull R> Observable zipWith(@NonNull ObservableSource other, @NonNull BiFunction zipper, boolean delayError) { return zip(this, other, zipper, delayError); } @@ -16435,7 +16773,7 @@ public final Observable zipWith(@NonNull ObservableSource @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable zipWith(@NonNull ObservableSource other, + public final <@NonNull U, @NonNull R> Observable zipWith(@NonNull ObservableSource other, @NonNull BiFunction zipper, boolean delayError, int bufferSize) { return zip(this, other, zipper, delayError, bufferSize); } @@ -16517,7 +16855,7 @@ public final TestObserver test(boolean dispose) { // NoPMD @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Observable<@NonNull T> fromOptional(@NonNull Optional optional) { + public static <@NonNull T> Observable<@NonNull T> fromOptional(@NonNull Optional optional) { Objects.requireNonNull(optional, "optional is null"); return optional.map(Observable::just).orElseGet(Observable::empty); } @@ -16528,7 +16866,7 @@ public final TestObserver test(boolean dispose) { // NoPMD * *

* Note that the operator takes an already instantiated, running or terminated {@code CompletionStage}. - * If the optional is to be created per consumer upon subscription, use {@link #defer(Supplier)} + * If the {@code CompletionStage} is to be created per consumer upon subscription, use {@link #defer(Supplier)} * around {@code fromCompletionStage}: *


      * Observable.defer(() -> Observable.fromCompletionStage(createCompletionStage()));
@@ -16551,7 +16889,7 @@ public final TestObserver test(boolean dispose) { // NoPMD
     @CheckReturnValue
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
-    public static  Observable<@NonNull T> fromCompletionStage(@NonNull CompletionStage stage) {
+    public static <@NonNull T> Observable<@NonNull T> fromCompletionStage(@NonNull CompletionStage stage) {
         Objects.requireNonNull(stage, "stage is null");
         return RxJavaPlugins.onAssembly(new ObservableFromCompletionStage<>(stage));
     }
@@ -16594,7 +16932,7 @@ public final TestObserver test(boolean dispose) { // NoPMD
     @CheckReturnValue
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
-    public static  Observable<@NonNull T> fromStream(@NonNull Stream stream) {
+    public static <@NonNull T> Observable<@NonNull T> fromStream(@NonNull Stream stream) {
         Objects.requireNonNull(stream, "stream is null");
         return RxJavaPlugins.onAssembly(new ObservableFromStream<>(stream));
     }
@@ -16648,7 +16986,7 @@ public final TestObserver test(boolean dispose) { // NoPMD
     @CheckReturnValue
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
-    public final <@NonNull R, A> Single collect(@NonNull Collector collector) {
+    public final <@NonNull R, @Nullable A> Single collect(@NonNull Collector collector) {
         Objects.requireNonNull(collector, "collector is null");
         return RxJavaPlugins.onAssembly(new ObservableCollectWithCollectorSingle<>(this, collector));
     }
@@ -16946,7 +17284,7 @@ public final Stream blockingStream(int capacityHint) {
     @CheckReturnValue
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
-    public final <@NonNull R> Observable concatMapStream(@NonNull Function> mapper) {
+    public final <@NonNull R> Observable concatMapStream(@NonNull Function> mapper) {
         return flatMapStream(mapper);
     }
 
@@ -16993,7 +17331,7 @@ public final Stream blockingStream(int capacityHint) {
     @CheckReturnValue
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
-    public final <@NonNull R> Observable flatMapStream(@NonNull Function> mapper) {
+    public final <@NonNull R> Observable flatMapStream(@NonNull Function> mapper) {
         Objects.requireNonNull(mapper, "mapper is null");
         return RxJavaPlugins.onAssembly(new ObservableFlatMapStream<>(this, mapper));
     }
diff --git a/src/main/java/io/reactivex/rxjava3/core/ObservableConverter.java b/src/main/java/io/reactivex/rxjava3/core/ObservableConverter.java
index 7ab3a30a74..24cb2c9fad 100644
--- a/src/main/java/io/reactivex/rxjava3/core/ObservableConverter.java
+++ b/src/main/java/io/reactivex/rxjava3/core/ObservableConverter.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/ObservableEmitter.java b/src/main/java/io/reactivex/rxjava3/core/ObservableEmitter.java
index 1ce0b93687..0658c4ba81 100644
--- a/src/main/java/io/reactivex/rxjava3/core/ObservableEmitter.java
+++ b/src/main/java/io/reactivex/rxjava3/core/ObservableEmitter.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/ObservableOnSubscribe.java b/src/main/java/io/reactivex/rxjava3/core/ObservableOnSubscribe.java
index de98fe0817..056441620a 100644
--- a/src/main/java/io/reactivex/rxjava3/core/ObservableOnSubscribe.java
+++ b/src/main/java/io/reactivex/rxjava3/core/ObservableOnSubscribe.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
@@ -10,13 +10,14 @@
  * 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 io.reactivex.rxjava3.core;
 
 import io.reactivex.rxjava3.annotations.NonNull;
 
 /**
  * A functional interface that has a {@code subscribe()} method that receives
- * an instance of an {@link ObservableEmitter} instance that allows pushing
+ * an {@link ObservableEmitter} instance that allows pushing
  * events in a cancellation-safe manner.
  *
  * @param  the value type pushed
diff --git a/src/main/java/io/reactivex/rxjava3/core/ObservableOperator.java b/src/main/java/io/reactivex/rxjava3/core/ObservableOperator.java
index 749bfa1a70..fd697fa626 100644
--- a/src/main/java/io/reactivex/rxjava3/core/ObservableOperator.java
+++ b/src/main/java/io/reactivex/rxjava3/core/ObservableOperator.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/ObservableSource.java b/src/main/java/io/reactivex/rxjava3/core/ObservableSource.java
index 89603f8e9c..c00bfc2170 100644
--- a/src/main/java/io/reactivex/rxjava3/core/ObservableSource.java
+++ b/src/main/java/io/reactivex/rxjava3/core/ObservableSource.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
@@ -10,6 +10,7 @@
  * 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 io.reactivex.rxjava3.core;
 
 import io.reactivex.rxjava3.annotations.NonNull;
diff --git a/src/main/java/io/reactivex/rxjava3/core/ObservableTransformer.java b/src/main/java/io/reactivex/rxjava3/core/ObservableTransformer.java
index e6686e2e97..57b32bdc71 100644
--- a/src/main/java/io/reactivex/rxjava3/core/ObservableTransformer.java
+++ b/src/main/java/io/reactivex/rxjava3/core/ObservableTransformer.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/Observer.java b/src/main/java/io/reactivex/rxjava3/core/Observer.java
index dd4fb58711..6b911f51e5 100644
--- a/src/main/java/io/reactivex/rxjava3/core/Observer.java
+++ b/src/main/java/io/reactivex/rxjava3/core/Observer.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/Scheduler.java b/src/main/java/io/reactivex/rxjava3/core/Scheduler.java
index bd121c06c4..3aa001127a 100644
--- a/src/main/java/io/reactivex/rxjava3/core/Scheduler.java
+++ b/src/main/java/io/reactivex/rxjava3/core/Scheduler.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016-present, RxJava Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
@@ -60,8 +60,9 @@
  * interface which can grant access to the original or hooked {@code Runnable}, thus, a repeated {@code RxJavaPlugins.onSchedule}
  * can detect the earlier hook and not apply a new one over again.
  * 

- * The default implementation of {@link #now(TimeUnit)} and {@link Worker#now(TimeUnit)} methods to return current - * {@link System#currentTimeMillis()} value in the desired time unit. Custom {@code Scheduler} implementations can override this + * The default implementation of {@link #now(TimeUnit)} and {@link Worker#now(TimeUnit)} methods to return current {@link System#currentTimeMillis()} + * value in the desired time unit, unless {@code rx3.scheduler.use-nanotime} (boolean) is set. When the property is set to + * {@code true}, the method uses {@link System#nanoTime()} as its basis instead. Custom {@code Scheduler} implementations can override this * to provide specialized time accounting (such as virtual time to be advanced programmatically). * Note that operators requiring a {@code Scheduler} may rely on either of the {@code now()} calls provided by * {@code Scheduler} or {@code Worker} respectively, therefore, it is recommended they represent a logically @@ -88,6 +89,34 @@ * All methods on the {@code Scheduler} and {@code Worker} classes should be thread safe. */ public abstract class Scheduler { + /** + * Value representing whether to use {@link System#nanoTime()}, or default as clock for {@link #now(TimeUnit)} + * and {@link Scheduler.Worker#now(TimeUnit)}. + *

+ * Associated system parameter: + *

    + *
  • {@code rx3.scheduler.use-nanotime}, boolean, default {@code false} + *
+ */ + static boolean IS_DRIFT_USE_NANOTIME = Boolean.getBoolean("rx3.scheduler.use-nanotime"); + + /** + * Returns the current clock time depending on state of {@link Scheduler#IS_DRIFT_USE_NANOTIME} in given {@code unit} + *

+ * By default {@link System#currentTimeMillis()} will be used as the clock. When the property is set + * {@link System#nanoTime()} will be used. + *

+ * @param unit the time unit + * @return the 'current time' in given unit + * @throws NullPointerException if {@code unit} is {@code null} + */ + static long computeNow(TimeUnit unit) { + if (!IS_DRIFT_USE_NANOTIME) { + return unit.convert(System.currentTimeMillis(), TimeUnit.MILLISECONDS); + } + return unit.convert(System.nanoTime(), TimeUnit.NANOSECONDS); + } + /** * The tolerance for a clock drift in nanoseconds where the periodic scheduler will rebase. *

@@ -156,7 +185,7 @@ public static long clockDriftTolerance() { * @since 2.0 */ public long now(@NonNull TimeUnit unit) { - return unit.convert(System.currentTimeMillis(), TimeUnit.MILLISECONDS); + return computeNow(unit); } /** @@ -321,7 +350,7 @@ public Disposable schedulePeriodicallyDirect(@NonNull Runnable run, long initial * }); *

* - * Slowing down the rate to no more than than 1 a second. This suffers from + * Slowing down the rate to no more than 1 a second. This suffers from * the same problem as the one above I could find an {@link Flowable} * operator that limits the rate without dropping the values (aka leaky * bucket algorithm). @@ -362,8 +391,9 @@ public S when(@NonNull Function - * The default implementation of the {@link #now(TimeUnit)} method returns current - * {@link System#currentTimeMillis()} value in the desired time unit. Custom {@code Worker} implementations can override this + * The default implementation of the {@link #now(TimeUnit)} method returns current {@link System#currentTimeMillis()} + * value in the desired time unit, unless {@code rx3.scheduler.use-nanotime} (boolean) is set. When the property is set to + * {@code true}, the method uses {@link System#nanoTime()} as its basis instead. Custom {@code Worker} implementations can override this * to provide specialized time accounting (such as virtual time to be advanced programmatically). * Note that operators requiring a scheduler may rely on either of the {@code now()} calls provided by * {@code Scheduler} or {@code Worker} respectively, therefore, it is recommended they represent a logically @@ -482,7 +512,7 @@ public Disposable schedulePeriodically(@NonNull Runnable run, final long initial * @since 2.0 */ public long now(@NonNull TimeUnit unit) { - return unit.convert(System.currentTimeMillis(), TimeUnit.MILLISECONDS); + return computeNow(unit); } /** diff --git a/src/main/java/io/reactivex/rxjava3/core/Single.java b/src/main/java/io/reactivex/rxjava3/core/Single.java index b10706a214..6cf5a3f789 100644 --- a/src/main/java/io/reactivex/rxjava3/core/Single.java +++ b/src/main/java/io/reactivex/rxjava3/core/Single.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -20,7 +20,7 @@ import org.reactivestreams.*; import io.reactivex.rxjava3.annotations.*; -import io.reactivex.rxjava3.disposables.Disposable; +import io.reactivex.rxjava3.disposables.*; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.*; @@ -134,7 +134,7 @@ public abstract class Single<@NonNull T> implements SingleSource { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single amb(@NonNull Iterable<@NonNull ? extends SingleSource> sources) { + public static <@NonNull T> Single amb(@NonNull Iterable<@NonNull ? extends SingleSource> sources) { Objects.requireNonNull(sources, "sources is null"); return RxJavaPlugins.onAssembly(new SingleAmb<>(null, sources)); } @@ -159,7 +159,7 @@ public static Single amb(@NonNull Iterable<@NonNull ? extends SingleSourc @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs @NonNull - public static Single ambArray(@NonNull SingleSource... sources) { + public static <@NonNull T> Single ambArray(@NonNull SingleSource... sources) { Objects.requireNonNull(sources, "sources is null"); if (sources.length == 0) { return error(SingleInternalHelper.emptyThrower()); @@ -193,7 +193,7 @@ public static Single ambArray(@NonNull SingleSource... sourc @NonNull @SchedulerSupport(SchedulerSupport.NONE) @BackpressureSupport(BackpressureKind.FULL) - public static Flowable concat(@NonNull Iterable<@NonNull ? extends SingleSource> sources) { + public static <@NonNull T> Flowable concat(@NonNull Iterable<@NonNull ? extends SingleSource> sources) { return Flowable.fromIterable(sources).concatMapSingleDelayError(Functions.identity(), false); } @@ -215,7 +215,7 @@ public static Flowable concat(@NonNull Iterable<@NonNull ? extends Single @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable concat(@NonNull ObservableSource> sources) { + public static <@NonNull T> Observable concat(@NonNull ObservableSource> sources) { Objects.requireNonNull(sources, "sources is null"); return RxJavaPlugins.onAssembly(new ObservableConcatMapSingle<>(sources, Functions.identity(), ErrorMode.IMMEDIATE, 2)); } @@ -242,7 +242,7 @@ public static Observable concat(@NonNull ObservableSource Flowable concat(@NonNull Publisher<@NonNull ? extends SingleSource> sources) { + public static <@NonNull T> Flowable concat(@NonNull Publisher<@NonNull ? extends SingleSource> sources) { return concat(sources, 2); } @@ -270,7 +270,7 @@ public static Flowable concat(@NonNull Publisher<@NonNull ? extends Singl @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concat(@NonNull Publisher<@NonNull ? extends SingleSource> sources, int prefetch) { + public static <@NonNull T> Flowable concat(@NonNull Publisher<@NonNull ? extends SingleSource> sources, int prefetch) { Objects.requireNonNull(sources, "sources is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); return RxJavaPlugins.onAssembly(new FlowableConcatMapSinglePublisher<>(sources, Functions.identity(), ErrorMode.IMMEDIATE, prefetch)); @@ -300,7 +300,7 @@ public static Flowable concat(@NonNull Publisher<@NonNull ? extends Singl @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concat( + public static <@NonNull T> Flowable concat( @NonNull SingleSource source1, @NonNull SingleSource source2 ) { Objects.requireNonNull(source1, "source1 is null"); @@ -334,7 +334,7 @@ public static Flowable concat( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concat( + public static <@NonNull T> Flowable concat( @NonNull SingleSource source1, @NonNull SingleSource source2, @NonNull SingleSource source3 ) { @@ -372,7 +372,7 @@ public static Flowable concat( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concat( + public static <@NonNull T> Flowable concat( @NonNull SingleSource source1, @NonNull SingleSource source2, @NonNull SingleSource source3, @NonNull SingleSource source4 ) { @@ -405,7 +405,7 @@ public static Flowable concat( @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs - public static Flowable concatArray(@NonNull SingleSource... sources) { + public static <@NonNull T> Flowable concatArray(@NonNull SingleSource... sources) { return Flowable.fromArray(sources).concatMapSingleDelayError(Functions.identity(), false); } @@ -431,7 +431,7 @@ public static Flowable concatArray(@NonNull SingleSource... @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs - public static Flowable concatArrayDelayError(@NonNull SingleSource... sources) { + public static <@NonNull T> Flowable concatArrayDelayError(@NonNull SingleSource... sources) { return Flowable.fromArray(sources).concatMapSingleDelayError(Functions.identity(), true); } @@ -459,7 +459,7 @@ public static Flowable concatArrayDelayError(@NonNull SingleSource Flowable concatArrayEager(@NonNull SingleSource... sources) { + public static <@NonNull T> Flowable concatArrayEager(@NonNull SingleSource... sources) { return Flowable.fromArray(sources).concatMapEager(SingleInternalHelper.toFlowable()); } @@ -488,7 +488,7 @@ public static Flowable concatArrayEager(@NonNull SingleSource Flowable concatArrayEagerDelayError(@NonNull SingleSource... sources) { + public static <@NonNull T> Flowable concatArrayEagerDelayError(@NonNull SingleSource... sources) { return Flowable.fromArray(sources).concatMapEagerDelayError(SingleInternalHelper.toFlowable(), true); } @@ -515,7 +515,7 @@ public static Flowable concatArrayEagerDelayError(@NonNull SingleSource Flowable concatDelayError(@NonNull Iterable<@NonNull ? extends SingleSource> sources) { + public static <@NonNull T> Flowable concatDelayError(@NonNull Iterable<@NonNull ? extends SingleSource> sources) { return Flowable.fromIterable(sources).concatMapSingleDelayError(Functions.identity()); } @@ -542,7 +542,7 @@ public static Flowable concatDelayError(@NonNull Iterable<@NonNull ? exte @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable concatDelayError(@NonNull Publisher<@NonNull ? extends SingleSource> sources) { + public static <@NonNull T> Flowable concatDelayError(@NonNull Publisher<@NonNull ? extends SingleSource> sources) { return Flowable.fromPublisher(sources).concatMapSingleDelayError(Functions.identity()); } @@ -574,7 +574,7 @@ public static Flowable concatDelayError(@NonNull Publisher<@NonNull ? ext @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Flowable concatDelayError(@NonNull Publisher<@NonNull ? extends SingleSource> sources, int prefetch) { + public static <@NonNull T> Flowable concatDelayError(@NonNull Publisher<@NonNull ? extends SingleSource> sources, int prefetch) { return Flowable.fromPublisher(sources).concatMapSingleDelayError(Functions.identity(), true, prefetch); } @@ -601,7 +601,7 @@ public static Flowable concatDelayError(@NonNull Publisher<@NonNull ? ext @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concatEager(@NonNull Iterable<@NonNull ? extends SingleSource> sources) { + public static <@NonNull T> Flowable concatEager(@NonNull Iterable<@NonNull ? extends SingleSource> sources) { return Flowable.fromIterable(sources).concatMapEagerDelayError(SingleInternalHelper.toFlowable(), false); } @@ -633,7 +633,7 @@ public static Flowable concatEager(@NonNull Iterable<@NonNull ? extends S @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concatEager(@NonNull Iterable<@NonNull ? extends SingleSource> sources, int maxConcurrency) { + public static <@NonNull T> Flowable concatEager(@NonNull Iterable<@NonNull ? extends SingleSource> sources, int maxConcurrency) { return Flowable.fromIterable(sources).concatMapEagerDelayError(SingleInternalHelper.toFlowable(), false, maxConcurrency, 1); } @@ -662,7 +662,7 @@ public static Flowable concatEager(@NonNull Iterable<@NonNull ? extends S @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concatEager(@NonNull Publisher<@NonNull ? extends SingleSource> sources) { + public static <@NonNull T> Flowable concatEager(@NonNull Publisher<@NonNull ? extends SingleSource> sources) { return Flowable.fromPublisher(sources).concatMapEager(SingleInternalHelper.toFlowable()); } @@ -696,7 +696,7 @@ public static Flowable concatEager(@NonNull Publisher<@NonNull ? extends @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concatEager(@NonNull Publisher<@NonNull ? extends SingleSource> sources, int maxConcurrency) { + public static <@NonNull T> Flowable concatEager(@NonNull Publisher<@NonNull ? extends SingleSource> sources, int maxConcurrency) { return Flowable.fromPublisher(sources).concatMapEager(SingleInternalHelper.toFlowable(), maxConcurrency, 1); } @@ -725,7 +725,7 @@ public static Flowable concatEager(@NonNull Publisher<@NonNull ? extends @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concatEagerDelayError(@NonNull Iterable<@NonNull ? extends SingleSource> sources) { + public static <@NonNull T> Flowable concatEagerDelayError(@NonNull Iterable<@NonNull ? extends SingleSource> sources) { return Flowable.fromIterable(sources).concatMapEagerDelayError(SingleInternalHelper.toFlowable(), true); } @@ -757,7 +757,7 @@ public static Flowable concatEagerDelayError(@NonNull Iterable<@NonNull ? @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concatEagerDelayError(@NonNull Iterable<@NonNull ? extends SingleSource> sources, int maxConcurrency) { + public static <@NonNull T> Flowable concatEagerDelayError(@NonNull Iterable<@NonNull ? extends SingleSource> sources, int maxConcurrency) { return Flowable.fromIterable(sources).concatMapEagerDelayError(SingleInternalHelper.toFlowable(), true, maxConcurrency, 1); } @@ -788,7 +788,7 @@ public static Flowable concatEagerDelayError(@NonNull Iterable<@NonNull ? @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concatEagerDelayError(@NonNull Publisher<@NonNull ? extends SingleSource> sources) { + public static <@NonNull T> Flowable concatEagerDelayError(@NonNull Publisher<@NonNull ? extends SingleSource> sources) { return Flowable.fromPublisher(sources).concatMapEagerDelayError(SingleInternalHelper.toFlowable(), true); } @@ -822,7 +822,7 @@ public static Flowable concatEagerDelayError(@NonNull Publisher<@NonNull @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable concatEagerDelayError(@NonNull Publisher<@NonNull ? extends SingleSource> sources, int maxConcurrency) { + public static <@NonNull T> Flowable concatEagerDelayError(@NonNull Publisher<@NonNull ? extends SingleSource> sources, int maxConcurrency) { return Flowable.fromPublisher(sources).concatMapEagerDelayError(SingleInternalHelper.toFlowable(), true, maxConcurrency, 1); } @@ -895,7 +895,7 @@ public static Flowable concatEagerDelayError(@NonNull Publisher<@NonNull @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single defer(@NonNull Supplier> supplier) { + public static <@NonNull T> Single defer(@NonNull Supplier> supplier) { Objects.requireNonNull(supplier, "supplier is null"); return RxJavaPlugins.onAssembly(new SingleDefer<>(supplier)); } @@ -917,7 +917,7 @@ public static Single defer(@NonNull Supplier Single error(@NonNull Supplier supplier) { + public static <@NonNull T> Single error(@NonNull Supplier supplier) { Objects.requireNonNull(supplier, "supplier is null"); return RxJavaPlugins.onAssembly(new SingleError<>(supplier)); } @@ -944,7 +944,7 @@ public static Single error(@NonNull Supplier supplie @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single error(@NonNull Throwable throwable) { + public static <@NonNull T> Single error(@NonNull Throwable throwable) { Objects.requireNonNull(throwable, "throwable is null"); return error(Functions.justSupplier(throwable)); } @@ -1080,7 +1080,7 @@ public static Single error(@NonNull Throwable throwable) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single fromMaybe(@NonNull MaybeSource maybe) { + public static <@NonNull T> Single fromMaybe(@NonNull MaybeSource maybe) { Objects.requireNonNull(maybe, "maybe is null"); return RxJavaPlugins.onAssembly(new MaybeToSingle<>(maybe, null)); } @@ -1105,7 +1105,7 @@ public static Single fromMaybe(@NonNull MaybeSource maybe) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single fromMaybe(@NonNull MaybeSource maybe, @NonNull T defaultItem) { + public static <@NonNull T> Single fromMaybe(@NonNull MaybeSource maybe, @NonNull T defaultItem) { Objects.requireNonNull(maybe, "maybe is null"); Objects.requireNonNull(defaultItem, "defaultItem is null"); return RxJavaPlugins.onAssembly(new MaybeToSingle<>(maybe, defaultItem)); @@ -1146,7 +1146,7 @@ public static Single fromMaybe(@NonNull MaybeSource maybe, @NonNull T @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single fromPublisher(@NonNull Publisher<@NonNull ? extends T> publisher) { + public static <@NonNull T> Single fromPublisher(@NonNull Publisher publisher) { Objects.requireNonNull(publisher, "publisher is null"); return RxJavaPlugins.onAssembly(new SingleFromPublisher<>(publisher)); } @@ -1172,7 +1172,7 @@ public static Single fromPublisher(@NonNull Publisher<@NonNull ? extends @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single fromObservable(@NonNull ObservableSource observable) { + public static <@NonNull T> Single fromObservable(@NonNull ObservableSource observable) { Objects.requireNonNull(observable, "observable is null"); return RxJavaPlugins.onAssembly(new ObservableSingleSingle<>(observable, null)); } @@ -1279,7 +1279,7 @@ public static Single fromObservable(@NonNull ObservableSource Flowable merge(@NonNull Iterable<@NonNull ? extends SingleSource> sources) { + public static <@NonNull T> Flowable merge(@NonNull Iterable<@NonNull ? extends SingleSource> sources) { return Flowable.fromIterable(sources).flatMapSingle(Functions.identity()); } @@ -1318,7 +1318,7 @@ public static Flowable merge(@NonNull Iterable<@NonNull ? extends SingleS @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable merge(@NonNull Publisher<@NonNull ? extends SingleSource> sources) { + public static <@NonNull T> Flowable merge(@NonNull Publisher<@NonNull ? extends SingleSource> sources) { Objects.requireNonNull(sources, "sources is null"); return RxJavaPlugins.onAssembly(new FlowableFlatMapSinglePublisher<>(sources, Functions.identity(), false, Integer.MAX_VALUE)); } @@ -1349,7 +1349,7 @@ public static Flowable merge(@NonNull Publisher<@NonNull ? extends Single @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single merge(@NonNull SingleSource> source) { + public static <@NonNull T> Single merge(@NonNull SingleSource> source) { Objects.requireNonNull(source, "source is null"); return RxJavaPlugins.onAssembly(new SingleFlatMap, T>(source, Functions.identity())); } @@ -1395,7 +1395,7 @@ public static Single merge(@NonNull SingleSource Flowable merge( + public static <@NonNull T> Flowable merge( @NonNull SingleSource source1, @NonNull SingleSource source2 ) { Objects.requireNonNull(source1, "source1 is null"); @@ -1446,7 +1446,7 @@ public static Flowable merge( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable merge( + public static <@NonNull T> Flowable merge( @NonNull SingleSource source1, @NonNull SingleSource source2, @NonNull SingleSource source3 ) { @@ -1501,7 +1501,7 @@ public static Flowable merge( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable merge( + public static <@NonNull T> Flowable merge( @NonNull SingleSource source1, @NonNull SingleSource source2, @NonNull SingleSource source3, @NonNull SingleSource source4 ) { @@ -1547,7 +1547,7 @@ public static Flowable merge( @NonNull @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs - public static Flowable mergeArray(SingleSource... sources) { + public static <@NonNull T> Flowable mergeArray(SingleSource... sources) { return Flowable.fromArray(sources).flatMapSingle(Functions.identity(), false, Math.max(1, sources.length)); } @@ -1583,7 +1583,7 @@ public static Flowable mergeArray(SingleSource... sources) { @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs @NonNull - public static Flowable mergeArrayDelayError(@NonNull SingleSource... sources) { + public static <@NonNull T> Flowable mergeArrayDelayError(@NonNull SingleSource... sources) { return Flowable.fromArray(sources).flatMapSingle(Functions.identity(), true, Math.max(1, sources.length)); } @@ -1610,7 +1610,7 @@ public static Flowable mergeArrayDelayError(@NonNull SingleSource Flowable mergeDelayError(@NonNull Iterable<@NonNull ? extends SingleSource> sources) { + public static <@NonNull T> Flowable mergeDelayError(@NonNull Iterable<@NonNull ? extends SingleSource> sources) { return Flowable.fromIterable(sources).flatMapSingle(Functions.identity(), true, Integer.MAX_VALUE); } @@ -1637,7 +1637,7 @@ public static Flowable mergeDelayError(@NonNull Iterable<@NonNull ? exten @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable mergeDelayError(@NonNull Publisher<@NonNull ? extends SingleSource> sources) { + public static <@NonNull T> Flowable mergeDelayError(@NonNull Publisher<@NonNull ? extends SingleSource> sources) { Objects.requireNonNull(sources, "sources is null"); return RxJavaPlugins.onAssembly(new FlowableFlatMapSinglePublisher<>(sources, Functions.identity(), true, Integer.MAX_VALUE)); } @@ -1672,7 +1672,7 @@ public static Flowable mergeDelayError(@NonNull Publisher<@NonNull ? exte @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable mergeDelayError( + public static <@NonNull T> Flowable mergeDelayError( @NonNull SingleSource source1, @NonNull SingleSource source2 ) { Objects.requireNonNull(source1, "source1 is null"); @@ -1712,7 +1712,7 @@ public static Flowable mergeDelayError( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable mergeDelayError( + public static <@NonNull T> Flowable mergeDelayError( @NonNull SingleSource source1, @NonNull SingleSource source2, @NonNull SingleSource source3 ) { @@ -1756,7 +1756,7 @@ public static Flowable mergeDelayError( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable mergeDelayError( + public static <@NonNull T> Flowable mergeDelayError( @NonNull SingleSource source1, @NonNull SingleSource source2, @NonNull SingleSource source3, @NonNull SingleSource source4 ) { @@ -1783,7 +1783,7 @@ public static Flowable mergeDelayError( @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings("unchecked") @NonNull - public static Single never() { + public static <@NonNull T> Single never() { return RxJavaPlugins.onAssembly((Single) SingleNever.INSTANCE); } @@ -1853,7 +1853,7 @@ public static Single timer(long delay, @NonNull TimeUnit unit, @NonNull Sc @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single sequenceEqual(@NonNull SingleSource source1, @NonNull SingleSource source2) { // NOPMD + public static <@NonNull T> Single sequenceEqual(@NonNull SingleSource source1, @NonNull SingleSource source2) { // NOPMD Objects.requireNonNull(source1, "source1 is null"); Objects.requireNonNull(source2, "source2 is null"); return RxJavaPlugins.onAssembly(new SingleEquals<>(source1, source2)); @@ -1888,7 +1888,7 @@ public static Single sequenceEqual(@NonNull SingleSource Flowable switchOnNext(@NonNull Publisher<@NonNull ? extends SingleSource> sources) { + public static <@NonNull T> Flowable switchOnNext(@NonNull Publisher<@NonNull ? extends SingleSource> sources) { Objects.requireNonNull(sources, "sources is null"); return RxJavaPlugins.onAssembly(new FlowableSwitchMapSinglePublisher<>(sources, Functions.identity(), false)); } @@ -1923,7 +1923,7 @@ public static Flowable switchOnNext(@NonNull Publisher<@NonNull ? extends @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Flowable switchOnNextDelayError(@NonNull Publisher<@NonNull ? extends SingleSource> sources) { + public static <@NonNull T> Flowable switchOnNextDelayError(@NonNull Publisher<@NonNull ? extends SingleSource> sources) { Objects.requireNonNull(sources, "sources is null"); return RxJavaPlugins.onAssembly(new FlowableSwitchMapSinglePublisher<>(sources, Functions.identity(), true)); } @@ -1949,7 +1949,7 @@ public static Flowable switchOnNextDelayError(@NonNull Publisher<@NonNull @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single unsafeCreate(@NonNull SingleSource onSubscribe) { + public static <@NonNull T> Single unsafeCreate(@NonNull SingleSource onSubscribe) { Objects.requireNonNull(onSubscribe, "onSubscribe is null"); if (onSubscribe instanceof Single) { throw new IllegalArgumentException("unsafeCreate(Single) should be upgraded"); @@ -1982,7 +1982,7 @@ public static Single unsafeCreate(@NonNull SingleSource onSubscribe) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public static Single using(@NonNull Supplier resourceSupplier, + public static <@NonNull T, @NonNull U> Single using(@NonNull Supplier resourceSupplier, @NonNull Function> sourceSupplier, @NonNull Consumer resourceCleanup) { return using(resourceSupplier, sourceSupplier, resourceCleanup, true); @@ -2018,7 +2018,7 @@ public static Single using(@NonNull Supplier resourceSupplier, @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single using( + public static <@NonNull T, @NonNull U> Single using( @NonNull Supplier resourceSupplier, @NonNull Function> sourceSupplier, @NonNull Consumer resourceCleanup, @@ -2047,7 +2047,7 @@ public static Single using( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single wrap(@NonNull SingleSource source) { + public static <@NonNull T> Single wrap(@NonNull SingleSource source) { Objects.requireNonNull(source, "source is null"); if (source instanceof Single) { return RxJavaPlugins.onAssembly((Single)source); @@ -2088,7 +2088,7 @@ public static Single wrap(@NonNull SingleSource source) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single zip(@NonNull Iterable<@NonNull ? extends SingleSource> sources, + public static <@NonNull T, @NonNull R> Single zip(@NonNull Iterable<@NonNull ? extends SingleSource> sources, @NonNull Function zipper) { Objects.requireNonNull(zipper, "zipper is null"); Objects.requireNonNull(sources, "sources is null"); @@ -2122,7 +2122,7 @@ public static Single zip(@NonNull Iterable<@NonNull ? extends SingleSo @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single zip( + public static <@NonNull T1, @NonNull T2, @NonNull R> Single zip( @NonNull SingleSource source1, @NonNull SingleSource source2, @NonNull BiFunction zipper ) { @@ -2162,7 +2162,7 @@ public static Single zip( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single zip( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull R> Single zip( @NonNull SingleSource source1, @NonNull SingleSource source2, @NonNull SingleSource source3, @NonNull Function3 zipper @@ -2207,7 +2207,7 @@ public static Single zip( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single zip( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull R> Single zip( @NonNull SingleSource source1, @NonNull SingleSource source2, @NonNull SingleSource source3, @NonNull SingleSource source4, @NonNull Function4 zipper @@ -2257,7 +2257,7 @@ public static Single zip( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single zip( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull R> Single zip( @NonNull SingleSource source1, @NonNull SingleSource source2, @NonNull SingleSource source3, @NonNull SingleSource source4, @NonNull SingleSource source5, @@ -2312,7 +2312,7 @@ public static Single zip( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single zip( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull R> Single zip( @NonNull SingleSource source1, @NonNull SingleSource source2, @NonNull SingleSource source3, @NonNull SingleSource source4, @NonNull SingleSource source5, @NonNull SingleSource source6, @@ -2371,7 +2371,7 @@ public static Single zip( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single zip( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull R> Single zip( @NonNull SingleSource source1, @NonNull SingleSource source2, @NonNull SingleSource source3, @NonNull SingleSource source4, @NonNull SingleSource source5, @NonNull SingleSource source6, @@ -2435,7 +2435,7 @@ public static Single zip( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single zip( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull T8, @NonNull R> Single zip( @NonNull SingleSource source1, @NonNull SingleSource source2, @NonNull SingleSource source3, @NonNull SingleSource source4, @NonNull SingleSource source5, @NonNull SingleSource source6, @@ -2504,7 +2504,7 @@ public static Single zip( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single zip( + public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull T8, @NonNull T9, @NonNull R> Single zip( @NonNull SingleSource source1, @NonNull SingleSource source2, @NonNull SingleSource source3, @NonNull SingleSource source4, @NonNull SingleSource source5, @NonNull SingleSource source6, @@ -2558,7 +2558,7 @@ public static Single zip( @NonNull @SchedulerSupport(SchedulerSupport.NONE) @SafeVarargs - public static Single zipArray(@NonNull Function zipper, @NonNull SingleSource... sources) { + public static <@NonNull T, @NonNull R> Single zipArray(@NonNull Function zipper, @NonNull SingleSource... sources) { Objects.requireNonNull(zipper, "zipper is null"); Objects.requireNonNull(sources, "sources is null"); if (sources.length == 0) { @@ -2633,7 +2633,7 @@ public final Single hide() { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Single compose(@NonNull SingleTransformer transformer) { + public final <@NonNull R> Single compose(@NonNull SingleTransformer transformer) { return wrap(((SingleTransformer) Objects.requireNonNull(transformer, "transformer is null")).apply(this)); } @@ -2676,7 +2676,7 @@ public final Single cache() { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Single cast(@NonNull Class clazz) { + public final <@NonNull U> Single cast(@NonNull Class clazz) { Objects.requireNonNull(clazz, "clazz is null"); return map(Functions.castFunction(clazz)); } @@ -2704,7 +2704,7 @@ public final Single cast(@NonNull Class clazz) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Single concatMap(@NonNull Function> mapper) { + public final <@NonNull R> Single concatMap(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new SingleFlatMap<>(this, mapper)); } @@ -2759,7 +2759,7 @@ public final Completable concatMapCompletable(@NonNull Function Maybe concatMapMaybe(@NonNull Function> mapper) { + public final <@NonNull R> Maybe concatMapMaybe(@NonNull Function> mapper) { return flatMapMaybe(mapper); } @@ -2938,7 +2938,7 @@ public final Single delaySubscription(@NonNull CompletableSource subscription @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Single delaySubscription(@NonNull SingleSource subscriptionIndicator) { + public final <@NonNull U> Single delaySubscription(@NonNull SingleSource subscriptionIndicator) { Objects.requireNonNull(subscriptionIndicator, "subscriptionIndicator is null"); return RxJavaPlugins.onAssembly(new SingleDelayWithSingle<>(this, subscriptionIndicator)); } @@ -2964,7 +2964,7 @@ public final Single delaySubscription(@NonNull SingleSource subscripti @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Single delaySubscription(@NonNull ObservableSource subscriptionIndicator) { + public final <@NonNull U> Single delaySubscription(@NonNull ObservableSource subscriptionIndicator) { Objects.requireNonNull(subscriptionIndicator, "subscriptionIndicator is null"); return RxJavaPlugins.onAssembly(new SingleDelayWithObservable<>(this, subscriptionIndicator)); } @@ -2995,7 +2995,7 @@ public final Single delaySubscription(@NonNull ObservableSource subscr @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Single delaySubscription(@NonNull Publisher subscriptionIndicator) { + public final <@NonNull U> Single delaySubscription(@NonNull Publisher subscriptionIndicator) { Objects.requireNonNull(subscriptionIndicator, "subscriptionIndicator is null"); return RxJavaPlugins.onAssembly(new SingleDelayWithPublisher<>(this, subscriptionIndicator)); } @@ -3385,7 +3385,7 @@ public final Maybe filter(@NonNull Predicate predicate) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Single flatMap(@NonNull Function> mapper) { + public final <@NonNull R> Single flatMap(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new SingleFlatMap<>(this, mapper)); } @@ -3417,7 +3417,7 @@ public final Single flatMap(@NonNull Function Single flatMap(@NonNull Function> mapper, + public final <@NonNull U, @NonNull R> Single flatMap(@NonNull Function> mapper, @NonNull BiFunction combiner) { Objects.requireNonNull(mapper, "mapper is null"); Objects.requireNonNull(combiner, "combiner is null"); @@ -3448,7 +3448,7 @@ public final Single flatMap(@NonNull Function Single flatMap( + public final <@NonNull R> Single flatMap( @NonNull Function> onSuccessMapper, @NonNull Function> onErrorMapper) { Objects.requireNonNull(onSuccessMapper, "onSuccessMapper is null"); @@ -3476,7 +3476,7 @@ public final Single flatMap( @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Maybe flatMapMaybe(@NonNull Function> mapper) { + public final <@NonNull R> Maybe flatMapMaybe(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new SingleFlatMapMaybe<>(this, mapper)); } @@ -3506,7 +3506,7 @@ public final Maybe flatMapMaybe(@NonNull Function Flowable flatMapPublisher(@NonNull Function> mapper) { + public final <@NonNull R> Flowable flatMapPublisher(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new SingleFlatMapPublisher<>(this, mapper)); } @@ -3537,7 +3537,7 @@ public final Flowable flatMapPublisher(@NonNull Function Flowable flattenAsFlowable(@NonNull Function> mapper) { + public final <@NonNull U> Flowable flattenAsFlowable(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new SingleFlatMapIterableFlowable<>(this, mapper)); } @@ -3565,7 +3565,7 @@ public final Flowable flattenAsFlowable(@NonNull Function Observable flattenAsObservable(@NonNull Function<@NonNull ? super T, @NonNull ? extends Iterable<@NonNull ? extends U>> mapper) { + public final <@NonNull U> Observable flattenAsObservable(@NonNull Function<@NonNull ? super T, @NonNull ? extends Iterable> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new SingleFlatMapIterableObservable<>(this, mapper)); } @@ -3892,7 +3892,7 @@ public final void blockingSubscribe(@NonNull SingleObserver observer) @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Single lift(@NonNull SingleOperator lift) { + public final <@NonNull R> Single lift(@NonNull SingleOperator lift) { Objects.requireNonNull(lift, "lift is null"); return RxJavaPlugins.onAssembly(new SingleLift<>(this, lift)); } @@ -4039,7 +4039,7 @@ public final Flowable mergeWith(@NonNull SingleSource other) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Maybe ofType(@NonNull Class clazz) { + public final <@NonNull U> Maybe ofType(@NonNull Class clazz) { Objects.requireNonNull(clazz, "clazz is null"); return filter(Functions.isInstanceOf(clazz)).cast(clazz); } @@ -4333,7 +4333,7 @@ public final Flowable repeat(long times) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Flowable repeatWhen(@NonNull Function, ? extends Publisher<@NonNull ?>> handler) { + public final Flowable repeatWhen(@NonNull Function, @NonNull ? extends Publisher<@NonNull ?>> handler) { return toFlowable().repeatWhen(handler); } @@ -4538,7 +4538,7 @@ public final Single retryUntil(@NonNull BooleanSupplier stop) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Single retryWhen(@NonNull Function, ? extends Publisher<@NonNull ?>> handler) { + public final Single retryWhen(@NonNull Function, @NonNull ? extends Publisher<@NonNull ?>> handler) { return toSingle(toFlowable().retryWhen(handler)); } @@ -4705,6 +4705,7 @@ public final Flowable startWith(@NonNull Publisher other) { * * @return the new {@link Disposable} instance that can be used for disposing the subscription at any time * @see ReactiveX operators documentation: Subscribe + * @see #subscribe(Consumer, Consumer, DisposableContainer) */ @SchedulerSupport(SchedulerSupport.NONE) @NonNull @@ -4726,14 +4727,15 @@ public final Disposable subscribe() { * the callback that receives either the success value or the failure {@link Throwable} * (whichever is not {@code null}) * @return the new {@link Disposable} instance that can be used for disposing the subscription at any time - * @see ReactiveX operators documentation: Subscribe * @throws NullPointerException * if {@code onCallback} is {@code null} + * @see #subscribe(Consumer, Consumer, DisposableContainer) + * @see ReactiveX operators documentation: Subscribe */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Disposable subscribe(@NonNull BiConsumer onCallback) { + public final Disposable subscribe(@NonNull BiConsumer<@Nullable ? super T, @Nullable ? super Throwable> onCallback) { Objects.requireNonNull(onCallback, "onCallback is null"); BiConsumerSingleObserver observer = new BiConsumerSingleObserver<>(onCallback); @@ -4760,6 +4762,7 @@ public final Disposable subscribe(@NonNull BiConsumerReactiveX operators documentation: Subscribe + * @see #subscribe(Consumer, Consumer, DisposableContainer) */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @@ -4784,9 +4787,10 @@ public final Disposable subscribe(@NonNull Consumer onSuccess) { * the {@code Consumer} you have designed to accept any error notification from the * {@code Single} * @return the new {@link Disposable} instance that can be used for disposing the subscription at any time - * @see ReactiveX operators documentation: Subscribe * @throws NullPointerException * if {@code onSuccess} or {@code onError} is {@code null} + * @see ReactiveX operators documentation: Subscribe + * @see #subscribe(Consumer, Consumer, DisposableContainer) */ @CheckReturnValue @NonNull @@ -4800,6 +4804,44 @@ public final Disposable subscribe(@NonNull Consumer onSuccess, @NonNu return observer; } + /** + * Wraps the given onXXX callbacks into a {@link Disposable} {@link SingleObserver}, + * adds it to the given {@link DisposableContainer} and ensures, that if the upstream + * terminates or this particular {@code Disposable} is disposed, the {@code SingleObserver} is removed + * from the given container. + *

+ * The {@code SingleObserver} will be removed after the callback for the terminal event has been invoked. + *

+ *
Scheduler:
+ *
{@code subscribe} does not operate by default on a particular {@link Scheduler}.
+ *
+ * @param onSuccess the callback for upstream items + * @param onError the callback for an upstream error if any + * @param container the {@code DisposableContainer} (such as {@link CompositeDisposable}) to add and remove the + * created {@code Disposable} {@code SingleObserver} + * @return the {@code Disposable} that allows disposing the particular subscription. + * @throws NullPointerException + * if {@code onSuccess}, {@code onError} + * or {@code container} is {@code null} + * @since 3.1.0 + */ + @SchedulerSupport(SchedulerSupport.NONE) + @NonNull + public final Disposable subscribe( + @NonNull Consumer onSuccess, + @NonNull Consumer onError, + @NonNull DisposableContainer container) { + Objects.requireNonNull(onSuccess, "onSuccess is null"); + Objects.requireNonNull(onError, "onError is null"); + Objects.requireNonNull(container, "container is null"); + + DisposableAutoReleaseMultiObserver observer = new DisposableAutoReleaseMultiObserver<>( + container, onSuccess, onError, Functions.EMPTY_ACTION); + container.add(observer); + subscribe(observer); + return observer; + } + @SchedulerSupport(SchedulerSupport.NONE) @Override public final void subscribe(@NonNull SingleObserver observer) { @@ -5169,7 +5211,7 @@ public final Single takeUntil(@NonNull CompletableSource other) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Single takeUntil(@NonNull Publisher other) { + public final <@NonNull E> Single takeUntil(@NonNull Publisher other) { Objects.requireNonNull(other, "other is null"); return RxJavaPlugins.onAssembly(new SingleTakeUntil<>(this, other)); } @@ -5197,7 +5239,7 @@ public final Single takeUntil(@NonNull Publisher other) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Single takeUntil(@NonNull SingleSource other) { + public final <@NonNull E> Single takeUntil(@NonNull SingleSource other) { Objects.requireNonNull(other, "other is null"); return takeUntil(new SingleToFlowable(other)); } @@ -5487,7 +5529,7 @@ public final Single unsubscribeOn(@NonNull Scheduler scheduler) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Single zipWith(@NonNull SingleSource other, @NonNull BiFunction zipper) { + public final <@NonNull U, @NonNull R> Single zipWith(@NonNull SingleSource other, @NonNull BiFunction zipper) { return zip(this, other, zipper); } @@ -5556,7 +5598,7 @@ private static Single toSingle(@NonNull Flowable source) { * *

* Note that the operator takes an already instantiated, running or terminated {@code CompletionStage}. - * If the optional is to be created per consumer upon subscription, use {@link #defer(Supplier)} + * If the {@code CompletionStage} is to be created per consumer upon subscription, use {@link #defer(Supplier)} * around {@code fromCompletionStage}: *


      * Single.defer(() -> Single.fromCompletionStage(createCompletionStage()));
@@ -5580,7 +5622,7 @@ private static  Single toSingle(@NonNull Flowable source) {
     @CheckReturnValue
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
-    public static  Single<@NonNull T> fromCompletionStage(@NonNull CompletionStage stage) {
+    public static <@NonNull T> Single<@NonNull T> fromCompletionStage(@NonNull CompletionStage stage) {
         Objects.requireNonNull(stage, "stage is null");
         return RxJavaPlugins.onAssembly(new SingleFromCompletionStage<>(stage));
     }
@@ -5674,7 +5716,7 @@ public final CompletionStage toCompletionStage() {
     @SchedulerSupport(SchedulerSupport.NONE)
     @BackpressureSupport(BackpressureKind.FULL)
     @NonNull
-    public final  Flowable flattenStreamAsFlowable(@NonNull Function> mapper) {
+    public final <@NonNull R> Flowable flattenStreamAsFlowable(@NonNull Function> mapper) {
         Objects.requireNonNull(mapper, "mapper is null");
         return RxJavaPlugins.onAssembly(new SingleFlattenStreamAsFlowable<>(this, mapper));
     }
@@ -5687,7 +5729,7 @@ public final  Flowable flattenStreamAsFlowable(@NonNull Function
      * The operator closes the {@code Stream} upon cancellation and when it terminates. The exceptions raised when
      * closing a {@code Stream} are routed to the global error handler ({@link RxJavaPlugins#onError(Throwable)}.
-     * If a {@code Stream} should not be closed, turn it into an {@link Iterable} and use {@link #flattenAsFlowable(Function)}:
+     * If a {@code Stream} should not be closed, turn it into an {@link Iterable} and use {@link #flattenAsObservable(Function)}:
      * 

      * source.flattenAsObservable(item -> createStream(item)::iterator);
      * 
@@ -5715,7 +5757,7 @@ public final Flowable flattenStreamAsFlowable(@NonNull Function Observable flattenStreamAsObservable(@NonNull Function> mapper) { + public final <@NonNull R> Observable flattenStreamAsObservable(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new SingleFlattenStreamAsObservable<>(this, mapper)); } diff --git a/src/main/java/io/reactivex/rxjava3/core/SingleConverter.java b/src/main/java/io/reactivex/rxjava3/core/SingleConverter.java index ce3a446452..960a17d9d5 100644 --- a/src/main/java/io/reactivex/rxjava3/core/SingleConverter.java +++ b/src/main/java/io/reactivex/rxjava3/core/SingleConverter.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/core/SingleEmitter.java b/src/main/java/io/reactivex/rxjava3/core/SingleEmitter.java index c8d0a79ec3..4b18a81644 100644 --- a/src/main/java/io/reactivex/rxjava3/core/SingleEmitter.java +++ b/src/main/java/io/reactivex/rxjava3/core/SingleEmitter.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/core/SingleObserver.java b/src/main/java/io/reactivex/rxjava3/core/SingleObserver.java index 281c15e531..a110d4bcff 100644 --- a/src/main/java/io/reactivex/rxjava3/core/SingleObserver.java +++ b/src/main/java/io/reactivex/rxjava3/core/SingleObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/core/SingleOnSubscribe.java b/src/main/java/io/reactivex/rxjava3/core/SingleOnSubscribe.java index 14ff5e1f97..e8b9e89f8b 100644 --- a/src/main/java/io/reactivex/rxjava3/core/SingleOnSubscribe.java +++ b/src/main/java/io/reactivex/rxjava3/core/SingleOnSubscribe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,13 +10,14 @@ * 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 io.reactivex.rxjava3.core; import io.reactivex.rxjava3.annotations.NonNull; /** * A functional interface that has a {@code subscribe()} method that receives - * an instance of a {@link SingleEmitter} instance that allows pushing + * a {@link SingleEmitter} instance that allows pushing * an event in a cancellation-safe manner. * * @param the value type pushed diff --git a/src/main/java/io/reactivex/rxjava3/core/SingleOperator.java b/src/main/java/io/reactivex/rxjava3/core/SingleOperator.java index f3975b3a7f..3b9c4a53c5 100644 --- a/src/main/java/io/reactivex/rxjava3/core/SingleOperator.java +++ b/src/main/java/io/reactivex/rxjava3/core/SingleOperator.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/core/SingleSource.java b/src/main/java/io/reactivex/rxjava3/core/SingleSource.java index bbeeaac40b..16147fd55b 100644 --- a/src/main/java/io/reactivex/rxjava3/core/SingleSource.java +++ b/src/main/java/io/reactivex/rxjava3/core/SingleSource.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.core; import io.reactivex.rxjava3.annotations.NonNull; diff --git a/src/main/java/io/reactivex/rxjava3/core/SingleTransformer.java b/src/main/java/io/reactivex/rxjava3/core/SingleTransformer.java index f3edca3430..3ece315f97 100644 --- a/src/main/java/io/reactivex/rxjava3/core/SingleTransformer.java +++ b/src/main/java/io/reactivex/rxjava3/core/SingleTransformer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/core/package-info.java b/src/main/java/io/reactivex/rxjava3/core/package-info.java index 91717d0178..ee76f76a64 100644 --- a/src/main/java/io/reactivex/rxjava3/core/package-info.java +++ b/src/main/java/io/reactivex/rxjava3/core/package-info.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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. */ + /** * Base reactive classes: {@link io.reactivex.rxjava3.core.Flowable}, {@link io.reactivex.rxjava3.core.Observable}, * {@link io.reactivex.rxjava3.core.Single}, {@link io.reactivex.rxjava3.core.Maybe} and diff --git a/src/main/java/io/reactivex/rxjava3/disposables/ActionDisposable.java b/src/main/java/io/reactivex/rxjava3/disposables/ActionDisposable.java index 32ad478656..4caad11d79 100644 --- a/src/main/java/io/reactivex/rxjava3/disposables/ActionDisposable.java +++ b/src/main/java/io/reactivex/rxjava3/disposables/ActionDisposable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.disposables; import io.reactivex.rxjava3.annotations.NonNull; diff --git a/src/main/java/io/reactivex/rxjava3/disposables/AutoCloseableDisposable.java b/src/main/java/io/reactivex/rxjava3/disposables/AutoCloseableDisposable.java index 08cbe9cd99..34cdaed0eb 100644 --- a/src/main/java/io/reactivex/rxjava3/disposables/AutoCloseableDisposable.java +++ b/src/main/java/io/reactivex/rxjava3/disposables/AutoCloseableDisposable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/disposables/CompositeDisposable.java b/src/main/java/io/reactivex/rxjava3/disposables/CompositeDisposable.java index f877dc1381..bcf28ec148 100644 --- a/src/main/java/io/reactivex/rxjava3/disposables/CompositeDisposable.java +++ b/src/main/java/io/reactivex/rxjava3/disposables/CompositeDisposable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.disposables; import java.util.*; diff --git a/src/main/java/io/reactivex/rxjava3/disposables/Disposable.java b/src/main/java/io/reactivex/rxjava3/disposables/Disposable.java index d71a452cb1..845d603171 100644 --- a/src/main/java/io/reactivex/rxjava3/disposables/Disposable.java +++ b/src/main/java/io/reactivex/rxjava3/disposables/Disposable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.disposables; import io.reactivex.rxjava3.annotations.NonNull; @@ -39,8 +40,8 @@ public interface Disposable { /** * Construct a {@code Disposable} by wrapping a {@link Runnable} that is * executed exactly once when the {@code Disposable} is disposed. - * @param run the Runnable to wrap - * @return the new Disposable instance + * @param run the {@code Runnable} to wrap + * @return the new {@code Disposable} instance * @throws NullPointerException if {@code run} is {@code null} * @since 3.0.0 */ @@ -53,8 +54,8 @@ static Disposable fromRunnable(@NonNull Runnable run) { /** * Construct a {@code Disposable} by wrapping a {@link Action} that is * executed exactly once when the {@code Disposable} is disposed. - * @param action the Action to wrap - * @return the new Disposable instance + * @param action the {@code Action} to wrap + * @return the new {@code Disposable} instance * @throws NullPointerException if {@code action} is {@code null} * @since 3.0.0 */ @@ -69,8 +70,8 @@ static Disposable fromAction(@NonNull Action action) { * cancelled exactly once when the {@code Disposable} is disposed. *

* The {@code Future} is cancelled with {@code mayInterruptIfRunning == true}. - * @param future the Future to wrap - * @return the new Disposable instance + * @param future the {@code Future} to wrap + * @return the new {@code Disposable} instance * @throws NullPointerException if {@code future} is {@code null} * @see #fromFuture(Future, boolean) * @since 3.0.0 @@ -84,9 +85,9 @@ static Disposable fromFuture(@NonNull Future future) { /** * Construct a {@code Disposable} by wrapping a {@link Future} that is * cancelled exactly once when the {@code Disposable} is disposed. - * @param future the Future to wrap + * @param future the {@code Future} to wrap * @param allowInterrupt if true, the future cancel happens via {@code Future.cancel(true)} - * @return the new Disposable instance + * @return the new {@code Disposable} instance * @throws NullPointerException if {@code future} is {@code null} * @since 3.0.0 */ @@ -99,8 +100,8 @@ static Disposable fromFuture(@NonNull Future future, boolean allowInterrupt) /** * Construct a {@code Disposable} by wrapping a {@link Subscription} that is * cancelled exactly once when the {@code Disposable} is disposed. - * @param subscription the Runnable to wrap - * @return the new Disposable instance + * @param subscription the {@code Runnable} to wrap + * @return the new {@code Disposable} instance * @throws NullPointerException if {@code subscription} is {@code null} * @since 3.0.0 */ @@ -113,8 +114,8 @@ static Disposable fromSubscription(@NonNull Subscription subscription) { /** * Construct a {@code Disposable} by wrapping an {@link AutoCloseable} that is * closed exactly once when the {@code Disposable} is disposed. - * @param autoCloseable the AutoCloseable to wrap - * @return the new Disposable instance + * @param autoCloseable the {@code AutoCloseable} to wrap + * @return the new {@code Disposable} instance * @throws NullPointerException if {@code autoCloseable} is {@code null} * @since 3.0.0 */ @@ -127,8 +128,8 @@ static Disposable fromAutoCloseable(@NonNull AutoCloseable autoCloseable) { /** * Construct an {@link AutoCloseable} by wrapping a {@code Disposable} that is * disposed when the returned {@code AutoCloseable} is closed. - * @param disposable the Disposable instance - * @return the new AutoCloseable instance + * @param disposable the {@code Disposable} instance + * @return the new {@code AutoCloseable} instance * @throws NullPointerException if {@code disposable} is {@code null} * @since 3.0.0 */ diff --git a/src/main/java/io/reactivex/rxjava3/disposables/DisposableContainer.java b/src/main/java/io/reactivex/rxjava3/disposables/DisposableContainer.java index d7099fbadc..49311e4082 100644 --- a/src/main/java/io/reactivex/rxjava3/disposables/DisposableContainer.java +++ b/src/main/java/io/reactivex/rxjava3/disposables/DisposableContainer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/disposables/FutureDisposable.java b/src/main/java/io/reactivex/rxjava3/disposables/FutureDisposable.java index 9649bcd7d3..d8f70ff655 100644 --- a/src/main/java/io/reactivex/rxjava3/disposables/FutureDisposable.java +++ b/src/main/java/io/reactivex/rxjava3/disposables/FutureDisposable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.disposables; import java.util.concurrent.Future; diff --git a/src/main/java/io/reactivex/rxjava3/disposables/ReferenceDisposable.java b/src/main/java/io/reactivex/rxjava3/disposables/ReferenceDisposable.java index eea584ab0b..55bb24a268 100644 --- a/src/main/java/io/reactivex/rxjava3/disposables/ReferenceDisposable.java +++ b/src/main/java/io/reactivex/rxjava3/disposables/ReferenceDisposable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/disposables/RunnableDisposable.java b/src/main/java/io/reactivex/rxjava3/disposables/RunnableDisposable.java index 34203e86a9..390a7912b4 100644 --- a/src/main/java/io/reactivex/rxjava3/disposables/RunnableDisposable.java +++ b/src/main/java/io/reactivex/rxjava3/disposables/RunnableDisposable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.disposables; import io.reactivex.rxjava3.annotations.NonNull; diff --git a/src/main/java/io/reactivex/rxjava3/disposables/SerialDisposable.java b/src/main/java/io/reactivex/rxjava3/disposables/SerialDisposable.java index 1f408f8c94..7b1f6463a8 100644 --- a/src/main/java/io/reactivex/rxjava3/disposables/SerialDisposable.java +++ b/src/main/java/io/reactivex/rxjava3/disposables/SerialDisposable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/disposables/SubscriptionDisposable.java b/src/main/java/io/reactivex/rxjava3/disposables/SubscriptionDisposable.java index f6756b58de..48c5c7ab3d 100644 --- a/src/main/java/io/reactivex/rxjava3/disposables/SubscriptionDisposable.java +++ b/src/main/java/io/reactivex/rxjava3/disposables/SubscriptionDisposable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.disposables; import org.reactivestreams.Subscription; diff --git a/src/main/java/io/reactivex/rxjava3/disposables/package-info.java b/src/main/java/io/reactivex/rxjava3/disposables/package-info.java index 29812d0ab7..00ff5dd6ff 100644 --- a/src/main/java/io/reactivex/rxjava3/disposables/package-info.java +++ b/src/main/java/io/reactivex/rxjava3/disposables/package-info.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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. */ /** diff --git a/src/main/java/io/reactivex/rxjava3/exceptions/CompositeException.java b/src/main/java/io/reactivex/rxjava3/exceptions/CompositeException.java index d7a3457fe4..5d2928b28f 100644 --- a/src/main/java/io/reactivex/rxjava3/exceptions/CompositeException.java +++ b/src/main/java/io/reactivex/rxjava3/exceptions/CompositeException.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.exceptions; import java.io.*; @@ -201,38 +199,41 @@ public void printStackTrace(PrintWriter s) { * Special handling for printing out a {@code CompositeException}. * Loops through all inner exceptions and prints them out. * - * @param s + * @param output * stream to print to */ - private void printStackTrace(PrintStreamOrWriter s) { - StringBuilder b = new StringBuilder(128); - b.append(this).append('\n'); + private void printStackTrace(PrintStreamOrWriter output) { + output.append(this).append("\n"); for (StackTraceElement myStackElement : getStackTrace()) { - b.append("\tat ").append(myStackElement).append('\n'); + output.append("\tat ").append(myStackElement).append("\n"); } int i = 1; for (Throwable ex : exceptions) { - b.append(" ComposedException ").append(i).append(" :\n"); - appendStackTrace(b, ex, "\t"); + output.append(" ComposedException ").append(i).append(" :\n"); + appendStackTrace(output, ex, "\t"); i++; } - s.println(b.toString()); + output.append("\n"); } - private void appendStackTrace(StringBuilder b, Throwable ex, String prefix) { - b.append(prefix).append(ex).append('\n'); + private void appendStackTrace(PrintStreamOrWriter output, Throwable ex, String prefix) { + output.append(prefix).append(ex).append('\n'); for (StackTraceElement stackElement : ex.getStackTrace()) { - b.append("\t\tat ").append(stackElement).append('\n'); + output.append("\t\tat ").append(stackElement).append('\n'); } if (ex.getCause() != null) { - b.append("\tCaused by: "); - appendStackTrace(b, ex.getCause(), ""); + output.append("\tCaused by: "); + appendStackTrace(output, ex.getCause(), ""); } } abstract static class PrintStreamOrWriter { - /** Prints the specified string as a line on this StreamOrWriter. */ - abstract void println(Object o); + /** + * Prints the object's string representation via the underlying PrintStream or PrintWriter. + * @param o the object to print + * @return this + */ + abstract PrintStreamOrWriter append(Object o); } /** @@ -246,11 +247,15 @@ static final class WrappedPrintStream extends PrintStreamOrWriter { } @Override - void println(Object o) { - printStream.println(o); + WrappedPrintStream append(Object o) { + printStream.print(o); + return this; } } + /** + * Same abstraction and implementation as in JDK to allow PrintStream and PrintWriter to share implementation. + */ static final class WrappedPrintWriter extends PrintStreamOrWriter { private final PrintWriter printWriter; @@ -259,8 +264,9 @@ static final class WrappedPrintWriter extends PrintStreamOrWriter { } @Override - void println(Object o) { - printWriter.println(o); + WrappedPrintWriter append(Object o) { + printWriter.print(o); + return this; } } diff --git a/src/main/java/io/reactivex/rxjava3/exceptions/Exceptions.java b/src/main/java/io/reactivex/rxjava3/exceptions/Exceptions.java index 41ddbd4fed..155a2801d2 100644 --- a/src/main/java/io/reactivex/rxjava3/exceptions/Exceptions.java +++ b/src/main/java/io/reactivex/rxjava3/exceptions/Exceptions.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/exceptions/MissingBackpressureException.java b/src/main/java/io/reactivex/rxjava3/exceptions/MissingBackpressureException.java index f7b19a2fc2..f0a173ba59 100644 --- a/src/main/java/io/reactivex/rxjava3/exceptions/MissingBackpressureException.java +++ b/src/main/java/io/reactivex/rxjava3/exceptions/MissingBackpressureException.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -20,6 +20,15 @@ public final class MissingBackpressureException extends RuntimeException { private static final long serialVersionUID = 8517344746016032542L; + /** + * The default error message. + *

+ * This can happen if the downstream doesn't call {@link org.reactivestreams.Subscription#request(long)} + * in time or at all. + * @since 3.1.6 + */ + public static final String DEFAULT_MESSAGE = "Could not emit value due to lack of requests"; + /** * Constructs a MissingBackpressureException without message or cause. */ @@ -35,4 +44,13 @@ public MissingBackpressureException(String message) { super(message); } + /** + * Constructs a new {@code MissingBackpressureException} with the + * default message {@value #DEFAULT_MESSAGE}. + * @return the new {@code MissingBackpressureException} instance. + * @since 3.1.6 + */ + public static MissingBackpressureException createDefault() { + return new MissingBackpressureException(DEFAULT_MESSAGE); + } } diff --git a/src/main/java/io/reactivex/rxjava3/exceptions/OnErrorNotImplementedException.java b/src/main/java/io/reactivex/rxjava3/exceptions/OnErrorNotImplementedException.java index d70769af39..072b889a57 100644 --- a/src/main/java/io/reactivex/rxjava3/exceptions/OnErrorNotImplementedException.java +++ b/src/main/java/io/reactivex/rxjava3/exceptions/OnErrorNotImplementedException.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -50,4 +50,4 @@ public OnErrorNotImplementedException(String message, @NonNull Throwable e) { public OnErrorNotImplementedException(@NonNull Throwable e) { this("The exception was not handled due to missing onError handler in the subscribe() method call. Further reading: https://github.com/ReactiveX/RxJava/wiki/Error-Handling | " + e, e); } -} \ No newline at end of file +} diff --git a/src/main/java/io/reactivex/rxjava3/exceptions/ProtocolViolationException.java b/src/main/java/io/reactivex/rxjava3/exceptions/ProtocolViolationException.java index 9df2ed9762..66fab7f911 100644 --- a/src/main/java/io/reactivex/rxjava3/exceptions/ProtocolViolationException.java +++ b/src/main/java/io/reactivex/rxjava3/exceptions/ProtocolViolationException.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/exceptions/QueueOverflowException.java b/src/main/java/io/reactivex/rxjava3/exceptions/QueueOverflowException.java new file mode 100644 index 0000000000..bdd8a25e6f --- /dev/null +++ b/src/main/java/io/reactivex/rxjava3/exceptions/QueueOverflowException.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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 io.reactivex.rxjava3.exceptions; + +/** + * Indicates an overflow happened because the upstream disregarded backpressure completely or + * {@link org.reactivestreams.Subscriber#onNext(Object)} was called concurrently from multiple threads + * without synchronization. Rarely, it is an indication of bugs inside an operator. + * @since 3.1.6 + */ +public final class QueueOverflowException extends RuntimeException { + + private static final long serialVersionUID = 8517344746016032542L; + + /** + * The message for queue overflows. + *

+ * This can happen if the upstream disregards backpressure completely or calls + * {@link org.reactivestreams.Subscriber#onNext(Object)} concurrently from multiple threads + * without synchronization. Rarely, it is an indication of bugs inside an operator. + */ + private static final String DEFAULT_MESSAGE = "Queue overflow due to illegal concurrent onNext calls or a bug in an operator"; + + /** + * Constructs a QueueOverflowException with the default message. + */ + public QueueOverflowException() { + this(DEFAULT_MESSAGE); + } + + /** + * Constructs a QueueOverflowException with the given message but no cause. + * @param message the error message + */ + public QueueOverflowException(String message) { + super(message); + } +} diff --git a/src/main/java/io/reactivex/rxjava3/exceptions/UndeliverableException.java b/src/main/java/io/reactivex/rxjava3/exceptions/UndeliverableException.java index 08f926e9b3..11a4c07f8a 100644 --- a/src/main/java/io/reactivex/rxjava3/exceptions/UndeliverableException.java +++ b/src/main/java/io/reactivex/rxjava3/exceptions/UndeliverableException.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/exceptions/package-info.java b/src/main/java/io/reactivex/rxjava3/exceptions/package-info.java index 05ebb5bfb3..91de82962f 100644 --- a/src/main/java/io/reactivex/rxjava3/exceptions/package-info.java +++ b/src/main/java/io/reactivex/rxjava3/exceptions/package-info.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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. */ /** diff --git a/src/main/java/io/reactivex/rxjava3/flowables/ConnectableFlowable.java b/src/main/java/io/reactivex/rxjava3/flowables/ConnectableFlowable.java index 041fc3bd1b..133d0186c8 100644 --- a/src/main/java/io/reactivex/rxjava3/flowables/ConnectableFlowable.java +++ b/src/main/java/io/reactivex/rxjava3/flowables/ConnectableFlowable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -16,7 +16,7 @@ import java.util.Objects; import java.util.concurrent.TimeUnit; -import org.reactivestreams.Subscriber; +import org.reactivestreams.*; import io.reactivex.rxjava3.annotations.*; import io.reactivex.rxjava3.core.*; @@ -37,9 +37,9 @@ * *

* When the upstream terminates, the {@code ConnectableFlowable} remains in this terminated state and, - * depending on the actual underlying implementation, relays cached events to late {@link Subscriber}s. + * depending on the actual underlying implementation, relays cached events to late {@code Subscriber}s. * In order to reuse and restart this {@code ConnectableFlowable}, the {@link #reset()} method has to be called. - * When called, this {@code ConnectableFlowable} will appear as fresh, unconnected source to new {@link Subscriber}s. + * When called, this {@code ConnectableFlowable} will appear as fresh, unconnected source to new {@code Subscriber}s. * Disposing the connection will reset the {@code ConnectableFlowable} to its fresh state and there is no need to call * {@code reset()} in this case. *

@@ -48,8 +48,7 @@ * there is no unwanted signal loss due to early {@code connect()} or {@code reset()} calls while {@code Subscriber}s are * still being subscribed to to this {@code ConnectableFlowable} to receive signals from the get go. *

- * @see RxJava Wiki: - * Connectable Observable Operators + * @see RxJava Wiki: Connectable Observable Operators * @param * the type of items emitted by the {@code ConnectableFlowable} * @since 2.0.0 @@ -74,7 +73,7 @@ public abstract class ConnectableFlowable extends Flowable { public abstract void connect(@NonNull Consumer connection); /** - * Resets this ConnectableFlowable into its fresh state if it has terminated. + * Resets this {@code ConnectableFlowable} into its fresh state if it has terminated. *

* Calling this method on a fresh or active {@code ConnectableFlowable} has no effect. *

@@ -108,7 +107,7 @@ public final Disposable connect() { } /** - * Returns a {@code Flowable} that stays connected to this {@code ConnectableFlowable} as long as there + * Returns a {@link Flowable} that stays connected to this {@code ConnectableFlowable} as long as there * is at least one subscription to this {@code ConnectableFlowable}. *
*
Backpressure:
@@ -117,7 +116,7 @@ public final Disposable connect() { *
Scheduler:
*
This {@code refCount} overload does not operate on any particular {@link Scheduler}.
*
- * @return a {@link Flowable} + * @return the new {@code Flowable} instance * @see ReactiveX documentation: RefCount * @see #refCount(int) * @see #refCount(long, TimeUnit) @@ -143,7 +142,8 @@ public Flowable refCount() { *
*

History: 2.1.14 - experimental * @param subscriberCount the number of subscribers required to connect to the upstream - * @return the new Flowable instance + * @return the new {@link Flowable} instance + * @throws IllegalArgumentException if {@code subscriberCount} is non-positive * @since 2.2 */ @CheckReturnValue @@ -168,7 +168,7 @@ public final Flowable refCount(int subscriberCount) { *

History: 2.1.14 - experimental * @param timeout the time to wait before disconnecting after all subscribers unsubscribed * @param unit the time unit of the timeout - * @return the new Flowable instance + * @return the new {@link Flowable} instance * @throws NullPointerException if {@code unit} is {@code null} * @see #refCount(long, TimeUnit, Scheduler) * @since 2.2 @@ -196,7 +196,7 @@ public final Flowable refCount(long timeout, @NonNull TimeUnit unit) { * @param timeout the time to wait before disconnecting after all subscribers unsubscribed * @param unit the time unit of the timeout * @param scheduler the target scheduler to wait on before disconnecting - * @return the new Flowable instance + * @return the new {@link Flowable} instance * @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null} * @since 2.2 */ @@ -223,8 +223,9 @@ public final Flowable refCount(long timeout, @NonNull TimeUnit unit, @NonNull * @param subscriberCount the number of subscribers required to connect to the upstream * @param timeout the time to wait before disconnecting after all subscribers unsubscribed * @param unit the time unit of the timeout - * @return the new Flowable instance + * @return the new {@link Flowable} instance * @throws NullPointerException if {@code unit} is {@code null} + * @throws IllegalArgumentException if {@code subscriberCount} is non-positive * @see #refCount(int, long, TimeUnit, Scheduler) * @since 2.2 */ @@ -252,7 +253,7 @@ public final Flowable refCount(int subscriberCount, long timeout, @NonNull Ti * @param timeout the time to wait before disconnecting after all subscribers unsubscribed * @param unit the time unit of the timeout * @param scheduler the target scheduler to wait on before disconnecting - * @return the new Flowable instance + * @return the new {@link Flowable} instance * @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null} * @throws IllegalArgumentException if {@code subscriberCount} is non-positive * @since 2.2 @@ -269,20 +270,20 @@ public final Flowable refCount(int subscriberCount, long timeout, @NonNull Ti } /** - * Returns a Flowable that automatically connects (at most once) to this ConnectableFlowable - * when the first Subscriber subscribes. + * Returns a {@link Flowable} that automatically connects (at most once) to this {@code ConnectableFlowable} + * when the first {@link Subscriber} subscribes. *

* *

* The connection happens after the first subscription and happens at most once - * during the lifetime of the returned Flowable. If this ConnectableFlowable - * terminates, the connection is never renewed, no matter how Subscribers come + * during the lifetime of the returned {@code Flowable}. If this {@code ConnectableFlowable} + * terminates, the connection is never renewed, no matter how {@code Subscriber}s come * and go. Use {@link #refCount()} to renew a connection or dispose an active - * connection when all {@code Subscriber}s have cancelled their {@code Subscription}s. + * connection when all {@code Subscriber}s have cancelled their {@link Subscription}s. *

* This overload does not allow disconnecting the connection established via * {@link #connect(Consumer)}. Use the {@link #autoConnect(int, Consumer)} overload - * to gain access to the {@code Disposable} representing the only connection. + * to gain access to the {@link Disposable} representing the only connection. *

*
Backpressure:
*
The operator itself doesn't interfere with backpressure which is determined by @@ -291,8 +292,8 @@ public final Flowable refCount(int subscriberCount, long timeout, @NonNull Ti *
{@code autoConnect} does not operate by default on a particular {@link Scheduler}.
*
* - * @return a Flowable that automatically connects to this ConnectableFlowable - * when the first Subscriber subscribes + * @return a new {@code Flowable} instance that automatically connects to this {@code ConnectableFlowable} + * when the first {@code Subscriber} subscribes * @see #refCount() * @see #autoConnect(int, Consumer) */ @@ -304,20 +305,20 @@ public Flowable autoConnect() { return autoConnect(1); } /** - * Returns a Flowable that automatically connects (at most once) to this ConnectableFlowable - * when the specified number of Subscribers subscribe to it. + * Returns a {@link Flowable} that automatically connects (at most once) to this {@code ConnectableFlowable} + * when the specified number of {@link Subscriber}s subscribe to it. *

* *

* The connection happens after the given number of subscriptions and happens at most once - * during the lifetime of the returned Flowable. If this ConnectableFlowable - * terminates, the connection is never renewed, no matter how Subscribers come + * during the lifetime of the returned {@code Flowable}. If this {@code ConnectableFlowable} + * terminates, the connection is never renewed, no matter how {@code Subscriber}s come * and go. Use {@link #refCount()} to renew a connection or dispose an active - * connection when all {@code Subscriber}s have cancelled their {@code Subscription}s. + * connection when all {@code Subscriber}s have cancelled their {@link Subscription}s. *

* This overload does not allow disconnecting the connection established via * {@link #connect(Consumer)}. Use the {@link #autoConnect(int, Consumer)} overload - * to gain access to the {@code Disposable} representing the only connection. + * to gain access to the {@link Disposable} representing the only connection. *

*
Backpressure:
*
The operator itself doesn't interfere with backpressure which is determined by @@ -327,10 +328,10 @@ public Flowable autoConnect() { *
* * @param numberOfSubscribers the number of subscribers to await before calling connect - * on the ConnectableFlowable. A non-positive value indicates + * on the {@code ConnectableFlowable}. A non-positive value indicates * an immediate connection. - * @return a Flowable that automatically connects to this ConnectableFlowable - * when the specified number of Subscribers subscribe to it + * @return a new {@code Flowable} instance that automatically connects to this {@code ConnectableFlowable} + * when the specified number of {@code Subscriber}s subscribe to it */ @NonNull @CheckReturnValue @@ -341,17 +342,17 @@ public Flowable autoConnect(int numberOfSubscribers) { } /** - * Returns a Flowable that automatically connects (at most once) to this ConnectableFlowable - * when the specified number of Subscribers subscribe to it and calls the - * specified callback with the Subscription associated with the established connection. + * Returns a {@link Flowable} that automatically connects (at most once) to this {@code ConnectableFlowable} + * when the specified number of {@link Subscriber}s subscribe to it and calls the + * specified callback with the {@link Disposable} associated with the established connection. *

* *

* The connection happens after the given number of subscriptions and happens at most once - * during the lifetime of the returned Flowable. If this ConnectableFlowable - * terminates, the connection is never renewed, no matter how Subscribers come + * during the lifetime of the returned {@code Flowable}. If this {@code ConnectableFlowable} + * terminates, the connection is never renewed, no matter how {@code Subscriber}s come * and go. Use {@link #refCount()} to renew a connection or dispose an active - * connection when all {@code Subscriber}s have cancelled their {@code Subscription}s. + * connection when all {@code Subscriber}s have cancelled their {@link Subscription}s. *

*
Backpressure:
*
The operator itself doesn't interfere with backpressure which is determined by @@ -361,13 +362,13 @@ public Flowable autoConnect(int numberOfSubscribers) { *
* * @param numberOfSubscribers the number of subscribers to await before calling connect - * on the ConnectableFlowable. A non-positive value indicates + * on the {@code ConnectableFlowable}. A non-positive value indicates * an immediate connection. - * @param connection the callback Consumer that will receive the Subscription representing the + * @param connection the callback {@link Consumer} that will receive the {@code Disposable} representing the * established connection - * @return a Flowable that automatically connects to this ConnectableFlowable - * when the specified number of Subscribers subscribe to it and calls the - * specified callback with the Subscription associated with the established connection + * @return a new {@code Flowable} instance that automatically connects to this {@code ConnectableFlowable} + * when the specified number of {@code Subscriber}s subscribe to it and calls the + * specified callback with the {@code Disposable} associated with the established connection * @throws NullPointerException if {@code connection} is {@code null} */ @NonNull diff --git a/src/main/java/io/reactivex/rxjava3/flowables/GroupedFlowable.java b/src/main/java/io/reactivex/rxjava3/flowables/GroupedFlowable.java index d9564c3e6e..609fc7808f 100644 --- a/src/main/java/io/reactivex/rxjava3/flowables/GroupedFlowable.java +++ b/src/main/java/io/reactivex/rxjava3/flowables/GroupedFlowable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.flowables; import io.reactivex.rxjava3.annotations.Nullable; diff --git a/src/main/java/io/reactivex/rxjava3/flowables/package-info.java b/src/main/java/io/reactivex/rxjava3/flowables/package-info.java index 75a6dec4e9..06475a34ea 100644 --- a/src/main/java/io/reactivex/rxjava3/flowables/package-info.java +++ b/src/main/java/io/reactivex/rxjava3/flowables/package-info.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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. */ /** diff --git a/src/main/java/io/reactivex/rxjava3/functions/Action.java b/src/main/java/io/reactivex/rxjava3/functions/Action.java index da0e76e0a6..509e5fcb64 100644 --- a/src/main/java/io/reactivex/rxjava3/functions/Action.java +++ b/src/main/java/io/reactivex/rxjava3/functions/Action.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/functions/BiConsumer.java b/src/main/java/io/reactivex/rxjava3/functions/BiConsumer.java index 85ce3dbd17..09fec68cbf 100644 --- a/src/main/java/io/reactivex/rxjava3/functions/BiConsumer.java +++ b/src/main/java/io/reactivex/rxjava3/functions/BiConsumer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/functions/BiFunction.java b/src/main/java/io/reactivex/rxjava3/functions/BiFunction.java index 0724ef5bd1..27aa9ee016 100644 --- a/src/main/java/io/reactivex/rxjava3/functions/BiFunction.java +++ b/src/main/java/io/reactivex/rxjava3/functions/BiFunction.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/functions/BiPredicate.java b/src/main/java/io/reactivex/rxjava3/functions/BiPredicate.java index 393ec86ab7..e45397aab7 100644 --- a/src/main/java/io/reactivex/rxjava3/functions/BiPredicate.java +++ b/src/main/java/io/reactivex/rxjava3/functions/BiPredicate.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/functions/BooleanSupplier.java b/src/main/java/io/reactivex/rxjava3/functions/BooleanSupplier.java index b30087fbd7..4e3b447b6e 100644 --- a/src/main/java/io/reactivex/rxjava3/functions/BooleanSupplier.java +++ b/src/main/java/io/reactivex/rxjava3/functions/BooleanSupplier.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/functions/Cancellable.java b/src/main/java/io/reactivex/rxjava3/functions/Cancellable.java index b9f3420c1b..574c832268 100644 --- a/src/main/java/io/reactivex/rxjava3/functions/Cancellable.java +++ b/src/main/java/io/reactivex/rxjava3/functions/Cancellable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/functions/Consumer.java b/src/main/java/io/reactivex/rxjava3/functions/Consumer.java index bf245bdcb7..3ac1806438 100644 --- a/src/main/java/io/reactivex/rxjava3/functions/Consumer.java +++ b/src/main/java/io/reactivex/rxjava3/functions/Consumer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/functions/Function.java b/src/main/java/io/reactivex/rxjava3/functions/Function.java index 0f8b2fe39a..40e11ca3ba 100644 --- a/src/main/java/io/reactivex/rxjava3/functions/Function.java +++ b/src/main/java/io/reactivex/rxjava3/functions/Function.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/functions/Function3.java b/src/main/java/io/reactivex/rxjava3/functions/Function3.java index fb1fe5aa76..377cceaeaf 100644 --- a/src/main/java/io/reactivex/rxjava3/functions/Function3.java +++ b/src/main/java/io/reactivex/rxjava3/functions/Function3.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/functions/Function4.java b/src/main/java/io/reactivex/rxjava3/functions/Function4.java index 9c0af4737d..36db385819 100644 --- a/src/main/java/io/reactivex/rxjava3/functions/Function4.java +++ b/src/main/java/io/reactivex/rxjava3/functions/Function4.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/functions/Function5.java b/src/main/java/io/reactivex/rxjava3/functions/Function5.java index fddaa28152..d3fc1504c4 100644 --- a/src/main/java/io/reactivex/rxjava3/functions/Function5.java +++ b/src/main/java/io/reactivex/rxjava3/functions/Function5.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/functions/Function6.java b/src/main/java/io/reactivex/rxjava3/functions/Function6.java index 1f6ad10d20..2969a39f82 100644 --- a/src/main/java/io/reactivex/rxjava3/functions/Function6.java +++ b/src/main/java/io/reactivex/rxjava3/functions/Function6.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/functions/Function7.java b/src/main/java/io/reactivex/rxjava3/functions/Function7.java index 39a6b26916..091b203296 100644 --- a/src/main/java/io/reactivex/rxjava3/functions/Function7.java +++ b/src/main/java/io/reactivex/rxjava3/functions/Function7.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/functions/Function8.java b/src/main/java/io/reactivex/rxjava3/functions/Function8.java index 907c68cdfe..c8e21acf9d 100644 --- a/src/main/java/io/reactivex/rxjava3/functions/Function8.java +++ b/src/main/java/io/reactivex/rxjava3/functions/Function8.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/functions/Function9.java b/src/main/java/io/reactivex/rxjava3/functions/Function9.java index a7f7518456..0b182eb5f3 100644 --- a/src/main/java/io/reactivex/rxjava3/functions/Function9.java +++ b/src/main/java/io/reactivex/rxjava3/functions/Function9.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/functions/IntFunction.java b/src/main/java/io/reactivex/rxjava3/functions/IntFunction.java index 9859bfd3c6..3a405aac26 100644 --- a/src/main/java/io/reactivex/rxjava3/functions/IntFunction.java +++ b/src/main/java/io/reactivex/rxjava3/functions/IntFunction.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.functions; import io.reactivex.rxjava3.annotations.NonNull; diff --git a/src/main/java/io/reactivex/rxjava3/functions/LongConsumer.java b/src/main/java/io/reactivex/rxjava3/functions/LongConsumer.java index 9af7de4f47..5b12752c1d 100644 --- a/src/main/java/io/reactivex/rxjava3/functions/LongConsumer.java +++ b/src/main/java/io/reactivex/rxjava3/functions/LongConsumer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.functions; /** diff --git a/src/main/java/io/reactivex/rxjava3/functions/Predicate.java b/src/main/java/io/reactivex/rxjava3/functions/Predicate.java index 550a365e60..1bce2d6bff 100644 --- a/src/main/java/io/reactivex/rxjava3/functions/Predicate.java +++ b/src/main/java/io/reactivex/rxjava3/functions/Predicate.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/functions/Supplier.java b/src/main/java/io/reactivex/rxjava3/functions/Supplier.java index 5a6245f05d..ebf7fdda6d 100644 --- a/src/main/java/io/reactivex/rxjava3/functions/Supplier.java +++ b/src/main/java/io/reactivex/rxjava3/functions/Supplier.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -13,8 +13,6 @@ package io.reactivex.rxjava3.functions; -import io.reactivex.rxjava3.annotations.NonNull; - /** * A functional interface (callback) that provides a single value or * throws an exception. @@ -25,7 +23,7 @@ * @since 3.0.0 */ @FunctionalInterface -public interface Supplier<@NonNull T> { +public interface Supplier { /** * Produces a value or throws an exception. diff --git a/src/main/java/io/reactivex/rxjava3/functions/package-info.java b/src/main/java/io/reactivex/rxjava3/functions/package-info.java index a7d92ce8fb..ab9dad0426 100644 --- a/src/main/java/io/reactivex/rxjava3/functions/package-info.java +++ b/src/main/java/io/reactivex/rxjava3/functions/package-info.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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. */ /** diff --git a/src/main/java/io/reactivex/rxjava3/internal/disposables/ArrayCompositeDisposable.java b/src/main/java/io/reactivex/rxjava3/internal/disposables/ArrayCompositeDisposable.java index 5ebcdde15b..c9a6bc9bc4 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/disposables/ArrayCompositeDisposable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/disposables/ArrayCompositeDisposable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/disposables/CancellableDisposable.java b/src/main/java/io/reactivex/rxjava3/internal/disposables/CancellableDisposable.java index 314464e156..863f52e91b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/disposables/CancellableDisposable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/disposables/CancellableDisposable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/disposables/DisposableHelper.java b/src/main/java/io/reactivex/rxjava3/internal/disposables/DisposableHelper.java index 1f2d2122d1..79dbd855ac 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/disposables/DisposableHelper.java +++ b/src/main/java/io/reactivex/rxjava3/internal/disposables/DisposableHelper.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/disposables/EmptyDisposable.java b/src/main/java/io/reactivex/rxjava3/internal/disposables/EmptyDisposable.java index 51acc86c75..fdb30932ed 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/disposables/EmptyDisposable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/disposables/EmptyDisposable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -15,7 +15,7 @@ import io.reactivex.rxjava3.annotations.Nullable; import io.reactivex.rxjava3.core.*; -import io.reactivex.rxjava3.internal.fuseable.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueDisposable; /** * Represents a stateless empty Disposable that reports being always diff --git a/src/main/java/io/reactivex/rxjava3/internal/disposables/ListCompositeDisposable.java b/src/main/java/io/reactivex/rxjava3/internal/disposables/ListCompositeDisposable.java index 8a6d4dd992..4c4b1f8a73 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/disposables/ListCompositeDisposable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/disposables/ListCompositeDisposable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.disposables; import java.util.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/disposables/SequentialDisposable.java b/src/main/java/io/reactivex/rxjava3/internal/disposables/SequentialDisposable.java index d9922ebec8..f6aef6bdd3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/disposables/SequentialDisposable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/disposables/SequentialDisposable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/functions/Functions.java b/src/main/java/io/reactivex/rxjava3/internal/functions/Functions.java index 659bcbcb2e..e0d3dead3c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/functions/Functions.java +++ b/src/main/java/io/reactivex/rxjava3/internal/functions/Functions.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.functions; import java.util.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/functions/ObjectHelper.java b/src/main/java/io/reactivex/rxjava3/internal/functions/ObjectHelper.java index 05bceafa1d..5bbdf22ad3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/functions/ObjectHelper.java +++ b/src/main/java/io/reactivex/rxjava3/internal/functions/ObjectHelper.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.functions; import io.reactivex.rxjava3.functions.BiPredicate; diff --git a/src/main/java/io/reactivex/rxjava3/internal/fuseable/AbstractEmptyQueueFuseable.java b/src/main/java/io/reactivex/rxjava3/internal/fuseable/AbstractEmptyQueueFuseable.java index 071db9fff8..13732bd426 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/fuseable/AbstractEmptyQueueFuseable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/fuseable/AbstractEmptyQueueFuseable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -14,6 +14,9 @@ package io.reactivex.rxjava3.internal.fuseable; import io.reactivex.rxjava3.annotations.NonNull; +import io.reactivex.rxjava3.operators.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueSubscription; /** * Represents an empty, async-only {@link QueueFuseable} instance. @@ -73,4 +76,4 @@ public void dispose() { public boolean isDisposed() { return false; } -} \ No newline at end of file +} diff --git a/src/main/java/io/reactivex/rxjava3/internal/fuseable/CancellableQueueFuseable.java b/src/main/java/io/reactivex/rxjava3/internal/fuseable/CancellableQueueFuseable.java index 8f9e12d3cb..71f993e226 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/fuseable/CancellableQueueFuseable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/fuseable/CancellableQueueFuseable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -13,6 +13,8 @@ package io.reactivex.rxjava3.internal.fuseable; +import io.reactivex.rxjava3.operators.QueueFuseable; + /** * Represents an empty, async-only {@link QueueFuseable} instance that tracks and exposes a * canceled/disposed state. @@ -39,4 +41,4 @@ public void dispose() { public boolean isDisposed() { return disposed; } -} \ No newline at end of file +} diff --git a/src/main/java/io/reactivex/rxjava3/internal/fuseable/FuseToFlowable.java b/src/main/java/io/reactivex/rxjava3/internal/fuseable/FuseToFlowable.java index c0359640f1..fe70b40a01 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/fuseable/FuseToFlowable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/fuseable/FuseToFlowable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/fuseable/FuseToMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/fuseable/FuseToMaybe.java index d7655bba86..13ccd6be75 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/fuseable/FuseToMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/fuseable/FuseToMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/fuseable/FuseToObservable.java b/src/main/java/io/reactivex/rxjava3/internal/fuseable/FuseToObservable.java index c9371ae538..d7ae761e37 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/fuseable/FuseToObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/fuseable/FuseToObservable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/fuseable/HasUpstreamCompletableSource.java b/src/main/java/io/reactivex/rxjava3/internal/fuseable/HasUpstreamCompletableSource.java index cb6c18edd5..fddb14ef0b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/fuseable/HasUpstreamCompletableSource.java +++ b/src/main/java/io/reactivex/rxjava3/internal/fuseable/HasUpstreamCompletableSource.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/fuseable/HasUpstreamMaybeSource.java b/src/main/java/io/reactivex/rxjava3/internal/fuseable/HasUpstreamMaybeSource.java index 6f4fcd9085..121e2937e4 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/fuseable/HasUpstreamMaybeSource.java +++ b/src/main/java/io/reactivex/rxjava3/internal/fuseable/HasUpstreamMaybeSource.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/fuseable/HasUpstreamObservableSource.java b/src/main/java/io/reactivex/rxjava3/internal/fuseable/HasUpstreamObservableSource.java index 8bd340a6c0..1a1e878b65 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/fuseable/HasUpstreamObservableSource.java +++ b/src/main/java/io/reactivex/rxjava3/internal/fuseable/HasUpstreamObservableSource.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/fuseable/HasUpstreamPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/fuseable/HasUpstreamPublisher.java index a412b37e1d..5a46f38555 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/fuseable/HasUpstreamPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/fuseable/HasUpstreamPublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/fuseable/HasUpstreamSingleSource.java b/src/main/java/io/reactivex/rxjava3/internal/fuseable/HasUpstreamSingleSource.java index dfab10fd9e..ef833ae2ff 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/fuseable/HasUpstreamSingleSource.java +++ b/src/main/java/io/reactivex/rxjava3/internal/fuseable/HasUpstreamSingleSource.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/fuseable/package-info.java b/src/main/java/io/reactivex/rxjava3/internal/fuseable/package-info.java index b4ee869076..339eabbfd2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/fuseable/package-info.java +++ b/src/main/java/io/reactivex/rxjava3/internal/fuseable/package-info.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/CompletableFromCompletionStage.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/CompletableFromCompletionStage.java index 44f539bf4b..639516d005 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/CompletableFromCompletionStage.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/CompletableFromCompletionStage.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.concurrent.CompletionStage; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/CompletionStageConsumer.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/CompletionStageConsumer.java index d92e56041e..2410290734 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/CompletionStageConsumer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/CompletionStageConsumer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.NoSuchElementException; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableCollectWithCollector.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableCollectWithCollector.java index 11a00aadb9..63ca949295 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableCollectWithCollector.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableCollectWithCollector.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.Objects; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableCollectWithCollectorSingle.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableCollectWithCollectorSingle.java index 14c1ebf4a8..aba390e1da 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableCollectWithCollectorSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableCollectWithCollectorSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.Objects; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableFirstStageSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableFirstStageSubscriber.java index 5af6cc5aac..19bfcbff6d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableFirstStageSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableFirstStageSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.NoSuchElementException; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableFlatMapStream.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableFlatMapStream.java index b01b24748a..48ea8b6e5f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableFlatMapStream.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableFlatMapStream.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -23,10 +23,12 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.fuseable.*; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.*; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueSubscription; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** @@ -172,7 +174,7 @@ public void onNext(T t) { if (sourceMode != QueueFuseable.ASYNC) { if (!queue.offer(t)) { upstream.cancel(); - onError(new MissingBackpressureException("Queue full?!")); + onError(new QueueOverflowException()); return; } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableFromCompletionStage.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableFromCompletionStage.java index f864cdd96d..1ee0f7786e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableFromCompletionStage.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableFromCompletionStage.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.concurrent.CompletionStage; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableFromStream.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableFromStream.java index 55ec854ddf..4fd3b4eb00 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableFromStream.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableFromStream.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.Iterator; @@ -22,9 +23,10 @@ import io.reactivex.rxjava3.annotations.*; import io.reactivex.rxjava3.core.Flowable; import io.reactivex.rxjava3.exceptions.Exceptions; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.subscriptions.*; import io.reactivex.rxjava3.internal.util.BackpressureHelper; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; +import io.reactivex.rxjava3.operators.QueueSubscription; import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableLastStageSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableLastStageSubscriber.java index c9a93eeb0e..0bdf3e9304 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableLastStageSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableLastStageSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.NoSuchElementException; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableMapOptional.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableMapOptional.java index 3fdcd40a4f..cc4ff8bdf5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableMapOptional.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableMapOptional.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.*; @@ -18,8 +19,8 @@ import io.reactivex.rxjava3.core.Flowable; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.ConditionalSubscriber; import io.reactivex.rxjava3.internal.subscribers.*; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; /** * Map the upstream values into an Optional and emit its value if any. diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableSingleStageSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableSingleStageSubscriber.java index 8040ec6f5d..8206a9a8ac 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableSingleStageSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableSingleStageSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.NoSuchElementException; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableStageSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableStageSubscriber.java index 6594b7ba5c..66e4fddde7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableStageSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableStageSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.concurrent.CompletableFuture; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsFlowable.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsFlowable.java index 0ac724bdf4..653642426e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsFlowable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsFlowable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsObservable.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsObservable.java index e7a74f0593..404fcb8106 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsObservable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/MaybeFromCompletionStage.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/MaybeFromCompletionStage.java index d8523b8ead..45af605e96 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/MaybeFromCompletionStage.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/MaybeFromCompletionStage.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.concurrent.CompletionStage; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/MaybeMapOptional.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/MaybeMapOptional.java index 8330d5249a..760456f2ee 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/MaybeMapOptional.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/MaybeMapOptional.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableCollectWithCollector.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableCollectWithCollector.java index 63452ce3e9..980317750e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableCollectWithCollector.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableCollectWithCollector.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.Objects; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableCollectWithCollectorSingle.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableCollectWithCollectorSingle.java index 9f990a77a5..fa1ccd9c8f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableCollectWithCollectorSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableCollectWithCollectorSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.Objects; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableFirstStageObserver.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableFirstStageObserver.java index cda0073067..6ac5ae51f1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableFirstStageObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableFirstStageObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.NoSuchElementException; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableFlatMapStream.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableFlatMapStream.java index 210d920aad..72bbea2a3f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableFlatMapStream.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableFlatMapStream.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableFromCompletionStage.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableFromCompletionStage.java index 262da56026..11a5a6307c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableFromCompletionStage.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableFromCompletionStage.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.concurrent.CompletionStage; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableFromStream.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableFromStream.java index 90d7681303..169eeb0bcc 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableFromStream.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableFromStream.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.*; @@ -20,7 +21,7 @@ import io.reactivex.rxjava3.core.Observer; import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.internal.disposables.EmptyDisposable; -import io.reactivex.rxjava3.internal.fuseable.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueDisposable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableLastStageObserver.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableLastStageObserver.java index e2f9dc2225..b35ab3dba9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableLastStageObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableLastStageObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.NoSuchElementException; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableMapOptional.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableMapOptional.java index eb134482be..a51ef1af28 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableMapOptional.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableMapOptional.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableSingleStageObserver.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableSingleStageObserver.java index fa8714397a..c506fc36d4 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableSingleStageObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableSingleStageObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.NoSuchElementException; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableStageObserver.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableStageObserver.java index 54acae086f..4025890f17 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableStageObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableStageObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.concurrent.CompletableFuture; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ParallelCollector.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ParallelCollector.java index c8802de3f6..7fefa11e80 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ParallelCollector.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ParallelCollector.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ParallelFlatMapStream.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ParallelFlatMapStream.java index 3f38d1fec3..beae3fee36 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ParallelFlatMapStream.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ParallelFlatMapStream.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ParallelMapOptional.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ParallelMapOptional.java index 350f59f2b2..a31be9a75e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ParallelMapOptional.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ParallelMapOptional.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,8 +19,8 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.ConditionalSubscriber; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; import io.reactivex.rxjava3.parallel.ParallelFlowable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ParallelMapTryOptional.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ParallelMapTryOptional.java index a2d454c994..d463c7bbab 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ParallelMapTryOptional.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ParallelMapTryOptional.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,8 +19,8 @@ import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.fuseable.ConditionalSubscriber; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; import io.reactivex.rxjava3.parallel.*; import io.reactivex.rxjava3.plugins.RxJavaPlugins; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/SingleFlattenStreamAsFlowable.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/SingleFlattenStreamAsFlowable.java index d7286d5932..8ed45d40b9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/SingleFlattenStreamAsFlowable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/SingleFlattenStreamAsFlowable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/SingleFlattenStreamAsObservable.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/SingleFlattenStreamAsObservable.java index 81b2d5fd7b..4733474f13 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/SingleFlattenStreamAsObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/SingleFlattenStreamAsObservable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/SingleFromCompletionStage.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/SingleFromCompletionStage.java index f1be64375e..126a096a26 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/SingleFromCompletionStage.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/SingleFromCompletionStage.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.jdk8; import java.util.concurrent.CompletionStage; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/SingleMapOptional.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/SingleMapOptional.java index 9ee9a6f803..ad54068d34 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/SingleMapOptional.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/SingleMapOptional.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/AbstractDisposableAutoRelease.java b/src/main/java/io/reactivex/rxjava3/internal/observers/AbstractDisposableAutoRelease.java new file mode 100644 index 0000000000..e5d89a4502 --- /dev/null +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/AbstractDisposableAutoRelease.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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. + */ + +/* + * Copyright 2016-2019 David Karnok + * + * Licensed 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 io.reactivex.rxjava3.internal.observers; + +import java.util.concurrent.atomic.AtomicReference; + +import io.reactivex.rxjava3.disposables.*; +import io.reactivex.rxjava3.exceptions.*; +import io.reactivex.rxjava3.functions.*; +import io.reactivex.rxjava3.internal.disposables.DisposableHelper; +import io.reactivex.rxjava3.internal.functions.Functions; +import io.reactivex.rxjava3.observers.LambdaConsumerIntrospection; +import io.reactivex.rxjava3.plugins.RxJavaPlugins; + +/** + * Wraps lambda callbacks and when the upstream terminates or the observer gets disposed, + * removes itself from a {@link io.reactivex.rxjava3.disposables.CompositeDisposable}. + *

History: 0.18.0 @ RxJavaExtensions + * @since 3.1.0 + */ +abstract class AbstractDisposableAutoRelease +extends AtomicReference +implements Disposable, LambdaConsumerIntrospection { + + private static final long serialVersionUID = 8924480688481408726L; + + final AtomicReference composite; + + final Consumer onError; + + final Action onComplete; + + AbstractDisposableAutoRelease( + DisposableContainer composite, + Consumer onError, + Action onComplete + ) { + this.onError = onError; + this.onComplete = onComplete; + this.composite = new AtomicReference<>(composite); + } + + public final void onError(Throwable t) { + if (get() != DisposableHelper.DISPOSED) { + lazySet(DisposableHelper.DISPOSED); + try { + onError.accept(t); + } catch (Throwable e) { + Exceptions.throwIfFatal(e); + RxJavaPlugins.onError(new CompositeException(t, e)); + } + } else { + RxJavaPlugins.onError(t); + } + removeSelf(); + } + + public final void onComplete() { + if (get() != DisposableHelper.DISPOSED) { + lazySet(DisposableHelper.DISPOSED); + try { + onComplete.run(); + } catch (Throwable e) { + Exceptions.throwIfFatal(e); + RxJavaPlugins.onError(e); + } + } + removeSelf(); + } + + @Override + public final void dispose() { + DisposableHelper.dispose(this); + removeSelf(); + } + + final void removeSelf() { + DisposableContainer c = composite.getAndSet(null); + if (c != null) { + c.delete(this); + } + } + + @Override + public final boolean isDisposed() { + return DisposableHelper.isDisposed(get()); + } + + public final void onSubscribe(Disposable d) { + DisposableHelper.setOnce(this, d); + } + + @Override + public final boolean hasCustomOnError() { + return onError != Functions.ON_ERROR_MISSING; + } + +} diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/BasicFuseableObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/BasicFuseableObserver.java index 0beef61824..6bd12f3940 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/BasicFuseableObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/BasicFuseableObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -17,7 +17,7 @@ import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueDisposable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/BasicIntQueueDisposable.java b/src/main/java/io/reactivex/rxjava3/internal/observers/BasicIntQueueDisposable.java index 84a5c017b5..726db3ae96 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/BasicIntQueueDisposable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/BasicIntQueueDisposable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -15,7 +15,7 @@ import java.util.concurrent.atomic.AtomicInteger; -import io.reactivex.rxjava3.internal.fuseable.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueDisposable; /** * An abstract QueueDisposable implementation, extending an AtomicInteger, diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/BasicQueueDisposable.java b/src/main/java/io/reactivex/rxjava3/internal/observers/BasicQueueDisposable.java index fb6fc08366..0daaf520a5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/BasicQueueDisposable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/BasicQueueDisposable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -13,7 +13,7 @@ package io.reactivex.rxjava3.internal.observers; -import io.reactivex.rxjava3.internal.fuseable.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueDisposable; /** * An abstract QueueDisposable implementation that defaults all diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/BiConsumerSingleObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/BiConsumerSingleObserver.java index 2fb0221f64..1e9696cb15 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/BiConsumerSingleObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/BiConsumerSingleObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingBaseObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingBaseObserver.java index 9a128799d5..93ce06eedf 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingBaseObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingBaseObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.observers; import java.util.concurrent.CountDownLatch; diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingDisposableMultiObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingDisposableMultiObserver.java index da7e289e27..a2334c21ba 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingDisposableMultiObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingDisposableMultiObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingFirstObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingFirstObserver.java index 276848afe4..570000a55a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingFirstObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingFirstObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingLastObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingLastObserver.java index bf745d3ed1..c8e979cc31 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingLastObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingLastObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingMultiObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingMultiObserver.java index 4945730ab5..458e6db5a1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingMultiObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingMultiObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingObserver.java index da38180751..ff84f2a4c6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/BlockingObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/CallbackCompletableObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/CallbackCompletableObserver.java index f6e7fed1cd..be2da69160 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/CallbackCompletableObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/CallbackCompletableObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -20,33 +20,24 @@ import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; +import io.reactivex.rxjava3.internal.functions.Functions; import io.reactivex.rxjava3.observers.LambdaConsumerIntrospection; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class CallbackCompletableObserver extends AtomicReference - implements CompletableObserver, Disposable, Consumer, LambdaConsumerIntrospection { + implements CompletableObserver, Disposable, LambdaConsumerIntrospection { private static final long serialVersionUID = -4361286194466301354L; final Consumer onError; final Action onComplete; - public CallbackCompletableObserver(Action onComplete) { - this.onError = this; - this.onComplete = onComplete; - } - public CallbackCompletableObserver(Consumer onError, Action onComplete) { this.onError = onError; this.onComplete = onComplete; } - @Override - public void accept(Throwable e) { - RxJavaPlugins.onError(new OnErrorNotImplementedException(e)); - } - @Override public void onComplete() { try { @@ -86,6 +77,6 @@ public boolean isDisposed() { @Override public boolean hasCustomOnError() { - return onError != this; + return onError != Functions.ON_ERROR_MISSING; } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/ConsumerSingleObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/ConsumerSingleObserver.java index b29a74e4bb..eff6e4a0c1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/ConsumerSingleObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/ConsumerSingleObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/DeferredScalarDisposable.java b/src/main/java/io/reactivex/rxjava3/internal/observers/DeferredScalarDisposable.java index 57d5f8c5c7..084ad68571 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/DeferredScalarDisposable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/DeferredScalarDisposable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/DeferredScalarObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/DeferredScalarObserver.java index a99fb49a57..4453e0ffa8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/DeferredScalarObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/DeferredScalarObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/DisposableAutoReleaseMultiObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/DisposableAutoReleaseMultiObserver.java new file mode 100644 index 0000000000..4779ff5723 --- /dev/null +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/DisposableAutoReleaseMultiObserver.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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. + */ + +/* + * Copyright 2016-2019 David Karnok + * + * Licensed 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 io.reactivex.rxjava3.internal.observers; + +import io.reactivex.rxjava3.core.*; +import io.reactivex.rxjava3.disposables.DisposableContainer; +import io.reactivex.rxjava3.exceptions.Exceptions; +import io.reactivex.rxjava3.functions.*; +import io.reactivex.rxjava3.internal.disposables.DisposableHelper; +import io.reactivex.rxjava3.plugins.RxJavaPlugins; + +/** + * Wraps lambda callbacks and when the upstream terminates or this (Single | Maybe | Completable) + * observer gets disposed, removes itself from a {@link io.reactivex.rxjava3.disposables.CompositeDisposable}. + *

History: 0.18.0 @ RxJavaExtensions + * @param the element type consumed + * @since 3.1.0 + */ +public final class DisposableAutoReleaseMultiObserver +extends AbstractDisposableAutoRelease +implements SingleObserver, MaybeObserver, CompletableObserver { + + private static final long serialVersionUID = 8924480688481408726L; + + final Consumer onSuccess; + + public DisposableAutoReleaseMultiObserver( + DisposableContainer composite, + Consumer onSuccess, + Consumer onError, + Action onComplete + ) { + super(composite, onError, onComplete); + this.onSuccess = onSuccess; + } + + @Override + public void onSuccess(T t) { + if (get() != DisposableHelper.DISPOSED) { + lazySet(DisposableHelper.DISPOSED); + try { + onSuccess.accept(t); + } catch (Throwable e) { + Exceptions.throwIfFatal(e); + RxJavaPlugins.onError(e); + } + } + removeSelf(); + } + +} diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/DisposableAutoReleaseObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/DisposableAutoReleaseObserver.java new file mode 100644 index 0000000000..89435c96ed --- /dev/null +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/DisposableAutoReleaseObserver.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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. + */ + +/* + * Copyright 2016-2019 David Karnok + * + * Licensed 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 io.reactivex.rxjava3.internal.observers; + +import io.reactivex.rxjava3.core.Observer; +import io.reactivex.rxjava3.disposables.DisposableContainer; +import io.reactivex.rxjava3.exceptions.Exceptions; +import io.reactivex.rxjava3.functions.*; +import io.reactivex.rxjava3.internal.disposables.DisposableHelper; + +/** + * Wraps lambda callbacks and when the upstream terminates or this observer gets disposed, + * removes itself from a {@link io.reactivex.rxjava3.disposables.CompositeDisposable}. + *

History: 0.18.0 @ RxJavaExtensions + * @param the element type consumed + * @since 3.1.0 + */ +public final class DisposableAutoReleaseObserver +extends AbstractDisposableAutoRelease +implements Observer { + + private static final long serialVersionUID = 8924480688481408726L; + + final Consumer onNext; + + public DisposableAutoReleaseObserver( + DisposableContainer composite, + Consumer onNext, + Consumer onError, + Action onComplete + ) { + super(composite, onError, onComplete); + this.onNext = onNext; + } + + @Override + public void onNext(T t) { + if (get() != DisposableHelper.DISPOSED) { + try { + onNext.accept(t); + } catch (Throwable e) { + Exceptions.throwIfFatal(e); + get().dispose(); + onError(e); + } + } + } + +} diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/DisposableLambdaObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/DisposableLambdaObserver.java index 2e935140ca..529d651c67 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/DisposableLambdaObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/DisposableLambdaObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/EmptyCompletableObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/EmptyCompletableObserver.java index 36a08269c8..e92893b9bd 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/EmptyCompletableObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/EmptyCompletableObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/ForEachWhileObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/ForEachWhileObserver.java index 7017239ae0..bed185523f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/ForEachWhileObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/ForEachWhileObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/FutureMultiObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/FutureMultiObserver.java index e2f2aeea5a..f109aaa5a3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/FutureMultiObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/FutureMultiObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/FutureObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/FutureObserver.java index 5c25e3f59c..13fd2dc9bf 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/FutureObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/FutureObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/InnerQueuedObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/InnerQueuedObserver.java index f7ad3e3350..9d6417c0e8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/InnerQueuedObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/InnerQueuedObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,8 +18,10 @@ import io.reactivex.rxjava3.core.Observer; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.util.QueueDrainHelper; +import io.reactivex.rxjava3.operators.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueSubscription; +import io.reactivex.rxjava3.operators.SimpleQueue; /** * Subscriber that can fuse with the upstream and calls a support interface diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/InnerQueuedObserverSupport.java b/src/main/java/io/reactivex/rxjava3/internal/observers/InnerQueuedObserverSupport.java index ff28bd092c..01bebaf007 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/InnerQueuedObserverSupport.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/InnerQueuedObserverSupport.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/LambdaObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/LambdaObserver.java index c52017fa4d..6bd5dece94 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/LambdaObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/LambdaObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/QueueDrainObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/QueueDrainObserver.java index 6f1cad3c34..aa25f4286c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/QueueDrainObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/QueueDrainObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -17,8 +17,8 @@ import io.reactivex.rxjava3.core.Observer; import io.reactivex.rxjava3.disposables.Disposable; -import io.reactivex.rxjava3.internal.fuseable.SimplePlainQueue; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SimplePlainQueue; /** * Abstract base class for subscribers that hold another subscriber, a queue diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/ResumeSingleObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/ResumeSingleObserver.java index 90a29bef1c..acaa71257c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/ResumeSingleObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/ResumeSingleObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/SafeCompletableObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/SafeCompletableObserver.java index d9e929c234..18e16383af 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/SafeCompletableObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/SafeCompletableObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/SafeMaybeObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/SafeMaybeObserver.java index a6e794b1fd..320ac53427 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/SafeMaybeObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/SafeMaybeObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/SafeSingleObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/SafeSingleObserver.java index 6757350756..3e73d1e639 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/SafeSingleObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/SafeSingleObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAmb.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAmb.java index 14e8ae464b..60fa3ce4c6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAmb.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAmb.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAndThenCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAndThenCompletable.java index d006329aea..13e582e764 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAndThenCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAndThenCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableCache.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableCache.java index da002c0dd6..c5fd3279d6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableCache.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableCache.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcat.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcat.java index c3458e4cd3..00a53f3ad7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcat.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcat.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -21,9 +21,8 @@ import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.*; -import io.reactivex.rxjava3.internal.queue.*; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; +import io.reactivex.rxjava3.operators.*; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class CompletableConcat extends Completable { @@ -121,7 +120,7 @@ public void onSubscribe(Subscription s) { public void onNext(CompletableSource t) { if (sourceFused == QueueSubscription.NONE) { if (!queue.offer(t)) { - onError(new MissingBackpressureException()); + onError(new QueueOverflowException()); return; } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcatArray.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcatArray.java index c423c37587..e87968e774 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcatArray.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcatArray.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcatIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcatIterable.java index ef801a1646..73510018ff 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcatIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcatIterable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableCreate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableCreate.java index 4004630756..b721cbb351 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableCreate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableCreate.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDefer.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDefer.java index c451413f49..2a7763bb52 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDefer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDefer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDelay.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDelay.java index 49c25bf6e1..c21134569b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDelay.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDelay.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDetach.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDetach.java index efd28228fa..d01d297495 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDetach.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDetach.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDisposeOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDisposeOn.java index 16f9fa159c..bd213b5fc4 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDisposeOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDisposeOn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoFinally.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoFinally.java index 425ed4caea..02fa08cdb0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoFinally.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoFinally.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoOnEvent.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoOnEvent.java index 63a408efc4..dfa24b000f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoOnEvent.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoOnEvent.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableEmpty.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableEmpty.java index e18ccc9421..7c18a4ddc9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableEmpty.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableEmpty.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableError.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableError.java index 70d4e41006..8d2cb2fcc2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableError.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableError.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableErrorSupplier.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableErrorSupplier.java index bd4250c447..80c95806b8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableErrorSupplier.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableErrorSupplier.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromAction.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromAction.java index 82bec67c92..53cfc2615b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromAction.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromAction.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromCallable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromCallable.java index 57764950df..90f9266934 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromCallable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromCallable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromObservable.java index d91133e502..25dffbbebf 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromObservable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromPublisher.java index 6baeb7a87e..4205d1141c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromPublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromRunnable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromRunnable.java index 60332d8db2..79f2efb470 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromRunnable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromRunnable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromSingle.java index b035f142d9..d55fc30339 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromSupplier.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromSupplier.java index e3e29188a0..8b45e6b5f0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromSupplier.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromSupplier.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromUnsafeSource.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromUnsafeSource.java index 02857d4692..dfc0356bf7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromUnsafeSource.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromUnsafeSource.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableHide.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableHide.java index 16708ee90e..536855a7b7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableHide.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableHide.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableLift.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableLift.java index 58356a73dd..6749689bcc 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableLift.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableLift.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMaterialize.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMaterialize.java index 15dd320cad..198ba94b1a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMaterialize.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMaterialize.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMerge.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMerge.java index 9d916d84b6..2528fe2f3b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMerge.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMerge.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeArray.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeArray.java index 49037b4c65..56095221cc 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeArray.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeArray.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeArrayDelayError.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeArrayDelayError.java index b939396c9f..85b4c61225 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeArrayDelayError.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeArrayDelayError.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeDelayErrorIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeDelayErrorIterable.java index f7f4c068a6..cb62974753 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeDelayErrorIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeDelayErrorIterable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeIterable.java index 728b372a30..3f2dce90e1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeIterable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableNever.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableNever.java index 8c11621a7c..17bc2cc140 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableNever.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableNever.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableObserveOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableObserveOn.java index 8bccc8ced0..b48ade189f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableObserveOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableObserveOn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableOnErrorComplete.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableOnErrorComplete.java index 6d87a4275e..c4252e7f3b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableOnErrorComplete.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableOnErrorComplete.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -32,15 +32,18 @@ public CompletableOnErrorComplete(CompletableSource source, Predicate predicate; - OnError(CompletableObserver observer) { + OnError(CompletableObserver observer, + Predicate predicate) { this.downstream = observer; + this.predicate = predicate; } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableOnErrorReturn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableOnErrorReturn.java index c8fa43499f..9cd91262a5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableOnErrorReturn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableOnErrorReturn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletablePeek.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletablePeek.java index 04955c6931..aeba5381b5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletablePeek.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletablePeek.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableResumeNext.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableResumeNext.java index 1d3bd7a3a0..785501511a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableResumeNext.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableResumeNext.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSubscribeOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSubscribeOn.java index f76ac93595..748602f978 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSubscribeOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSubscribeOn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTakeUntilCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTakeUntilCompletable.java index bd7e519a17..364484ab10 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTakeUntilCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTakeUntilCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTimeout.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTimeout.java index 1a38bb383a..80f40dfd72 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTimeout.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTimeout.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTimer.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTimer.java index 4e271af773..b50fd5db2e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTimer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTimer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToFlowable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToFlowable.java index 9a6c0326a1..346267ce13 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToFlowable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToFlowable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToObservable.java index 84eea97c8d..ccf1a9e504 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToObservable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToSingle.java index c35d909796..58e47247df 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableUsing.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableUsing.java index 3476a65b25..648e6529e2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableUsing.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableUsing.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/AbstractBackpressureThrottlingSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/AbstractBackpressureThrottlingSubscriber.java new file mode 100644 index 0000000000..62c7d07a88 --- /dev/null +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/AbstractBackpressureThrottlingSubscriber.java @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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 io.reactivex.rxjava3.internal.operators.flowable; + +import io.reactivex.rxjava3.core.FlowableSubscriber; +import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; +import io.reactivex.rxjava3.internal.util.BackpressureHelper; +import org.reactivestreams.Subscriber; +import org.reactivestreams.Subscription; + +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; +import java.util.concurrent.atomic.AtomicReference; + +/** + * Abstract base class for operators that throttle excessive updates from upstream in case if + * downstream {@link Subscriber} is not ready to receive updates. + * + * @param the upstream value type + * @param the downstream value type + */ +abstract class AbstractBackpressureThrottlingSubscriber extends AtomicInteger implements FlowableSubscriber, Subscription { + + private static final long serialVersionUID = -5050301752721603566L; + + final Subscriber downstream; + + Subscription upstream; + + volatile boolean done; + Throwable error; + + volatile boolean cancelled; + + final AtomicLong requested = new AtomicLong(); + + final AtomicReference current = new AtomicReference<>(); + + AbstractBackpressureThrottlingSubscriber(Subscriber downstream) { + this.downstream = downstream; + } + + @Override + public void onSubscribe(Subscription s) { + if (SubscriptionHelper.validate(this.upstream, s)) { + this.upstream = s; + downstream.onSubscribe(this); + s.request(Long.MAX_VALUE); + } + } + + @Override + public abstract void onNext(T t); + + @Override + public void onError(Throwable t) { + error = t; + done = true; + drain(); + } + + @Override + public void onComplete() { + done = true; + drain(); + } + + @Override + public void request(long n) { + if (SubscriptionHelper.validate(n)) { + BackpressureHelper.add(requested, n); + drain(); + } + } + + @Override + public void cancel() { + if (!cancelled) { + cancelled = true; + upstream.cancel(); + + if (getAndIncrement() == 0) { + current.lazySet(null); + } + } + } + + void drain() { + if (getAndIncrement() != 0) { + return; + } + final Subscriber a = downstream; + int missed = 1; + final AtomicLong r = requested; + final AtomicReference q = current; + + for (;;) { + long e = 0L; + + while (e != r.get()) { + boolean d = done; + R v = q.getAndSet(null); + boolean empty = v == null; + + if (checkTerminated(d, empty, a, q)) { + return; + } + + if (empty) { + break; + } + + a.onNext(v); + + e++; + } + + if (e == r.get() && checkTerminated(done, q.get() == null, a, q)) { + return; + } + + if (e != 0L) { + BackpressureHelper.produced(r, e); + } + + missed = addAndGet(-missed); + if (missed == 0) { + break; + } + } + } + + boolean checkTerminated(boolean d, boolean empty, Subscriber a, AtomicReference q) { + if (cancelled) { + q.lazySet(null); + return true; + } + + if (d) { + Throwable e = error; + if (e != null) { + q.lazySet(null); + a.onError(e); + return true; + } else + if (empty) { + a.onComplete(); + return true; + } + } + + return false; + } +} diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/AbstractFlowableWithUpstream.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/AbstractFlowableWithUpstream.java index d83f65c347..4a9484f743 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/AbstractFlowableWithUpstream.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/AbstractFlowableWithUpstream.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableIterable.java index 51015ce918..11239d04a7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableIterable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -22,9 +22,9 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.*; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SpscArrayQueue; public final class BlockingFlowableIterable implements Iterable { final Flowable source; @@ -138,9 +138,12 @@ public void onSubscribe(Subscription s) { @Override public void onNext(T t) { if (!queue.offer(t)) { + // Error must be set first before calling cancel to avoid race + // with hasNext(), which checks for cancel first before checking + // for error. + error = new QueueOverflowException(); SubscriptionHelper.cancel(this); - - onError(new MissingBackpressureException("Queue full?!")); + onComplete(); } else { signalConsumer(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableLatest.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableLatest.java index 1cc469a1b9..7628776ae0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableLatest.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableLatest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableMostRecent.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableMostRecent.java index d679dd937f..7c41634c55 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableMostRecent.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableMostRecent.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableNext.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableNext.java index b8e79eda54..9704d2d210 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableNext.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableNext.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAll.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAll.java index 84ea50cbf7..7f8271733d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAll.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAll.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.flowable; import org.reactivestreams.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAllSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAllSingle.java index 8d1bf998ef..03d269e738 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAllSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAllSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.flowable; import org.reactivestreams.Subscription; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAmb.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAmb.java index ff650b5719..5646fdb993 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAmb.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAmb.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAny.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAny.java index d0adcb6dbe..b09dce4c03 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAny.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAny.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.flowable; import org.reactivestreams.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAnySingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAnySingle.java index 7ca8a6b428..1b210b82d4 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAnySingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAnySingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.flowable; import org.reactivestreams.Subscription; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAutoConnect.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAutoConnect.java index c8bb4a7d1a..8d4b428c2b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAutoConnect.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAutoConnect.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBlockingSubscribe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBlockingSubscribe.java index 26287a0ccc..22cede1410 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBlockingSubscribe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBlockingSubscribe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBuffer.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBuffer.java index 3fe2fb1a96..a1cb792f08 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBuffer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBuffer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferBoundary.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferBoundary.java index 251144a1d2..b009b1bc25 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferBoundary.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferBoundary.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -22,9 +22,9 @@ import io.reactivex.rxjava3.disposables.*; import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class FlowableBufferBoundary, Open, Close> diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferExactBoundary.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferExactBoundary.java index 8d23e3c7bc..3e2abefdd9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferExactBoundary.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferExactBoundary.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -45,7 +45,7 @@ protected void subscribeActual(Subscriber s) { } static final class BufferExactBoundarySubscriber, B> - extends QueueDrainSubscriber implements FlowableSubscriber, Subscription, Disposable { + extends QueueDrainSubscriber implements Subscription, Disposable { final Supplier bufferSupplier; final Publisher boundary; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferTimed.java index 854e0460ed..89749acaef 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferTimed.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCache.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCache.java index 25d5fb71a3..ee52769e69 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCache.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCache.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCollect.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCollect.java index b8751a23f9..8f45d62404 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCollect.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCollect.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.flowable; import org.reactivestreams.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCollectSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCollectSingle.java index f159911fba..714bc92eea 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCollectSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCollectSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.flowable; import org.reactivestreams.Subscription; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCombineLatest.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCombineLatest.java index 8a1fea8346..ac947b9541 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCombineLatest.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCombineLatest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -23,9 +23,9 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.operators.flowable.FlowableMap.MapSubscriber; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.*; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatArray.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatArray.java index 81834bba61..34d4248514 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatArray.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatArray.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.flowable; import java.util.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMap.java index aea261f5aa..5d1b6e4c33 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMap.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,20 +10,22 @@ * 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 io.reactivex.rxjava3.internal.operators.flowable; import java.util.Objects; -import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.*; import org.reactivestreams.*; import io.reactivex.rxjava3.core.*; -import io.reactivex.rxjava3.exceptions.Exceptions; +import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.fuseable.*; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.*; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.QueueSubscription; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscArrayQueue; public final class FlowableConcatMap extends AbstractFlowableWithUpstream { @@ -150,7 +152,7 @@ public final void onNext(T t) { if (sourceMode != QueueSubscription.ASYNC) { if (!queue.offer(t)) { upstream.cancel(); - onError(new IllegalStateException("Queue full?!")); + onError(new QueueOverflowException()); return; } } @@ -308,7 +310,7 @@ void drain() { continue; } else { active = true; - inner.setSubscription(new WeakScalarSubscription<>(vr, inner)); + inner.setSubscription(new SimpleScalarSubscription<>(vr, inner)); } } else { @@ -325,20 +327,22 @@ void drain() { } } - static final class WeakScalarSubscription implements Subscription { + static final class SimpleScalarSubscription + extends AtomicBoolean + implements Subscription { + private static final long serialVersionUID = -7606889335172043256L; + final Subscriber downstream; final T value; - boolean once; - WeakScalarSubscription(T value, Subscriber downstream) { + SimpleScalarSubscription(T value, Subscriber downstream) { this.value = value; this.downstream = downstream; } @Override public void request(long n) { - if (n > 0 && !once) { - once = true; + if (n > 0L && compareAndSet(false, true)) { Subscriber a = downstream; a.onNext(value); a.onComplete(); @@ -507,7 +511,7 @@ void drain() { continue; } else { active = true; - inner.setSubscription(new WeakScalarSubscription<>(vr, inner)); + inner.setSubscription(new SimpleScalarSubscription<>(vr, inner)); } } else { active = true; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEager.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEager.java index ead625a829..dc423d89fc 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEager.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEager.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -21,11 +21,11 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.SimpleQueue; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.subscribers.*; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; public final class FlowableConcatMapEager extends AbstractFlowableWithUpstream { @@ -200,7 +200,7 @@ public void innerNext(InnerQueuedSubscriber inner, R value) { drain(); } else { inner.cancel(); - innerError(inner, new MissingBackpressureException()); + innerError(inner, MissingBackpressureException.createDefault()); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEagerPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEagerPublisher.java index 36d465d190..218f90c2a6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEagerPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEagerPublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapScheduler.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapScheduler.java index 3dfcd38b9d..707d10a19e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapScheduler.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapScheduler.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.flowable; import java.util.Objects; @@ -18,13 +19,14 @@ import org.reactivestreams.*; import io.reactivex.rxjava3.core.*; -import io.reactivex.rxjava3.exceptions.Exceptions; +import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.operators.flowable.FlowableConcatMap.*; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.QueueSubscription; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscArrayQueue; public final class FlowableConcatMapScheduler extends AbstractFlowableWithUpstream { @@ -149,7 +151,7 @@ public final void onNext(T t) { if (sourceMode != QueueSubscription.ASYNC) { if (!queue.offer(t)) { upstream.cancel(); - onError(new IllegalStateException("Queue full?!")); + onError(new QueueOverflowException()); return; } } @@ -345,7 +347,7 @@ public void run() { continue; } else { active = true; - inner.setSubscription(new WeakScalarSubscription<>(vr, inner)); + inner.setSubscription(new SimpleScalarSubscription<>(vr, inner)); } } else { @@ -528,7 +530,7 @@ public void run() { continue; } else { active = true; - inner.setSubscription(new WeakScalarSubscription<>(vr, inner)); + inner.setSubscription(new SimpleScalarSubscription<>(vr, inner)); } } else { active = true; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithCompletable.java index 31729e450f..81ac13776a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithMaybe.java index b7db7fd093..e82076533a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithSingle.java index c93ee51ba8..bfe900ab2e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCount.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCount.java index 7858180b09..2c32dd4d76 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCount.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCount.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCountSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCountSingle.java index 928f36209c..750f722dbc 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCountSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCountSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCreate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCreate.java index b7091c31f9..1e87c4b7e6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCreate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCreate.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -22,10 +22,10 @@ import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.Cancellable; import io.reactivex.rxjava3.internal.disposables.*; -import io.reactivex.rxjava3.internal.fuseable.SimplePlainQueue; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SimplePlainQueue; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class FlowableCreate extends Flowable { @@ -442,7 +442,7 @@ static final class ErrorAsyncEmitter extends NoOverflowBaseAsyncEmitter { @Override void onOverflow() { - onError(new MissingBackpressureException("create: could not emit value due to lack of requests")); + onError(new MissingBackpressureException("create: " + MissingBackpressureException.DEFAULT_MESSAGE)); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounce.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounce.java index 16c666b283..51838a1864 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounce.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounce.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -148,7 +148,7 @@ void emit(long idx, T value) { BackpressureHelper.produced(this, 1); } else { cancel(); - downstream.onError(new MissingBackpressureException("Could not deliver value due to lack of requests")); + downstream.onError(MissingBackpressureException.createDefault()); } } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounceTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounceTimed.java index 82ae29d497..b9e5dff7f3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounceTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounceTimed.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -16,6 +16,8 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.*; +import io.reactivex.rxjava3.exceptions.Exceptions; +import io.reactivex.rxjava3.functions.Consumer; import org.reactivestreams.*; import io.reactivex.rxjava3.core.*; @@ -32,19 +34,20 @@ public final class FlowableDebounceTimed extends AbstractFlowableWithUpstream final long timeout; final TimeUnit unit; final Scheduler scheduler; + final Consumer onDropped; - public FlowableDebounceTimed(Flowable source, long timeout, TimeUnit unit, Scheduler scheduler) { + public FlowableDebounceTimed(Flowable source, long timeout, TimeUnit unit, Scheduler scheduler, Consumer onDropped) { super(source); this.timeout = timeout; this.unit = unit; this.scheduler = scheduler; + this.onDropped = onDropped; } @Override protected void subscribeActual(Subscriber s) { source.subscribe(new DebounceTimedSubscriber<>( - new SerializedSubscriber<>(s), - timeout, unit, scheduler.createWorker())); + new SerializedSubscriber<>(s), timeout, unit, scheduler.createWorker(), onDropped)); } static final class DebounceTimedSubscriber extends AtomicLong @@ -55,20 +58,22 @@ static final class DebounceTimedSubscriber extends AtomicLong final long timeout; final TimeUnit unit; final Scheduler.Worker worker; + final Consumer onDropped; Subscription upstream; - Disposable timer; + DebounceEmitter timer; volatile long index; boolean done; - DebounceTimedSubscriber(Subscriber actual, long timeout, TimeUnit unit, Worker worker) { + DebounceTimedSubscriber(Subscriber actual, long timeout, TimeUnit unit, Worker worker, Consumer onDropped) { this.downstream = actual; this.timeout = timeout; this.unit = unit; this.worker = worker; + this.onDropped = onDropped; } @Override @@ -88,15 +93,26 @@ public void onNext(T t) { long idx = index + 1; index = idx; - Disposable d = timer; - if (d != null) { - d.dispose(); + DebounceEmitter currentEmitter = timer; + if (currentEmitter != null) { + currentEmitter.dispose(); + } + + if (onDropped != null && currentEmitter != null) { + try { + onDropped.accept(currentEmitter.value); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + upstream.cancel(); + done = true; + downstream.onError(ex); + worker.dispose(); + } } - DebounceEmitter de = new DebounceEmitter<>(t, idx, this); - timer = de; - d = worker.schedule(de, timeout, unit); - de.setResource(d); + DebounceEmitter newEmitter = new DebounceEmitter<>(t, idx, this); + timer = newEmitter; + newEmitter.setResource(worker.schedule(newEmitter, timeout, unit)); } @Override @@ -121,15 +137,13 @@ public void onComplete() { } done = true; - Disposable d = timer; + DebounceEmitter d = timer; if (d != null) { d.dispose(); } - @SuppressWarnings("unchecked") - DebounceEmitter de = (DebounceEmitter)d; - if (de != null) { - de.emit(); + if (d != null) { + d.emit(); } downstream.onComplete(); @@ -159,7 +173,7 @@ void emit(long idx, T t, DebounceEmitter emitter) { emitter.dispose(); } else { cancel(); - downstream.onError(new MissingBackpressureException("Could not deliver value due to lack of requests")); + downstream.onError(MissingBackpressureException.createDefault()); } } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDefer.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDefer.java index 6c3d8f9008..b3ea3f1ecc 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDefer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDefer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelay.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelay.java index e66acd39e9..a7de73213a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelay.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelay.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -111,7 +111,9 @@ final class OnNext implements Runnable { @Override public void run() { - downstream.onNext(t); + if (!w.isDisposed()) { + downstream.onNext(t); + } } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelaySubscriptionOther.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelaySubscriptionOther.java index c4e199c7e2..2f12cc6e4e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelaySubscriptionOther.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelaySubscriptionOther.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.flowable; import java.util.concurrent.atomic.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDematerialize.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDematerialize.java index dc2de8e389..10806f5776 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDematerialize.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDematerialize.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDetach.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDetach.java index e03ee6094b..8d755b8ad3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDetach.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDetach.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinct.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinct.java index bc62429611..7c3c777c26 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinct.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinct.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -22,10 +22,10 @@ import io.reactivex.rxjava3.core.Flowable; import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.internal.subscribers.BasicFuseableSubscriber; import io.reactivex.rxjava3.internal.subscriptions.EmptySubscription; import io.reactivex.rxjava3.internal.util.ExceptionHelper; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class FlowableDistinct extends AbstractFlowableWithUpstream { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinctUntilChanged.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinctUntilChanged.java index 6eb323625d..2c597556ec 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinctUntilChanged.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinctUntilChanged.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,8 +18,8 @@ import io.reactivex.rxjava3.annotations.Nullable; import io.reactivex.rxjava3.core.Flowable; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.fuseable.ConditionalSubscriber; import io.reactivex.rxjava3.internal.subscribers.*; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; public final class FlowableDistinctUntilChanged extends AbstractFlowableWithUpstream { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterNext.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterNext.java index 7aa451e1f6..763e93a54a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterNext.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterNext.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,8 +18,8 @@ import io.reactivex.rxjava3.annotations.Nullable; import io.reactivex.rxjava3.core.Flowable; import io.reactivex.rxjava3.functions.Consumer; -import io.reactivex.rxjava3.internal.fuseable.ConditionalSubscriber; import io.reactivex.rxjava3.internal.subscribers.*; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; /** * Calls a consumer after pushing the current item to the downstream. diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoFinally.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoFinally.java index 9373819291..71da853227 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoFinally.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoFinally.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,8 +19,9 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Action; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.subscriptions.*; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; +import io.reactivex.rxjava3.operators.QueueSubscription; import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnEach.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnEach.java index 2e6d45d5e7..3284a2e507 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnEach.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnEach.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,9 +19,9 @@ import io.reactivex.rxjava3.core.Flowable; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.fuseable.ConditionalSubscriber; import io.reactivex.rxjava3.internal.subscribers.*; import io.reactivex.rxjava3.internal.util.ExceptionHelper; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class FlowableDoOnEach extends AbstractFlowableWithUpstream { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnLifecycle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnLifecycle.java index a75881d2ba..8b56c38c70 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnLifecycle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnLifecycle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.flowable; import org.reactivestreams.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAt.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAt.java index 91c9c0bee7..eecd3d1c17 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAt.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAt.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtMaybe.java index fc30483fd2..f62439c577 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtMaybePublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtMaybePublisher.java index a474b03280..b6b16a3e40 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtMaybePublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtMaybePublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtSingle.java index b743b6a3b7..95b32bde6d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableEmpty.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableEmpty.java index 4a9bbe7d32..3606ac57d6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableEmpty.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableEmpty.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -16,8 +16,8 @@ import org.reactivestreams.Subscriber; import io.reactivex.rxjava3.core.Flowable; -import io.reactivex.rxjava3.internal.fuseable.ScalarSupplier; import io.reactivex.rxjava3.internal.subscriptions.EmptySubscription; +import io.reactivex.rxjava3.operators.ScalarSupplier; /** * A source Flowable that signals an onSubscribe() + onComplete() only. diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableError.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableError.java index f65410ff11..190eb53c6b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableError.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableError.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFilter.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFilter.java index 790881a160..74a4413e36 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFilter.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFilter.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,8 +18,9 @@ import io.reactivex.rxjava3.annotations.Nullable; import io.reactivex.rxjava3.core.Flowable; import io.reactivex.rxjava3.functions.Predicate; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.subscribers.*; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; +import io.reactivex.rxjava3.operators.QueueSubscription; public final class FlowableFilter extends AbstractFlowableWithUpstream { final Predicate predicate; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMap.java index 184efcc203..c250d3b165 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMap.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -22,10 +22,9 @@ import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.fuseable.*; -import io.reactivex.rxjava3.internal.queue.*; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.*; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class FlowableFlatMap extends AbstractFlowableWithUpstream { @@ -244,7 +243,7 @@ void tryEmitScalar(U value) { q = getMainQueue(); } if (!q.offer(value)) { - onError(new MissingBackpressureException("Scalar queue full?!")); + onError(new QueueOverflowException()); } } if (decrementAndGet() == 0) { @@ -253,7 +252,7 @@ void tryEmitScalar(U value) { } else { SimpleQueue q = getMainQueue(); if (!q.offer(value)) { - onError(new MissingBackpressureException("Scalar queue full?!")); + onError(new QueueOverflowException()); return; } if (getAndIncrement() != 0) { @@ -279,7 +278,7 @@ void tryEmit(U value, InnerSubscriber inner) { inner.queue = q; } if (!q.offer(value)) { - onError(new MissingBackpressureException("Inner queue full?!")); + onError(new QueueOverflowException()); } } if (decrementAndGet() == 0) { @@ -292,7 +291,7 @@ void tryEmit(U value, InnerSubscriber inner) { inner.queue = q; } if (!q.offer(value)) { - onError(new MissingBackpressureException("Inner queue full?!")); + onError(new QueueOverflowException()); return; } if (getAndIncrement() != 0) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapCompletable.java index 2960cfc510..b69a6e2895 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapCompletableCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapCompletableCompletable.java index 6032dcdd33..2d604e5157 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapCompletableCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapCompletableCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapMaybe.java index ffb5763f14..2936fa9066 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -23,9 +23,9 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; /** * Maps upstream values into MaybeSources and merges their signals into one sequence. diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapMaybePublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapMaybePublisher.java index f300607052..acc527215c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapMaybePublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapMaybePublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapSingle.java index f733eb7fa5..f5277d603a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -23,9 +23,9 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; /** * Maps upstream values into SingleSources and merges their signals into one sequence. diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapSinglePublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapSinglePublisher.java index 457a728523..570ef96f78 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapSinglePublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapSinglePublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlattenIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlattenIterable.java index 06f0b650e6..0b9164e0cd 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlattenIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlattenIterable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -22,10 +22,11 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.fuseable.*; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.*; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.QueueSubscription; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class FlowableFlattenIterable extends AbstractFlowableWithUpstream { @@ -179,7 +180,7 @@ public void onNext(T t) { return; } if (fusionMode == NONE && !queue.offer(t)) { - onError(new MissingBackpressureException("Queue is full?!")); + onError(new QueueOverflowException()); return; } drain(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromAction.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromAction.java index 2d683e7601..693f40ddb4 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromAction.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromAction.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromArray.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromArray.java index 9b9a4c66f4..1b13bcff3b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromArray.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromArray.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -17,9 +17,9 @@ import io.reactivex.rxjava3.annotations.Nullable; import io.reactivex.rxjava3.core.Flowable; -import io.reactivex.rxjava3.internal.fuseable.ConditionalSubscriber; import io.reactivex.rxjava3.internal.subscriptions.*; import io.reactivex.rxjava3.internal.util.BackpressureHelper; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; import java.util.Objects; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCallable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCallable.java index 603f09abae..e2a331d2f0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCallable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCallable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCompletable.java index 78b37325ca..c4b15b947d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromFuture.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromFuture.java index 57dc02774f..0fef368287 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromFuture.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromFuture.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromIterable.java index 5c0642021d..314f0f2f54 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromIterable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -21,9 +21,9 @@ import io.reactivex.rxjava3.annotations.Nullable; import io.reactivex.rxjava3.core.Flowable; import io.reactivex.rxjava3.exceptions.Exceptions; -import io.reactivex.rxjava3.internal.fuseable.ConditionalSubscriber; import io.reactivex.rxjava3.internal.subscriptions.*; import io.reactivex.rxjava3.internal.util.BackpressureHelper; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; public final class FlowableFromIterable extends Flowable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromObservable.java index 459228f549..664dbf4acf 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromObservable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.flowable; import org.reactivestreams.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromPublisher.java index df575a0274..a021846388 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromPublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromRunnable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromRunnable.java index b163f1b7ee..0d503d4668 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromRunnable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromRunnable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSupplier.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSupplier.java index 84fbae7eec..ca2a331396 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSupplier.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSupplier.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGenerate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGenerate.java index 2feda7ad97..3639d64eeb 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGenerate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGenerate.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupBy.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupBy.java index f4df324110..50e641ffc1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupBy.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupBy.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -24,9 +24,9 @@ import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.flowables.GroupedFlowable; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.*; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class FlowableGroupBy extends AbstractFlowableWithUpstream> { @@ -168,7 +168,7 @@ public void onNext(T t) { if (emittedGroups != get()) { downstream.onNext(group); } else { - MissingBackpressureException mbe = new MissingBackpressureException(groupHangWarning(emittedGroups)); + MissingBackpressureException mbe = groupHangWarning(emittedGroups); mbe.initCause(ex); onError(mbe); return; @@ -194,13 +194,13 @@ public void onNext(T t) { } } else { upstream.cancel(); - onError(new MissingBackpressureException(groupHangWarning(emittedGroups))); + onError(groupHangWarning(emittedGroups)); } } } - static String groupHangWarning(long n) { - return "Unable to emit a new group (#" + n + ") due to lack of requests. Please make sure the downstream can always accept a new group as well as each group is consumed in order for the whole operator to be able to proceed."; + static MissingBackpressureException groupHangWarning(long n) { + return new MissingBackpressureException("Unable to emit a new group (#" + n + ") due to lack of requests. Please make sure the downstream can always accept a new group as well as each group is consumed in order for the whole operator to be able to proceed."); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupJoin.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupJoin.java index e832cf8950..c9619c48b7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupJoin.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupJoin.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.operators.flowable; @@ -25,10 +22,10 @@ import io.reactivex.rxjava3.disposables.*; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.fuseable.SimpleQueue; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.processors.UnicastProcessor; @@ -279,7 +276,7 @@ void drain() { a.onNext(w); BackpressureHelper.produced(requested, 1); } else { - fail(new MissingBackpressureException("Could not emit value due to lack of requests"), a, q); + fail(MissingBackpressureException.createDefault(), a, q); return; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableHide.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableHide.java index 17d84f178a..bc9b47011b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableHide.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableHide.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElements.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElements.java index 9afee2e50d..20f546feee 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElements.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElements.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -17,8 +17,8 @@ import io.reactivex.rxjava3.annotations.Nullable; import io.reactivex.rxjava3.core.*; -import io.reactivex.rxjava3.internal.fuseable.QueueSubscription; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; +import io.reactivex.rxjava3.operators.QueueSubscription; public final class FlowableIgnoreElements extends AbstractFlowableWithUpstream { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElementsCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElementsCompletable.java index 4eaced342e..19d8546d2d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElementsCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElementsCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableInternalHelper.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableInternalHelper.java index 41dc08d920..781d475872 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableInternalHelper.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableInternalHelper.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.flowable; import java.util.Objects; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableInterval.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableInterval.java index 9ef04ea11c..98fbe6dee1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableInterval.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableInterval.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -93,7 +93,7 @@ public void run() { downstream.onNext(count++); BackpressureHelper.produced(this, 1); } else { - downstream.onError(new MissingBackpressureException("Can't deliver value " + count + " due to lack of requests")); + downstream.onError(new MissingBackpressureException("Could not emit value " + count + " due to lack of requests")); DisposableHelper.dispose(resource); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIntervalRange.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIntervalRange.java index e9580f40c6..cfa605882d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIntervalRange.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIntervalRange.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -114,7 +114,7 @@ public void run() { decrementAndGet(); } } else { - downstream.onError(new MissingBackpressureException("Can't deliver value " + count + " due to lack of requests")); + downstream.onError(new MissingBackpressureException("Could not emit value " + count + " due to lack of requests")); DisposableHelper.dispose(resource); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableJoin.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableJoin.java index 3406b7411d..9cda3d457d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableJoin.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableJoin.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -22,11 +22,11 @@ import io.reactivex.rxjava3.disposables.CompositeDisposable; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.fuseable.SimpleQueue; import io.reactivex.rxjava3.internal.operators.flowable.FlowableGroupJoin.*; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class FlowableJoin extends AbstractFlowableWithUpstream { @@ -260,7 +260,7 @@ void drain() { e++; } else { - ExceptionHelper.addThrowable(error, new MissingBackpressureException("Could not emit value due to lack of requests")); + ExceptionHelper.addThrowable(error, MissingBackpressureException.createDefault()); q.clear(); cancelAll(); errorAll(a); @@ -321,7 +321,7 @@ else if (mode == RIGHT_VALUE) { e++; } else { - ExceptionHelper.addThrowable(error, new MissingBackpressureException("Could not emit value due to lack of requests")); + ExceptionHelper.addThrowable(error, MissingBackpressureException.createDefault()); q.clear(); cancelAll(); errorAll(a); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableJust.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableJust.java index d17c9644fa..2926d49509 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableJust.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableJust.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -16,8 +16,8 @@ import org.reactivestreams.Subscriber; import io.reactivex.rxjava3.core.Flowable; -import io.reactivex.rxjava3.internal.fuseable.ScalarSupplier; import io.reactivex.rxjava3.internal.subscriptions.ScalarSubscription; +import io.reactivex.rxjava3.operators.ScalarSupplier; /** * Represents a constant scalar value. diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLastMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLastMaybe.java index 936e68c211..056dfe9201 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLastMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLastMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLastSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLastSingle.java index 70346f3555..ef4fb1a015 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLastSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLastSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLift.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLift.java index 5f92e95652..99e4075bc4 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLift.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLift.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMap.java index 6bae806972..90ad6c2883 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMap.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,8 +18,8 @@ import io.reactivex.rxjava3.annotations.Nullable; import io.reactivex.rxjava3.core.Flowable; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.ConditionalSubscriber; import io.reactivex.rxjava3.internal.subscribers.*; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; import java.util.Objects; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapNotification.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapNotification.java index b01d6dc5a0..be2d78062e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapNotification.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapNotification.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapPublisher.java index 159efcea6c..cc8ccb8fe8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapPublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMaterialize.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMaterialize.java index 2b361427b1..7a806b8d5d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMaterialize.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMaterialize.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithCompletable.java index a0725a1d64..ccd48a78fa 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithMaybe.java index 7d3be91bea..e7581bcaed 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -20,10 +20,10 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.SimplePlainQueue; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SimplePlainQueue; +import io.reactivex.rxjava3.operators.SpscArrayQueue; /** * Merges an Observable and a Maybe by emitting the items of the Observable and the success diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithSingle.java index 997ad3fa2e..b0f3e8b3ed 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -20,10 +20,10 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.SimplePlainQueue; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SimplePlainQueue; +import io.reactivex.rxjava3.operators.SpscArrayQueue; /** * Merges an Observable and a Maybe by emitting the items of the Observable and the success diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableNever.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableNever.java index 9dc0611920..83aeb1533d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableNever.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableNever.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.flowable; import org.reactivestreams.Subscriber; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableObserveOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableObserveOn.java index 1ec41a6374..576debbf2b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableObserveOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableObserveOn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -21,10 +21,12 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.core.Scheduler.Worker; import io.reactivex.rxjava3.exceptions.*; -import io.reactivex.rxjava3.internal.fuseable.*; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.*; import io.reactivex.rxjava3.internal.util.BackpressureHelper; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; +import io.reactivex.rxjava3.operators.QueueSubscription; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class FlowableObserveOn extends AbstractFlowableWithUpstream { @@ -111,7 +113,7 @@ public final void onNext(T t) { if (!queue.offer(t)) { upstream.cancel(); - error = new MissingBackpressureException("Queue is full?!"); + error = new QueueOverflowException(); done = true; } trySchedule(); @@ -242,8 +244,7 @@ public final boolean isEmpty() { } } - static final class ObserveOnSubscriber extends BaseObserveOnSubscriber - implements FlowableSubscriber { + static final class ObserveOnSubscriber extends BaseObserveOnSubscriber { private static final long serialVersionUID = -4547113800637756442L; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBuffer.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBuffer.java index 19d28291ba..db58b68a10 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBuffer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBuffer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -20,30 +20,31 @@ import io.reactivex.rxjava3.annotations.Nullable; import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.*; -import io.reactivex.rxjava3.functions.Action; -import io.reactivex.rxjava3.internal.fuseable.SimplePlainQueue; -import io.reactivex.rxjava3.internal.queue.*; +import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.subscriptions.*; import io.reactivex.rxjava3.internal.util.BackpressureHelper; +import io.reactivex.rxjava3.operators.*; public final class FlowableOnBackpressureBuffer extends AbstractFlowableWithUpstream { final int bufferSize; final boolean unbounded; final boolean delayError; final Action onOverflow; + final Consumer onDropped; public FlowableOnBackpressureBuffer(Flowable source, int bufferSize, boolean unbounded, - boolean delayError, Action onOverflow) { + boolean delayError, Action onOverflow, Consumer onDropped) { super(source); this.bufferSize = bufferSize; this.unbounded = unbounded; this.delayError = delayError; this.onOverflow = onOverflow; + this.onDropped = onDropped; } @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new BackpressureBufferSubscriber<>(s, bufferSize, unbounded, delayError, onOverflow)); + source.subscribe(new BackpressureBufferSubscriber<>(s, bufferSize, unbounded, delayError, onOverflow, onDropped)); } static final class BackpressureBufferSubscriber extends BasicIntQueueSubscription implements FlowableSubscriber { @@ -54,6 +55,7 @@ static final class BackpressureBufferSubscriber extends BasicIntQueueSubscrip final SimplePlainQueue queue; final boolean delayError; final Action onOverflow; + final Consumer onDropped; Subscription upstream; @@ -67,10 +69,11 @@ static final class BackpressureBufferSubscriber extends BasicIntQueueSubscrip boolean outputFused; BackpressureBufferSubscriber(Subscriber actual, int bufferSize, - boolean unbounded, boolean delayError, Action onOverflow) { + boolean unbounded, boolean delayError, Action onOverflow, Consumer onDropped) { this.downstream = actual; this.onOverflow = onOverflow; this.delayError = delayError; + this.onDropped = onDropped; SimplePlainQueue q; @@ -99,6 +102,7 @@ public void onNext(T t) { MissingBackpressureException ex = new MissingBackpressureException("Buffer is full"); try { onOverflow.run(); + onDropped.accept(t); } catch (Throwable e) { Exceptions.throwIfFatal(e); ex.initCause(e); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferStrategy.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferStrategy.java index 6e458356b6..7963fb7d40 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferStrategy.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferStrategy.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -20,7 +20,7 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.*; -import io.reactivex.rxjava3.functions.Action; +import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.BackpressureHelper; import io.reactivex.rxjava3.plugins.RxJavaPlugins; @@ -38,17 +38,21 @@ public final class FlowableOnBackpressureBufferStrategy extends AbstractFlowa final BackpressureOverflowStrategy strategy; + final Consumer onDropped; + public FlowableOnBackpressureBufferStrategy(Flowable source, - long bufferSize, Action onOverflow, BackpressureOverflowStrategy strategy) { + long bufferSize, Action onOverflow, BackpressureOverflowStrategy strategy, + Consumer onDropped) { super(source); this.bufferSize = bufferSize; this.onOverflow = onOverflow; this.strategy = strategy; + this.onDropped = onDropped; } @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new OnBackpressureBufferStrategySubscriber<>(s, onOverflow, strategy, bufferSize)); + source.subscribe(new OnBackpressureBufferStrategySubscriber<>(s, onOverflow, strategy, bufferSize, onDropped)); } static final class OnBackpressureBufferStrategySubscriber @@ -61,6 +65,8 @@ static final class OnBackpressureBufferStrategySubscriber final Action onOverflow; + final Consumer onDropped; + final BackpressureOverflowStrategy strategy; final long bufferSize; @@ -77,13 +83,15 @@ static final class OnBackpressureBufferStrategySubscriber Throwable error; OnBackpressureBufferStrategySubscriber(Subscriber actual, Action onOverflow, - BackpressureOverflowStrategy strategy, long bufferSize) { + BackpressureOverflowStrategy strategy, long bufferSize, + Consumer onDropped) { this.downstream = actual; this.onOverflow = onOverflow; this.strategy = strategy; this.bufferSize = bufferSize; this.requested = new AtomicLong(); this.deque = new ArrayDeque<>(); + this.onDropped = onDropped; } @Override @@ -104,44 +112,60 @@ public void onNext(T t) { } boolean callOnOverflow = false; boolean callError = false; + boolean callDrain = false; Deque dq = deque; + T toDrop = null; synchronized (dq) { if (dq.size() == bufferSize) { switch (strategy) { case DROP_LATEST: - dq.pollLast(); + toDrop = dq.pollLast(); dq.offer(t); callOnOverflow = true; break; case DROP_OLDEST: - dq.poll(); + toDrop = dq.poll(); dq.offer(t); callOnOverflow = true; break; default: // signal error + toDrop = t; callError = true; break; } } else { dq.offer(t); + callDrain = true; } } - if (callOnOverflow) { - if (onOverflow != null) { - try { - onOverflow.run(); - } catch (Throwable ex) { - Exceptions.throwIfFatal(ex); - upstream.cancel(); - onError(ex); - } + if (callOnOverflow && onOverflow != null) { + try { + onOverflow.run(); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + upstream.cancel(); + onError(ex); } - } else if (callError) { + } + + if (onDropped != null && toDrop != null) { + try { + onDropped.accept(toDrop); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + upstream.cancel(); + onError(ex); + } + } + + if (callError) { upstream.cancel(); - onError(new MissingBackpressureException()); - } else { + onError(MissingBackpressureException.createDefault()); + } + + if (callDrain) { drain(); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureDrop.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureDrop.java index 0db3cd3cc2..799c5dbca1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureDrop.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureDrop.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureError.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureError.java index ea0a92af52..acaf165069 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureError.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureError.java @@ -1,11 +1,11 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. - *

+ * * Licensed 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. @@ -66,7 +66,7 @@ public void onNext(T t) { BackpressureHelper.produced(this, 1); } else { upstream.cancel(); - onError(new MissingBackpressureException("could not emit value due to lack of requests")); + onError(MissingBackpressureException.createDefault()); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureLatest.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureLatest.java index 6123475ef0..155e284e93 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureLatest.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureLatest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -13,159 +13,50 @@ package io.reactivex.rxjava3.internal.operators.flowable; -import java.util.concurrent.atomic.*; - -import org.reactivestreams.*; - -import io.reactivex.rxjava3.core.*; -import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; -import io.reactivex.rxjava3.internal.util.BackpressureHelper; +import io.reactivex.rxjava3.core.Flowable; +import io.reactivex.rxjava3.exceptions.Exceptions; +import io.reactivex.rxjava3.functions.Consumer; +import org.reactivestreams.Subscriber; public final class FlowableOnBackpressureLatest extends AbstractFlowableWithUpstream { - public FlowableOnBackpressureLatest(Flowable source) { + final Consumer onDropped; + + public FlowableOnBackpressureLatest(Flowable source, Consumer onDropped) { super(source); + this.onDropped = onDropped; } @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new BackpressureLatestSubscriber<>(s)); + source.subscribe(new BackpressureLatestSubscriber<>(s, onDropped)); } - static final class BackpressureLatestSubscriber extends AtomicInteger implements FlowableSubscriber, Subscription { + static final class BackpressureLatestSubscriber extends AbstractBackpressureThrottlingSubscriber { private static final long serialVersionUID = 163080509307634843L; - final Subscriber downstream; - - Subscription upstream; - - volatile boolean done; - Throwable error; - - volatile boolean cancelled; - - final AtomicLong requested = new AtomicLong(); + final Consumer onDropped; - final AtomicReference current = new AtomicReference<>(); - - BackpressureLatestSubscriber(Subscriber downstream) { - this.downstream = downstream; - } - - @Override - public void onSubscribe(Subscription s) { - if (SubscriptionHelper.validate(this.upstream, s)) { - this.upstream = s; - downstream.onSubscribe(this); - s.request(Long.MAX_VALUE); - } + BackpressureLatestSubscriber(Subscriber downstream, + Consumer onDropped) { + super(downstream); + this.onDropped = onDropped; } @Override public void onNext(T t) { - current.lazySet(t); - drain(); - } - - @Override - public void onError(Throwable t) { - error = t; - done = true; - drain(); - } - - @Override - public void onComplete() { - done = true; - drain(); - } - - @Override - public void request(long n) { - if (SubscriptionHelper.validate(n)) { - BackpressureHelper.add(requested, n); - drain(); - } - } - - @Override - public void cancel() { - if (!cancelled) { - cancelled = true; - upstream.cancel(); - - if (getAndIncrement() == 0) { - current.lazySet(null); + T oldValue = current.getAndSet(t); + if (onDropped != null && oldValue != null) { + try { + onDropped.accept(oldValue); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + upstream.cancel(); + downstream.onError(ex); } } - } - - void drain() { - if (getAndIncrement() != 0) { - return; - } - final Subscriber a = downstream; - int missed = 1; - final AtomicLong r = requested; - final AtomicReference q = current; - - for (;;) { - long e = 0L; - - while (e != r.get()) { - boolean d = done; - T v = q.getAndSet(null); - boolean empty = v == null; - - if (checkTerminated(d, empty, a, q)) { - return; - } - - if (empty) { - break; - } - - a.onNext(v); - - e++; - } - - if (e == r.get() && checkTerminated(done, q.get() == null, a, q)) { - return; - } - - if (e != 0L) { - BackpressureHelper.produced(r, e); - } - - missed = addAndGet(-missed); - if (missed == 0) { - break; - } - } - } - - boolean checkTerminated(boolean d, boolean empty, Subscriber a, AtomicReference q) { - if (cancelled) { - q.lazySet(null); - return true; - } - - if (d) { - Throwable e = error; - if (e != null) { - q.lazySet(null); - a.onError(e); - return true; - } else - if (empty) { - a.onComplete(); - return true; - } - } - - return false; + drain(); } } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureReduce.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureReduce.java new file mode 100644 index 0000000000..9a6abab89c --- /dev/null +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureReduce.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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 io.reactivex.rxjava3.internal.operators.flowable; + +import io.reactivex.rxjava3.annotations.NonNull; +import io.reactivex.rxjava3.core.Flowable; +import io.reactivex.rxjava3.exceptions.Exceptions; +import io.reactivex.rxjava3.functions.BiFunction; +import org.reactivestreams.Subscriber; + +import java.util.Objects; + +public final class FlowableOnBackpressureReduce extends AbstractFlowableWithUpstream { + + final BiFunction reducer; + + public FlowableOnBackpressureReduce(@NonNull Flowable source, @NonNull BiFunction reducer) { + super(source); + this.reducer = reducer; + } + + @Override + protected void subscribeActual(@NonNull Subscriber s) { + source.subscribe(new BackpressureReduceSubscriber<>(s, reducer)); + } + + static final class BackpressureReduceSubscriber extends AbstractBackpressureThrottlingSubscriber { + + private static final long serialVersionUID = 821363947659780367L; + + final BiFunction reducer; + + BackpressureReduceSubscriber(@NonNull Subscriber downstream, @NonNull BiFunction reducer) { + super(downstream); + this.reducer = reducer; + } + + @Override + public void onNext(T t) { + T v = current.get(); + if (v != null) { + v = current.getAndSet(null); + } + if (v == null) { + current.lazySet(t); + } else { + try { + current.lazySet(Objects.requireNonNull(reducer.apply(v, t), "The reducer returned a null value")); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + upstream.cancel(); + onError(ex); + return; + } + } + drain(); + } + } +} diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureReduceWith.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureReduceWith.java new file mode 100644 index 0000000000..faed723240 --- /dev/null +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureReduceWith.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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 io.reactivex.rxjava3.internal.operators.flowable; + +import io.reactivex.rxjava3.annotations.NonNull; +import io.reactivex.rxjava3.core.Flowable; +import io.reactivex.rxjava3.exceptions.Exceptions; +import io.reactivex.rxjava3.functions.BiFunction; +import io.reactivex.rxjava3.functions.Supplier; +import org.reactivestreams.Subscriber; + +import java.util.Objects; + +public final class FlowableOnBackpressureReduceWith extends AbstractFlowableWithUpstream { + + final BiFunction reducer; + final Supplier supplier; + + public FlowableOnBackpressureReduceWith(@NonNull Flowable source, + @NonNull Supplier supplier, + @NonNull BiFunction reducer) { + super(source); + this.reducer = reducer; + this.supplier = supplier; + } + + @Override + protected void subscribeActual(@NonNull Subscriber s) { + source.subscribe(new BackpressureReduceWithSubscriber<>(s, supplier, reducer)); + } + + static final class BackpressureReduceWithSubscriber extends AbstractBackpressureThrottlingSubscriber { + + private static final long serialVersionUID = 8255923705960622424L; + + final BiFunction reducer; + final Supplier supplier; + + BackpressureReduceWithSubscriber(@NonNull Subscriber downstream, + @NonNull Supplier supplier, + @NonNull BiFunction reducer) { + super(downstream); + this.reducer = reducer; + this.supplier = supplier; + } + + @Override + public void onNext(T t) { + R v = current.get(); + if (v != null) { + v = current.getAndSet(null); + } + try { + if (v == null) { + current.lazySet(Objects.requireNonNull( + reducer.apply(Objects.requireNonNull(supplier.get(), "The supplier returned a null value"), t), + "The reducer returned a null value" + )); + } else { + current.lazySet(Objects.requireNonNull(reducer.apply(v, t), "The reducer returned a null value")); + } + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + upstream.cancel(); + onError(ex); + return; + } + drain(); + } + } +} diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorComplete.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorComplete.java index c477917f35..a0999f25c4 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorComplete.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorComplete.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorNext.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorNext.java index 7c9de4a748..cb33b81a2f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorNext.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorNext.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorReturn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorReturn.java index 4fe88985a4..85a375fac9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorReturn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorReturn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublish.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublish.java index c1d5675cf1..b05bc8b748 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublish.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublish.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -23,9 +23,11 @@ import io.reactivex.rxjava3.flowables.ConnectableFlowable; import io.reactivex.rxjava3.functions.Consumer; import io.reactivex.rxjava3.internal.fuseable.*; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.QueueSubscription; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** @@ -224,7 +226,7 @@ public void onSubscribe(Subscription s) { public void onNext(T t) { // we expect upstream to honor backpressure requests if (sourceMode == QueueSubscription.NONE && !queue.offer(t)) { - onError(new MissingBackpressureException("Prefetch queue is full?!")); + onError(new QueueOverflowException()); return; } // since many things can happen concurrently, we have a common dispatch diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishMulticast.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishMulticast.java index 26dbaa7f4b..08d0e40058 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishMulticast.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishMulticast.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.operators.flowable; @@ -24,9 +21,10 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.subscriptions.*; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.QueueSubscription; +import io.reactivex.rxjava3.operators.SimpleQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** @@ -214,7 +212,7 @@ public void onNext(T t) { } if (sourceMode == QueueSubscription.NONE && !queue.offer(t)) { upstream.get().cancel(); - onError(new MissingBackpressureException()); + onError(MissingBackpressureException.createDefault()); return; } drain(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRange.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRange.java index 9c14349eb9..e2e3b9a6fb 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRange.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRange.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -17,9 +17,9 @@ import io.reactivex.rxjava3.annotations.Nullable; import io.reactivex.rxjava3.core.Flowable; -import io.reactivex.rxjava3.internal.fuseable.ConditionalSubscriber; import io.reactivex.rxjava3.internal.subscriptions.*; import io.reactivex.rxjava3.internal.util.BackpressureHelper; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; /** * Emits a range of integer values. diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeLong.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeLong.java index 8ae2f333ae..3be56da6ef 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeLong.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeLong.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -17,9 +17,9 @@ import io.reactivex.rxjava3.annotations.Nullable; import io.reactivex.rxjava3.core.Flowable; -import io.reactivex.rxjava3.internal.fuseable.ConditionalSubscriber; import io.reactivex.rxjava3.internal.subscriptions.*; import io.reactivex.rxjava3.internal.util.BackpressureHelper; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; /** * Emits a range of long values. diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduce.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduce.java index 2aa1d71db0..99bc861519 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduce.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduce.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceMaybe.java index aded7967b8..6541fee6bb 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceSeedSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceSeedSingle.java index 715cb49c0a..a5a8cc40cb 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceSeedSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceSeedSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceWithSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceWithSingle.java index b2aaf836d7..9d27a19668 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceWithSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceWithSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRefCount.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRefCount.java index 1bce5a4dd7..0c9f17b0bd 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRefCount.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRefCount.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeat.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeat.java index 3acb03fb76..ffc90b8f4b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeat.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeat.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatUntil.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatUntil.java index 70df0e949d..1d527fa59c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatUntil.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatUntil.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatWhen.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatWhen.java index 5371930b5f..a2bfa250e5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatWhen.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatWhen.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplay.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplay.java index 4423747632..11489490c7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplay.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplay.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -118,10 +118,11 @@ public static ConnectableFlowable create(Flowable source, } /** - * Creates a OperatorReplay instance to replay values of the given source observable. - * @param source the source observable - * @param bufferFactory the factory to instantiate the appropriate buffer when the observable becomes active - * @return the connectable observable + * Creates a OperatorReplay instance to replay values of the given source {@code Flowable}. + * @param the value type + * @param source the source {@code Flowable} to use + * @param bufferFactory the factory to instantiate the appropriate buffer when the {@code Flowable} becomes active + * @return the {@code ConnectableFlowable} instance */ static ConnectableFlowable create(Flowable source, final Supplier> bufferFactory) { @@ -544,6 +545,7 @@ public void dispose() { } /** * Convenience method to auto-cast the index object. + * @param type to cast index object * @return the current index object */ @SuppressWarnings("unchecked") diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryBiPredicate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryBiPredicate.java index 62b4852849..8c8a0e960e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryBiPredicate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryBiPredicate.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryPredicate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryPredicate.java index 75350871c4..a954a09300 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryPredicate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryPredicate.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryWhen.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryWhen.java index f4129d7be8..9babc65472 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryWhen.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryWhen.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSamplePublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSamplePublisher.java index 4a20a2b95f..19474d2cc0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSamplePublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSamplePublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -129,7 +129,7 @@ void emit() { BackpressureHelper.produced(requested, 1); } else { cancel(); - downstream.onError(new MissingBackpressureException("Couldn't emit value due to lack of requests!")); + downstream.onError(MissingBackpressureException.createDefault()); } } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSampleTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSampleTimed.java index 17e1644749..40551f4a8e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSampleTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSampleTimed.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -16,6 +16,8 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.*; +import io.reactivex.rxjava3.exceptions.Exceptions; +import io.reactivex.rxjava3.functions.Consumer; import org.reactivestreams.*; import io.reactivex.rxjava3.core.*; @@ -29,24 +31,25 @@ public final class FlowableSampleTimed extends AbstractFlowableWithUpstream onDropped; - public FlowableSampleTimed(Flowable source, long period, TimeUnit unit, Scheduler scheduler, boolean emitLast) { + public FlowableSampleTimed(Flowable source, long period, TimeUnit unit, Scheduler scheduler, boolean emitLast, Consumer onDropped) { super(source); this.period = period; this.unit = unit; this.scheduler = scheduler; this.emitLast = emitLast; + this.onDropped = onDropped; } @Override protected void subscribeActual(Subscriber s) { SerializedSubscriber serial = new SerializedSubscriber<>(s); if (emitLast) { - source.subscribe(new SampleTimedEmitLast<>(serial, period, unit, scheduler)); + source.subscribe(new SampleTimedEmitLast<>(serial, period, unit, scheduler, onDropped)); } else { - source.subscribe(new SampleTimedNoLast<>(serial, period, unit, scheduler)); + source.subscribe(new SampleTimedNoLast<>(serial, period, unit, scheduler, onDropped)); } } @@ -58,6 +61,7 @@ abstract static class SampleTimedSubscriber extends AtomicReference implem final long period; final TimeUnit unit; final Scheduler scheduler; + final Consumer onDropped; final AtomicLong requested = new AtomicLong(); @@ -65,11 +69,12 @@ abstract static class SampleTimedSubscriber extends AtomicReference implem Subscription upstream; - SampleTimedSubscriber(Subscriber actual, long period, TimeUnit unit, Scheduler scheduler) { + SampleTimedSubscriber(Subscriber actual, long period, TimeUnit unit, Scheduler scheduler, Consumer onDropped) { this.downstream = actual; this.period = period; this.unit = unit; this.scheduler = scheduler; + this.onDropped = onDropped; } @Override @@ -84,7 +89,17 @@ public void onSubscribe(Subscription s) { @Override public void onNext(T t) { - lazySet(t); + T oldValue = getAndSet(t); + if (oldValue != null && onDropped != null) { + try { + onDropped.accept(oldValue); + } catch (Throwable throwable) { + Exceptions.throwIfFatal(throwable); + cancelTimer(); + upstream.cancel(); + downstream.onError(throwable); + } + } } @Override @@ -125,7 +140,7 @@ void emit() { BackpressureHelper.produced(requested, 1); } else { cancel(); - downstream.onError(new MissingBackpressureException("Couldn't emit value due to lack of requests!")); + downstream.onError(MissingBackpressureException.createDefault()); } } } @@ -137,8 +152,8 @@ static final class SampleTimedNoLast extends SampleTimedSubscriber { private static final long serialVersionUID = -7139995637533111443L; - SampleTimedNoLast(Subscriber actual, long period, TimeUnit unit, Scheduler scheduler) { - super(actual, period, unit, scheduler); + SampleTimedNoLast(Subscriber actual, long period, TimeUnit unit, Scheduler scheduler, Consumer onDropped) { + super(actual, period, unit, scheduler, onDropped); } @Override @@ -158,8 +173,8 @@ static final class SampleTimedEmitLast extends SampleTimedSubscriber { final AtomicInteger wip; - SampleTimedEmitLast(Subscriber actual, long period, TimeUnit unit, Scheduler scheduler) { - super(actual, period, unit, scheduler); + SampleTimedEmitLast(Subscriber actual, long period, TimeUnit unit, Scheduler scheduler, Consumer onDropped) { + super(actual, period, unit, scheduler, onDropped); this.wip = new AtomicInteger(1); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScalarXMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScalarXMap.java index 4abae183b4..cb6471b878 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScalarXMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScalarXMap.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScan.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScan.java index 0199189204..84c348adfb 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScan.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScan.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScanSeed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScanSeed.java index 21c88ab7bf..2ffbc6c8e2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScanSeed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScanSeed.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.flowable; import java.util.Objects; @@ -20,10 +21,10 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.fuseable.SimplePlainQueue; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.*; import io.reactivex.rxjava3.internal.util.BackpressureHelper; +import io.reactivex.rxjava3.operators.SimplePlainQueue; +import io.reactivex.rxjava3.operators.SpscArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class FlowableScanSeed extends AbstractFlowableWithUpstream { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqual.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqual.java index cc65e1d37e..8dadbe0161 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqual.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqual.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -20,10 +20,11 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.BiPredicate; -import io.reactivex.rxjava3.internal.fuseable.*; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.*; import io.reactivex.rxjava3.internal.util.AtomicThrowable; +import io.reactivex.rxjava3.operators.QueueSubscription; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscArrayQueue; public final class FlowableSequenceEqual extends Flowable { final Publisher first; @@ -299,7 +300,7 @@ public void onSubscribe(Subscription s) { public void onNext(T t) { if (sourceMode == QueueSubscription.NONE) { if (!queue.offer(t)) { - onError(new MissingBackpressureException()); + onError(MissingBackpressureException.createDefault()); return; } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqualSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqualSingle.java index 05d99e4e49..5ede5990f9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqualSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqualSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -25,6 +25,7 @@ import io.reactivex.rxjava3.internal.operators.flowable.FlowableSequenceEqual.*; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.AtomicThrowable; +import io.reactivex.rxjava3.operators.SimpleQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class FlowableSequenceEqualSingle extends Single implements FuseToFlowable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSerialized.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSerialized.java index 2cd7df3369..4c43ff9c6f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSerialized.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSerialized.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.flowable; import org.reactivestreams.Subscriber; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingle.java index 068385289a..02077e5444 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleMaybe.java index fac74c9cd8..51beeff27c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleSingle.java index c24b45a760..8a4f7fe339 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkip.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkip.java index 2aecef3e10..d9c2f49d1e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkip.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkip.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLast.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLast.java index 5908d6d0b0..9f19ee86ba 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLast.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLast.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLastTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLastTimed.java index b56224cbdf..66f7d240f5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLastTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLastTimed.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,9 +19,9 @@ import org.reactivestreams.*; import io.reactivex.rxjava3.core.*; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.BackpressureHelper; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; public final class FlowableSkipLastTimed extends AbstractFlowableWithUpstream { final long time; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipUntil.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipUntil.java index 8de843142c..a7c51f9941 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipUntil.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipUntil.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,9 +18,9 @@ import org.reactivestreams.*; import io.reactivex.rxjava3.core.*; -import io.reactivex.rxjava3.internal.fuseable.ConditionalSubscriber; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; public final class FlowableSkipUntil extends AbstractFlowableWithUpstream { final Publisher other; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipWhile.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipWhile.java index 62ee5ebdbe..be88184f38 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipWhile.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipWhile.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSubscribeOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSubscribeOn.java index b7fdd91e9f..7d4a51f0f2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSubscribeOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSubscribeOn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchIfEmpty.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchIfEmpty.java index b2ad9db0d0..1d45216f14 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchIfEmpty.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchIfEmpty.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchMap.java index f7e2764460..4d4521c655 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchMap.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -21,10 +21,11 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.*; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.QueueSubscription; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class FlowableSwitchMap extends AbstractFlowableWithUpstream { @@ -380,7 +381,7 @@ public void onNext(R t) { SwitchMapSubscriber p = parent; if (index == p.unique) { if (fusionMode == QueueSubscription.NONE && !queue.offer(t)) { - onError(new MissingBackpressureException("Queue full?!")); + onError(new QueueOverflowException()); return; } p.drain(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTake.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTake.java index 15d06f087f..ea5ca1c4e1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTake.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTake.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLast.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLast.java index 5098b589fd..ad26f45124 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLast.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLast.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastOne.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastOne.java index e4b674704d..43d3bf4446 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastOne.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastOne.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.flowable; import org.reactivestreams.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTimed.java index a7c2ab3343..b42b5717ce 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTimed.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,9 +19,9 @@ import org.reactivestreams.*; import io.reactivex.rxjava3.core.*; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.BackpressureHelper; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; public final class FlowableTakeLastTimed extends AbstractFlowableWithUpstream { final long count; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakePublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakePublisher.java index 9a30bda905..b105b34ca2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakePublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakePublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntil.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntil.java index 9c927cca5d..6ea62f6975 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntil.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntil.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilPredicate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilPredicate.java index a8ec19c22a..a57bb14c0a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilPredicate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilPredicate.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeWhile.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeWhile.java index 5bcd8157d3..ea8d4f13eb 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeWhile.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeWhile.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleFirstTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleFirstTimed.java index 918e2ea6d7..44499ec255 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleFirstTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleFirstTimed.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -16,6 +16,8 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; +import io.reactivex.rxjava3.exceptions.Exceptions; +import io.reactivex.rxjava3.functions.Consumer; import org.reactivestreams.*; import io.reactivex.rxjava3.core.*; @@ -32,44 +34,53 @@ public final class FlowableThrottleFirstTimed extends AbstractFlowableWithUps final long timeout; final TimeUnit unit; final Scheduler scheduler; + final Consumer onDropped; - public FlowableThrottleFirstTimed(Flowable source, long timeout, TimeUnit unit, Scheduler scheduler) { + public FlowableThrottleFirstTimed(Flowable source, + long timeout, + TimeUnit unit, + Scheduler scheduler, + Consumer onDropped) { super(source); this.timeout = timeout; this.unit = unit; this.scheduler = scheduler; + this.onDropped = onDropped; } @Override protected void subscribeActual(Subscriber s) { source.subscribe(new DebounceTimedSubscriber<>( new SerializedSubscriber<>(s), - timeout, unit, scheduler.createWorker())); + timeout, unit, scheduler.createWorker(), + onDropped)); } static final class DebounceTimedSubscriber extends AtomicLong implements FlowableSubscriber, Subscription, Runnable { - private static final long serialVersionUID = -9102637559663639004L; + final Subscriber downstream; final long timeout; final TimeUnit unit; final Scheduler.Worker worker; - + final Consumer onDropped; Subscription upstream; - final SequentialDisposable timer = new SequentialDisposable(); - volatile boolean gate; - boolean done; - DebounceTimedSubscriber(Subscriber actual, long timeout, TimeUnit unit, Worker worker) { + DebounceTimedSubscriber(Subscriber actual, + long timeout, + TimeUnit unit, + Worker worker, + Consumer onDropped) { this.downstream = actual; this.timeout = timeout; this.unit = unit; this.worker = worker; + this.onDropped = onDropped; } @Override @@ -94,9 +105,10 @@ public void onNext(T t) { downstream.onNext(t); BackpressureHelper.produced(this, 1); } else { + upstream.cancel(); done = true; - cancel(); - downstream.onError(new MissingBackpressureException("Could not deliver value due to lack of requests")); + downstream.onError(MissingBackpressureException.createDefault()); + worker.dispose(); return; } @@ -106,6 +118,16 @@ public void onNext(T t) { } timer.replace(worker.schedule(this, timeout, unit)); + } else if (onDropped != null) { + try { + onDropped.accept(t); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + upstream.cancel(); + done = true; + downstream.onError(ex); + worker.dispose(); + } } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleLatest.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleLatest.java index 989eaaf4b2..e28e5f09df 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleLatest.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleLatest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,9 +19,11 @@ import org.reactivestreams.*; import io.reactivex.rxjava3.core.*; -import io.reactivex.rxjava3.exceptions.MissingBackpressureException; +import io.reactivex.rxjava3.exceptions.*; +import io.reactivex.rxjava3.functions.Consumer; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.BackpressureHelper; +import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** * Emits the next or latest item when the given time elapses. @@ -44,19 +46,24 @@ public final class FlowableThrottleLatest extends AbstractFlowableWithUpstrea final boolean emitLast; + final Consumer onDropped; + public FlowableThrottleLatest(Flowable source, - long timeout, TimeUnit unit, Scheduler scheduler, - boolean emitLast) { + long timeout, TimeUnit unit, + Scheduler scheduler, + boolean emitLast, + Consumer onDropped) { super(source); this.timeout = timeout; this.unit = unit; this.scheduler = scheduler; this.emitLast = emitLast; + this.onDropped = onDropped; } @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new ThrottleLatestSubscriber<>(s, timeout, unit, scheduler.createWorker(), emitLast)); + source.subscribe(new ThrottleLatestSubscriber<>(s, timeout, unit, scheduler.createWorker(), emitLast, onDropped)); } static final class ThrottleLatestSubscriber @@ -79,6 +86,8 @@ static final class ThrottleLatestSubscriber final AtomicLong requested; + final Consumer onDropped; + Subscription upstream; volatile boolean done; @@ -93,8 +102,10 @@ static final class ThrottleLatestSubscriber boolean timerRunning; ThrottleLatestSubscriber(Subscriber downstream, - long timeout, TimeUnit unit, Scheduler.Worker worker, - boolean emitLast) { + long timeout, TimeUnit unit, + Scheduler.Worker worker, + boolean emitLast, + Consumer onDropped) { this.downstream = downstream; this.timeout = timeout; this.unit = unit; @@ -102,6 +113,7 @@ static final class ThrottleLatestSubscriber this.emitLast = emitLast; this.latest = new AtomicReference<>(); this.requested = new AtomicLong(); + this.onDropped = onDropped; } @Override @@ -115,7 +127,17 @@ public void onSubscribe(Subscription s) { @Override public void onNext(T t) { - latest.set(t); + T old = latest.getAndSet(t); + if (onDropped != null && old != null) { + try { + onDropped.accept(old); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + upstream.cancel(); + error = ex; + done = true; + } + } drain(); } @@ -145,6 +167,22 @@ public void cancel() { upstream.cancel(); worker.dispose(); if (getAndIncrement() == 0) { + clear(); + } + } + + void clear() { + if (onDropped != null) { + T v = latest.getAndSet(null); + if (v != null) { + try { + onDropped.accept(v); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + RxJavaPlugins.onError(ex); + } + } + } else { latest.lazySet(null); } } @@ -170,14 +208,27 @@ void drain() { for (;;) { if (cancelled) { - latest.lazySet(null); + clear(); return; } boolean d = done; + Throwable error = this.error; if (d && error != null) { - latest.lazySet(null); + if (onDropped != null) { + T v = latest.getAndSet(null); + if (v != null) { + try { + onDropped.accept(v); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + error = new CompositeException(error, ex); + } + } + } else { + latest.lazySet(null); + } downstream.onError(error); worker.dispose(); return; @@ -187,19 +238,31 @@ void drain() { boolean empty = v == null; if (d) { - if (!empty && emitLast) { + if (!empty) { v = latest.getAndSet(null); - long e = emitted; - if (e != requested.get()) { - emitted = e + 1; - downstream.onNext(v); - downstream.onComplete(); + if (emitLast) { + long e = emitted; + if (e != requested.get()) { + emitted = e + 1; + downstream.onNext(v); + downstream.onComplete(); + } else { + tryDropAndSignalMBE(v); + } } else { - downstream.onError(new MissingBackpressureException( - "Could not emit final value due to lack of requests")); + if (onDropped != null) { + try { + onDropped.accept(v); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + downstream.onError(ex); + worker.dispose(); + return; + } + } + downstream.onComplete(); } } else { - latest.lazySet(null); downstream.onComplete(); } worker.dispose(); @@ -222,8 +285,7 @@ void drain() { emitted = e + 1; } else { upstream.cancel(); - downstream.onError(new MissingBackpressureException( - "Could not emit value due to lack of requests")); + tryDropAndSignalMBE(v); worker.dispose(); return; } @@ -242,5 +304,18 @@ void drain() { } } } + + void tryDropAndSignalMBE(T valueToDrop) { + Throwable errorToSignal = MissingBackpressureException.createDefault(); + if (onDropped != null) { + try { + onDropped.accept(valueToDrop); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + errorToSignal = new CompositeException(errorToSignal, ex); + } + } + downstream.onError(errorToSignal); + } } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeInterval.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeInterval.java index eb9ec1fbd9..1601814c98 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeInterval.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeInterval.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeout.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeout.java index 976ab10a05..506132f595 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeout.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeout.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutTimed.java index 351099500e..67d612011d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutTimed.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimer.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimer.java index 6c172320de..db45fe2e98 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -78,7 +78,7 @@ public void run() { downstream.onComplete(); } else { lazySet(EmptyDisposable.INSTANCE); - downstream.onError(new MissingBackpressureException("Can't deliver value due to lack of requests")); + downstream.onError(MissingBackpressureException.createDefault()); } } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToList.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToList.java index 18d8a86de4..3f03d93112 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToList.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToList.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -46,7 +46,7 @@ protected void subscribeActual(Subscriber s) { static final class ToListSubscriber> extends DeferredScalarSubscription - implements FlowableSubscriber, Subscription { + implements FlowableSubscriber { private static final long serialVersionUID = -8134157938864266736L; Subscription upstream; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToListSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToListSingle.java index aea4eb3270..5e65b48e08 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToListSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToListSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUnsubscribeOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUnsubscribeOn.java index ee9d8f3cc7..dd8c4ce4cf 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUnsubscribeOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUnsubscribeOn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUsing.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUsing.java index 5a5b177d35..8f34a6e414 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUsing.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUsing.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -117,7 +117,6 @@ public void onError(Throwable t) { } } - upstream.cancel(); if (innerError != null) { downstream.onError(new CompositeException(t, innerError)); } else { @@ -125,7 +124,6 @@ public void onError(Throwable t) { } } else { downstream.onError(t); - upstream.cancel(); disposeResource(); } } @@ -143,11 +141,9 @@ public void onComplete() { } } - upstream.cancel(); downstream.onComplete(); } else { downstream.onComplete(); - upstream.cancel(); disposeResource(); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindow.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindow.java index 1f139bad1c..85ab5a5e0b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindow.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindow.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,9 +19,9 @@ import org.reactivestreams.*; import io.reactivex.rxjava3.core.*; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.BackpressureHelper; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; import io.reactivex.rxjava3.processors.UnicastProcessor; public final class FlowableWindow extends AbstractFlowableWithUpstream> { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowBoundary.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowBoundary.java index c86d3faab1..2aad69dcb5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowBoundary.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowBoundary.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -248,7 +248,7 @@ void drain() { } else { SubscriptionHelper.cancel(upstream); boundarySubscriber.dispose(); - errors.tryAddThrowableOrReport(new MissingBackpressureException("Could not deliver a window due to lack of requests")); + errors.tryAddThrowableOrReport(MissingBackpressureException.createDefault()); done = true; } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowBoundarySelector.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowBoundarySelector.java index f6248b3355..d6bffae2e1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowBoundarySelector.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowBoundarySelector.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -22,10 +22,10 @@ import io.reactivex.rxjava3.disposables.*; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.SimplePlainQueue; import io.reactivex.rxjava3.internal.queue.MpscLinkedQueue; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SimplePlainQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.processors.UnicastProcessor; @@ -272,7 +272,7 @@ void drain() { upstream.cancel(); startSubscriber.cancel(); resources.dispose(); - error.tryAddThrowableOrReport(new MissingBackpressureException(FlowableWindowTimed.missingBackpressureMessage(emitted))); + error.tryAddThrowableOrReport(FlowableWindowTimed.missingBackpressureMessage(emitted)); upstreamDone = true; } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowSubscribeIntercept.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowSubscribeIntercept.java index 8f6cf0a2da..8ef2204c97 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowSubscribeIntercept.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowSubscribeIntercept.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -45,4 +45,4 @@ protected void subscribeActual(Subscriber s) { boolean tryAbandon() { return !once.get() && once.compareAndSet(false, true); } -} \ No newline at end of file +} diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowTimed.java index 89b49e857a..39e7de59ad 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowTimed.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -23,10 +23,10 @@ import io.reactivex.rxjava3.core.Scheduler.Worker; import io.reactivex.rxjava3.exceptions.MissingBackpressureException; import io.reactivex.rxjava3.internal.disposables.SequentialDisposable; -import io.reactivex.rxjava3.internal.fuseable.SimplePlainQueue; import io.reactivex.rxjava3.internal.queue.MpscLinkedQueue; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.BackpressureHelper; +import io.reactivex.rxjava3.operators.SimplePlainQueue; import io.reactivex.rxjava3.processors.UnicastProcessor; public final class FlowableWindowTimed extends AbstractFlowableWithUpstream> { @@ -213,7 +213,7 @@ void createFirstWindow() { upstream.request(Long.MAX_VALUE); } else { upstream.cancel(); - downstream.onError(new MissingBackpressureException(missingBackpressureMessage(emitted))); + downstream.onError(missingBackpressureMessage(emitted)); cleanupResources(); upstreamCancelled = true; @@ -282,7 +282,7 @@ else if (!isEmpty) { cleanupResources(); upstreamCancelled = true; - downstream.onError(new MissingBackpressureException(missingBackpressureMessage(emitted))); + downstream.onError(missingBackpressureMessage(emitted)); } else { emitted++; @@ -386,7 +386,7 @@ void createFirstWindow() { upstream.request(Long.MAX_VALUE); } else { upstream.cancel(); - downstream.onError(new MissingBackpressureException(missingBackpressureMessage(emitted))); + downstream.onError(missingBackpressureMessage(emitted)); cleanupResources(); upstreamCancelled = true; @@ -499,7 +499,7 @@ UnicastProcessor createNewWindow(UnicastProcessor window) { cleanupResources(); upstreamCancelled = true; - downstream.onError(new MissingBackpressureException(missingBackpressureMessage(emitted))); + downstream.onError(missingBackpressureMessage(emitted)); } else { this.emitted = ++emitted; @@ -584,7 +584,7 @@ void createFirstWindow() { upstream.request(Long.MAX_VALUE); } else { upstream.cancel(); - downstream.onError(new MissingBackpressureException(missingBackpressureMessage(emitted))); + downstream.onError(missingBackpressureMessage(emitted)); cleanupResources(); upstreamCancelled = true; @@ -654,7 +654,7 @@ void drain() { } } else { upstream.cancel(); - Throwable ex = new MissingBackpressureException(missingBackpressureMessage(emitted)); + Throwable ex = missingBackpressureMessage(emitted); for (UnicastProcessor window : windows) { window.onError(ex); } @@ -717,8 +717,8 @@ public void run() { } } - static String missingBackpressureMessage(long index) { - return "Unable to emit the next window (#" + index + ") due to lack of requests. Please make sure the downstream is ready to consume windows."; + static MissingBackpressureException missingBackpressureMessage(long index) { + return new MissingBackpressureException("Unable to emit the next window (#" + index + ") due to lack of requests. Please make sure the downstream is ready to consume windows."); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFrom.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFrom.java index 81d3544dd0..cad9f3c0ca 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFrom.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFrom.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -21,8 +21,8 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.BiFunction; -import io.reactivex.rxjava3.internal.fuseable.ConditionalSubscriber; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; import io.reactivex.rxjava3.subscribers.SerializedSubscriber; public final class FlowableWithLatestFrom extends AbstractFlowableWithUpstream { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFromMany.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFromMany.java index be9166a16d..77d0527729 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFromMany.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFromMany.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.flowable; import java.util.Arrays; @@ -22,9 +23,9 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.ConditionalSubscriber; import io.reactivex.rxjava3.internal.subscriptions.*; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZip.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZip.java index d3da152716..de680b19af 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZip.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZip.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -22,10 +22,11 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.*; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.*; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.QueueSubscription; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscArrayQueue; public final class FlowableZip extends Flowable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZipIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZipIterable.java index 1fb9777a50..25d4df529d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZipIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZipIterable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/AbstractMaybeWithUpstream.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/AbstractMaybeWithUpstream.java index ed559c96dc..348bb48227 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/AbstractMaybeWithUpstream.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/AbstractMaybeWithUpstream.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeAmb.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeAmb.java index b87390e847..802075b2ab 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeAmb.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeAmb.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCache.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCache.java index 05c1593707..f9080a1282 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCache.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCache.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCallbackObserver.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCallbackObserver.java index 774511f291..c94c7d4929 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCallbackObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCallbackObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArray.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArray.java index f77a59c364..889e229b64 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArray.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArray.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArrayDelayError.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArrayDelayError.java index e889adfe1a..3b4b87399a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArrayDelayError.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArrayDelayError.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatIterable.java index ee6e87cbe0..b777f4c751 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatIterable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeContains.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeContains.java index 8737c6ae37..c1154067f5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeContains.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeContains.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCount.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCount.java index d687e6ac1e..cd2bececf1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCount.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCount.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCreate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCreate.java index 24293b895b..1a6bc60d31 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCreate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCreate.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDefer.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDefer.java index ccba4e0041..a1ffacef74 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDefer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDefer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelay.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelay.java index 3e6922a339..5f13010781 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelay.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelay.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayOtherPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayOtherPublisher.java index 7797a968a5..eebddc3c87 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayOtherPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayOtherPublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelaySubscriptionOtherPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelaySubscriptionOtherPublisher.java index 7de18c70a5..7cd54da714 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelaySubscriptionOtherPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelaySubscriptionOtherPublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayWithCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayWithCompletable.java index 6bdc5d1a98..ecbd84a274 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayWithCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayWithCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDematerialize.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDematerialize.java index d5d3ed25cd..80b76d3171 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDematerialize.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDematerialize.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDetach.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDetach.java index 595c362917..7dad3b0cf2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDetach.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDetach.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoAfterSuccess.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoAfterSuccess.java index 28943223f0..c8f4799789 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoAfterSuccess.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoAfterSuccess.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoFinally.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoFinally.java index 0078cf88b1..0d8dfe8de2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoFinally.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoFinally.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnEvent.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnEvent.java index eccc36c606..a2771dcb8c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnEvent.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnEvent.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnLifecycle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnLifecycle.java index 3355c79014..0399329362 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnLifecycle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnLifecycle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.maybe; import io.reactivex.rxjava3.annotations.NonNull; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnTerminate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnTerminate.java index 7443b147a0..6c3494ac96 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnTerminate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnTerminate.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeEmpty.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeEmpty.java index 4b3361998e..a803b84fa9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeEmpty.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeEmpty.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -15,7 +15,7 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.internal.disposables.EmptyDisposable; -import io.reactivex.rxjava3.internal.fuseable.ScalarSupplier; +import io.reactivex.rxjava3.operators.ScalarSupplier; /** * Signals an onComplete. diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeEqualSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeEqualSingle.java index ddcfc7b3c5..bf940b8223 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeEqualSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeEqualSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeError.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeError.java index fc2f50066e..ed9c391f02 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeError.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeError.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeErrorCallable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeErrorCallable.java index 20bb1e03a8..360b729933 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeErrorCallable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeErrorCallable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFilter.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFilter.java index 2ddf5fff27..833edb75f3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFilter.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFilter.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFilterSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFilterSingle.java index 0535447881..aa3cae5e5c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFilterSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFilterSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapBiSelector.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapBiSelector.java index da5cfe56b8..c57caee8f7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapBiSelector.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapBiSelector.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapCompletable.java index 10fc003bf8..1611fddfff 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableFlowable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableFlowable.java index 40ca98c351..322a73177f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableFlowable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableFlowable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableObservable.java index c5c24995b1..2018274b1a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableObservable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapNotification.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapNotification.java index ffe6ee5e20..d91bd46da6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapNotification.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapNotification.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingle.java index 999b22f836..e88dd6fc3d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatten.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatten.java index 21d306095c..485cf69ea1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatten.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatten.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromAction.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromAction.java index 5bdf86f904..3d9cf428cf 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromAction.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromAction.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromCallable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromCallable.java index 088f2e14f0..592b02fad2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromCallable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromCallable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromCompletable.java index 5cb73e821c..f6ad406e35 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromFuture.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromFuture.java index acc93b3ea6..e506a32265 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromFuture.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromFuture.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromRunnable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromRunnable.java index 4c83bbeee7..a102e4b945 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromRunnable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromRunnable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromSingle.java index c74a73ee25..8fe691b767 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromSupplier.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromSupplier.java index 38f0afdb62..6eaf31ee64 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromSupplier.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromSupplier.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeHide.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeHide.java index 4dcddd0c27..2f87b5fddd 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeHide.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeHide.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIgnoreElement.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIgnoreElement.java index 1c9242548d..dcdbd2cd73 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIgnoreElement.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIgnoreElement.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIgnoreElementCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIgnoreElementCompletable.java index 6e9c1e9d67..42f40c92f1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIgnoreElementCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIgnoreElementCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmpty.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmpty.java index 64fb3046ba..a9642b92fe 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmpty.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmpty.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmptySingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmptySingle.java index a7fa1882b8..b4795a2985 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmptySingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmptySingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeJust.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeJust.java index 54dacb3c7d..7e6fc6dfa6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeJust.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeJust.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -15,7 +15,7 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.Disposable; -import io.reactivex.rxjava3.internal.fuseable.ScalarSupplier; +import io.reactivex.rxjava3.operators.ScalarSupplier; /** * Signals a constant value. diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeLift.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeLift.java index 8e40bbd45d..a5a6d76877 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeLift.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeLift.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMap.java index 167e21d7fb..2d637fdd43 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMap.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMaterialize.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMaterialize.java index 2690bc4797..022d92bbe8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMaterialize.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMaterialize.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMergeArray.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMergeArray.java index e550b16fba..82f6d62ddf 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMergeArray.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMergeArray.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -22,9 +22,9 @@ import io.reactivex.rxjava3.annotations.Nullable; import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.*; -import io.reactivex.rxjava3.internal.fuseable.SimpleQueue; import io.reactivex.rxjava3.internal.subscriptions.*; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SimpleQueue; /** * Run all MaybeSources of an array at once and signal their values as they become available. diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeNever.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeNever.java index 9690c28359..a9c35c9b67 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeNever.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeNever.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeObserveOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeObserveOn.java index 7bf03b080e..5afb4beaf3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeObserveOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeObserveOn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorComplete.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorComplete.java index 277e207eaf..46c15bcb2a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorComplete.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorComplete.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorNext.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorNext.java index 97fdd7b537..a3e975570d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorNext.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorNext.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorReturn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorReturn.java index 190856d5c7..6d14b2c8cd 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorReturn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorReturn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybePeek.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybePeek.java index 3b5427ba0f..58c69839a1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybePeek.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybePeek.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSubscribeOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSubscribeOn.java index 543b7c2b6a..7ec1a6ad71 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSubscribeOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSubscribeOn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmpty.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmpty.java index 3be260441c..c432b3c674 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmpty.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmpty.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmptySingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmptySingle.java index 142e39f1f6..29e77a3e56 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmptySingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmptySingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -124,4 +124,4 @@ public void onError(Throwable e) { } } -} \ No newline at end of file +} diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilMaybe.java index 6c9498c065..e99011e509 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilPublisher.java index e86cc7c324..8e57a5ee84 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilPublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeInterval.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeInterval.java index af30ee3a1d..9580976d89 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeInterval.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeInterval.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutMaybe.java index 03783489a3..2a2581c5f3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutPublisher.java index 76545730f3..e89a8d0bc9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutPublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimer.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimer.java index a374c44ced..2b9033c66b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToFlowable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToFlowable.java index c31ad262ab..5ce9f66103 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToFlowable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToFlowable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToObservable.java index 4b27918621..65ef0ced1b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToObservable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToPublisher.java index 914021c914..8f1f10d28d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToPublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToSingle.java index 807b9cac51..48ab0134e3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUnsafeCreate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUnsafeCreate.java index 35621c1bbf..462a2525b1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUnsafeCreate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUnsafeCreate.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUnsubscribeOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUnsubscribeOn.java index 2f07161dc9..b1d8cb6f65 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUnsubscribeOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUnsubscribeOn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUsing.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUsing.java index 0e490d6f40..74e4250e5f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUsing.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUsing.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipArray.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipArray.java index b155e019fc..ac7514fb68 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipArray.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipArray.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -73,7 +73,7 @@ static final class ZipCoordinator extends AtomicInteger implements Disposa final ZipMaybeObserver[] observers; - final Object[] values; + Object[] values; @SuppressWarnings("unchecked") ZipCoordinator(MaybeObserver observer, int n, Function zipper) { @@ -99,11 +99,16 @@ public void dispose() { for (ZipMaybeObserver d : observers) { d.dispose(); } + + values = null; } } void innerSuccess(T value, int index) { - values[index] = value; + Object[] values = this.values; + if (values != null) { + values[index] = value; + } if (decrementAndGet() == 0) { R v; @@ -111,10 +116,12 @@ void innerSuccess(T value, int index) { v = Objects.requireNonNull(zipper.apply(values), "The zipper returned a null value"); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); + this.values = null; downstream.onError(ex); return; } + this.values = null; downstream.onSuccess(v); } } @@ -133,6 +140,7 @@ void disposeExcept(int index) { void innerError(Throwable ex, int index) { if (getAndSet(0) > 0) { disposeExcept(index); + values = null; downstream.onError(ex); } else { RxJavaPlugins.onError(ex); @@ -142,6 +150,7 @@ void innerError(Throwable ex, int index) { void innerComplete(int index) { if (getAndSet(0) > 0) { disposeExcept(index); + values = null; downstream.onComplete(); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipIterable.java index 839b373920..b247ca4ded 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipIterable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/CompletableAndThenObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/CompletableAndThenObservable.java index 2a3263a50a..9f46c097f6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/CompletableAndThenObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/CompletableAndThenObservable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/CompletableAndThenPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/CompletableAndThenPublisher.java index c9017d0af6..7004181bcc 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/CompletableAndThenPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/CompletableAndThenPublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ConcatMapXMainObserver.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ConcatMapXMainObserver.java new file mode 100644 index 0000000000..d2d29b1213 --- /dev/null +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ConcatMapXMainObserver.java @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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 io.reactivex.rxjava3.internal.operators.mixed; + +import java.util.concurrent.atomic.AtomicInteger; + +import io.reactivex.rxjava3.core.Observer; +import io.reactivex.rxjava3.disposables.Disposable; +import io.reactivex.rxjava3.internal.disposables.DisposableHelper; +import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; + +/** + * Base class for implementing concatMapX main observers. + * + * @param the upstream value type + * @since 3.0.10 + */ +public abstract class ConcatMapXMainObserver extends AtomicInteger +implements Observer, Disposable { + + private static final long serialVersionUID = -3214213361171757852L; + + final AtomicThrowable errors; + + final int prefetch; + + final ErrorMode errorMode; + + SimpleQueue queue; + + Disposable upstream; + + volatile boolean done; + + volatile boolean disposed; + + public ConcatMapXMainObserver(int prefetch, ErrorMode errorMode) { + this.errorMode = errorMode; + this.errors = new AtomicThrowable(); + this.prefetch = prefetch; + } + + @Override + public final void onSubscribe(Disposable d) { + if (DisposableHelper.validate(upstream, d)) { + upstream = d; + if (d instanceof QueueDisposable) { + @SuppressWarnings("unchecked") + QueueDisposable qd = (QueueDisposable)d; + int mode = qd.requestFusion(QueueFuseable.ANY | QueueFuseable.BOUNDARY); + if (mode == QueueFuseable.SYNC) { + queue = qd; + done = true; + + onSubscribeDownstream(); + + drain(); + return; + } + else if (mode == QueueFuseable.ASYNC) { + queue = qd; + + onSubscribeDownstream(); + + return; + } + } + + queue = new SpscLinkedArrayQueue<>(prefetch); + onSubscribeDownstream(); + } + } + + @Override + public final void onNext(T t) { + // In async fusion mode, t is a drain indicator + if (t != null) { + queue.offer(t); + } + drain(); + } + + @Override + public final void onError(Throwable t) { + if (errors.tryAddThrowableOrReport(t)) { + if (errorMode == ErrorMode.IMMEDIATE) { + disposeInner(); + } + done = true; + drain(); + } + } + + @Override + public final void onComplete() { + done = true; + drain(); + } + + @Override + public final void dispose() { + disposed = true; + upstream.dispose(); + disposeInner(); + errors.tryTerminateAndReport(); + if (getAndIncrement() == 0) { + queue.clear(); + clearValue(); + } + } + + @Override + public final boolean isDisposed() { + return disposed; + } + + /** + * Override this to clear values when the downstream disposes. + */ + void clearValue() { + } + + /** + * Typically, this should be {@code downstream.onSubscribe(this)}. + */ + abstract void onSubscribeDownstream(); + + /** + * Typically, this should be {@code inner.dispose()}. + */ + abstract void disposeInner(); + + /** + * Implement the serialized inner subscribing and value emission here. + */ + abstract void drain(); +} diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ConcatMapXMainSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ConcatMapXMainSubscriber.java new file mode 100644 index 0000000000..03e4c568d6 --- /dev/null +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ConcatMapXMainSubscriber.java @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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 io.reactivex.rxjava3.internal.operators.mixed; + +import java.util.concurrent.atomic.AtomicInteger; + +import org.reactivestreams.Subscription; + +import io.reactivex.rxjava3.core.FlowableSubscriber; +import io.reactivex.rxjava3.exceptions.*; +import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; +import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueSubscription; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscArrayQueue; + +/** + * Base class for implementing concatMapX main subscribers. + * + * @param the upstream value type + * @since 3.0.10 + */ +public abstract class ConcatMapXMainSubscriber extends AtomicInteger +implements FlowableSubscriber { + + private static final long serialVersionUID = -3214213361171757852L; + + final AtomicThrowable errors; + + final int prefetch; + + final ErrorMode errorMode; + + SimpleQueue queue; + + Subscription upstream; + + volatile boolean done; + + volatile boolean cancelled; + + boolean syncFused; + + public ConcatMapXMainSubscriber(int prefetch, ErrorMode errorMode) { + this.errorMode = errorMode; + this.errors = new AtomicThrowable(); + this.prefetch = prefetch; + } + + @Override + public final void onSubscribe(Subscription s) { + if (SubscriptionHelper.validate(upstream, s)) { + upstream = s; + if (s instanceof QueueSubscription) { + @SuppressWarnings("unchecked") + QueueSubscription qs = (QueueSubscription)s; + int mode = qs.requestFusion(QueueFuseable.ANY | QueueFuseable.BOUNDARY); + if (mode == QueueFuseable.SYNC) { + queue = qs; + syncFused = true; + done = true; + + onSubscribeDownstream(); + + drain(); + return; + } + else if (mode == QueueFuseable.ASYNC) { + queue = qs; + + onSubscribeDownstream(); + + upstream.request(prefetch); + return; + } + } + + queue = new SpscArrayQueue<>(prefetch); + onSubscribeDownstream(); + upstream.request(prefetch); + } + } + + @Override + public final void onNext(T t) { + // In async fusion mode, t is a drain indicator + if (t != null) { + if (!queue.offer(t)) { + upstream.cancel(); + onError(new QueueOverflowException()); + return; + } + } + drain(); + } + + @Override + public final void onError(Throwable t) { + if (errors.tryAddThrowableOrReport(t)) { + if (errorMode == ErrorMode.IMMEDIATE) { + disposeInner(); + } + done = true; + drain(); + } + } + + @Override + public final void onComplete() { + done = true; + drain(); + } + + final void stop() { + cancelled = true; + upstream.cancel(); + disposeInner(); + errors.tryTerminateAndReport(); + if (getAndIncrement() == 0) { + queue.clear(); + clearValue(); + } + } + + /** + * Override this to clear values when the downstream disposes. + */ + void clearValue() { + } + + /** + * Typically, this should be {@code downstream.onSubscribe(this);}. + */ + abstract void onSubscribeDownstream(); + + /** + * Typically, this should be {@code inner.dispose()}. + */ + abstract void disposeInner(); + + /** + * Implement the serialized inner subscribing and value emission here. + */ + abstract void drain(); +} diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapCompletable.java index e4a3f36c05..ab93e4c27f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -14,19 +14,15 @@ package io.reactivex.rxjava3.internal.operators.mixed; import java.util.Objects; -import java.util.concurrent.atomic.*; - -import org.reactivestreams.Subscription; +import java.util.concurrent.atomic.AtomicReference; import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.Disposable; -import io.reactivex.rxjava3.exceptions.*; +import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.SimplePlainQueue; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; -import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SimpleQueue; /** * Maps the upstream items into {@link CompletableSource}s and subscribes to them one after the @@ -61,8 +57,8 @@ protected void subscribeActual(CompletableObserver observer) { } static final class ConcatMapCompletableObserver - extends AtomicInteger - implements FlowableSubscriber, Disposable { + extends ConcatMapXMainSubscriber + implements Disposable { private static final long serialVersionUID = 3610901111000061034L; @@ -70,93 +66,39 @@ static final class ConcatMapCompletableObserver final Function mapper; - final ErrorMode errorMode; - - final AtomicThrowable errors; - final ConcatMapInnerObserver inner; - final int prefetch; - - final SimplePlainQueue queue; - - Subscription upstream; - volatile boolean active; - volatile boolean done; - - volatile boolean disposed; - int consumed; ConcatMapCompletableObserver(CompletableObserver downstream, Function mapper, ErrorMode errorMode, int prefetch) { + super(prefetch, errorMode); this.downstream = downstream; this.mapper = mapper; - this.errorMode = errorMode; - this.prefetch = prefetch; - this.errors = new AtomicThrowable(); this.inner = new ConcatMapInnerObserver(this); - this.queue = new SpscArrayQueue<>(prefetch); - } - - @Override - public void onSubscribe(Subscription s) { - if (SubscriptionHelper.validate(upstream, s)) { - this.upstream = s; - downstream.onSubscribe(this); - s.request(prefetch); - } - } - - @Override - public void onNext(T t) { - if (queue.offer(t)) { - drain(); - } else { - upstream.cancel(); - onError(new MissingBackpressureException("Queue full?!")); - } } @Override - public void onError(Throwable t) { - if (errors.tryAddThrowableOrReport(t)) { - if (errorMode == ErrorMode.IMMEDIATE) { - inner.dispose(); - errors.tryTerminateConsumer(downstream); - if (getAndIncrement() == 0) { - queue.clear(); - } - } else { - done = true; - drain(); - } - } + void onSubscribeDownstream() { + downstream.onSubscribe(this); } @Override - public void onComplete() { - done = true; - drain(); + void disposeInner() { + inner.dispose(); } @Override public void dispose() { - disposed = true; - upstream.cancel(); - inner.dispose(); - errors.tryTerminateAndReport(); - if (getAndIncrement() == 0) { - queue.clear(); - } + stop(); } @Override public boolean isDisposed() { - return disposed; + return cancelled; } void innerError(Throwable ex) { @@ -179,29 +121,45 @@ void innerComplete() { drain(); } + @Override void drain() { if (getAndIncrement() != 0) { return; } + ErrorMode errorMode = this.errorMode; + SimpleQueue queue = this.queue; + AtomicThrowable errors = this.errors; + boolean syncFused = this.syncFused; + do { - if (disposed) { + if (cancelled) { queue.clear(); return; } - if (!active) { - - if (errorMode == ErrorMode.BOUNDARY) { - if (errors.get() != null) { - queue.clear(); - errors.tryTerminateConsumer(downstream); - return; - } + if (errors.get() != null) { + if (errorMode == ErrorMode.IMMEDIATE + || (errorMode == ErrorMode.BOUNDARY && !active)) { + queue.clear(); + errors.tryTerminateConsumer(downstream); + return; } + } + + if (!active) { boolean d = done; - T v = queue.poll(); + T v; + try { + v = queue.poll(); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + upstream.cancel(); + errors.tryAddThrowableOrReport(ex); + errors.tryTerminateConsumer(downstream); + return; + } boolean empty = v == null; if (d && empty) { @@ -212,12 +170,15 @@ void drain() { if (!empty) { int limit = prefetch - (prefetch >> 1); - int c = consumed + 1; - if (c == limit) { - consumed = 0; - upstream.request(limit); - } else { - consumed = c; + + if (!syncFused) { + int c = consumed + 1; + if (c == limit) { + consumed = 0; + upstream.request(limit); + } else { + consumed = c; + } } CompletableSource cs; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapMaybe.java index 5f71148e0d..944ac69311 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -20,13 +20,11 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.Disposable; -import io.reactivex.rxjava3.exceptions.*; +import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.SimplePlainQueue; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; -import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SimpleQueue; /** * Maps each upstream item into a {@link MaybeSource}, subscribes to them one after the other terminates @@ -62,8 +60,7 @@ protected void subscribeActual(Subscriber s) { } static final class ConcatMapMaybeSubscriber - extends AtomicInteger - implements FlowableSubscriber, Subscription { + extends ConcatMapXMainSubscriber implements Subscription { private static final long serialVersionUID = -9140123220065488293L; @@ -71,24 +68,10 @@ static final class ConcatMapMaybeSubscriber final Function> mapper; - final int prefetch; - final AtomicLong requested; - final AtomicThrowable errors; - final ConcatMapMaybeObserver inner; - final SimplePlainQueue queue; - - final ErrorMode errorMode; - - Subscription upstream; - - volatile boolean done; - - volatile boolean cancelled; - long emitted; int consumed; @@ -107,50 +90,16 @@ static final class ConcatMapMaybeSubscriber ConcatMapMaybeSubscriber(Subscriber downstream, Function> mapper, int prefetch, ErrorMode errorMode) { + super(prefetch, errorMode); this.downstream = downstream; this.mapper = mapper; - this.prefetch = prefetch; - this.errorMode = errorMode; this.requested = new AtomicLong(); - this.errors = new AtomicThrowable(); this.inner = new ConcatMapMaybeObserver<>(this); - this.queue = new SpscArrayQueue<>(prefetch); - } - - @Override - public void onSubscribe(Subscription s) { - if (SubscriptionHelper.validate(upstream, s)) { - upstream = s; - downstream.onSubscribe(this); - s.request(prefetch); - } - } - - @Override - public void onNext(T t) { - if (!queue.offer(t)) { - upstream.cancel(); - onError(new MissingBackpressureException("queue full?!")); - return; - } - drain(); - } - - @Override - public void onError(Throwable t) { - if (errors.tryAddThrowableOrReport(t)) { - if (errorMode == ErrorMode.IMMEDIATE) { - inner.dispose(); - } - done = true; - drain(); - } } @Override - public void onComplete() { - done = true; - drain(); + void onSubscribeDownstream() { + downstream.onSubscribe(this); } @Override @@ -161,14 +110,7 @@ public void request(long n) { @Override public void cancel() { - cancelled = true; - upstream.cancel(); - inner.dispose(); - errors.tryTerminateAndReport(); - if (getAndIncrement() == 0) { - queue.clear(); - item = null; - } + stop(); } void innerSuccess(R item) { @@ -192,6 +134,17 @@ void innerError(Throwable ex) { } } + @Override + void clearValue() { + item = null; + } + + @Override + void disposeInner() { + inner.dispose(); + } + + @Override void drain() { if (getAndIncrement() != 0) { return; @@ -200,10 +153,11 @@ void drain() { int missed = 1; Subscriber downstream = this.downstream; ErrorMode errorMode = this.errorMode; - SimplePlainQueue queue = this.queue; + SimpleQueue queue = this.queue; AtomicThrowable errors = this.errors; AtomicLong requested = this.requested; int limit = prefetch - (prefetch >> 1); + boolean syncFused = this.syncFused; for (;;) { @@ -228,7 +182,16 @@ void drain() { if (s == STATE_INACTIVE) { boolean d = done; - T v = queue.poll(); + T v; + try { + v = queue.poll(); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + upstream.cancel(); + errors.tryAddThrowableOrReport(ex); + errors.tryTerminateConsumer(downstream); + return; + } boolean empty = v == null; if (d && empty) { @@ -240,12 +203,14 @@ void drain() { break; } - int c = consumed + 1; - if (c == limit) { - consumed = 0; - upstream.request(limit); - } else { - consumed = c; + if (!syncFused) { + int c = consumed + 1; + if (c == limit) { + consumed = 0; + upstream.request(limit); + } else { + consumed = c; + } } MaybeSource ms; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapMaybePublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapMaybePublisher.java index 8651cdcb60..42c1f732c2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapMaybePublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapMaybePublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapSingle.java index f6cd939546..5c18b6b258 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -20,13 +20,11 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.Disposable; -import io.reactivex.rxjava3.exceptions.*; +import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.SimplePlainQueue; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; -import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SimpleQueue; /** * Maps each upstream item into a {@link SingleSource}, subscribes to them one after the other terminates @@ -62,8 +60,7 @@ protected void subscribeActual(Subscriber s) { } static final class ConcatMapSingleSubscriber - extends AtomicInteger - implements FlowableSubscriber, Subscription { + extends ConcatMapXMainSubscriber implements Subscription { private static final long serialVersionUID = -9140123220065488293L; @@ -71,24 +68,10 @@ static final class ConcatMapSingleSubscriber final Function> mapper; - final int prefetch; - final AtomicLong requested; - final AtomicThrowable errors; - final ConcatMapSingleObserver inner; - final SimplePlainQueue queue; - - final ErrorMode errorMode; - - Subscription upstream; - - volatile boolean done; - - volatile boolean cancelled; - long emitted; int consumed; @@ -107,68 +90,37 @@ static final class ConcatMapSingleSubscriber ConcatMapSingleSubscriber(Subscriber downstream, Function> mapper, int prefetch, ErrorMode errorMode) { + super(prefetch, errorMode); this.downstream = downstream; this.mapper = mapper; - this.prefetch = prefetch; - this.errorMode = errorMode; this.requested = new AtomicLong(); - this.errors = new AtomicThrowable(); this.inner = new ConcatMapSingleObserver<>(this); - this.queue = new SpscArrayQueue<>(prefetch); } @Override - public void onSubscribe(Subscription s) { - if (SubscriptionHelper.validate(upstream, s)) { - upstream = s; - downstream.onSubscribe(this); - s.request(prefetch); - } + void onSubscribeDownstream() { + downstream.onSubscribe(this); } @Override - public void onNext(T t) { - if (!queue.offer(t)) { - upstream.cancel(); - onError(new MissingBackpressureException("queue full?!")); - return; - } + public void request(long n) { + BackpressureHelper.add(requested, n); drain(); } @Override - public void onError(Throwable t) { - if (errors.tryAddThrowableOrReport(t)) { - if (errorMode == ErrorMode.IMMEDIATE) { - inner.dispose(); - } - done = true; - drain(); - } - } - - @Override - public void onComplete() { - done = true; - drain(); + public void cancel() { + stop(); } @Override - public void request(long n) { - BackpressureHelper.add(requested, n); - drain(); + void clearValue() { + item = null; } @Override - public void cancel() { - cancelled = true; - upstream.cancel(); + void disposeInner() { inner.dispose(); - errors.tryTerminateAndReport(); - if (getAndIncrement() == 0) { - queue.clear(); - item = null; - } } void innerSuccess(R item) { @@ -187,6 +139,7 @@ void innerError(Throwable ex) { } } + @Override void drain() { if (getAndIncrement() != 0) { return; @@ -195,10 +148,11 @@ void drain() { int missed = 1; Subscriber downstream = this.downstream; ErrorMode errorMode = this.errorMode; - SimplePlainQueue queue = this.queue; + SimpleQueue queue = this.queue; AtomicThrowable errors = this.errors; AtomicLong requested = this.requested; int limit = prefetch - (prefetch >> 1); + boolean syncFused = this.syncFused; for (;;) { @@ -223,7 +177,16 @@ void drain() { if (s == STATE_INACTIVE) { boolean d = done; - T v = queue.poll(); + T v; + try { + v = queue.poll(); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + upstream.cancel(); + errors.tryAddThrowableOrReport(ex); + errors.tryTerminateConsumer(downstream); + return; + } boolean empty = v == null; if (d && empty) { @@ -235,12 +198,14 @@ void drain() { break; } - int c = consumed + 1; - if (c == limit) { - consumed = 0; - upstream.request(limit); - } else { - consumed = c; + if (!syncFused) { + int c = consumed + 1; + if (c == limit) { + consumed = 0; + upstream.request(limit); + } else { + consumed = c; + } } SingleSource ss; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapSinglePublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapSinglePublisher.java index 5b34314d81..0e1986180a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapSinglePublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapSinglePublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapCompletable.java index 1bc0fb709e..9ca61ab15a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapCompletablePublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapCompletablePublisher.java index 5752027c23..9eae52029e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapCompletablePublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapCompletablePublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapMaybe.java index 7933b4ec13..3eab4e0d62 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapMaybePublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapMaybePublisher.java index 41696133e9..319247c295 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapMaybePublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapMaybePublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapSingle.java index 4fe83126e5..59c9cb7f8f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapSinglePublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapSinglePublisher.java index e64f839046..31ace1bf2d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapSinglePublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapSinglePublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaterializeSingleObserver.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaterializeSingleObserver.java index d9cb5592ac..3f1c540d7d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaterializeSingleObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaterializeSingleObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapObservable.java index ef1dc5f023..09e634f944 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapObservable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapPublisher.java index 82a6d5da7d..b6d2afeb2d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapPublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapCompletable.java index 2295f4397e..f9d91b170a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -14,16 +14,15 @@ package io.reactivex.rxjava3.internal.operators.mixed; import java.util.Objects; -import java.util.concurrent.atomic.*; +import java.util.concurrent.atomic.AtomicReference; import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.*; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SimpleQueue; /** * Maps the upstream items into {@link CompletableSource}s and subscribes to them one after the @@ -60,8 +59,7 @@ protected void subscribeActual(CompletableObserver observer) { } static final class ConcatMapCompletableObserver - extends AtomicInteger - implements Observer, Disposable { + extends ConcatMapXMainObserver { private static final long serialVersionUID = 3610901111000061034L; @@ -69,122 +67,36 @@ static final class ConcatMapCompletableObserver final Function mapper; - final ErrorMode errorMode; - - final AtomicThrowable errors; - final ConcatMapInnerObserver inner; - final int prefetch; - - SimpleQueue queue; - - Disposable upstream; - volatile boolean active; - volatile boolean done; - - volatile boolean disposed; - ConcatMapCompletableObserver(CompletableObserver downstream, Function mapper, ErrorMode errorMode, int prefetch) { + super(prefetch, errorMode); this.downstream = downstream; this.mapper = mapper; - this.errorMode = errorMode; - this.prefetch = prefetch; - this.errors = new AtomicThrowable(); this.inner = new ConcatMapInnerObserver(this); } @Override - public void onSubscribe(Disposable d) { - if (DisposableHelper.validate(upstream, d)) { - this.upstream = d; - if (d instanceof QueueDisposable) { - @SuppressWarnings("unchecked") - QueueDisposable qd = (QueueDisposable) d; - - int m = qd.requestFusion(QueueDisposable.ANY); - if (m == QueueDisposable.SYNC) { - queue = qd; - done = true; - downstream.onSubscribe(this); - drain(); - return; - } - if (m == QueueDisposable.ASYNC) { - queue = qd; - downstream.onSubscribe(this); - return; - } - } - queue = new SpscLinkedArrayQueue<>(prefetch); - downstream.onSubscribe(this); - } - } - - @Override - public void onNext(T t) { - if (t != null) { - queue.offer(t); - } - drain(); + void onSubscribeDownstream() { + downstream.onSubscribe(this); } @Override - public void onError(Throwable t) { - if (errors.tryAddThrowableOrReport(t)) { - if (errorMode == ErrorMode.IMMEDIATE) { - disposed = true; - inner.dispose(); - errors.tryTerminateConsumer(downstream); - if (getAndIncrement() == 0) { - queue.clear(); - } - } else { - done = true; - drain(); - } - } - } - - @Override - public void onComplete() { - done = true; - drain(); - } - - @Override - public void dispose() { - disposed = true; - upstream.dispose(); + void disposeInner() { inner.dispose(); - errors.tryTerminateAndReport(); - if (getAndIncrement() == 0) { - queue.clear(); - } - } - - @Override - public boolean isDisposed() { - return disposed; } void innerError(Throwable ex) { if (errors.tryAddThrowableOrReport(ex)) { - if (errorMode == ErrorMode.IMMEDIATE) { - disposed = true; + if (errorMode != ErrorMode.END) { upstream.dispose(); - errors.tryTerminateConsumer(downstream); - if (getAndIncrement() == 0) { - queue.clear(); - } - } else { - active = false; - drain(); } + active = false; + drain(); } } @@ -193,6 +105,7 @@ void innerComplete() { drain(); } + @Override void drain() { if (getAndIncrement() != 0) { return; @@ -200,6 +113,7 @@ void drain() { AtomicThrowable errors = this.errors; ErrorMode errorMode = this.errorMode; + SimpleQueue queue = this.queue; do { if (disposed) { @@ -207,16 +121,17 @@ void drain() { return; } - if (!active) { - - if (errorMode == ErrorMode.BOUNDARY) { - if (errors.get() != null) { - disposed = true; - queue.clear(); - errors.tryTerminateConsumer(downstream); - return; - } + if (errors.get() != null) { + if (errorMode == ErrorMode.IMMEDIATE + || (errorMode == ErrorMode.BOUNDARY && !active)) { + disposed = true; + queue.clear(); + errors.tryTerminateConsumer(downstream); + return; } + } + + if (!active) { boolean d = done; boolean empty = true; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapMaybe.java index 1177d5a06e..7e85104dd7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -14,16 +14,15 @@ package io.reactivex.rxjava3.internal.operators.mixed; import java.util.Objects; -import java.util.concurrent.atomic.*; +import java.util.concurrent.atomic.AtomicReference; import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.SimplePlainQueue; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SimpleQueue; /** * Maps each upstream item into a {@link MaybeSource}, subscribes to them one after the other terminates @@ -61,8 +60,7 @@ protected void subscribeActual(Observer observer) { } static final class ConcatMapMaybeMainObserver - extends AtomicInteger - implements Observer, Disposable { + extends ConcatMapXMainObserver { private static final long serialVersionUID = -9140123220065488293L; @@ -70,20 +68,8 @@ static final class ConcatMapMaybeMainObserver final Function> mapper; - final AtomicThrowable errors; - final ConcatMapMaybeObserver inner; - final SimplePlainQueue queue; - - final ErrorMode errorMode; - - Disposable upstream; - - volatile boolean done; - - volatile boolean cancelled; - R item; volatile int state; @@ -98,60 +84,20 @@ static final class ConcatMapMaybeMainObserver ConcatMapMaybeMainObserver(Observer downstream, Function> mapper, int prefetch, ErrorMode errorMode) { + super(prefetch, errorMode); this.downstream = downstream; this.mapper = mapper; - this.errorMode = errorMode; - this.errors = new AtomicThrowable(); this.inner = new ConcatMapMaybeObserver<>(this); - this.queue = new SpscLinkedArrayQueue<>(prefetch); } @Override - public void onSubscribe(Disposable d) { - if (DisposableHelper.validate(upstream, d)) { - upstream = d; - downstream.onSubscribe(this); - } + void onSubscribeDownstream() { + downstream.onSubscribe(this); } @Override - public void onNext(T t) { - queue.offer(t); - drain(); - } - - @Override - public void onError(Throwable t) { - if (errors.tryAddThrowableOrReport(t)) { - if (errorMode == ErrorMode.IMMEDIATE) { - inner.dispose(); - } - done = true; - drain(); - } - } - - @Override - public void onComplete() { - done = true; - drain(); - } - - @Override - public void dispose() { - cancelled = true; - upstream.dispose(); - inner.dispose(); - errors.tryTerminateAndReport(); - if (getAndIncrement() == 0) { - queue.clear(); - item = null; - } - } - - @Override - public boolean isDisposed() { - return cancelled; + void clearValue() { + item = null; } void innerSuccess(R item) { @@ -175,6 +121,12 @@ void innerError(Throwable ex) { } } + @Override + void disposeInner() { + inner.dispose(); + } + + @Override void drain() { if (getAndIncrement() != 0) { return; @@ -183,13 +135,13 @@ void drain() { int missed = 1; Observer downstream = this.downstream; ErrorMode errorMode = this.errorMode; - SimplePlainQueue queue = this.queue; + SimpleQueue queue = this.queue; AtomicThrowable errors = this.errors; for (;;) { for (;;) { - if (cancelled) { + if (disposed) { queue.clear(); item = null; break; @@ -209,7 +161,18 @@ void drain() { if (s == STATE_INACTIVE) { boolean d = done; - T v = queue.poll(); + T v; + + try { + v = queue.poll(); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + disposed = true; + upstream.dispose(); + errors.tryAddThrowableOrReport(ex); + errors.tryTerminateConsumer(downstream); + return; + } boolean empty = v == null; if (d && empty) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapSingle.java index 70d913cd42..b57940a5e7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -14,16 +14,15 @@ package io.reactivex.rxjava3.internal.operators.mixed; import java.util.Objects; -import java.util.concurrent.atomic.*; +import java.util.concurrent.atomic.AtomicReference; import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.SimplePlainQueue; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SimpleQueue; /** * Maps each upstream item into a {@link SingleSource}, subscribes to them one after the other terminates @@ -61,8 +60,7 @@ protected void subscribeActual(Observer observer) { } static final class ConcatMapSingleMainObserver - extends AtomicInteger - implements Observer, Disposable { + extends ConcatMapXMainObserver { private static final long serialVersionUID = -9140123220065488293L; @@ -70,20 +68,8 @@ static final class ConcatMapSingleMainObserver final Function> mapper; - final AtomicThrowable errors; - final ConcatMapSingleObserver inner; - final SimplePlainQueue queue; - - final ErrorMode errorMode; - - Disposable upstream; - - volatile boolean done; - - volatile boolean cancelled; - R item; volatile int state; @@ -98,78 +84,44 @@ static final class ConcatMapSingleMainObserver ConcatMapSingleMainObserver(Observer downstream, Function> mapper, int prefetch, ErrorMode errorMode) { + super(prefetch, errorMode); this.downstream = downstream; this.mapper = mapper; - this.errorMode = errorMode; - this.errors = new AtomicThrowable(); this.inner = new ConcatMapSingleObserver<>(this); - this.queue = new SpscLinkedArrayQueue<>(prefetch); } - @Override - public void onSubscribe(Disposable d) { - if (DisposableHelper.validate(upstream, d)) { - upstream = d; - downstream.onSubscribe(this); - } - } - - @Override - public void onNext(T t) { - queue.offer(t); + void innerSuccess(R item) { + this.item = item; + this.state = STATE_RESULT_VALUE; drain(); } - @Override - public void onError(Throwable t) { - if (errors.tryAddThrowableOrReport(t)) { - if (errorMode == ErrorMode.IMMEDIATE) { - inner.dispose(); + void innerError(Throwable ex) { + if (errors.tryAddThrowableOrReport(ex)) { + if (errorMode != ErrorMode.END) { + upstream.dispose(); } - done = true; + this.state = STATE_INACTIVE; drain(); } } @Override - public void onComplete() { - done = true; - drain(); - } - - @Override - public void dispose() { - cancelled = true; - upstream.dispose(); + void disposeInner() { inner.dispose(); - errors.tryTerminateAndReport(); - if (getAndIncrement() == 0) { - queue.clear(); - item = null; - } } @Override - public boolean isDisposed() { - return cancelled; + void onSubscribeDownstream() { + downstream.onSubscribe(this); } - void innerSuccess(R item) { - this.item = item; - this.state = STATE_RESULT_VALUE; - drain(); - } - - void innerError(Throwable ex) { - if (errors.tryAddThrowableOrReport(ex)) { - if (errorMode != ErrorMode.END) { - upstream.dispose(); - } - this.state = STATE_INACTIVE; - drain(); - } + @Override + void clearValue() { + item = null; } + @Override void drain() { if (getAndIncrement() != 0) { return; @@ -178,13 +130,13 @@ void drain() { int missed = 1; Observer downstream = this.downstream; ErrorMode errorMode = this.errorMode; - SimplePlainQueue queue = this.queue; + SimpleQueue queue = this.queue; AtomicThrowable errors = this.errors; for (;;) { for (;;) { - if (cancelled) { + if (disposed) { queue.clear(); item = null; break; @@ -204,7 +156,18 @@ void drain() { if (s == STATE_INACTIVE) { boolean d = done; - T v = queue.poll(); + T v; + + try { + v = queue.poll(); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + disposed = true; + upstream.dispose(); + errors.tryAddThrowableOrReport(ex); + errors.tryTerminateConsumer(downstream); + return; + } boolean empty = v == null; if (d && empty) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapCompletable.java index bb6ec70f85..b751afdbb0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapMaybe.java index f4c9bf6c0c..fe394df1e8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapSingle.java index f5db39d5d5..ca0e2953e0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ScalarXMapZHelper.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ScalarXMapZHelper.java index d7fe0e3445..2ed6301e42 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ScalarXMapZHelper.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ScalarXMapZHelper.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -78,6 +78,7 @@ static boolean tryAsCompletable(Object source, * Try subscribing to a {@link MaybeSource} mapped from * a scalar source (which implements {@link Supplier}). * @param the upstream value type + * @param the downstream value type * @param source the source reactive type ({@code Flowable} or {@code Observable}) * possibly implementing {@link Supplier}. * @param mapper the function that turns the scalar upstream value into a @@ -117,6 +118,7 @@ static boolean tryAsMaybe(Object source, * Try subscribing to a {@link SingleSource} mapped from * a scalar source (which implements {@link Supplier}). * @param the upstream value type + * @param the downstream value type * @param source the source reactive type ({@code Flowable} or {@code Observable}) * possibly implementing {@link Supplier}. * @param mapper the function that turns the scalar upstream value into a diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/SingleFlatMapObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/SingleFlatMapObservable.java index b2562d8dba..5db7515890 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/SingleFlatMapObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/SingleFlatMapObservable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/AbstractObservableWithUpstream.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/AbstractObservableWithUpstream.java index 2225cb2d2a..dcad29a5d8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/AbstractObservableWithUpstream.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/AbstractObservableWithUpstream.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableIterable.java index dce3e2bc21..561571febf 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableIterable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -20,8 +20,8 @@ import io.reactivex.rxjava3.core.ObservableSource; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; public final class BlockingObservableIterable implements Iterable { final ObservableSource source; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableLatest.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableLatest.java index e431db42a7..4aca95b210 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableLatest.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableLatest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableMostRecent.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableMostRecent.java index 75e8966ca9..0b2ea5bd34 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableMostRecent.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableMostRecent.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableNext.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableNext.java index 3ebeb0e1f0..2bbfe2b036 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableNext.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableNext.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAll.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAll.java index 3f62b4732c..0f365414c6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAll.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAll.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import io.reactivex.rxjava3.core.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAllSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAllSingle.java index 8c167d4c47..89e4e38a16 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAllSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAllSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import io.reactivex.rxjava3.core.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAmb.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAmb.java index ffab752652..f8841956c6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAmb.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAmb.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAny.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAny.java index bda497f7ed..fad20eb6e2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAny.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAny.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import io.reactivex.rxjava3.core.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAnySingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAnySingle.java index 6e263a0d48..ff7875fb54 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAnySingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAnySingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import io.reactivex.rxjava3.core.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAutoConnect.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAutoConnect.java index 393a9a3f94..d00a2fc291 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAutoConnect.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAutoConnect.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBlockingSubscribe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBlockingSubscribe.java index fe06c2099f..e173785760 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBlockingSubscribe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBlockingSubscribe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBuffer.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBuffer.java index 2688212575..6f94a97cc6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBuffer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBuffer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferBoundary.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferBoundary.java index 4b0027f4fe..4b0fafb188 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferBoundary.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferBoundary.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -22,8 +22,8 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.util.AtomicThrowable; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class ObservableBufferBoundary, Open, Close> diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferExactBoundary.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferExactBoundary.java index 849222505e..bb65058908 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferExactBoundary.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferExactBoundary.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -43,7 +43,7 @@ protected void subscribeActual(Observer t) { } static final class BufferExactBoundaryObserver, B> - extends QueueDrainObserver implements Observer, Disposable { + extends QueueDrainObserver implements Disposable { final Supplier bufferSupplier; final ObservableSource boundary; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferTimed.java index e5e4383956..7628a8f685 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferTimed.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCache.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCache.java index c3e7447e6e..daa9edd533 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCache.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCache.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCollect.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCollect.java index 6bddb34aac..6b700addd7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCollect.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCollect.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import io.reactivex.rxjava3.core.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCollectSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCollectSingle.java index 82f8923de3..88137432ac 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCollectSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCollectSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import io.reactivex.rxjava3.core.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCombineLatest.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCombineLatest.java index 646ab80690..fded0d0ef5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCombineLatest.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCombineLatest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -21,8 +21,8 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.disposables.*; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.util.AtomicThrowable; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; public final class ObservableCombineLatest extends Observable { final ObservableSource[] sources; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMap.java index 9b03b9fc35..b8f34df3d7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMap.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import java.util.Objects; @@ -20,10 +21,11 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.*; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.util.*; import io.reactivex.rxjava3.observers.SerializedObserver; +import io.reactivex.rxjava3.operators.QueueDisposable; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class ObservableConcatMap extends AbstractObservableWithUpstream { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapEager.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapEager.java index 792940b5e0..5a4b1c3a47 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapEager.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapEager.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -22,10 +22,11 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.observers.*; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.QueueDisposable; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; public final class ObservableConcatMapEager extends AbstractObservableWithUpstream { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapScheduler.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapScheduler.java index b4cd8352b5..1ea59c83c3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapScheduler.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapScheduler.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import java.util.Objects; @@ -20,10 +21,11 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.*; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.util.*; import io.reactivex.rxjava3.observers.SerializedObserver; +import io.reactivex.rxjava3.operators.QueueDisposable; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class ObservableConcatMapScheduler extends AbstractObservableWithUpstream { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithCompletable.java index 4ffc8f5490..8d97074a8c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithMaybe.java index 19af4e5641..e198a0412a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithSingle.java index b2e1860110..3d69ae83ac 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCount.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCount.java index f7ab3b012f..366c4bb3db 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCount.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCount.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCountSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCountSingle.java index 5796519f74..be73420542 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCountSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCountSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCreate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCreate.java index f05faf7eda..1e2e910f0f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCreate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCreate.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import java.util.concurrent.atomic.*; @@ -19,9 +20,9 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Cancellable; import io.reactivex.rxjava3.internal.disposables.*; -import io.reactivex.rxjava3.internal.fuseable.SimpleQueue; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class ObservableCreate extends Observable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDebounce.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDebounce.java index 16f882d6c5..862227e305 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDebounce.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDebounce.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDebounceTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDebounceTimed.java index b0b19ef0dc..f2db191229 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDebounceTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDebounceTimed.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,6 +19,8 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.core.Scheduler.Worker; import io.reactivex.rxjava3.disposables.Disposable; +import io.reactivex.rxjava3.exceptions.Exceptions; +import io.reactivex.rxjava3.functions.Consumer; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; import io.reactivex.rxjava3.observers.SerializedObserver; import io.reactivex.rxjava3.plugins.RxJavaPlugins; @@ -27,19 +29,20 @@ public final class ObservableDebounceTimed extends AbstractObservableWithUpst final long timeout; final TimeUnit unit; final Scheduler scheduler; + final Consumer onDropped; - public ObservableDebounceTimed(ObservableSource source, long timeout, TimeUnit unit, Scheduler scheduler) { + public ObservableDebounceTimed(ObservableSource source, long timeout, TimeUnit unit, Scheduler scheduler, Consumer onDropped) { super(source); this.timeout = timeout; this.unit = unit; this.scheduler = scheduler; + this.onDropped = onDropped; } @Override public void subscribeActual(Observer t) { source.subscribe(new DebounceTimedObserver<>( - new SerializedObserver<>(t), - timeout, unit, scheduler.createWorker())); + new SerializedObserver<>(t), timeout, unit, scheduler.createWorker(), onDropped)); } static final class DebounceTimedObserver @@ -48,20 +51,22 @@ static final class DebounceTimedObserver final long timeout; final TimeUnit unit; final Scheduler.Worker worker; + final Consumer onDropped; Disposable upstream; - Disposable timer; + DebounceEmitter timer; volatile long index; boolean done; - DebounceTimedObserver(Observer actual, long timeout, TimeUnit unit, Worker worker) { + DebounceTimedObserver(Observer actual, long timeout, TimeUnit unit, Worker worker, Consumer onDropped) { this.downstream = actual; this.timeout = timeout; this.unit = unit; this.worker = worker; + this.onDropped = onDropped; } @Override @@ -80,15 +85,25 @@ public void onNext(T t) { long idx = index + 1; index = idx; - Disposable d = timer; - if (d != null) { - d.dispose(); + DebounceEmitter currentEmitter = timer; + if (currentEmitter != null) { + currentEmitter.dispose(); } - DebounceEmitter de = new DebounceEmitter<>(t, idx, this); - timer = de; - d = worker.schedule(de, timeout, unit); - de.setResource(d); + if (onDropped != null && currentEmitter != null) { + try { + onDropped.accept(timer.value); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + upstream.dispose(); + downstream.onError(ex); + done = true; + } + } + + DebounceEmitter newEmitter = new DebounceEmitter<>(t, idx, this); + timer = newEmitter; + newEmitter.setResource(worker.schedule(newEmitter, timeout, unit)); } @Override @@ -113,15 +128,13 @@ public void onComplete() { } done = true; - Disposable d = timer; + DebounceEmitter d = timer; if (d != null) { d.dispose(); } - @SuppressWarnings("unchecked") - DebounceEmitter de = (DebounceEmitter)d; - if (de != null) { - de.run(); + if (d != null) { + d.run(); } downstream.onComplete(); worker.dispose(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDefer.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDefer.java index 15b3394af7..0b3388c84c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDefer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDefer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDelay.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDelay.java index 93cbb00389..7c01c23f90 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDelay.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDelay.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -111,7 +111,9 @@ final class OnNext implements Runnable { @Override public void run() { - downstream.onNext(t); + if (!w.isDisposed()) { + downstream.onNext(t); + } } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDelaySubscriptionOther.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDelaySubscriptionOther.java index c594c68b00..978e4d2f32 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDelaySubscriptionOther.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDelaySubscriptionOther.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDematerialize.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDematerialize.java index 37f5fdadd8..2016451986 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDematerialize.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDematerialize.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDetach.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDetach.java index 763fcdde97..b9c6f2bade 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDetach.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDetach.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinct.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinct.java index cd766ef559..ff377833a5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinct.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinct.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinctUntilChanged.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinctUntilChanged.java index f18e47030d..7604db7c8f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinctUntilChanged.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinctUntilChanged.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoAfterNext.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoAfterNext.java index 91051e7562..6382e6b822 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoAfterNext.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoAfterNext.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoFinally.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoFinally.java index 8c7ee32d09..e6d9031f72 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoFinally.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoFinally.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,8 +19,8 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Action; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.QueueDisposable; import io.reactivex.rxjava3.internal.observers.BasicIntQueueDisposable; +import io.reactivex.rxjava3.operators.QueueDisposable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnEach.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnEach.java index ff884192fa..f4869d19a8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnEach.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnEach.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnLifecycle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnLifecycle.java index 835cd886b2..f185231246 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnLifecycle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnLifecycle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import io.reactivex.rxjava3.core.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAt.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAt.java index b8d042a532..8d8a535bcf 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAt.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAt.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAtMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAtMaybe.java index 53b1312092..14bb368a23 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAtMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAtMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAtSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAtSingle.java index bb006ca2dd..c779f9eec2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAtSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAtSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableEmpty.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableEmpty.java index d4869b70ea..7ff9e8b955 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableEmpty.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableEmpty.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,11 +10,12 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.internal.disposables.EmptyDisposable; -import io.reactivex.rxjava3.internal.fuseable.ScalarSupplier; +import io.reactivex.rxjava3.operators.ScalarSupplier; public final class ObservableEmpty extends Observable implements ScalarSupplier { public static final Observable INSTANCE = new ObservableEmpty(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableError.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableError.java index 7481373e7a..f25af956e0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableError.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableError.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFilter.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFilter.java index 51fec2cc68..ed7068f6a0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFilter.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFilter.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMap.java index 6265a5d557..d19b505999 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMap.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -22,9 +22,8 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.*; -import io.reactivex.rxjava3.internal.queue.*; import io.reactivex.rxjava3.internal.util.AtomicThrowable; +import io.reactivex.rxjava3.operators.*; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class ObservableFlatMap extends AbstractObservableWithUpstream { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapCompletable.java index 1db5b140e5..ae7c6f98ac 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapCompletableCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapCompletableCompletable.java index 039be4ffb7..62ea03a54d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapCompletableCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapCompletableCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapMaybe.java index 3547769267..b8d223d4ac 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -21,8 +21,8 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.util.AtomicThrowable; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; /** * Maps upstream values into MaybeSources and merges their signals into one sequence. diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapSingle.java index e93051fd0c..985e4fa2d9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -21,8 +21,8 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.util.AtomicThrowable; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; /** * Maps upstream values into SingleSources and merges their signals into one sequence. diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlattenIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlattenIterable.java index 732eb50dd3..47dbde9a1e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlattenIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlattenIterable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromAction.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromAction.java index cccb5b5d38..cd0970f0d0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromAction.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromAction.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromArray.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromArray.java index 97ebfe0d4f..f84c118346 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromArray.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromArray.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromCallable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromCallable.java index 0285b83ff2..ab4b7aa7b8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromCallable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromCallable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromCompletable.java index 4748e6a625..83bf51f7e0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromFuture.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromFuture.java index 5459429f4d..d6f21ad133 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromFuture.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromFuture.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromIterable.java index 187d0cecc3..d5f402d193 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromIterable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromPublisher.java index 14efd74eba..ade1eeb870 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromPublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import org.reactivestreams.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromRunnable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromRunnable.java index 0dc37a8993..eeda8e4832 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromRunnable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromRunnable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromSupplier.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromSupplier.java index e46cf8fe8f..7d3cd41480 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromSupplier.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromSupplier.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromUnsafeSource.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromUnsafeSource.java index d34423bcd4..1f7c7bcccd 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromUnsafeSource.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromUnsafeSource.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGenerate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGenerate.java index 2bd9a866a1..fee8dfe26e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGenerate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGenerate.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupBy.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupBy.java index 8e259db47c..e1af50378e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupBy.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupBy.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -23,8 +23,8 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.disposables.*; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.observables.GroupedObservable; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; public final class ObservableGroupBy extends AbstractObservableWithUpstream> { final Function keySelector; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupJoin.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupJoin.java index 2a553fd1b1..4df7fc7bd8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupJoin.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupJoin.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.operators.observable; @@ -26,8 +23,8 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.util.ExceptionHelper; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.subjects.UnicastSubject; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableHide.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableHide.java index 5b216cd44c..8d6c7a7b60 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableHide.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableHide.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIgnoreElements.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIgnoreElements.java index ec4a07e92a..6afab8124d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIgnoreElements.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIgnoreElements.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIgnoreElementsCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIgnoreElementsCompletable.java index 14b3a77684..10e4880b55 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIgnoreElementsCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIgnoreElementsCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableInternalHelper.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableInternalHelper.java index 5f9dce646d..89822c3e9b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableInternalHelper.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableInternalHelper.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import java.util.Objects; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableInterval.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableInterval.java index 93fee0973d..c61645bdd9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableInterval.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableInterval.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIntervalRange.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIntervalRange.java index 54576298a7..68d303b6ab 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIntervalRange.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIntervalRange.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableJoin.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableJoin.java index 70f62aec03..4a0f95695e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableJoin.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableJoin.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.operators.observable; @@ -25,8 +22,8 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.operators.observable.ObservableGroupJoin.*; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.util.ExceptionHelper; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class ObservableJoin extends AbstractObservableWithUpstream { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableJust.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableJust.java index d3448d0b41..af01eb09bb 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableJust.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableJust.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -14,8 +14,8 @@ package io.reactivex.rxjava3.internal.operators.observable; import io.reactivex.rxjava3.core.*; -import io.reactivex.rxjava3.internal.fuseable.ScalarSupplier; import io.reactivex.rxjava3.internal.operators.observable.ObservableScalarXMap.ScalarDisposable; +import io.reactivex.rxjava3.operators.ScalarSupplier; /** * Represents a constant scalar value. diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLastMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLastMaybe.java index 73e26a3972..b20119d430 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLastMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLastMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLastSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLastSingle.java index 7c5433e105..049e9341c1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLastSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLastSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLift.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLift.java index 4aa45683ff..67dd7a0649 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLift.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLift.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMap.java index 4361016ec6..8f4502ba19 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMap.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMapNotification.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMapNotification.java index 1622b504d4..51883e7519 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMapNotification.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMapNotification.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMaterialize.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMaterialize.java index e55430c378..866ced7dd9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMaterialize.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMaterialize.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithCompletable.java index 1f086f7175..e1a79180d8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithMaybe.java index f462075a50..4e940a74f5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,9 +18,9 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.SimplePlainQueue; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.util.AtomicThrowable; +import io.reactivex.rxjava3.operators.SimplePlainQueue; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; /** * Merges an Observable and a Maybe by emitting the items of the Observable and the success diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithSingle.java index 08940cf645..014df98cc2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,9 +18,9 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.SimplePlainQueue; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.util.AtomicThrowable; +import io.reactivex.rxjava3.operators.SimplePlainQueue; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; /** * Merges an Observable and a Single by emitting the items of the Observable and the success diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableNever.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableNever.java index dd476d5993..1d237491cc 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableNever.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableNever.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import io.reactivex.rxjava3.core.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableObserveOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableObserveOn.java index af5e78df3f..05a0064f41 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableObserveOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableObserveOn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,10 +18,11 @@ import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.observers.BasicIntQueueDisposable; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.schedulers.TrampolineScheduler; +import io.reactivex.rxjava3.operators.QueueDisposable; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class ObservableObserveOn extends AbstractObservableWithUpstream { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorComplete.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorComplete.java index 6854a5ce6d..70266c14d3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorComplete.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorComplete.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorNext.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorNext.java index 3cf1849011..9bcc3b8dd6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorNext.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorNext.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorReturn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorReturn.java index 54efdc62e5..24c9af4700 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorReturn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorReturn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservablePublish.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservablePublish.java index 8589ee3c8a..f2d4c8f0f4 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservablePublish.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservablePublish.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservablePublishSelector.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservablePublishSelector.java index 687bee9548..d025a5487d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservablePublishSelector.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservablePublishSelector.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRange.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRange.java index 56e277dc32..53855a46c2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRange.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRange.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import io.reactivex.rxjava3.annotations.Nullable; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRangeLong.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRangeLong.java index f92decb11e..39a36e72f2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRangeLong.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRangeLong.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import io.reactivex.rxjava3.annotations.Nullable; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceMaybe.java index f5421a666e..3f66614ef0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceSeedSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceSeedSingle.java index 67347debb8..f2382f6f9d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceSeedSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceSeedSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceWithSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceWithSingle.java index 1de6cb1e6c..22dbaa6a1d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceWithSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceWithSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRefCount.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRefCount.java index a806a537c6..1a5d9f55cc 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRefCount.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRefCount.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeat.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeat.java index 2816dac708..b14549f65f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeat.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeat.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeatUntil.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeatUntil.java index 51c8b9dd65..d89fd17b83 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeatUntil.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeatUntil.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeatWhen.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeatWhen.java index d3fcdf5971..87d30330ba 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeatWhen.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeatWhen.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReplay.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReplay.java index 3b7bff1673..0e8c122d62 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReplay.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReplay.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -122,6 +122,7 @@ public static ConnectableObservable create(ObservableSource source, /** * Creates a OperatorReplay instance to replay values of the given source observable. + * @param the value type * @param source the source observable * @param bufferFactory the factory to instantiate the appropriate buffer when the observable becomes active * @return the connectable observable @@ -453,6 +454,7 @@ public void dispose() { } /** * Convenience method to auto-cast the index object. + * @param type index to be casted to * @return the index Object or null */ @SuppressWarnings("unchecked") diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryBiPredicate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryBiPredicate.java index 56de8606be..1340a5ad9f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryBiPredicate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryBiPredicate.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryPredicate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryPredicate.java index 9c4d5c748a..5c40dc6d97 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryPredicate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryPredicate.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryWhen.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryWhen.java index 2a3f0b6b07..bae50456e4 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryWhen.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryWhen.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSampleTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSampleTimed.java index 3f516e8cca..f264b8e76d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSampleTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSampleTimed.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,6 +18,8 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.Disposable; +import io.reactivex.rxjava3.exceptions.Exceptions; +import io.reactivex.rxjava3.functions.Consumer; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; import io.reactivex.rxjava3.observers.SerializedObserver; @@ -25,24 +27,30 @@ public final class ObservableSampleTimed extends AbstractObservableWithUpstre final long period; final TimeUnit unit; final Scheduler scheduler; - + final Consumer onDropped; final boolean emitLast; - public ObservableSampleTimed(ObservableSource source, long period, TimeUnit unit, Scheduler scheduler, boolean emitLast) { + public ObservableSampleTimed(ObservableSource source, + long period, + TimeUnit unit, + Scheduler scheduler, + boolean emitLast, + Consumer onDropped) { super(source); this.period = period; this.unit = unit; this.scheduler = scheduler; this.emitLast = emitLast; + this.onDropped = onDropped; } @Override public void subscribeActual(Observer t) { SerializedObserver serial = new SerializedObserver<>(t); if (emitLast) { - source.subscribe(new SampleTimedEmitLast<>(serial, period, unit, scheduler)); + source.subscribe(new SampleTimedEmitLast<>(serial, period, unit, scheduler, onDropped)); } else { - source.subscribe(new SampleTimedNoLast<>(serial, period, unit, scheduler)); + source.subscribe(new SampleTimedNoLast<>(serial, period, unit, scheduler, onDropped)); } } @@ -54,16 +62,18 @@ abstract static class SampleTimedObserver extends AtomicReference implemen final long period; final TimeUnit unit; final Scheduler scheduler; + final Consumer onDropped; final AtomicReference timer = new AtomicReference<>(); Disposable upstream; - SampleTimedObserver(Observer actual, long period, TimeUnit unit, Scheduler scheduler) { + SampleTimedObserver(Observer actual, long period, TimeUnit unit, Scheduler scheduler, Consumer onDropped) { this.downstream = actual; this.period = period; this.unit = unit; this.scheduler = scheduler; + this.onDropped = onDropped; } @Override @@ -79,7 +89,17 @@ public void onSubscribe(Disposable d) { @Override public void onNext(T t) { - lazySet(t); + T oldValue = getAndSet(t); + if (oldValue != null && onDropped != null) { + try { + onDropped.accept(oldValue); + } catch (Throwable throwable) { + Exceptions.throwIfFatal(throwable); + cancelTimer(); + upstream.dispose(); + downstream.onError(throwable); + } + } } @Override @@ -123,8 +143,8 @@ static final class SampleTimedNoLast extends SampleTimedObserver { private static final long serialVersionUID = -7139995637533111443L; - SampleTimedNoLast(Observer actual, long period, TimeUnit unit, Scheduler scheduler) { - super(actual, period, unit, scheduler); + SampleTimedNoLast(Observer actual, long period, TimeUnit unit, Scheduler scheduler, Consumer onDropped) { + super(actual, period, unit, scheduler, onDropped); } @Override @@ -144,8 +164,8 @@ static final class SampleTimedEmitLast extends SampleTimedObserver { final AtomicInteger wip; - SampleTimedEmitLast(Observer actual, long period, TimeUnit unit, Scheduler scheduler) { - super(actual, period, unit, scheduler); + SampleTimedEmitLast(Observer actual, long period, TimeUnit unit, Scheduler scheduler, Consumer onDropped) { + super(actual, period, unit, scheduler, onDropped); this.wip = new AtomicInteger(1); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSampleWithObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSampleWithObservable.java index cae3259d12..53b9aec31f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSampleWithObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSampleWithObservable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScalarXMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScalarXMap.java index c62c23c0c5..7ce5bb82f0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScalarXMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScalarXMap.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -21,7 +21,7 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.disposables.EmptyDisposable; -import io.reactivex.rxjava3.internal.fuseable.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueDisposable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScan.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScan.java index bd0ba2b12a..59a74661cc 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScan.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScan.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScanSeed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScanSeed.java index 89eb4046f0..f0e197db7e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScanSeed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScanSeed.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import io.reactivex.rxjava3.core.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSequenceEqual.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSequenceEqual.java index 11eb694696..e79f992243 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSequenceEqual.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSequenceEqual.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -20,7 +20,7 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.BiPredicate; import io.reactivex.rxjava3.internal.disposables.ArrayCompositeDisposable; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; public final class ObservableSequenceEqual extends Observable { final ObservableSource first; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSequenceEqualSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSequenceEqualSingle.java index 9169cb6465..9b51815ce0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSequenceEqualSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSequenceEqualSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -21,7 +21,7 @@ import io.reactivex.rxjava3.functions.BiPredicate; import io.reactivex.rxjava3.internal.disposables.ArrayCompositeDisposable; import io.reactivex.rxjava3.internal.fuseable.FuseToObservable; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class ObservableSequenceEqualSingle extends Single implements FuseToObservable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSerialized.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSerialized.java index 98f757e6f7..c57d0d9a24 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSerialized.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSerialized.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import io.reactivex.rxjava3.core.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSingleMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSingleMaybe.java index 83a8569f05..b4068e834d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSingleMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSingleMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSingleSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSingleSingle.java index de4729f5e5..dd8032a400 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSingleSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSingleSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkip.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkip.java index e0000dc7a5..0fe5787c1b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkip.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkip.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLast.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLast.java index 3e45e38a79..68fabb3ac7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLast.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLast.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLastTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLastTimed.java index f70620b5c0..7cc6f34f24 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLastTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLastTimed.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,7 +19,7 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; public final class ObservableSkipLastTimed extends AbstractObservableWithUpstream { final long time; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipUntil.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipUntil.java index 457158200d..87535fabf2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipUntil.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipUntil.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipWhile.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipWhile.java index d6dad232b5..1614b0b472 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipWhile.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipWhile.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSubscribeOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSubscribeOn.java index 8eac3ae04e..5eaeaa5035 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSubscribeOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSubscribeOn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchIfEmpty.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchIfEmpty.java index b697afc1c9..6aa1d84ecf 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchIfEmpty.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchIfEmpty.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchMap.java index dbbb3da35a..3e0558aacf 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchMap.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -21,9 +21,10 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.*; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.util.AtomicThrowable; +import io.reactivex.rxjava3.operators.QueueDisposable; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; public final class ObservableSwitchMap extends AbstractObservableWithUpstream { @@ -348,9 +349,10 @@ public void onSubscribe(Disposable d) { @Override public void onNext(R t) { - if (index == parent.unique) { + SimpleQueue q = queue; + if (index == parent.unique && q != null) { if (t != null) { - queue.offer(t); + q.offer(t); } parent.drain(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTake.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTake.java index 63f37db46e..8cc73b1b56 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTake.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTake.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLast.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLast.java index 80f408de32..b0b04c141d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLast.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLast.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastOne.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastOne.java index f2766db765..cb243dd3bd 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastOne.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastOne.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import io.reactivex.rxjava3.core.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastTimed.java index be6f83db79..33066f374b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastTimed.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,7 +19,7 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; public final class ObservableTakeLastTimed extends AbstractObservableWithUpstream { final long count; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntil.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntil.java index f1d5d00a0d..c32f3a6f65 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntil.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntil.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntilPredicate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntilPredicate.java index 1727a24fb4..5183a6026e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntilPredicate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntilPredicate.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeWhile.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeWhile.java index 5c251c969e..1b56e6cf34 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeWhile.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeWhile.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleFirstTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleFirstTimed.java index 138cb3f869..6bf3b9f119 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleFirstTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleFirstTimed.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,6 +19,8 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.core.Scheduler.Worker; import io.reactivex.rxjava3.disposables.Disposable; +import io.reactivex.rxjava3.exceptions.Exceptions; +import io.reactivex.rxjava3.functions.Consumer; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; import io.reactivex.rxjava3.observers.SerializedObserver; @@ -26,20 +28,27 @@ public final class ObservableThrottleFirstTimed extends AbstractObservableWit final long timeout; final TimeUnit unit; final Scheduler scheduler; - - public ObservableThrottleFirstTimed(ObservableSource source, - long timeout, TimeUnit unit, Scheduler scheduler) { + final Consumer onDropped; + + public ObservableThrottleFirstTimed( + ObservableSource source, + long timeout, + TimeUnit unit, + Scheduler scheduler, + Consumer onDropped) { super(source); this.timeout = timeout; this.unit = unit; this.scheduler = scheduler; + this.onDropped = onDropped; } @Override public void subscribeActual(Observer t) { source.subscribe(new DebounceTimedObserver<>( new SerializedObserver<>(t), - timeout, unit, scheduler.createWorker())); + timeout, unit, scheduler.createWorker(), + onDropped)); } static final class DebounceTimedObserver @@ -51,16 +60,21 @@ static final class DebounceTimedObserver final long timeout; final TimeUnit unit; final Scheduler.Worker worker; - + final Consumer onDropped; Disposable upstream; - volatile boolean gate; - DebounceTimedObserver(Observer actual, long timeout, TimeUnit unit, Worker worker) { + DebounceTimedObserver( + Observer actual, + long timeout, + TimeUnit unit, + Worker worker, + Consumer onDropped) { this.downstream = actual; this.timeout = timeout; this.unit = unit; this.worker = worker; + this.onDropped = onDropped; } @Override @@ -83,6 +97,15 @@ public void onNext(T t) { d.dispose(); } DisposableHelper.replace(this, worker.schedule(this, timeout, unit)); + } else if (onDropped != null) { + try { + onDropped.accept(t); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + upstream.dispose(); + downstream.onError(ex); + worker.dispose(); + } } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleLatest.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleLatest.java index 253f5d3501..caf14d3a5e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleLatest.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleLatest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,7 +18,10 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.Disposable; +import io.reactivex.rxjava3.exceptions.*; +import io.reactivex.rxjava3.functions.Consumer; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; +import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** * Emits the next or latest item when the given time elapses. @@ -41,19 +44,24 @@ public final class ObservableThrottleLatest extends AbstractObservableWithUps final boolean emitLast; + final Consumer onDropped; + public ObservableThrottleLatest(Observable source, - long timeout, TimeUnit unit, Scheduler scheduler, - boolean emitLast) { + long timeout, TimeUnit unit, + Scheduler scheduler, + boolean emitLast, + Consumer onDropped) { super(source); this.timeout = timeout; this.unit = unit; this.scheduler = scheduler; this.emitLast = emitLast; + this.onDropped = onDropped; } @Override protected void subscribeActual(Observer observer) { - source.subscribe(new ThrottleLatestObserver<>(observer, timeout, unit, scheduler.createWorker(), emitLast)); + source.subscribe(new ThrottleLatestObserver<>(observer, timeout, unit, scheduler.createWorker(), emitLast, onDropped)); } static final class ThrottleLatestObserver @@ -74,6 +82,8 @@ static final class ThrottleLatestObserver final AtomicReference latest; + final Consumer onDropped; + Disposable upstream; volatile boolean done; @@ -86,14 +96,17 @@ static final class ThrottleLatestObserver boolean timerRunning; ThrottleLatestObserver(Observer downstream, - long timeout, TimeUnit unit, Scheduler.Worker worker, - boolean emitLast) { + long timeout, TimeUnit unit, + Scheduler.Worker worker, + boolean emitLast, + Consumer onDropped) { this.downstream = downstream; this.timeout = timeout; this.unit = unit; this.worker = worker; this.emitLast = emitLast; this.latest = new AtomicReference<>(); + this.onDropped = onDropped; } @Override @@ -106,7 +119,17 @@ public void onSubscribe(Disposable d) { @Override public void onNext(T t) { - latest.set(t); + T old = latest.getAndSet(t); + if (onDropped != null && old != null) { + try { + onDropped.accept(old); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + upstream.dispose(); + error = ex; + done = true; + } + } drain(); } @@ -129,6 +152,22 @@ public void dispose() { upstream.dispose(); worker.dispose(); if (getAndIncrement() == 0) { + clear(); + } + } + + void clear() { + if (onDropped != null) { + T v = latest.getAndSet(null); + if (v != null) { + try { + onDropped.accept(v); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + RxJavaPlugins.onError(ex); + } + } + } else { latest.lazySet(null); } } @@ -158,14 +197,27 @@ void drain() { for (;;) { if (cancelled) { - latest.lazySet(null); + clear(); return; } boolean d = done; + Throwable error = this.error; if (d && error != null) { - latest.lazySet(null); + if (onDropped != null) { + T v = latest.getAndSet(null); + if (v != null) { + try { + onDropped.accept(v); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + error = new CompositeException(error, ex); + } + } + } else { + latest.lazySet(null); + } downstream.onError(error); worker.dispose(); return; @@ -175,9 +227,22 @@ void drain() { boolean empty = v == null; if (d) { - v = latest.getAndSet(null); - if (!empty && emitLast) { - downstream.onNext(v); + if (!empty) { + v = latest.getAndSet(null); + if (emitLast) { + downstream.onNext(v); + } else { + if (onDropped != null) { + try { + onDropped.accept(v); + } catch (Throwable ex) { + Exceptions.throwIfFatal(ex); + downstream.onError(ex); + worker.dispose(); + return; + } + } + } } downstream.onComplete(); worker.dispose(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeInterval.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeInterval.java index 7dd47ec03b..4a4e6a787f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeInterval.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeInterval.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeout.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeout.java index dfef0e74e6..1922251d54 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeout.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeout.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeoutTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeoutTimed.java index 29b1772930..d0f5695143 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeoutTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeoutTimed.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimer.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimer.java index 778388f39b..3c9500996e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToList.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToList.java index ed64de962a..e75986c77c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToList.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToList.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToListSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToListSingle.java index 0ac41b12d6..de4db3ecf1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToListSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToListSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUnsubscribeOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUnsubscribeOn.java index 2c5f748477..d06d64f34c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUnsubscribeOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUnsubscribeOn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUsing.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUsing.java index dec3da5ebe..1ffdef32d6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUsing.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUsing.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -115,11 +115,9 @@ public void onError(Throwable t) { } } - upstream.dispose(); downstream.onError(t); } else { downstream.onError(t); - upstream.dispose(); disposeResource(); } } @@ -137,11 +135,9 @@ public void onComplete() { } } - upstream.dispose(); downstream.onComplete(); } else { downstream.onComplete(); - upstream.dispose(); disposeResource(); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindow.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindow.java index 1bd0e2f32e..c742ad6288 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindow.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindow.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowBoundary.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowBoundary.java index 503a5cbd29..a1ecb8e869 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowBoundary.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowBoundary.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowBoundarySelector.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowBoundarySelector.java index 367ddf2d02..cec435839e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowBoundarySelector.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowBoundarySelector.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -23,9 +23,9 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.SimplePlainQueue; import io.reactivex.rxjava3.internal.queue.MpscLinkedQueue; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SimplePlainQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.subjects.UnicastSubject; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowSubscribeIntercept.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowSubscribeIntercept.java index da6f96f2a3..4cc879662d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowSubscribeIntercept.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowSubscribeIntercept.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -43,4 +43,4 @@ protected void subscribeActual(Observer s) { boolean tryAbandon() { return !once.get() && once.compareAndSet(false, true); } -} \ No newline at end of file +} diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowTimed.java index 5c295f4608..2cc96a61a9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowTimed.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -23,8 +23,8 @@ import io.reactivex.rxjava3.core.Scheduler.Worker; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.internal.disposables.*; -import io.reactivex.rxjava3.internal.fuseable.SimplePlainQueue; import io.reactivex.rxjava3.internal.queue.MpscLinkedQueue; +import io.reactivex.rxjava3.operators.SimplePlainQueue; import io.reactivex.rxjava3.subjects.UnicastSubject; public final class ObservableWindowTimed extends AbstractObservableWithUpstream> { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWithLatestFrom.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWithLatestFrom.java index b7e283c515..95b21187a7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWithLatestFrom.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWithLatestFrom.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWithLatestFromMany.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWithLatestFromMany.java index c9f2a6b57a..f8327b8284 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWithLatestFromMany.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWithLatestFromMany.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import java.util.Arrays; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZip.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZip.java index ace2d748e5..e1626b4865 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZip.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZip.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -22,7 +22,7 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.disposables.*; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; public final class ObservableZip extends Observable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZipIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZipIterable.java index c1881bdca3..7c8f5e6d0e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZipIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZipIterable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObserverResourceWrapper.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObserverResourceWrapper.java index 4245417ce7..a3c797fee6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObserverResourceWrapper.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObserverResourceWrapper.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelCollect.java b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelCollect.java index 29f9d91674..60e36beed4 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelCollect.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelCollect.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -47,6 +47,8 @@ public ParallelCollect(ParallelFlowable source, @Override public void subscribe(Subscriber[] subscribers) { + subscribers = RxJavaPlugins.onSubscribe(this, subscribers); + if (!validate(subscribers)) { return; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelConcatMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelConcatMap.java index 1ff745ecba..ebdcf0bdf3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelConcatMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelConcatMap.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,6 +19,7 @@ import io.reactivex.rxjava3.internal.operators.flowable.FlowableConcatMap; import io.reactivex.rxjava3.internal.util.ErrorMode; import io.reactivex.rxjava3.parallel.ParallelFlowable; +import io.reactivex.rxjava3.plugins.RxJavaPlugins; import java.util.Objects; @@ -55,6 +56,8 @@ public int parallelism() { @Override public void subscribe(Subscriber[] subscribers) { + subscribers = RxJavaPlugins.onSubscribe(this, subscribers); + if (!validate(subscribers)) { return; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelDoOnNextTry.java b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelDoOnNextTry.java index 6b3f69ff97..b8ff388535 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelDoOnNextTry.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelDoOnNextTry.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -17,8 +17,8 @@ import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.fuseable.ConditionalSubscriber; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; import io.reactivex.rxjava3.parallel.*; import io.reactivex.rxjava3.plugins.RxJavaPlugins; @@ -48,6 +48,8 @@ public ParallelDoOnNextTry(ParallelFlowable source, Consumer onNex @Override public void subscribe(Subscriber[] subscribers) { + subscribers = RxJavaPlugins.onSubscribe(this, subscribers); + if (!validate(subscribers)) { return; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFilter.java b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFilter.java index 14f414dce3..28987a6fc9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFilter.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFilter.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -17,8 +17,8 @@ import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Predicate; -import io.reactivex.rxjava3.internal.fuseable.ConditionalSubscriber; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; import io.reactivex.rxjava3.parallel.ParallelFlowable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; @@ -40,6 +40,8 @@ public ParallelFilter(ParallelFlowable source, Predicate predicate @Override public void subscribe(Subscriber[] subscribers) { + subscribers = RxJavaPlugins.onSubscribe(this, subscribers); + if (!validate(subscribers)) { return; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFilterTry.java b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFilterTry.java index bfd22ec5a8..563937e1a6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFilterTry.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFilterTry.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -17,8 +17,8 @@ import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.fuseable.ConditionalSubscriber; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; import io.reactivex.rxjava3.parallel.*; import io.reactivex.rxjava3.plugins.RxJavaPlugins; @@ -46,6 +46,8 @@ public ParallelFilterTry(ParallelFlowable source, Predicate predic @Override public void subscribe(Subscriber[] subscribers) { + subscribers = RxJavaPlugins.onSubscribe(this, subscribers); + if (!validate(subscribers)) { return; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFlatMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFlatMap.java index 1e0c9f5738..227521143a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFlatMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFlatMap.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,6 +18,7 @@ import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.operators.flowable.FlowableFlatMap; import io.reactivex.rxjava3.parallel.ParallelFlowable; +import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** * Flattens the generated Publishers on each rail. @@ -57,6 +58,8 @@ public int parallelism() { @Override public void subscribe(Subscriber[] subscribers) { + subscribers = RxJavaPlugins.onSubscribe(this, subscribers); + if (!validate(subscribers)) { return; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFlatMapIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFlatMapIterable.java index 1bb127233f..9e6c45a9ca 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFlatMapIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFlatMapIterable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,6 +18,7 @@ import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.operators.flowable.FlowableFlattenIterable; import io.reactivex.rxjava3.parallel.ParallelFlowable; +import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** * Flattens the generated {@link Iterable}s on each rail. @@ -50,6 +51,8 @@ public int parallelism() { @Override public void subscribe(Subscriber[] subscribers) { + subscribers = RxJavaPlugins.onSubscribe(this, subscribers); + if (!validate(subscribers)) { return; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFromArray.java b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFromArray.java index cb40caaad5..d2512ccd7f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFromArray.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFromArray.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -16,6 +16,7 @@ import org.reactivestreams.*; import io.reactivex.rxjava3.parallel.ParallelFlowable; +import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** * Wraps multiple Publishers into a ParallelFlowable which runs them @@ -37,6 +38,8 @@ public int parallelism() { @Override public void subscribe(Subscriber[] subscribers) { + subscribers = RxJavaPlugins.onSubscribe(this, subscribers); + if (!validate(subscribers)) { return; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFromPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFromPublisher.java index 1d9bab143b..eb57bccea5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFromPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelFromPublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,11 +19,13 @@ import io.reactivex.rxjava3.core.FlowableSubscriber; import io.reactivex.rxjava3.exceptions.*; -import io.reactivex.rxjava3.internal.fuseable.*; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.BackpressureHelper; +import io.reactivex.rxjava3.operators.QueueSubscription; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscArrayQueue; import io.reactivex.rxjava3.parallel.ParallelFlowable; +import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** * Dispatches the values from upstream in a round robin fashion to subscribers which are @@ -51,6 +53,8 @@ public int parallelism() { @Override public void subscribe(Subscriber[] subscribers) { + subscribers = RxJavaPlugins.onSubscribe(this, subscribers); + if (!validate(subscribers)) { return; } @@ -200,7 +204,7 @@ public void onNext(T t) { if (sourceMode == QueueSubscription.NONE) { if (!queue.offer(t)) { upstream.cancel(); - onError(new MissingBackpressureException("Queue is full?")); + onError(new QueueOverflowException()); return; } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelJoin.java b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelJoin.java index 57f82230a0..2852fda8c7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelJoin.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelJoin.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,11 +18,12 @@ import org.reactivestreams.*; import io.reactivex.rxjava3.core.*; -import io.reactivex.rxjava3.exceptions.MissingBackpressureException; -import io.reactivex.rxjava3.internal.fuseable.*; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; +import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SimplePlainQueue; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscArrayQueue; import io.reactivex.rxjava3.parallel.ParallelFlowable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; @@ -152,7 +153,7 @@ public void onNext(JoinInnerSubscriber inner, T value) { if (!q.offer(value)) { cancelAll(); - Throwable mbe = new MissingBackpressureException("Queue full?!"); + Throwable mbe = new QueueOverflowException(); if (errors.compareAndSet(null, mbe)) { downstream.onError(mbe); } else { @@ -169,7 +170,7 @@ public void onNext(JoinInnerSubscriber inner, T value) { if (!q.offer(value)) { cancelAll(); - onError(new MissingBackpressureException("Queue full?!")); + onError(new QueueOverflowException()); return; } @@ -332,7 +333,7 @@ void onNext(JoinInnerSubscriber inner, T value) { if (!q.offer(value)) { inner.cancel(); - errors.tryAddThrowableOrReport(new MissingBackpressureException("Queue full?!")); + errors.tryAddThrowableOrReport(new QueueOverflowException()); done.decrementAndGet(); drainLoop(); return; @@ -346,7 +347,7 @@ void onNext(JoinInnerSubscriber inner, T value) { if (!q.offer(value)) { inner.cancel(); - errors.tryAddThrowableOrReport(new MissingBackpressureException("Queue full?!")); + errors.tryAddThrowableOrReport(new QueueOverflowException()); done.decrementAndGet(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelMap.java index c941887853..81d70a01d9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelMap.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,8 +18,8 @@ import io.reactivex.rxjava3.core.FlowableSubscriber; import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.ConditionalSubscriber; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; import io.reactivex.rxjava3.parallel.ParallelFlowable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; @@ -44,6 +44,8 @@ public ParallelMap(ParallelFlowable source, Function @Override public void subscribe(Subscriber[] subscribers) { + subscribers = RxJavaPlugins.onSubscribe(this, subscribers); + if (!validate(subscribers)) { return; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelMapTry.java b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelMapTry.java index 30250f2e60..cac64f3711 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelMapTry.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelMapTry.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -17,8 +17,8 @@ import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.fuseable.ConditionalSubscriber; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; import io.reactivex.rxjava3.parallel.*; import io.reactivex.rxjava3.plugins.RxJavaPlugins; @@ -49,6 +49,8 @@ public ParallelMapTry(ParallelFlowable source, Function[] subscribers) { + subscribers = RxJavaPlugins.onSubscribe(this, subscribers); + if (!validate(subscribers)) { return; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelPeek.java b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelPeek.java index 206a2dd472..42f65567ca 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelPeek.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelPeek.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -66,6 +66,8 @@ public ParallelPeek(ParallelFlowable source, @Override public void subscribe(Subscriber[] subscribers) { + subscribers = RxJavaPlugins.onSubscribe(this, subscribers); + if (!validate(subscribers)) { return; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelReduce.java b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelReduce.java index 53fa2b3899..b955ca711a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelReduce.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelReduce.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -46,6 +46,8 @@ public ParallelReduce(ParallelFlowable source, Supplier initialS @Override public void subscribe(Subscriber[] subscribers) { + subscribers = RxJavaPlugins.onSubscribe(this, subscribers); + if (!validate(subscribers)) { return; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelReduceFull.java b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelReduceFull.java index a47bc5b898..2e24b9e256 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelReduceFull.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelReduceFull.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelRunOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelRunOn.java index 46d3bcdc1a..22f822db34 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelRunOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelRunOn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,13 +19,13 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.core.Scheduler.Worker; -import io.reactivex.rxjava3.exceptions.MissingBackpressureException; -import io.reactivex.rxjava3.internal.fuseable.ConditionalSubscriber; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; +import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.internal.schedulers.SchedulerMultiWorkerSupport; import io.reactivex.rxjava3.internal.schedulers.SchedulerMultiWorkerSupport.WorkerCallback; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.BackpressureHelper; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; +import io.reactivex.rxjava3.operators.SpscArrayQueue; import io.reactivex.rxjava3.parallel.ParallelFlowable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; @@ -49,7 +49,9 @@ public ParallelRunOn(ParallelFlowable parent, } @Override - public void subscribe(final Subscriber[] subscribers) { + public void subscribe(Subscriber[] subscribers) { + subscribers = RxJavaPlugins.onSubscribe(this, subscribers); + if (!validate(subscribers)) { return; } @@ -146,7 +148,7 @@ public final void onNext(T t) { } if (!queue.offer(t)) { upstream.cancel(); - onError(new MissingBackpressureException("Queue is full?!")); + onError(new QueueOverflowException()); return; } schedule(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelSortedJoin.java b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelSortedJoin.java index 3d4347d283..fb20bb65b9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelSortedJoin.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelSortedJoin.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleAmb.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleAmb.java index 7fd1dba29f..24ff7eabed 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleAmb.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleAmb.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleCache.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleCache.java index a8cb63f0ed..7f0848e4c1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleCache.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleCache.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleContains.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleContains.java index aaa249a6e8..2497fb2047 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleContains.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleContains.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleCreate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleCreate.java index 8c5331c87b..c0f6c4b1d0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleCreate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleCreate.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDefer.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDefer.java index 24a35fbdee..ddf2b2c347 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDefer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDefer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelay.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelay.java index 12da3821fc..1a92d389fa 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelay.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelay.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithCompletable.java index c3f7458459..164a502992 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithObservable.java index 44dbc50ecf..58ed261e71 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithObservable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithPublisher.java index 1d8a601a02..12eeb7fd13 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithPublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithSingle.java index d8e11665c8..1f2ffb21dd 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithSingle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDematerialize.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDematerialize.java index 6d072f4cea..e573560e76 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDematerialize.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDematerialize.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDetach.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDetach.java index 72e1f3def3..2a9acc8a19 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDetach.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDetach.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterSuccess.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterSuccess.java index d7ab5e4c79..51b73f0216 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterSuccess.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterSuccess.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterTerminate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterTerminate.java index eca7ebff15..651c9ee60d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterTerminate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterTerminate.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoFinally.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoFinally.java index 0ba60a6493..a64060cc97 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoFinally.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoFinally.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnDispose.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnDispose.java index 262f4f7d43..8c9fd1cb1b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnDispose.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnDispose.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnError.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnError.java index 87061fdafe..dd24ac210c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnError.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnError.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnEvent.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnEvent.java index 9aa9fccd8a..de53462380 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnEvent.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnEvent.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnLifecycle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnLifecycle.java index 288e8970cd..2d4e15f27c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnLifecycle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnLifecycle.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.single; import io.reactivex.rxjava3.annotations.NonNull; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnSubscribe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnSubscribe.java index 24a24caac9..567f95404b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnSubscribe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnSubscribe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnSuccess.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnSuccess.java index 2efec6acdd..855dc7e388 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnSuccess.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnSuccess.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnTerminate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnTerminate.java index 1bb0ca2dec..d6f5dea7fa 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnTerminate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnTerminate.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleEquals.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleEquals.java index 5d56487570..d11f938a2e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleEquals.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleEquals.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleError.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleError.java index 89b9bc3baa..f016d2c9a9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleError.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleError.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMap.java index d622f83fae..ff38538b09 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMap.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapBiSelector.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapBiSelector.java index d1051f3357..7f6f58de84 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapBiSelector.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapBiSelector.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapCompletable.java index d914799640..a06241c56c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapCompletable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableFlowable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableFlowable.java index cd16312620..6d69726588 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableFlowable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableFlowable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableObservable.java index add137d7cb..c07131da8c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableObservable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapMaybe.java index d810f8f5c3..c58e6aeeae 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapMaybe.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapNotification.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapNotification.java index 1ba9796b7c..bb592a74a9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapNotification.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapNotification.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapPublisher.java index e453f28b68..59a067832f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapPublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFromCallable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFromCallable.java index a78dde3e36..d1a6b73384 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFromCallable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFromCallable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFromPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFromPublisher.java index e18394eb1a..860e47f904 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFromPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFromPublisher.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFromSupplier.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFromSupplier.java index e6fd32603f..83e2dc4780 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFromSupplier.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFromSupplier.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFromUnsafeSource.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFromUnsafeSource.java index 328ab873b6..e09e38c833 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFromUnsafeSource.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFromUnsafeSource.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleHide.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleHide.java index 34f5dc4aed..01a4e36d6e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleHide.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleHide.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleInternalHelper.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleInternalHelper.java index 30d1192a17..5df3dae35d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleInternalHelper.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleInternalHelper.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleJust.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleJust.java index 4fd2387f96..ceb94b93a1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleJust.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleJust.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleLift.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleLift.java index 8382b2f1b8..5b127e58cb 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleLift.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleLift.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleMap.java index 534b41495c..3fb20516ce 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleMap.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleMaterialize.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleMaterialize.java index 1ffbfe073a..c09d28ffd1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleMaterialize.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleMaterialize.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleNever.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleNever.java index ea76fac50d..0feefe196d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleNever.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleNever.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleObserveOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleObserveOn.java index 168a88ee8e..e513e16fa2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleObserveOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleObserveOn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleOnErrorComplete.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleOnErrorComplete.java index 7be9bd817c..bd083cddb1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleOnErrorComplete.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleOnErrorComplete.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleOnErrorReturn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleOnErrorReturn.java index 1a606d2750..d1f8b66fd9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleOnErrorReturn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleOnErrorReturn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleResumeNext.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleResumeNext.java index 070b244747..554a2a254b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleResumeNext.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleResumeNext.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleSubscribeOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleSubscribeOn.java index 3347fc1989..56cf684e9f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleSubscribeOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleSubscribeOn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTakeUntil.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTakeUntil.java index 50e8b89763..fb5d0989f6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTakeUntil.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTakeUntil.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTimeInterval.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTimeInterval.java index 2eac3bbc3a..f6d65f7c14 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTimeInterval.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTimeInterval.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTimeout.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTimeout.java index f529d02446..cc5b923727 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTimeout.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTimeout.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -113,11 +113,7 @@ public void onError(Throwable e) { @Override public void run() { - Disposable d = get(); - if (d != DisposableHelper.DISPOSED && compareAndSet(d, DisposableHelper.DISPOSED)) { - if (d != null) { - d.dispose(); - } + if (DisposableHelper.dispose(this)) { SingleSource other = this.other; if (other == null) { downstream.onError(new TimeoutException(timeoutMessage(timeout, unit))); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTimer.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTimer.java index 5188f3a2c9..07748952c8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTimer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTimer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleToFlowable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleToFlowable.java index 890f6b0569..e692dea5b9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleToFlowable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleToFlowable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.single; import org.reactivestreams.Subscriber; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleToObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleToObservable.java index 810adaea3f..4586317740 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleToObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleToObservable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.single; import io.reactivex.rxjava3.core.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleUnsubscribeOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleUnsubscribeOn.java index 9a78d61bb7..4b18599c84 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleUnsubscribeOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleUnsubscribeOn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleUsing.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleUsing.java index 57f9daf263..55ab6c31ff 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleUsing.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleUsing.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleZipArray.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleZipArray.java index 9130a2bf35..b53d2f2184 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleZipArray.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleZipArray.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -74,7 +74,7 @@ static final class ZipCoordinator extends AtomicInteger implements Disposa final ZipSingleObserver[] observers; - final Object[] values; + Object[] values; @SuppressWarnings("unchecked") ZipCoordinator(SingleObserver observer, int n, Function zipper) { @@ -100,11 +100,16 @@ public void dispose() { for (ZipSingleObserver d : observers) { d.dispose(); } + + values = null; } } void innerSuccess(T value, int index) { - values[index] = value; + Object[] values = this.values; + if (values != null) { + values[index] = value; + } if (decrementAndGet() == 0) { R v; @@ -112,10 +117,12 @@ void innerSuccess(T value, int index) { v = Objects.requireNonNull(zipper.apply(values), "The zipper returned a null value"); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); + this.values = null; downstream.onError(ex); return; } + this.values = null; downstream.onSuccess(v); } } @@ -134,6 +141,7 @@ void disposeExcept(int index) { void innerError(Throwable ex, int index) { if (getAndSet(0) > 0) { disposeExcept(index); + values = null; downstream.onError(ex); } else { RxJavaPlugins.onError(ex); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleZipIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleZipIterable.java index ad393987be..935550ab47 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleZipIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleZipIterable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/queue/MpscLinkedQueue.java b/src/main/java/io/reactivex/rxjava3/internal/queue/MpscLinkedQueue.java index 31fe6eca9b..e8d19c633e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/queue/MpscLinkedQueue.java +++ b/src/main/java/io/reactivex/rxjava3/internal/queue/MpscLinkedQueue.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -21,7 +21,7 @@ import java.util.concurrent.atomic.AtomicReference; import io.reactivex.rxjava3.annotations.Nullable; -import io.reactivex.rxjava3.internal.fuseable.SimplePlainQueue; +import io.reactivex.rxjava3.operators.SimplePlainQueue; /** * A multi-producer single consumer unbounded queue. @@ -91,6 +91,8 @@ public T poll() { // we have to null out the value because we are going to hang on to the node final T nextValue = nextNode.getAndNullValue(); spConsumerNode(nextNode); + // unlink previous consumer to help gc + currConsumerNode.soNext(null); return nextValue; } else if (currConsumerNode != lvProducerNode()) { @@ -101,6 +103,8 @@ else if (currConsumerNode != lvProducerNode()) { // we have to null out the value because we are going to hang on to the node final T nextValue = nextNode.getAndNullValue(); spConsumerNode(nextNode); + // unlink previous consumer to help gc + currConsumerNode.soNext(null); return nextValue; } return null; diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/AbstractDirectTask.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/AbstractDirectTask.java index a1c4bc2ce1..556fcd23c7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/AbstractDirectTask.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/AbstractDirectTask.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. - * - * Licensed 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 - * + * + * Licensed 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. + * + * 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 io.reactivex.rxjava3.internal.schedulers; @@ -35,14 +32,17 @@ abstract class AbstractDirectTask protected final Runnable runnable; + protected final boolean interruptOnCancel; + protected Thread runner; protected static final FutureTask FINISHED = new FutureTask<>(Functions.EMPTY_RUNNABLE, null); protected static final FutureTask DISPOSED = new FutureTask<>(Functions.EMPTY_RUNNABLE, null); - AbstractDirectTask(Runnable runnable) { + AbstractDirectTask(Runnable runnable, boolean interruptOnCancel) { this.runnable = runnable; + this.interruptOnCancel = interruptOnCancel; } @Override @@ -51,7 +51,7 @@ public final void dispose() { if (f != FINISHED && f != DISPOSED) { if (compareAndSet(f, DISPOSED)) { if (f != null) { - f.cancel(runner != Thread.currentThread()); + cancelFuture(f); } } } @@ -70,7 +70,7 @@ public final void setFuture(Future future) { break; } if (f == DISPOSED) { - future.cancel(runner != Thread.currentThread()); + cancelFuture(future); break; } if (compareAndSet(f, future)) { @@ -79,8 +79,36 @@ public final void setFuture(Future future) { } } + private void cancelFuture(Future future) { + if (runner == Thread.currentThread()) { + future.cancel(false); + } else { + future.cancel(interruptOnCancel); + } + } + @Override public Runnable getWrappedRunnable() { return runnable; } + + @Override + public String toString() { + String status; + Future f = get(); + if (f == FINISHED) { + status = "Finished"; + } else if (f == DISPOSED) { + status = "Disposed"; + } else { + Thread r = runner; + if (r != null) { + status = "Running on " + runner; + } else { + status = "Waiting"; + } + } + + return getClass().getSimpleName() + "[" + status + "]"; + } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/ComputationScheduler.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/ComputationScheduler.java index cdbdda3d83..f6845e660e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/ComputationScheduler.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/ComputationScheduler.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.schedulers; import java.util.concurrent.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/DisposeOnCancel.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/DisposeOnCancel.java index 370fb5d8a2..72ac8ef525 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/DisposeOnCancel.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/DisposeOnCancel.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/ExecutorScheduler.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/ExecutorScheduler.java index 2e76702b1b..fa0bcab7f8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/ExecutorScheduler.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/ExecutorScheduler.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -38,7 +38,9 @@ public final class ExecutorScheduler extends Scheduler { @NonNull final Executor executor; - static final Scheduler HELPER = Schedulers.single(); + static final class SingleHolder { + static final Scheduler HELPER = Schedulers.single(); + } public ExecutorScheduler(@NonNull Executor executor, boolean interruptibleWorker, boolean fair) { this.executor = executor; @@ -58,7 +60,7 @@ public Disposable scheduleDirect(@NonNull Runnable run) { Runnable decoratedRun = RxJavaPlugins.onSchedule(run); try { if (executor instanceof ExecutorService) { - ScheduledDirectTask task = new ScheduledDirectTask(decoratedRun); + ScheduledDirectTask task = new ScheduledDirectTask(decoratedRun, interruptibleWorker); Future f = ((ExecutorService)executor).submit(task); task.setFuture(f); return task; @@ -85,7 +87,7 @@ public Disposable scheduleDirect(@NonNull Runnable run, final long delay, final final Runnable decoratedRun = RxJavaPlugins.onSchedule(run); if (executor instanceof ScheduledExecutorService) { try { - ScheduledDirectTask task = new ScheduledDirectTask(decoratedRun); + ScheduledDirectTask task = new ScheduledDirectTask(decoratedRun, interruptibleWorker); Future f = ((ScheduledExecutorService)executor).schedule(task, delay, unit); task.setFuture(f); return task; @@ -97,7 +99,7 @@ public Disposable scheduleDirect(@NonNull Runnable run, final long delay, final final DelayedRunnable dr = new DelayedRunnable(decoratedRun); - Disposable delayed = HELPER.scheduleDirect(new DelayedDispose(dr), delay, unit); + Disposable delayed = SingleHolder.HELPER.scheduleDirect(new DelayedDispose(dr), delay, unit); dr.timed.replace(delayed); @@ -110,7 +112,7 @@ public Disposable schedulePeriodicallyDirect(@NonNull Runnable run, long initial if (executor instanceof ScheduledExecutorService) { Runnable decoratedRun = RxJavaPlugins.onSchedule(run); try { - ScheduledDirectPeriodicTask task = new ScheduledDirectPeriodicTask(decoratedRun); + ScheduledDirectPeriodicTask task = new ScheduledDirectPeriodicTask(decoratedRun, interruptibleWorker); Future f = ((ScheduledExecutorService)executor).scheduleAtFixedRate(task, initialDelay, period, unit); task.setFuture(f); return task; @@ -202,7 +204,7 @@ public Disposable schedule(@NonNull Runnable run, long delay, @NonNull TimeUnit final Runnable decoratedRun = RxJavaPlugins.onSchedule(run); - ScheduledRunnable sr = new ScheduledRunnable(new SequentialDispose(mar, decoratedRun), tasks); + ScheduledRunnable sr = new ScheduledRunnable(new SequentialDispose(mar, decoratedRun), tasks, interruptibleWorker); tasks.add(sr); if (executor instanceof ScheduledExecutorService) { @@ -215,7 +217,7 @@ public Disposable schedule(@NonNull Runnable run, long delay, @NonNull TimeUnit return EmptyDisposable.INSTANCE; } } else { - final Disposable d = HELPER.scheduleDirect(sr, delay, unit); + final Disposable d = SingleHolder.HELPER.scheduleDirect(sr, delay, unit); sr.setFuture(new DisposeOnCancel(d)); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/ImmediateThinScheduler.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/ImmediateThinScheduler.java index 21fbbead83..e2430e74cb 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/ImmediateThinScheduler.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/ImmediateThinScheduler.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/InstantPeriodicTask.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/InstantPeriodicTask.java index ad85765ed6..1fd37f5d93 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/InstantPeriodicTask.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/InstantPeriodicTask.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. - * - * Licensed 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 - * + * + * Licensed 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. + * + * 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 io.reactivex.rxjava3.internal.schedulers; diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/IoScheduler.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/IoScheduler.java index 6d63715770..cfe9520685 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/IoScheduler.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/IoScheduler.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.schedulers; @@ -48,6 +45,10 @@ public final class IoScheduler extends Scheduler { /** The name of the system property for setting the thread priority for this Scheduler. */ private static final String KEY_IO_PRIORITY = "rx3.io-priority"; + /** The name of the system property for setting the release behaviour for this Scheduler. */ + private static final String KEY_SCHEDULED_RELEASE = "rx3.io-scheduled-release"; + static boolean USE_SCHEDULED_RELEASE; + static final CachedWorkerPool NONE; static { @@ -63,6 +64,8 @@ public final class IoScheduler extends Scheduler { EVICTOR_THREAD_FACTORY = new RxThreadFactory(EVICTOR_THREAD_NAME_PREFIX, priority); + USE_SCHEDULED_RELEASE = Boolean.getBoolean(KEY_SCHEDULED_RELEASE); + NONE = new CachedWorkerPool(0, null, WORKER_THREAD_FACTORY); NONE.shutdown(); } @@ -194,7 +197,7 @@ public int size() { return pool.get().allWorkers.size(); } - static final class EventLoopWorker extends Scheduler.Worker { + static final class EventLoopWorker extends Scheduler.Worker implements Runnable { private final CompositeDisposable tasks; private final CachedWorkerPool pool; private final ThreadWorker threadWorker; @@ -212,11 +215,20 @@ public void dispose() { if (once.compareAndSet(false, true)) { tasks.dispose(); - // releasing the pool should be the last action - pool.release(threadWorker); + if (USE_SCHEDULED_RELEASE) { + threadWorker.scheduleActual(this, 0, TimeUnit.NANOSECONDS, null); + } else { + // releasing the pool should be the last action + pool.release(threadWorker); + } } } + @Override + public void run() { + pool.release(threadWorker); + } + @Override public boolean isDisposed() { return once.get(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/NewThreadScheduler.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/NewThreadScheduler.java index 1cd48ce1e0..1c29efddc5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/NewThreadScheduler.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/NewThreadScheduler.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.schedulers; diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/NewThreadWorker.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/NewThreadWorker.java index d811c8e782..764241e76e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/NewThreadWorker.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/NewThreadWorker.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -26,7 +26,7 @@ * worker but doesn't perform task-tracking operations. * */ -public class NewThreadWorker extends Scheduler.Worker implements Disposable { +public class NewThreadWorker extends Scheduler.Worker { private final ScheduledExecutorService executor; volatile boolean disposed; @@ -59,7 +59,7 @@ public Disposable schedule(@NonNull final Runnable action, long delayTime, @NonN * @return the ScheduledRunnable instance */ public Disposable scheduleDirect(final Runnable run, long delayTime, TimeUnit unit) { - ScheduledDirectTask task = new ScheduledDirectTask(RxJavaPlugins.onSchedule(run)); + ScheduledDirectTask task = new ScheduledDirectTask(RxJavaPlugins.onSchedule(run), true); try { Future f; if (delayTime <= 0L) { @@ -104,7 +104,7 @@ public Disposable schedulePeriodicallyDirect(Runnable run, long initialDelay, lo return periodicWrapper; } - ScheduledDirectPeriodicTask task = new ScheduledDirectPeriodicTask(decoratedRun); + ScheduledDirectPeriodicTask task = new ScheduledDirectPeriodicTask(decoratedRun, true); try { Future f = executor.scheduleAtFixedRate(task, initialDelay, period, unit); task.setFuture(f); @@ -116,10 +116,8 @@ public Disposable schedulePeriodicallyDirect(Runnable run, long initialDelay, lo } /** - * Wraps the given runnable into a ScheduledRunnable and schedules it + * Wraps and returns the given runnable into a ScheduledRunnable and schedules it * on the underlying ScheduledExecutorService. - *

If the schedule has been rejected, the ScheduledRunnable.wasScheduled will return - * false. * @param run the runnable instance * @param delayTime the time to delay the execution * @param unit the time unit diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/NonBlockingThread.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/NonBlockingThread.java index f800f1ac4e..ff6dd5c706 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/NonBlockingThread.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/NonBlockingThread.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/RxThreadFactory.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/RxThreadFactory.java index 5bd0614b89..9b3a7968c3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/RxThreadFactory.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/RxThreadFactory.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/ScheduledDirectPeriodicTask.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/ScheduledDirectPeriodicTask.java index 4be6e4b558..1862035dde 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/ScheduledDirectPeriodicTask.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/ScheduledDirectPeriodicTask.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. - * - * Licensed 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 - * + * + * Licensed 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. + * + * 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 io.reactivex.rxjava3.internal.schedulers; @@ -27,8 +24,8 @@ public final class ScheduledDirectPeriodicTask extends AbstractDirectTask implem private static final long serialVersionUID = 1811839108042568751L; - public ScheduledDirectPeriodicTask(Runnable runnable) { - super(runnable); + public ScheduledDirectPeriodicTask(Runnable runnable, boolean interruptOnCancel) { + super(runnable, interruptOnCancel); } @Override @@ -39,8 +36,8 @@ public void run() { runner = null; } catch (Throwable ex) { // Exceptions.throwIfFatal(ex); nowhere to go - runner = null; dispose(); + runner = null; RxJavaPlugins.onError(ex); throw ex; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/ScheduledDirectTask.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/ScheduledDirectTask.java index 4959342d06..6ca8992971 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/ScheduledDirectTask.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/ScheduledDirectTask.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. - * - * Licensed 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 - * + * + * Licensed 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. + * + * 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 io.reactivex.rxjava3.internal.schedulers; @@ -29,8 +26,8 @@ public final class ScheduledDirectTask extends AbstractDirectTask implements Cal private static final long serialVersionUID = 1811839108042568751L; - public ScheduledDirectTask(Runnable runnable) { - super(runnable); + public ScheduledDirectTask(Runnable runnable, boolean interruptOnCancel) { + super(runnable, interruptOnCancel); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/ScheduledRunnable.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/ScheduledRunnable.java index d437985890..2a1baa641a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/ScheduledRunnable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/ScheduledRunnable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -24,6 +24,7 @@ public final class ScheduledRunnable extends AtomicReferenceArray private static final long serialVersionUID = -6120223772001106981L; final Runnable actual; + final boolean interruptOnCancel; /** Indicates that the parent tracking this task has been notified about its completion. */ static final Object PARENT_DISPOSED = new Object(); @@ -41,12 +42,26 @@ public final class ScheduledRunnable extends AtomicReferenceArray /** * Creates a ScheduledRunnable by wrapping the given action and setting * up the optional parent. + * The underlying future will be interrupted if the task is disposed asynchronously. * @param actual the runnable to wrap, not-null (not verified) * @param parent the parent tracking container or null if none */ public ScheduledRunnable(Runnable actual, DisposableContainer parent) { + this(actual, parent, true); + } + + /** + * Creates a ScheduledRunnable by wrapping the given action and setting + * up the optional parent. + * @param actual the runnable to wrap, not-null (not verified) + * @param parent the parent tracking container or null if none + * @param interruptOnCancel if true, the underlying future will be interrupted when disposing + * this task from a different thread than it is running on. + */ + public ScheduledRunnable(Runnable actual, DisposableContainer parent, boolean interruptOnCancel) { super(3); this.actual = actual; + this.interruptOnCancel = interruptOnCancel; this.lazySet(0, parent); } @@ -69,7 +84,6 @@ public void run() { throw e; } } finally { - lazySet(THREAD_INDEX, null); Object o = get(PARENT_INDEX); if (o != PARENT_DISPOSED && compareAndSet(PARENT_INDEX, o, DONE) && o != null) { ((DisposableContainer)o).delete(this); @@ -81,6 +95,7 @@ public void run() { break; } } + lazySet(THREAD_INDEX, null); } } @@ -95,7 +110,7 @@ public void setFuture(Future f) { return; } if (o == ASYNC_DISPOSED) { - f.cancel(true); + f.cancel(interruptOnCancel); return; } if (compareAndSet(FUTURE_INDEX, o, f)) { @@ -114,7 +129,7 @@ public void dispose() { boolean async = get(THREAD_INDEX) != Thread.currentThread(); if (compareAndSet(FUTURE_INDEX, o, async ? ASYNC_DISPOSED : SYNC_DISPOSED)) { if (o != null) { - ((Future)o).cancel(async); + ((Future)o).cancel(async && interruptOnCancel); } break; } @@ -137,4 +152,26 @@ public boolean isDisposed() { Object o = get(PARENT_INDEX); return o == PARENT_DISPOSED || o == DONE; } + + @Override + public String toString() { + String state; + Object o = get(FUTURE_INDEX); + if (o == DONE) { + state = "Finished"; + } else if (o == SYNC_DISPOSED) { + state = "Disposed(Sync)"; + } else if (o == ASYNC_DISPOSED) { + state = "Disposed(Async)"; + } else { + o = get(THREAD_INDEX); + if (o == null) { + state = "Waiting"; + } else { + state = "Running on " + o; + } + } + + return getClass().getSimpleName() + "[" + state + "]"; + } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/SchedulerMultiWorkerSupport.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/SchedulerMultiWorkerSupport.java index d42fa32cfb..b1e186adc9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/SchedulerMultiWorkerSupport.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/SchedulerMultiWorkerSupport.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/SchedulerPoolFactory.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/SchedulerPoolFactory.java index 333d4ded9e..44a824a168 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/SchedulerPoolFactory.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/SchedulerPoolFactory.java @@ -1,24 +1,19 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.schedulers; -import java.util.*; import java.util.concurrent.*; -import java.util.concurrent.atomic.AtomicReference; import io.reactivex.rxjava3.exceptions.Exceptions; import io.reactivex.rxjava3.functions.Function; @@ -34,86 +29,11 @@ private SchedulerPoolFactory() { static final String PURGE_ENABLED_KEY = "rx3.purge-enabled"; - /** - * Indicates the periodic purging of the ScheduledExecutorService is enabled. - */ public static final boolean PURGE_ENABLED; - static final String PURGE_PERIOD_SECONDS_KEY = "rx3.purge-period-seconds"; - - /** - * Indicates the purge period of the ScheduledExecutorServices created by create(). - */ - public static final int PURGE_PERIOD_SECONDS; - - static final AtomicReference PURGE_THREAD = - new AtomicReference<>(); - - // Upcast to the Map interface here to avoid 8.x compatibility issues. - // See http://stackoverflow.com/a/32955708/61158 - static final Map POOLS = - new ConcurrentHashMap<>(); - - /** - * Starts the purge thread if not already started. - */ - public static void start() { - tryStart(PURGE_ENABLED); - } - - static void tryStart(boolean purgeEnabled) { - if (purgeEnabled) { - for (;;) { - ScheduledExecutorService curr = PURGE_THREAD.get(); - if (curr != null) { - return; - } - ScheduledExecutorService next = Executors.newScheduledThreadPool(1, new RxThreadFactory("RxSchedulerPurge")); - if (PURGE_THREAD.compareAndSet(curr, next)) { - - next.scheduleAtFixedRate(new ScheduledTask(), PURGE_PERIOD_SECONDS, PURGE_PERIOD_SECONDS, TimeUnit.SECONDS); - - return; - } else { - next.shutdownNow(); - } - } - } - } - - /** - * Stops the purge thread. - */ - public static void shutdown() { - ScheduledExecutorService exec = PURGE_THREAD.getAndSet(null); - if (exec != null) { - exec.shutdownNow(); - } - POOLS.clear(); - } - static { SystemPropertyAccessor propertyAccessor = new SystemPropertyAccessor(); PURGE_ENABLED = getBooleanProperty(true, PURGE_ENABLED_KEY, true, true, propertyAccessor); - PURGE_PERIOD_SECONDS = getIntProperty(PURGE_ENABLED, PURGE_PERIOD_SECONDS_KEY, 1, 1, propertyAccessor); - - start(); - } - - static int getIntProperty(boolean enabled, String key, int defaultNotFound, int defaultNotEnabled, Function propertyAccessor) { - if (enabled) { - try { - String value = propertyAccessor.apply(key); - if (value == null) { - return defaultNotFound; - } - return Integer.parseInt(value); - } catch (Throwable ex) { - Exceptions.throwIfFatal(ex); - return defaultNotFound; - } - } - return defaultNotEnabled; } static boolean getBooleanProperty(boolean enabled, String key, boolean defaultNotFound, boolean defaultNotEnabled, Function propertyAccessor) { @@ -145,28 +65,8 @@ public String apply(String t) { * @return the ScheduledExecutorService */ public static ScheduledExecutorService create(ThreadFactory factory) { - final ScheduledExecutorService exec = Executors.newScheduledThreadPool(1, factory); - tryPutIntoPool(PURGE_ENABLED, exec); + final ScheduledThreadPoolExecutor exec = new ScheduledThreadPoolExecutor(1, factory); + exec.setRemoveOnCancelPolicy(PURGE_ENABLED); return exec; } - - static void tryPutIntoPool(boolean purgeEnabled, ScheduledExecutorService exec) { - if (purgeEnabled && exec instanceof ScheduledThreadPoolExecutor) { - ScheduledThreadPoolExecutor e = (ScheduledThreadPoolExecutor) exec; - POOLS.put(e, exec); - } - } - - static final class ScheduledTask implements Runnable { - @Override - public void run() { - for (ScheduledThreadPoolExecutor e : new ArrayList<>(POOLS.keySet())) { - if (e.isShutdown()) { - POOLS.remove(e); - } else { - e.purge(); - } - } - } - } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/SchedulerWhen.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/SchedulerWhen.java index 4da5b161b8..814c971f1c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/SchedulerWhen.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/SchedulerWhen.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.schedulers; import java.util.concurrent.TimeUnit; @@ -82,7 +80,7 @@ * } * * - * Slowing down the rate to no more than than 1 a second. This suffers from the + * Slowing down the rate to no more than 1 a second. This suffers from the * same problem as the one above I could find an {@link Observable} operator * that limits the rate without dropping the values (aka leaky bucket * algorithm). diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/SingleScheduler.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/SingleScheduler.java index 2f42acbf35..98d3b04626 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/SingleScheduler.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/SingleScheduler.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.schedulers; import java.util.concurrent.*; @@ -105,7 +106,7 @@ public Worker createWorker() { @NonNull @Override public Disposable scheduleDirect(@NonNull Runnable run, long delay, TimeUnit unit) { - ScheduledDirectTask task = new ScheduledDirectTask(RxJavaPlugins.onSchedule(run)); + ScheduledDirectTask task = new ScheduledDirectTask(RxJavaPlugins.onSchedule(run), true); try { Future f; if (delay <= 0L) { @@ -145,7 +146,7 @@ public Disposable schedulePeriodicallyDirect(@NonNull Runnable run, long initial return periodicWrapper; } - ScheduledDirectPeriodicTask task = new ScheduledDirectPeriodicTask(decoratedRun); + ScheduledDirectPeriodicTask task = new ScheduledDirectPeriodicTask(decoratedRun, true); try { Future f = executor.get().scheduleAtFixedRate(task, initialDelay, period, unit); task.setFuture(f); diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/TrampolineScheduler.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/TrampolineScheduler.java index 5ddd867783..04496482b0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/TrampolineScheduler.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/TrampolineScheduler.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.schedulers; @@ -65,7 +62,7 @@ public Disposable scheduleDirect(@NonNull Runnable run, long delay, TimeUnit uni return EmptyDisposable.INSTANCE; } - static final class TrampolineWorker extends Scheduler.Worker implements Disposable { + static final class TrampolineWorker extends Scheduler.Worker { final PriorityBlockingQueue queue = new PriorityBlockingQueue<>(); private final AtomicInteger wip = new AtomicInteger(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscribers/BasicFuseableConditionalSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/subscribers/BasicFuseableConditionalSubscriber.java index ae1e72c3f8..645a3171f2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscribers/BasicFuseableConditionalSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscribers/BasicFuseableConditionalSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -16,8 +16,9 @@ import org.reactivestreams.Subscription; import io.reactivex.rxjava3.exceptions.Exceptions; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; +import io.reactivex.rxjava3.operators.QueueSubscription; import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscribers/BasicFuseableSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/subscribers/BasicFuseableSubscriber.java index b0944cacec..162a9dbe55 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscribers/BasicFuseableSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscribers/BasicFuseableSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -17,8 +17,8 @@ import io.reactivex.rxjava3.core.FlowableSubscriber; import io.reactivex.rxjava3.exceptions.Exceptions; -import io.reactivex.rxjava3.internal.fuseable.QueueSubscription; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; +import io.reactivex.rxjava3.operators.QueueSubscription; import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscribers/BlockingBaseSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/subscribers/BlockingBaseSubscriber.java index cf93064c6a..68fa0df3eb 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscribers/BlockingBaseSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscribers/BlockingBaseSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.subscribers; import java.util.concurrent.CountDownLatch; diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscribers/BlockingFirstSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/subscribers/BlockingFirstSubscriber.java index 228023b3d9..1226eca845 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscribers/BlockingFirstSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscribers/BlockingFirstSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscribers/BlockingLastSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/subscribers/BlockingLastSubscriber.java index 1889193770..05be9d79fa 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscribers/BlockingLastSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscribers/BlockingLastSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscribers/BlockingSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/subscribers/BlockingSubscriber.java index 9ddba51e3c..4617833fc4 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscribers/BlockingSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscribers/BlockingSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscribers/BoundedSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/subscribers/BoundedSubscriber.java index 7ea697a3ab..a55f4ae4fa 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscribers/BoundedSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscribers/BoundedSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -136,4 +136,4 @@ public void cancel() { public boolean hasCustomOnError() { return onError != Functions.ON_ERROR_MISSING; } -} \ No newline at end of file +} diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscribers/DeferredScalarSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/subscribers/DeferredScalarSubscriber.java index 5fca99286a..11123962f2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscribers/DeferredScalarSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscribers/DeferredScalarSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscribers/DisposableAutoReleaseSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/subscribers/DisposableAutoReleaseSubscriber.java new file mode 100644 index 0000000000..3b9d2d99b3 --- /dev/null +++ b/src/main/java/io/reactivex/rxjava3/internal/subscribers/DisposableAutoReleaseSubscriber.java @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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. + */ + +/* + * Copyright 2016-2019 David Karnok + * + * Licensed 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 io.reactivex.rxjava3.internal.subscribers; + +import java.util.concurrent.atomic.AtomicReference; + +import org.reactivestreams.Subscription; + +import io.reactivex.rxjava3.core.FlowableSubscriber; +import io.reactivex.rxjava3.disposables.*; +import io.reactivex.rxjava3.exceptions.*; +import io.reactivex.rxjava3.functions.*; +import io.reactivex.rxjava3.internal.functions.Functions; +import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; +import io.reactivex.rxjava3.observers.LambdaConsumerIntrospection; +import io.reactivex.rxjava3.plugins.RxJavaPlugins; + +/** + * Wraps lambda callbacks and when the upstream terminates or this subscriber gets disposed, + * removes itself from a {@link io.reactivex.rxjava3.disposables.CompositeDisposable}. + *

History: 0.18.0 @ RxJavaExtensions + * @param the element type consumed + * @since 3.1.0 + */ +public final class DisposableAutoReleaseSubscriber +extends AtomicReference +implements FlowableSubscriber, Disposable, LambdaConsumerIntrospection { + + private static final long serialVersionUID = 8924480688481408726L; + + final AtomicReference composite; + + final Consumer onNext; + + final Consumer onError; + + final Action onComplete; + + public DisposableAutoReleaseSubscriber( + DisposableContainer composite, + Consumer onNext, + Consumer onError, + Action onComplete + ) { + this.onNext = onNext; + this.onError = onError; + this.onComplete = onComplete; + this.composite = new AtomicReference<>(composite); + } + + @Override + public void onNext(T t) { + if (get() != SubscriptionHelper.CANCELLED) { + try { + onNext.accept(t); + } catch (Throwable e) { + Exceptions.throwIfFatal(e); + get().cancel(); + onError(e); + } + } + } + + @Override + public void onError(Throwable t) { + if (get() != SubscriptionHelper.CANCELLED) { + lazySet(SubscriptionHelper.CANCELLED); + try { + onError.accept(t); + } catch (Throwable e) { + Exceptions.throwIfFatal(e); + RxJavaPlugins.onError(new CompositeException(t, e)); + } + } else { + RxJavaPlugins.onError(t); + } + removeSelf(); + } + + @Override + public void onComplete() { + if (get() != SubscriptionHelper.CANCELLED) { + lazySet(SubscriptionHelper.CANCELLED); + try { + onComplete.run(); + } catch (Throwable e) { + Exceptions.throwIfFatal(e); + RxJavaPlugins.onError(e); + } + } + removeSelf(); + } + + @Override + public void dispose() { + SubscriptionHelper.cancel(this); + removeSelf(); + } + + void removeSelf() { + DisposableContainer c = composite.getAndSet(null); + if (c != null) { + c.delete(this); + } + } + + @Override + public boolean isDisposed() { + return SubscriptionHelper.CANCELLED == get(); + } + + @Override + public void onSubscribe(Subscription s) { + if (SubscriptionHelper.setOnce(this, s)) { + s.request(Long.MAX_VALUE); + } + } + + @Override + public boolean hasCustomOnError() { + return onError != Functions.ON_ERROR_MISSING; + } + +} diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscribers/ForEachWhileSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/subscribers/ForEachWhileSubscriber.java index 34d00eef9d..cb5ff01a13 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscribers/ForEachWhileSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscribers/ForEachWhileSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscribers/FutureSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/subscribers/FutureSubscriber.java index d44e4a0dd0..145195e2cc 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscribers/FutureSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscribers/FutureSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscribers/InnerQueuedSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/subscribers/InnerQueuedSubscriber.java index 955f9d87b1..f946ec7deb 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscribers/InnerQueuedSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscribers/InnerQueuedSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,9 +18,10 @@ import org.reactivestreams.Subscription; import io.reactivex.rxjava3.core.FlowableSubscriber; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.QueueDrainHelper; +import io.reactivex.rxjava3.operators.QueueSubscription; +import io.reactivex.rxjava3.operators.SimpleQueue; /** * Subscriber that can fuse with the upstream and calls a support interface diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscribers/InnerQueuedSubscriberSupport.java b/src/main/java/io/reactivex/rxjava3/internal/subscribers/InnerQueuedSubscriberSupport.java index e7deb5c411..3844c5b981 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscribers/InnerQueuedSubscriberSupport.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscribers/InnerQueuedSubscriberSupport.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscribers/LambdaSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/subscribers/LambdaSubscriber.java index daa76fdfbf..f137237e97 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscribers/LambdaSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscribers/LambdaSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscribers/QueueDrainSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/subscribers/QueueDrainSubscriber.java index c66505a071..8fb7f55295 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscribers/QueueDrainSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscribers/QueueDrainSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -20,9 +20,9 @@ import io.reactivex.rxjava3.core.FlowableSubscriber; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.MissingBackpressureException; -import io.reactivex.rxjava3.internal.fuseable.SimplePlainQueue; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.SimplePlainQueue; /** * Abstract base class for subscribers that hold another subscriber, a queue @@ -84,7 +84,7 @@ protected final void fastPathEmitMax(U value, boolean delayError, Disposable dis } } else { dispose.dispose(); - s.onError(new MissingBackpressureException("Could not emit buffer due to lack of requests")); + s.onError(MissingBackpressureException.createDefault()); return; } } else { @@ -118,7 +118,7 @@ protected final void fastPathOrderedEmitMax(U value, boolean delayError, Disposa } else { cancelled = true; dispose.dispose(); - s.onError(new MissingBackpressureException("Could not emit buffer due to lack of requests")); + s.onError(MissingBackpressureException.createDefault()); return; } } else { diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscribers/SinglePostCompleteSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/subscribers/SinglePostCompleteSubscriber.java index ab9f9ba799..ceec9f6b90 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscribers/SinglePostCompleteSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscribers/SinglePostCompleteSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscribers/StrictSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/subscribers/StrictSubscriber.java index f351126044..265acd60a5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscribers/StrictSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscribers/StrictSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscribers/SubscriberResourceWrapper.java b/src/main/java/io/reactivex/rxjava3/internal/subscribers/SubscriberResourceWrapper.java index 4c9b6b4930..df85e95324 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscribers/SubscriberResourceWrapper.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscribers/SubscriberResourceWrapper.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/ArrayCompositeSubscription.java b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/ArrayCompositeSubscription.java index 628891a7e6..ce4b2b5ac8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/ArrayCompositeSubscription.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/ArrayCompositeSubscription.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/AsyncSubscription.java b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/AsyncSubscription.java index 62973e7440..d33d05c8d1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/AsyncSubscription.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/AsyncSubscription.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/BasicIntQueueSubscription.java b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/BasicIntQueueSubscription.java index 862fb51b4b..46b420354b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/BasicIntQueueSubscription.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/BasicIntQueueSubscription.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -15,14 +15,15 @@ import java.util.concurrent.atomic.AtomicInteger; -import io.reactivex.rxjava3.internal.fuseable.QueueSubscription; +import io.reactivex.rxjava3.annotations.NonNull; +import io.reactivex.rxjava3.operators.QueueSubscription; /** * Base class extending AtomicInteger (wip or request accounting) and QueueSubscription (fusion). * * @param the value type */ -public abstract class BasicIntQueueSubscription extends AtomicInteger implements QueueSubscription { +public abstract class BasicIntQueueSubscription<@NonNull T> extends AtomicInteger implements QueueSubscription { private static final long serialVersionUID = -6671519529404341862L; diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/BasicQueueSubscription.java b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/BasicQueueSubscription.java index 54d33f26cb..684bdf4e80 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/BasicQueueSubscription.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/BasicQueueSubscription.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -15,7 +15,7 @@ import java.util.concurrent.atomic.AtomicLong; -import io.reactivex.rxjava3.internal.fuseable.QueueSubscription; +import io.reactivex.rxjava3.operators.QueueSubscription; /** * Base class extending AtomicLong (wip or request accounting) and QueueSubscription (fusion). diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/BooleanSubscription.java b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/BooleanSubscription.java index 117b09b60c..2d7f01ef05 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/BooleanSubscription.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/BooleanSubscription.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.subscriptions; import java.util.concurrent.atomic.AtomicBoolean; diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/DeferredScalarSubscription.java b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/DeferredScalarSubscription.java index b50b4e13f9..544fac8b58 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/DeferredScalarSubscription.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/DeferredScalarSubscription.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -15,7 +15,7 @@ import org.reactivestreams.Subscriber; -import io.reactivex.rxjava3.annotations.Nullable; +import io.reactivex.rxjava3.annotations.*; /** * A subscription that signals a single value eventually. @@ -33,7 +33,7 @@ * Where exclusively set means any other bits are 0 when that bit is set. * @param the value type */ -public class DeferredScalarSubscription extends BasicIntQueueSubscription { +public class DeferredScalarSubscription<@NonNull T> extends BasicIntQueueSubscription { private static final long serialVersionUID = -2151279923272604993L; @@ -115,7 +115,7 @@ public final void complete(T v) { lazySet(FUSED_READY); Subscriber a = downstream; - a.onNext(v); + a.onNext(null); if (get() != CANCELLED) { a.onComplete(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/EmptySubscription.java b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/EmptySubscription.java index 2da5f529a1..6b2c033d5e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/EmptySubscription.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/EmptySubscription.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -16,7 +16,7 @@ import org.reactivestreams.Subscriber; import io.reactivex.rxjava3.annotations.Nullable; -import io.reactivex.rxjava3.internal.fuseable.QueueSubscription; +import io.reactivex.rxjava3.operators.QueueSubscription; /** * An empty subscription that does nothing other than validates the request amount. diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/ScalarSubscription.java b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/ScalarSubscription.java index e854c11f92..ef1e35e753 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/ScalarSubscription.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/ScalarSubscription.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,7 +18,7 @@ import org.reactivestreams.Subscriber; import io.reactivex.rxjava3.annotations.Nullable; -import io.reactivex.rxjava3.internal.fuseable.QueueSubscription; +import io.reactivex.rxjava3.operators.QueueSubscription; /** * A Subscription that holds a constant value and emits it only when requested. diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/SubscriptionArbiter.java b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/SubscriptionArbiter.java index 44c5fe5845..7d964224eb 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/SubscriptionArbiter.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/SubscriptionArbiter.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -12,18 +12,6 @@ */ package io.reactivex.rxjava3.internal.subscriptions; -/** - * Copyright (c) 2016-present, RxJava Contributors. - * - * Licensed 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. - */ import java.util.Objects; import java.util.concurrent.atomic.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/SubscriptionHelper.java b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/SubscriptionHelper.java index 8cfc3f5a7c..922ac9c3c9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/SubscriptionHelper.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/SubscriptionHelper.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/AppendOnlyLinkedArrayList.java b/src/main/java/io/reactivex/rxjava3/internal/util/AppendOnlyLinkedArrayList.java index a2a78e7b7e..3c17b88009 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/AppendOnlyLinkedArrayList.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/AppendOnlyLinkedArrayList.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/ArrayListSupplier.java b/src/main/java/io/reactivex/rxjava3/internal/util/ArrayListSupplier.java index 7338c99040..6379cfcab8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/ArrayListSupplier.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/ArrayListSupplier.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/AtomicThrowable.java b/src/main/java/io/reactivex/rxjava3/internal/util/AtomicThrowable.java index 222008e216..3ef92cb77a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/AtomicThrowable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/AtomicThrowable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/BackpressureHelper.java b/src/main/java/io/reactivex/rxjava3/internal/util/BackpressureHelper.java index 4ccfe67845..73b15382c8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/BackpressureHelper.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/BackpressureHelper.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.util; import java.util.concurrent.atomic.AtomicLong; diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/BlockingHelper.java b/src/main/java/io/reactivex/rxjava3/internal/util/BlockingHelper.java index 57d9f863b3..84acadee6f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/BlockingHelper.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/BlockingHelper.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/BlockingIgnoringReceiver.java b/src/main/java/io/reactivex/rxjava3/internal/util/BlockingIgnoringReceiver.java index f0d90e4708..8d4c1fb76e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/BlockingIgnoringReceiver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/BlockingIgnoringReceiver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/ConnectConsumer.java b/src/main/java/io/reactivex/rxjava3/internal/util/ConnectConsumer.java index 63fd12dc99..5d5246719d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/ConnectConsumer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/ConnectConsumer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/EmptyComponent.java b/src/main/java/io/reactivex/rxjava3/internal/util/EmptyComponent.java index 1ffc9c51d4..47390f57cb 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/EmptyComponent.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/EmptyComponent.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/EndConsumerHelper.java b/src/main/java/io/reactivex/rxjava3/internal/util/EndConsumerHelper.java index 01b95a0a11..0e72353800 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/EndConsumerHelper.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/EndConsumerHelper.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/ErrorMode.java b/src/main/java/io/reactivex/rxjava3/internal/util/ErrorMode.java index e3ff3d5fdb..02389f0b7a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/ErrorMode.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/ErrorMode.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/ExceptionHelper.java b/src/main/java/io/reactivex/rxjava3/internal/util/ExceptionHelper.java index 8b9d62317a..1ddbb8aca1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/ExceptionHelper.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/ExceptionHelper.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/HalfSerializer.java b/src/main/java/io/reactivex/rxjava3/internal/util/HalfSerializer.java index 378327ea4c..e1bf5596e2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/HalfSerializer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/HalfSerializer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.util; import java.util.concurrent.atomic.AtomicInteger; diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/HashMapSupplier.java b/src/main/java/io/reactivex/rxjava3/internal/util/HashMapSupplier.java index 46236ff293..15c2884266 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/HashMapSupplier.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/HashMapSupplier.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/LinkedArrayList.java b/src/main/java/io/reactivex/rxjava3/internal/util/LinkedArrayList.java index 08d675a4af..92ff9d30a6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/LinkedArrayList.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/LinkedArrayList.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.util; import java.util.*; diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/ListAddBiConsumer.java b/src/main/java/io/reactivex/rxjava3/internal/util/ListAddBiConsumer.java index cd6c8e9750..fb643fcff3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/ListAddBiConsumer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/ListAddBiConsumer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/MergerBiFunction.java b/src/main/java/io/reactivex/rxjava3/internal/util/MergerBiFunction.java index 64d9faff71..a736309019 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/MergerBiFunction.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/MergerBiFunction.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/NotificationLite.java b/src/main/java/io/reactivex/rxjava3/internal/util/NotificationLite.java index c37aa71da2..c27486d9cf 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/NotificationLite.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/NotificationLite.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.util; import java.io.Serializable; diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/ObservableQueueDrain.java b/src/main/java/io/reactivex/rxjava3/internal/util/ObservableQueueDrain.java index c0187e9cc2..6d69b375d4 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/ObservableQueueDrain.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/ObservableQueueDrain.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/OpenHashSet.java b/src/main/java/io/reactivex/rxjava3/internal/util/OpenHashSet.java index c5bf3bb676..9967ca831d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/OpenHashSet.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/OpenHashSet.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/Pow2.java b/src/main/java/io/reactivex/rxjava3/internal/util/Pow2.java index dd6df01d9e..fd30ee04fb 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/Pow2.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/Pow2.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -15,6 +15,7 @@ * Original License: https://github.com/JCTools/JCTools/blob/master/LICENSE * Original location: https://github.com/JCTools/JCTools/blob/master/jctools-core/src/main/java/org/jctools/util/Pow2.java */ + package io.reactivex.rxjava3.internal.util; public final class Pow2 { diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/QueueDrain.java b/src/main/java/io/reactivex/rxjava3/internal/util/QueueDrain.java index 4a84e5e6ed..481cbe0012 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/QueueDrain.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/QueueDrain.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/QueueDrainHelper.java b/src/main/java/io/reactivex/rxjava3/internal/util/QueueDrainHelper.java index 9808e2fe0d..fa0c500892 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/QueueDrainHelper.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/QueueDrainHelper.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.util; import java.util.Queue; @@ -21,8 +22,7 @@ import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.BooleanSupplier; -import io.reactivex.rxjava3.internal.fuseable.*; -import io.reactivex.rxjava3.internal.queue.*; +import io.reactivex.rxjava3.operators.*; /** * Utility class to help with the queue-drain serialization idiom. @@ -78,7 +78,7 @@ public static void drainMaxLoop(SimplePlainQueue q, Subscriber the value type * @param n the current request amount * @param actual the target Subscriber to send events to * @param queue the queue to drain if in the post-complete state diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/SorterFunction.java b/src/main/java/io/reactivex/rxjava3/internal/util/SorterFunction.java index a62efd154f..b74f1bccf6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/SorterFunction.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/SorterFunction.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/SuppressAnimalSniffer.java b/src/main/java/io/reactivex/rxjava3/internal/util/SuppressAnimalSniffer.java index e57d883036..b55fb0673b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/SuppressAnimalSniffer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/SuppressAnimalSniffer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/VolatileSizeArrayList.java b/src/main/java/io/reactivex/rxjava3/internal/util/VolatileSizeArrayList.java index 33e1e18a56..798a05a6dc 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/VolatileSizeArrayList.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/VolatileSizeArrayList.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/observables/ConnectableObservable.java b/src/main/java/io/reactivex/rxjava3/observables/ConnectableObservable.java index 107971ca88..231d0357fe 100644 --- a/src/main/java/io/reactivex/rxjava3/observables/ConnectableObservable.java +++ b/src/main/java/io/reactivex/rxjava3/observables/ConnectableObservable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -35,19 +35,18 @@ * *

* When the upstream terminates, the {@code ConnectableObservable} remains in this terminated state and, - * depending on the actual underlying implementation, relays cached events to late {@link Observer}s. + * depending on the actual underlying implementation, relays cached events to late {@code Observer}s. * In order to reuse and restart this {@code ConnectableObservable}, the {@link #reset()} method has to be called. - * When called, this {@code ConnectableObservable} will appear as fresh, unconnected source to new {@link Observer}s. - * Disposing the connection will reset the {@code ConnectableFlowable} to its fresh state and there is no need to call - * {@code reset()} in this case. + * When called, this {@code ConnectableObservable} will appear as fresh, unconnected source to new {@code Observer}s. + * Disposing the connection will reset the {@code ConnectableObservable} to its fresh state and there is no need to call + * {@link #reset()} in this case. *

* Note that although {@link #connect()} and {@link #reset()} are safe to call from multiple threads, it is recommended * a dedicated thread or business logic manages the connection or resetting of a {@code ConnectableObservable} so that * there is no unwanted signal loss due to early {@code connect()} or {@code reset()} calls while {@code Observer}s are * still being subscribed to to this {@code ConnectableObservable} to receive signals from the get go. * - * @see RxJava Wiki: - * Connectable Observable Operators + * @see RxJava Wiki: Connectable Observable Operators * @param * the type of items emitted by the {@code ConnectableObservable} */ @@ -71,7 +70,7 @@ public abstract class ConnectableObservable extends Observable { public abstract void connect(@NonNull Consumer connection); /** - * Resets this ConnectableObservable into its fresh state if it has terminated + * Resets this {@code ConnectableObservable} into its fresh state if it has terminated * or has been disposed. *

* Calling this method on a fresh or active {@code ConnectableObservable} has no effect. @@ -94,7 +93,7 @@ public abstract class ConnectableObservable extends Observable { *

The behavior is determined by the implementor of this abstract class.
* * - * @return the subscription representing the connection + * @return the {@link Disposable} representing the connection * @see ReactiveX documentation: Connect */ @NonNull @@ -106,13 +105,13 @@ public final Disposable connect() { } /** - * Returns an {@code Observable} that stays connected to this {@code ConnectableObservable} as long as there + * Returns an {@link Observable} that stays connected to this {@code ConnectableObservable} as long as there * is at least one subscription to this {@code ConnectableObservable}. *
*
Scheduler:
*
This {@code refCount} overload does not operate on any particular {@link Scheduler}.
*
- * @return an {@link Observable} + * @return a new {@code Observable} instance * @see ReactiveX documentation: RefCount * @see #refCount(int) * @see #refCount(long, TimeUnit) @@ -127,35 +126,36 @@ public Observable refCount() { /** * Connects to the upstream {@code ConnectableObservable} if the number of subscribed - * observers reaches the specified count and disconnect if all subscribers have unsubscribed. + * observers reaches the specified count and disconnect if all {@link Observer}s have unsubscribed. *
*
Scheduler:
*
This {@code refCount} overload does not operate on any particular {@link Scheduler}.
*
*

History: 2.1.14 - experimental - * @param subscriberCount the number of subscribers required to connect to the upstream - * @return the new Observable instance + * @param observerCount the number of {@code Observer}s required to connect to the upstream + * @return the new {@link Observable} instance + * @throws IllegalArgumentException if {@code observerCount} is non-positive * @since 2.2 */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable refCount(int subscriberCount) { - return refCount(subscriberCount, 0, TimeUnit.NANOSECONDS, Schedulers.trampoline()); + public final Observable refCount(int observerCount) { + return refCount(observerCount, 0, TimeUnit.NANOSECONDS, Schedulers.trampoline()); } /** * Connects to the upstream {@code ConnectableObservable} if the number of subscribed * observers reaches 1 and disconnect after the specified - * timeout if all subscribers have unsubscribed. + * timeout if all {@link Observer}s have unsubscribed. *

*
Scheduler:
*
This {@code refCount} overload operates on the {@code computation} {@link Scheduler}.
*
*

History: 2.1.14 - experimental - * @param timeout the time to wait before disconnecting after all subscribers unsubscribed + * @param timeout the time to wait before disconnecting after all {@code Observer}s unsubscribed * @param unit the time unit of the timeout - * @return the new Observable instance + * @return the new {@link Observable} instance * @throws NullPointerException if {@code unit} is {@code null} * @see #refCount(long, TimeUnit, Scheduler) * @since 2.2 @@ -170,16 +170,16 @@ public final Observable refCount(long timeout, @NonNull TimeUnit unit) { /** * Connects to the upstream {@code ConnectableObservable} if the number of subscribed * observers reaches 1 and disconnect after the specified - * timeout if all subscribers have unsubscribed. + * timeout if all {@link Observer}s have unsubscribed. *

*
Scheduler:
*
This {@code refCount} overload operates on the specified {@link Scheduler}.
*
*

History: 2.1.14 - experimental - * @param timeout the time to wait before disconnecting after all subscribers unsubscribed + * @param timeout the time to wait before disconnecting after all {@code Observer}s unsubscribed * @param unit the time unit of the timeout * @param scheduler the target scheduler to wait on before disconnecting - * @return the new Observable instance + * @return the new {@link Observable} instance * @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null} * @since 2.2 */ @@ -193,66 +193,67 @@ public final Observable refCount(long timeout, @NonNull TimeUnit unit, @NonNu /** * Connects to the upstream {@code ConnectableObservable} if the number of subscribed * observers reaches the specified count and disconnect after the specified - * timeout if all subscribers have unsubscribed. + * timeout if all {@link Observer}s have unsubscribed. *

*
Scheduler:
*
This {@code refCount} overload operates on the {@code computation} {@link Scheduler}.
*
*

History: 2.1.14 - experimental - * @param subscriberCount the number of subscribers required to connect to the upstream - * @param timeout the time to wait before disconnecting after all subscribers unsubscribed + * @param observerCount the number of {@code Observer}s required to connect to the upstream + * @param timeout the time to wait before disconnecting after all {@code Observer}s unsubscribed * @param unit the time unit of the timeout - * @return the new Observable instance + * @return the new {@link Observable} instance * @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null} + * @throws IllegalArgumentException if {@code observerCount} is non-positive * @see #refCount(int, long, TimeUnit, Scheduler) * @since 2.2 */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.COMPUTATION) @NonNull - public final Observable refCount(int subscriberCount, long timeout, @NonNull TimeUnit unit) { - return refCount(subscriberCount, timeout, unit, Schedulers.computation()); + public final Observable refCount(int observerCount, long timeout, @NonNull TimeUnit unit) { + return refCount(observerCount, timeout, unit, Schedulers.computation()); } /** * Connects to the upstream {@code ConnectableObservable} if the number of subscribed * observers reaches the specified count and disconnect after the specified - * timeout if all subscribers have unsubscribed. + * timeout if all {@link Observer}s have unsubscribed. *

*
Scheduler:
*
This {@code refCount} overload operates on the specified {@link Scheduler}.
*
*

History: 2.1.14 - experimental - * @param subscriberCount the number of subscribers required to connect to the upstream - * @param timeout the time to wait before disconnecting after all subscribers unsubscribed + * @param observerCount the number of {@code Observer}s required to connect to the upstream + * @param timeout the time to wait before disconnecting after all {@code Observer}s unsubscribed * @param unit the time unit of the timeout * @param scheduler the target scheduler to wait on before disconnecting - * @return the new Observable instance + * @return the new {@link Observable} instance * @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null} - * @throws IllegalArgumentException if {@code subscriberCount} is non-positive + * @throws IllegalArgumentException if {@code observerCount} is non-positive * @since 2.2 */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.CUSTOM) @NonNull - public final Observable refCount(int subscriberCount, long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { - ObjectHelper.verifyPositive(subscriberCount, "subscriberCount"); + public final Observable refCount(int observerCount, long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { + ObjectHelper.verifyPositive(observerCount, "observerCount"); Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); - return RxJavaPlugins.onAssembly(new ObservableRefCount<>(this, subscriberCount, timeout, unit, scheduler)); + return RxJavaPlugins.onAssembly(new ObservableRefCount<>(this, observerCount, timeout, unit, scheduler)); } /** - * Returns an Observable that automatically connects (at most once) to this ConnectableObservable - * when the first Observer subscribes. + * Returns an {@link Observable} that automatically connects (at most once) to this {@code ConnectableObservable} + * when the first {@link Observer} subscribes. *

* *

* The connection happens after the first subscription and happens at most once - * during the lifetime of the returned Observable. If this ConnectableObservable - * terminates, the connection is never renewed, no matter how Observers come + * during the lifetime of the returned {@code Observable}. If this {@code ConnectableObservable} + * terminates, the connection is never renewed, no matter how {@code Observer}s come * and go. Use {@link #refCount()} to renew a connection or dispose an active - * connection when all {@code Observer}s have disposed their {@code Disposable}s. + * connection when all {@code Observer}s have disposed their {@link Disposable}s. *

* This overload does not allow disconnecting the connection established via * {@link #connect(Consumer)}. Use the {@link #autoConnect(int, Consumer)} overload @@ -262,8 +263,8 @@ public final Observable refCount(int subscriberCount, long timeout, @NonNull *

{@code autoConnect} overload does not operate on any particular {@link Scheduler}.
* * - * @return an Observable that automatically connects to this ConnectableObservable - * when the first Observer subscribes + * @return a new {@code Observable} instance that automatically connects to this {@code ConnectableObservable} + * when the first {@code Observer} subscribes */ @NonNull @CheckReturnValue @@ -273,16 +274,16 @@ public Observable autoConnect() { } /** - * Returns an Observable that automatically connects (at most once) to this ConnectableObservable - * when the specified number of Observers subscribe to it. + * Returns an {@link Observable} that automatically connects (at most once) to this {@code ConnectableObservable} + * when the specified number of {@link Observer}s subscribe to it. *

* *

* The connection happens after the given number of subscriptions and happens at most once - * during the lifetime of the returned Observable. If this ConnectableObservable - * terminates, the connection is never renewed, no matter how Observers come + * during the lifetime of the returned {@code Observable}. If this {@code ConnectableObservable} + * terminates, the connection is never renewed, no matter how {@code Observer}s come * and go. Use {@link #refCount()} to renew a connection or dispose an active - * connection when all {@code Observer}s have disposed their {@code Disposable}s. + * connection when all {@code Observer}s have disposed their {@link Disposable}s. *

* This overload does not allow disconnecting the connection established via * {@link #connect(Consumer)}. Use the {@link #autoConnect(int, Consumer)} overload @@ -292,29 +293,29 @@ public Observable autoConnect() { *

{@code autoConnect} overload does not operate on any particular {@link Scheduler}.
* * - * @param numberOfSubscribers the number of subscribers to await before calling connect - * on the ConnectableObservable. A non-positive value indicates + * @param numberOfObservers the number of subscribers to await before calling connect + * on the {@code ConnectableObservable}. A non-positive value indicates * an immediate connection. - * @return an Observable that automatically connects to this ConnectableObservable - * when the specified number of Subscribers subscribe to it + * @return a new {@code Observable} instance that automatically connects to this {@code ConnectableObservable} + * when the specified number of {@code Observer}s subscribe to it */ @NonNull @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) - public Observable autoConnect(int numberOfSubscribers) { - return autoConnect(numberOfSubscribers, Functions.emptyConsumer()); + public Observable autoConnect(int numberOfObservers) { + return autoConnect(numberOfObservers, Functions.emptyConsumer()); } /** - * Returns an Observable that automatically connects (at most once) to this ConnectableObservable - * when the specified number of Subscribers subscribe to it and calls the - * specified callback with the Subscription associated with the established connection. + * Returns an {@link Observable} that automatically connects (at most once) to this {@code ConnectableObservable} + * when the specified number of {@link Observer}s subscribe to it and calls the + * specified callback with the {@link Disposable} associated with the established connection. *

* *

* The connection happens after the given number of subscriptions and happens at most once - * during the lifetime of the returned Observable. If this ConnectableObservable - * terminates, the connection is never renewed, no matter how Observers come + * during the lifetime of the returned {@code Observable}. If this {@code ConnectableObservable} + * terminates, the connection is never renewed, no matter how {@code Observer}s come * and go. Use {@link #refCount()} to renew a connection or dispose an active * connection when all {@code Observer}s have disposed their {@code Disposable}s. *

@@ -322,25 +323,25 @@ public Observable autoConnect(int numberOfSubscribers) { *
{@code autoConnect} overload does not operate on any particular {@link Scheduler}.
*
* - * @param numberOfSubscribers the number of subscribers to await before calling connect - * on the ConnectableObservable. A non-positive value indicates + * @param numberOfObservers the number of subscribers to await before calling connect + * on the {@code ConnectableObservable}. A non-positive value indicates * an immediate connection. - * @param connection the callback Consumer that will receive the Subscription representing the + * @param connection the callback {@link Consumer} that will receive the {@code Disposable} representing the * established connection - * @return an Observable that automatically connects to this ConnectableObservable - * when the specified number of Subscribers subscribe to it and calls the - * specified callback with the Subscription associated with the established connection + * @return a new {@code Observable} instance that automatically connects to this {@code ConnectableObservable} + * when the specified number of {@code Observer}s subscribe to it and calls the + * specified callback with the {@code Disposable} associated with the established connection * @throws NullPointerException if {@code connection} is {@code null} */ @NonNull @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) - public Observable autoConnect(int numberOfSubscribers, @NonNull Consumer connection) { + public Observable autoConnect(int numberOfObservers, @NonNull Consumer connection) { Objects.requireNonNull(connection, "connection is null"); - if (numberOfSubscribers <= 0) { + if (numberOfObservers <= 0) { this.connect(connection); return RxJavaPlugins.onAssembly(this); } - return RxJavaPlugins.onAssembly(new ObservableAutoConnect<>(this, numberOfSubscribers, connection)); + return RxJavaPlugins.onAssembly(new ObservableAutoConnect<>(this, numberOfObservers, connection)); } } diff --git a/src/main/java/io/reactivex/rxjava3/observables/GroupedObservable.java b/src/main/java/io/reactivex/rxjava3/observables/GroupedObservable.java index 489ee1d716..baa35ce48d 100644 --- a/src/main/java/io/reactivex/rxjava3/observables/GroupedObservable.java +++ b/src/main/java/io/reactivex/rxjava3/observables/GroupedObservable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.observables; import io.reactivex.rxjava3.annotations.Nullable; diff --git a/src/main/java/io/reactivex/rxjava3/observables/package-info.java b/src/main/java/io/reactivex/rxjava3/observables/package-info.java index 7fb2fc1454..93c6ad0c40 100644 --- a/src/main/java/io/reactivex/rxjava3/observables/package-info.java +++ b/src/main/java/io/reactivex/rxjava3/observables/package-info.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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. */ /** diff --git a/src/main/java/io/reactivex/rxjava3/observers/BaseTestConsumer.java b/src/main/java/io/reactivex/rxjava3/observers/BaseTestConsumer.java index 458325c280..6b3a72fadb 100644 --- a/src/main/java/io/reactivex/rxjava3/observers/BaseTestConsumer.java +++ b/src/main/java/io/reactivex/rxjava3/observers/BaseTestConsumer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -54,6 +54,9 @@ public abstract class BaseTestConsumer> { */ protected boolean timeout; + /** + * Constructs a {@code BaseTestConsumer} with {@code CountDownLatch} set to 1. + */ public BaseTestConsumer() { this.values = new VolatileSizeArrayList<>(); this.errors = new VolatileSizeArrayList<>(); @@ -228,7 +231,7 @@ public final U assertNoErrors() { */ @NonNull public final U assertError(@NonNull Throwable error) { - return assertError(Functions.equalsWith(error)); + return assertError(Functions.equalsWith(error), true); } /** @@ -240,7 +243,7 @@ public final U assertError(@NonNull Throwable error) { @SuppressWarnings({ "unchecked", "rawtypes" }) @NonNull public final U assertError(@NonNull Class errorClass) { - return (U)assertError((Predicate)Functions.isInstanceOf(errorClass)); + return (U)assertError((Predicate)Functions.isInstanceOf(errorClass), true); } /** @@ -251,9 +254,14 @@ public final U assertError(@NonNull Class errorClass) { * and should return {@code true} for expected errors. * @return this */ - @SuppressWarnings("unchecked") @NonNull public final U assertError(@NonNull Predicate errorPredicate) { + return assertError(errorPredicate, false); + } + + @SuppressWarnings("unchecked") + @NonNull + private U assertError(@NonNull Predicate errorPredicate, boolean exact) { int s = errors.size(); if (s == 0) { throw fail("No errors"); @@ -274,10 +282,16 @@ public final U assertError(@NonNull Predicate errorPredicate) { if (found) { if (s != 1) { - throw fail("Error present but other errors as well"); + if (exact) { + throw fail("Error present but other errors as well"); + } + throw fail("One error passed the predicate but other errors are present as well"); } } else { - throw fail("Error not present"); + if (exact) { + throw fail("Error not present"); + } + throw fail("No error(s) passed the predicate"); } return (U)this; } @@ -293,11 +307,11 @@ public final U assertError(@NonNull Predicate errorPredicate) { public final U assertValue(@NonNull T value) { int s = values.size(); if (s != 1) { - throw fail("expected: " + valueAndClass(value) + " but was: " + values); + throw fail("\nexpected: " + valueAndClass(value) + "\ngot: " + values); } T v = values.get(0); if (!Objects.equals(value, v)) { - throw fail("expected: " + valueAndClass(value) + " but was: " + valueAndClass(v)); + throw fail("\nexpected: " + valueAndClass(value) + "\ngot: " + valueAndClass(v)); } return (U)this; } @@ -316,7 +330,7 @@ public final U assertValue(@NonNull Predicate valuePredicate) { assertValueAt(0, valuePredicate); if (values.size() > 1) { - throw fail("Value present but other values as well"); + throw fail("The first value passed the predicate but this consumer received more than one value"); } return (U)this; @@ -339,13 +353,14 @@ public final U assertValueAt(int index, @NonNull T value) { throw fail("No values"); } - if (index >= s) { - throw fail("Invalid index: " + index); + if (index < 0 || index >= s) { + throw fail("Index " + index + " is out of range [0, " + s + ")"); } T v = values.get(index); if (!Objects.equals(value, v)) { - throw fail("expected: " + valueAndClass(value) + " but was: " + valueAndClass(v)); + throw fail("\nexpected: " + valueAndClass(value) + "\ngot: " + valueAndClass(v) + + "; Value at position " + index + " differ"); } return (U)this; } @@ -367,14 +382,15 @@ public final U assertValueAt(int index, @NonNull Predicate valuePredicate) { throw fail("No values"); } - if (index >= values.size()) { - throw fail("Invalid index: " + index); + if (index < 0 || index >= s) { + throw fail("Index " + index + " is out of range [0, " + s + ")"); } boolean found = false; + T v = values.get(index); try { - if (valuePredicate.test(values.get(index))) { + if (valuePredicate.test(v)) { found = true; } } catch (Throwable ex) { @@ -382,7 +398,7 @@ public final U assertValueAt(int index, @NonNull Predicate valuePredicate) { } if (!found) { - throw fail("Value not present"); + throw fail("Value " + valueAndClass(v) + " at position " + index + " did not pass the predicate"); } return (U)this; } @@ -410,7 +426,7 @@ public static String valueAndClass(@Nullable Object o) { public final U assertValueCount(int count) { int s = values.size(); if (s != count) { - throw fail("Value counts differ; expected: " + count + " but was: " + s); + throw fail("\nexpected: " + count + "\ngot: " + s + "; Value counts differ"); } return (U)this; } @@ -435,14 +451,15 @@ public final U assertNoValues() { public final U assertValues(@NonNull T... values) { int s = this.values.size(); if (s != values.length) { - throw fail("Value count differs; expected: " + values.length + " " + Arrays.toString(values) - + " but was: " + s + " " + this.values); + throw fail("\nexpected: " + values.length + " " + Arrays.toString(values) + + "\ngot: " + s + " " + this.values + "; Value count differs"); } for (int i = 0; i < s; i++) { T v = this.values.get(i); T u = values[i]; if (!Objects.equals(u, v)) { - throw fail("Values at position " + i + " differ; expected: " + valueAndClass(u) + " but was: " + valueAndClass(v)); + throw fail("\nexpected: " + valueAndClass(u) + "\ngot: " + valueAndClass(v) + + "; Value at position " + i + " differ"); } } return (U)this; @@ -489,7 +506,8 @@ public final U assertValueSequence(@NonNull Iterable sequence) { T v = actualIterator.next(); if (!Objects.equals(u, v)) { - throw fail("Values at position " + i + " differ; expected: " + valueAndClass(u) + " but was: " + valueAndClass(v)); + throw fail("\nexpected: " + valueAndClass(u) + "\ngot: " + valueAndClass(v) + + "; Value at position " + i + " differ"); } i++; } diff --git a/src/main/java/io/reactivex/rxjava3/observers/DefaultObserver.java b/src/main/java/io/reactivex/rxjava3/observers/DefaultObserver.java index 42cd69e79c..29d1f16d00 100644 --- a/src/main/java/io/reactivex/rxjava3/observers/DefaultObserver.java +++ b/src/main/java/io/reactivex/rxjava3/observers/DefaultObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/observers/DisposableCompletableObserver.java b/src/main/java/io/reactivex/rxjava3/observers/DisposableCompletableObserver.java index 940654b622..20bf6d59d5 100644 --- a/src/main/java/io/reactivex/rxjava3/observers/DisposableCompletableObserver.java +++ b/src/main/java/io/reactivex/rxjava3/observers/DisposableCompletableObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/observers/DisposableMaybeObserver.java b/src/main/java/io/reactivex/rxjava3/observers/DisposableMaybeObserver.java index 092994e818..6ea1d26e97 100644 --- a/src/main/java/io/reactivex/rxjava3/observers/DisposableMaybeObserver.java +++ b/src/main/java/io/reactivex/rxjava3/observers/DisposableMaybeObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/observers/DisposableObserver.java b/src/main/java/io/reactivex/rxjava3/observers/DisposableObserver.java index ff2eba7758..d4e6d5f5d8 100644 --- a/src/main/java/io/reactivex/rxjava3/observers/DisposableObserver.java +++ b/src/main/java/io/reactivex/rxjava3/observers/DisposableObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/observers/DisposableSingleObserver.java b/src/main/java/io/reactivex/rxjava3/observers/DisposableSingleObserver.java index 56e5c543b7..9126332b21 100644 --- a/src/main/java/io/reactivex/rxjava3/observers/DisposableSingleObserver.java +++ b/src/main/java/io/reactivex/rxjava3/observers/DisposableSingleObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/observers/LambdaConsumerIntrospection.java b/src/main/java/io/reactivex/rxjava3/observers/LambdaConsumerIntrospection.java index e3f5c46cfe..293847979e 100644 --- a/src/main/java/io/reactivex/rxjava3/observers/LambdaConsumerIntrospection.java +++ b/src/main/java/io/reactivex/rxjava3/observers/LambdaConsumerIntrospection.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/observers/ResourceCompletableObserver.java b/src/main/java/io/reactivex/rxjava3/observers/ResourceCompletableObserver.java index df05fe0169..339692d756 100644 --- a/src/main/java/io/reactivex/rxjava3/observers/ResourceCompletableObserver.java +++ b/src/main/java/io/reactivex/rxjava3/observers/ResourceCompletableObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/observers/ResourceMaybeObserver.java b/src/main/java/io/reactivex/rxjava3/observers/ResourceMaybeObserver.java index 22345e60ce..e9df1c3edc 100644 --- a/src/main/java/io/reactivex/rxjava3/observers/ResourceMaybeObserver.java +++ b/src/main/java/io/reactivex/rxjava3/observers/ResourceMaybeObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/observers/ResourceObserver.java b/src/main/java/io/reactivex/rxjava3/observers/ResourceObserver.java index f0810f4c5e..0238dd5a17 100644 --- a/src/main/java/io/reactivex/rxjava3/observers/ResourceObserver.java +++ b/src/main/java/io/reactivex/rxjava3/observers/ResourceObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/observers/ResourceSingleObserver.java b/src/main/java/io/reactivex/rxjava3/observers/ResourceSingleObserver.java index efebfaa85c..b1b9049524 100644 --- a/src/main/java/io/reactivex/rxjava3/observers/ResourceSingleObserver.java +++ b/src/main/java/io/reactivex/rxjava3/observers/ResourceSingleObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/observers/SafeObserver.java b/src/main/java/io/reactivex/rxjava3/observers/SafeObserver.java index c3935e79dc..4a72e5b80e 100644 --- a/src/main/java/io/reactivex/rxjava3/observers/SafeObserver.java +++ b/src/main/java/io/reactivex/rxjava3/observers/SafeObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.observers; import io.reactivex.rxjava3.annotations.NonNull; diff --git a/src/main/java/io/reactivex/rxjava3/observers/SerializedObserver.java b/src/main/java/io/reactivex/rxjava3/observers/SerializedObserver.java index e0d32fbd7a..062a3b6abf 100644 --- a/src/main/java/io/reactivex/rxjava3/observers/SerializedObserver.java +++ b/src/main/java/io/reactivex/rxjava3/observers/SerializedObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.observers; import io.reactivex.rxjava3.annotations.NonNull; diff --git a/src/main/java/io/reactivex/rxjava3/observers/TestObserver.java b/src/main/java/io/reactivex/rxjava3/observers/TestObserver.java index 44b129fdab..8142747ec1 100644 --- a/src/main/java/io/reactivex/rxjava3/observers/TestObserver.java +++ b/src/main/java/io/reactivex/rxjava3/observers/TestObserver.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.observers; import java.util.concurrent.atomic.AtomicReference; diff --git a/src/main/java/io/reactivex/rxjava3/observers/package-info.java b/src/main/java/io/reactivex/rxjava3/observers/package-info.java index dbf39cbef2..09f56f3eb0 100644 --- a/src/main/java/io/reactivex/rxjava3/observers/package-info.java +++ b/src/main/java/io/reactivex/rxjava3/observers/package-info.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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. */ /** @@ -23,7 +20,8 @@ *

* Available observer variants *
- * + *
+ * * * * diff --git a/src/main/java/io/reactivex/rxjava3/internal/fuseable/ConditionalSubscriber.java b/src/main/java/io/reactivex/rxjava3/operators/ConditionalSubscriber.java similarity index 85% rename from src/main/java/io/reactivex/rxjava3/internal/fuseable/ConditionalSubscriber.java rename to src/main/java/io/reactivex/rxjava3/operators/ConditionalSubscriber.java index 9db35aed02..0880d12544 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/fuseable/ConditionalSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/operators/ConditionalSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -11,20 +11,20 @@ * the License for the specific language governing permissions and limitations under the License. */ -package io.reactivex.rxjava3.internal.fuseable; +package io.reactivex.rxjava3.operators; import io.reactivex.rxjava3.annotations.NonNull; import io.reactivex.rxjava3.core.FlowableSubscriber; /** - * A Subscriber with an additional {@link #tryOnNext(Object)} method that - * tells the caller the specified value has been accepted or - * not. + * A {@link FlowableSubscriber} with an additional {@link #tryOnNext(Object)} method that + * tells the caller the specified value has been accepted or not. * *

This allows certain queue-drain or source-drain operators * to avoid requesting 1 on behalf of a dropped value. * * @param the value type + * @since 3.1.1 */ public interface ConditionalSubscriber<@NonNull T> extends FlowableSubscriber { /** diff --git a/src/main/java/io/reactivex/rxjava3/internal/fuseable/QueueDisposable.java b/src/main/java/io/reactivex/rxjava3/operators/QueueDisposable.java similarity index 69% rename from src/main/java/io/reactivex/rxjava3/internal/fuseable/QueueDisposable.java rename to src/main/java/io/reactivex/rxjava3/operators/QueueDisposable.java index 74124d918c..97096064d9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/fuseable/QueueDisposable.java +++ b/src/main/java/io/reactivex/rxjava3/operators/QueueDisposable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,16 +10,15 @@ * 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 io.reactivex.rxjava3.internal.fuseable; -import java.util.Queue; +package io.reactivex.rxjava3.operators; import io.reactivex.rxjava3.annotations.NonNull; import io.reactivex.rxjava3.disposables.Disposable; /** - * An interface extending Queue and Disposable and allows negotiating - * the fusion mode between subsequent operators of the {@code Observable} base reactive type. + * An interface extending {@link SimpleQueue} and {@link Disposable} and allows negotiating + * the fusion mode between subsequent operators of the {@link io.reactivex.rxjava3.core.Observable Observable} base reactive type. *

* The negotiation happens in subscription time when the upstream * calls the {@code onSubscribe} with an instance of this interface. The @@ -27,30 +26,32 @@ * with the appropriate mode before calling {@code request()}. *

* In synchronous fusion, all upstream values are either already available or is generated - * when {@link #poll()} is called synchronously. When the {@link #poll()} returns null, + * when {@link #poll()} is called synchronously. When the {@link #poll()} returns {@code null}, * that is the indication if a terminated stream. In this mode, the upstream won't call the onXXX methods. *

* In asynchronous fusion, upstream values may become available to {@link #poll()} eventually. - * Upstream signals onError() and onComplete() as usual but onNext may not actually contain - * the upstream value but have {@code null} instead. Downstream should treat such onNext as indication - * that {@link #poll()} can be called. + * Upstream signals {@code onError()} and {@code onComplete()} as usual, however, + * {@code onNext} will be called with {@code null} instead of the actual value. + * Downstream should treat such onNext as indication that {@link #poll()} can be called. *

- * The general rules for consuming the {@link Queue} interface: + * The general rules for consuming the {@link SimpleQueue} interface: *

    - *
  • {@link #poll()} has to be called sequentially (from within a serializing drain-loop).
  • + *
  • {@link #poll()} and {@link #clear()} has to be called sequentially (from within a serializing drain-loop).
  • *
  • In addition, callers of {@link #poll()} should be prepared to catch exceptions.
  • *
  • Due to how computation attaches to the {@link #poll()}, {@link #poll()} may return * {@code null} even if a preceding {@link #isEmpty()} returned false.
  • *
*

* Implementations should only allow calling the following methods and the rest of the - * {@link Queue} interface methods should throw {@link UnsupportedOperationException}: + * {@link SimpleQueue} interface methods should throw {@link UnsupportedOperationException}: *

    *
  • {@link #poll()}
  • *
  • {@link #isEmpty()}
  • *
  • {@link #clear()}
  • *
* @param the value type transmitted through the queue + * @see QueueSubscription + * @since 3.1.1 */ public interface QueueDisposable<@NonNull T> extends QueueFuseable, Disposable { } diff --git a/src/main/java/io/reactivex/rxjava3/internal/fuseable/QueueFuseable.java b/src/main/java/io/reactivex/rxjava3/operators/QueueFuseable.java similarity index 95% rename from src/main/java/io/reactivex/rxjava3/internal/fuseable/QueueFuseable.java rename to src/main/java/io/reactivex/rxjava3/operators/QueueFuseable.java index 71b93a75ad..d295d12f0d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/fuseable/QueueFuseable.java +++ b/src/main/java/io/reactivex/rxjava3/operators/QueueFuseable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -11,13 +11,14 @@ * the License for the specific language governing permissions and limitations under the License. */ -package io.reactivex.rxjava3.internal.fuseable; +package io.reactivex.rxjava3.operators; import io.reactivex.rxjava3.annotations.NonNull; /** - * Represents a SimpleQueue plus the means and constants for requesting a fusion mode. + * Represents a {@link SimpleQueue} plus the means and constants for requesting a fusion mode. * @param the value type returned by the SimpleQueue.poll() + * @since 3.1.1 */ public interface QueueFuseable<@NonNull T> extends SimpleQueue { /** diff --git a/src/main/java/io/reactivex/rxjava3/internal/fuseable/QueueSubscription.java b/src/main/java/io/reactivex/rxjava3/operators/QueueSubscription.java similarity index 70% rename from src/main/java/io/reactivex/rxjava3/internal/fuseable/QueueSubscription.java rename to src/main/java/io/reactivex/rxjava3/operators/QueueSubscription.java index 923589377c..eae8922992 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/fuseable/QueueSubscription.java +++ b/src/main/java/io/reactivex/rxjava3/operators/QueueSubscription.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,17 +10,16 @@ * 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 io.reactivex.rxjava3.internal.fuseable; -import java.util.Queue; +package io.reactivex.rxjava3.operators; import org.reactivestreams.Subscription; import io.reactivex.rxjava3.annotations.NonNull; /** - * An interface extending Queue and Subscription and allows negotiating - * the fusion mode between subsequent operators of the {@code Flowable} base reactive type. + * An interface extending {@link SimpleQueue} and {@link Subscription} and allows negotiating + * the fusion mode between subsequent operators of the {@link io.reactivex.rxjava3.core.Flowable Flowable} base reactive type. *

* The negotiation happens in subscription time when the upstream * calls the {@code onSubscribe} with an instance of this interface. The @@ -33,27 +32,30 @@ * in this mode. In this mode, the upstream won't call the onXXX methods. *

* In asynchronous fusion, upstream values may become available to {@link #poll()} eventually. - * Upstream signals onError() and onComplete() as usual but onNext may not actually contain - * the upstream value but have {@code null} instead. Downstream should treat such onNext as indication - * that {@link #poll()} can be called. In this mode, the downstream still has to call {@link #request(long)} + * Upstream signals {@code onError()} and {@code onComplete()} as usual, however, + * {@code onNext} will be called with {@code null} instead of the actual value. + * Downstream should treat such onNext as indication that {@link #poll()} can be called. + * In this mode, the downstream still has to call {@link #request(long)} * to indicate it is prepared to receive more values. *

- * The general rules for consuming the {@link Queue} interface: + * The general rules for consuming the {@link SimpleQueue} interface: *

    - *
  • {@link #poll()} has to be called sequentially (from within a serializing drain-loop).
  • + *
  • {@link #poll()} and {@link #clear()} has to be called sequentially (from within a serializing drain-loop).
  • *
  • In addition, callers of {@link #poll()} should be prepared to catch exceptions.
  • *
  • Due to how computation attaches to the {@link #poll()}, {@link #poll()} may return * {@code null} even if a preceding {@link #isEmpty()} returned false.
  • *
*

* Implementations should only allow calling the following methods and the rest of the - * {@link Queue} interface methods should throw {@link UnsupportedOperationException}: + * {@link SimpleQueue} interface methods should throw {@link UnsupportedOperationException}: *

    *
  • {@link #poll()}
  • *
  • {@link #isEmpty()}
  • *
  • {@link #clear()}
  • *
* @param the value type transmitted through the queue + * @see QueueDisposable + * @since 3.1.1 */ public interface QueueSubscription<@NonNull T> extends QueueFuseable, Subscription { } diff --git a/src/main/java/io/reactivex/rxjava3/internal/fuseable/ScalarSupplier.java b/src/main/java/io/reactivex/rxjava3/operators/ScalarSupplier.java similarity index 96% rename from src/main/java/io/reactivex/rxjava3/internal/fuseable/ScalarSupplier.java rename to src/main/java/io/reactivex/rxjava3/operators/ScalarSupplier.java index eda6086f87..9b79c5c102 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/fuseable/ScalarSupplier.java +++ b/src/main/java/io/reactivex/rxjava3/operators/ScalarSupplier.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,7 +10,8 @@ * 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 io.reactivex.rxjava3.internal.fuseable; + +package io.reactivex.rxjava3.operators; import io.reactivex.rxjava3.annotations.NonNull; import io.reactivex.rxjava3.functions.Supplier; @@ -29,6 +30,7 @@ * single-element sources uniformly. *

* @param the scalar value type held by the implementing reactive type + * @since 3.1.1 */ @FunctionalInterface public interface ScalarSupplier<@NonNull T> extends Supplier { diff --git a/src/main/java/io/reactivex/rxjava3/internal/fuseable/SimplePlainQueue.java b/src/main/java/io/reactivex/rxjava3/operators/SimplePlainQueue.java similarity index 83% rename from src/main/java/io/reactivex/rxjava3/internal/fuseable/SimplePlainQueue.java rename to src/main/java/io/reactivex/rxjava3/operators/SimplePlainQueue.java index c3122038c1..7e0cac21f3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/fuseable/SimplePlainQueue.java +++ b/src/main/java/io/reactivex/rxjava3/operators/SimplePlainQueue.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -11,14 +11,15 @@ * the License for the specific language governing permissions and limitations under the License. */ -package io.reactivex.rxjava3.internal.fuseable; +package io.reactivex.rxjava3.operators; import io.reactivex.rxjava3.annotations.*; /** - * Override of the SimpleQueue interface with no throws Exception on poll(). + * Override of the {@link SimpleQueue} interface with no {@code throws Throwable} on {@code poll()}. * * @param the value type to offer and poll, not null + * @since 3.1.1 */ public interface SimplePlainQueue<@NonNull T> extends SimpleQueue { diff --git a/src/main/java/io/reactivex/rxjava3/internal/fuseable/SimpleQueue.java b/src/main/java/io/reactivex/rxjava3/operators/SimpleQueue.java similarity index 85% rename from src/main/java/io/reactivex/rxjava3/internal/fuseable/SimpleQueue.java rename to src/main/java/io/reactivex/rxjava3/operators/SimpleQueue.java index 49d893031b..a10b7f9a43 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/fuseable/SimpleQueue.java +++ b/src/main/java/io/reactivex/rxjava3/operators/SimpleQueue.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -11,19 +11,24 @@ * the License for the specific language governing permissions and limitations under the License. */ -package io.reactivex.rxjava3.internal.fuseable; +package io.reactivex.rxjava3.operators; import io.reactivex.rxjava3.annotations.*; /** - * A minimalist queue interface without the method bloat of java.util.Collection and java.util.Queue. + * A simplified interface for offering, polling and clearing a queue. + *

+ * This interface does not define most of the {@link java.util.Collection} + * or {@link java.util.Queue} methods as the intended usage of {@code SimpleQueue} + * does not require support for iteration or introspection. * * @param the value type to offer and poll, not null + * @since 3.1.1 */ public interface SimpleQueue<@NonNull T> { /** - * Atomically enqueue a single. + * Atomically enqueue a single value. * @param value the value to enqueue, not null * @return true if successful, false if the value was not enqueued * likely due to reaching the queue capacity) diff --git a/src/main/java/io/reactivex/rxjava3/internal/queue/SpscArrayQueue.java b/src/main/java/io/reactivex/rxjava3/operators/SpscArrayQueue.java similarity index 93% rename from src/main/java/io/reactivex/rxjava3/internal/queue/SpscArrayQueue.java rename to src/main/java/io/reactivex/rxjava3/operators/SpscArrayQueue.java index c86a109f81..1e4c2d4f11 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/queue/SpscArrayQueue.java +++ b/src/main/java/io/reactivex/rxjava3/operators/SpscArrayQueue.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -16,12 +16,11 @@ * https://github.com/JCTools/JCTools/blob/master/jctools-core/src/main/java/org/jctools/queues/atomic */ -package io.reactivex.rxjava3.internal.queue; +package io.reactivex.rxjava3.operators; import java.util.concurrent.atomic.*; import io.reactivex.rxjava3.annotations.Nullable; -import io.reactivex.rxjava3.internal.fuseable.SimplePlainQueue; import io.reactivex.rxjava3.internal.util.Pow2; /** @@ -37,6 +36,7 @@ * This implementation is wait free. * * @param the element type of the queue + * @since 3.1.1 */ public final class SpscArrayQueue extends AtomicReferenceArray implements SimplePlainQueue { private static final long serialVersionUID = -1296597691183856449L; @@ -47,6 +47,12 @@ public final class SpscArrayQueue extends AtomicReferenceArray implements final AtomicLong consumerIndex; final int lookAheadStep; + /** + * Constructs an array-backed queue with the given capacity rounded + * up to the next power of 2 size. + * @param capacity the maximum number of elements the queue would hold, + * rounded up to the next power of 2 + */ public SpscArrayQueue(int capacity) { super(Pow2.roundToPowerOfTwo(capacity)); this.mask = length() - 1; diff --git a/src/main/java/io/reactivex/rxjava3/internal/queue/SpscLinkedArrayQueue.java b/src/main/java/io/reactivex/rxjava3/operators/SpscLinkedArrayQueue.java similarity index 95% rename from src/main/java/io/reactivex/rxjava3/internal/queue/SpscLinkedArrayQueue.java rename to src/main/java/io/reactivex/rxjava3/operators/SpscLinkedArrayQueue.java index 2bd61dcc15..97fac2253a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/queue/SpscLinkedArrayQueue.java +++ b/src/main/java/io/reactivex/rxjava3/operators/SpscLinkedArrayQueue.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -16,18 +16,18 @@ * https://github.com/JCTools/JCTools/blob/master/jctools-core/src/main/java/org/jctools/queues/atomic */ -package io.reactivex.rxjava3.internal.queue; +package io.reactivex.rxjava3.operators; import java.util.concurrent.atomic.*; import io.reactivex.rxjava3.annotations.Nullable; -import io.reactivex.rxjava3.internal.fuseable.SimplePlainQueue; import io.reactivex.rxjava3.internal.util.Pow2; /** * A single-producer single-consumer array-backed queue which can allocate new arrays in case the consumer is slower * than the producer. * @param the contained value type + * @since 3.1.1 */ public final class SpscLinkedArrayQueue implements SimplePlainQueue { static final int MAX_LOOK_AHEAD_STEP = Integer.getInteger("jctools.spsc.max.lookahead.step", 4096); @@ -45,6 +45,11 @@ public final class SpscLinkedArrayQueue implements SimplePlainQueue { private static final Object HAS_NEXT = new Object(); + /** + * Constructs a linked array-based queue instance with the given + * island size rounded up to the next power of 2. + * @param bufferSize the maximum number of elements per island + */ public SpscLinkedArrayQueue(final int bufferSize) { int p2capacity = Pow2.roundToPowerOfTwo(Math.max(8, bufferSize)); int mask = p2capacity - 1; @@ -160,7 +165,13 @@ private T newBufferPoll(AtomicReferenceArray nextBuffer, final long inde return n; } + /** + * Returns the next element in this queue without removing it or {@code null} + * if this queue is empty + * @return the next element or {@code null} + */ @SuppressWarnings("unchecked") + @Nullable public T peek() { final AtomicReferenceArray buffer = consumerBuffer; final long index = lpConsumerIndex(); @@ -186,6 +197,10 @@ public void clear() { while (poll() != null || !isEmpty()) { } // NOPMD } + /** + * Returns the number of elements in the queue. + * @return the number of elements in the queue + */ public int size() { /* * It is possible for a thread to be interrupted or reschedule between the read of the producer and diff --git a/src/main/java/io/reactivex/rxjava3/operators/package-info.java b/src/main/java/io/reactivex/rxjava3/operators/package-info.java new file mode 100644 index 0000000000..93e1ca05be --- /dev/null +++ b/src/main/java/io/reactivex/rxjava3/operators/package-info.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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. + */ + +/** + * Classes and interfaces for writing advanced operators within and outside RxJava. + */ + +package io.reactivex.rxjava3.operators; \ No newline at end of file diff --git a/src/main/java/io/reactivex/rxjava3/parallel/ParallelFailureHandling.java b/src/main/java/io/reactivex/rxjava3/parallel/ParallelFailureHandling.java index 9e78d698e8..ce0496651e 100644 --- a/src/main/java/io/reactivex/rxjava3/parallel/ParallelFailureHandling.java +++ b/src/main/java/io/reactivex/rxjava3/parallel/ParallelFailureHandling.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/parallel/ParallelFlowable.java b/src/main/java/io/reactivex/rxjava3/parallel/ParallelFlowable.java index 58152e2400..8d5414d27c 100644 --- a/src/main/java/io/reactivex/rxjava3/parallel/ParallelFlowable.java +++ b/src/main/java/io/reactivex/rxjava3/parallel/ParallelFlowable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -59,7 +59,7 @@ public abstract class ParallelFlowable<@NonNull T> { */ @BackpressureSupport(BackpressureKind.SPECIAL) @SchedulerSupport(SchedulerSupport.NONE) - public abstract void subscribe(@NonNull Subscriber<@NonNull ? super T>[] subscribers); + public abstract void subscribe(@NonNull Subscriber[] subscribers); /** * Returns the number of expected parallel {@link Subscriber}s. @@ -110,7 +110,7 @@ protected final boolean validate(@NonNull Subscriber<@NonNull ?>[] subscribers) @NonNull @SchedulerSupport(SchedulerSupport.NONE) @BackpressureSupport(BackpressureKind.FULL) - public static <@NonNull T> ParallelFlowable from(@NonNull Publisher<@NonNull ? extends T> source) { + public static <@NonNull T> ParallelFlowable from(@NonNull Publisher source) { return from(source, Runtime.getRuntime().availableProcessors(), Flowable.bufferSize()); } @@ -135,7 +135,7 @@ protected final boolean validate(@NonNull Subscriber<@NonNull ?>[] subscribers) @NonNull @SchedulerSupport(SchedulerSupport.NONE) @BackpressureSupport(BackpressureKind.FULL) - public static <@NonNull T> ParallelFlowable from(@NonNull Publisher<@NonNull ? extends T> source, int parallelism) { + public static <@NonNull T> ParallelFlowable from(@NonNull Publisher source, int parallelism) { return from(source, parallelism, Flowable.bufferSize()); } @@ -164,7 +164,7 @@ protected final boolean validate(@NonNull Subscriber<@NonNull ?>[] subscribers) @NonNull @SchedulerSupport(SchedulerSupport.NONE) @BackpressureSupport(BackpressureKind.FULL) - public static <@NonNull T> ParallelFlowable from(@NonNull Publisher<@NonNull ? extends T> source, + public static <@NonNull T> ParallelFlowable from(@NonNull Publisher source, int parallelism, int prefetch) { Objects.requireNonNull(source, "source is null"); ObjectHelper.verifyPositive(parallelism, "parallelism"); @@ -193,7 +193,7 @@ protected final boolean validate(@NonNull Subscriber<@NonNull ?>[] subscribers) @NonNull @SchedulerSupport(SchedulerSupport.NONE) @BackpressureSupport(BackpressureKind.PASS_THROUGH) - public final ParallelFlowable map(@NonNull Function mapper) { + public final <@NonNull R> ParallelFlowable map(@NonNull Function mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new ParallelMap<>(this, mapper)); } @@ -223,7 +223,7 @@ public final ParallelFlowable map(@NonNull Function ParallelFlowable map(@NonNull Function mapper, @NonNull ParallelFailureHandling errorHandler) { + public final <@NonNull R> ParallelFlowable map(@NonNull Function mapper, @NonNull ParallelFailureHandling errorHandler) { Objects.requireNonNull(mapper, "mapper is null"); Objects.requireNonNull(errorHandler, "errorHandler is null"); return RxJavaPlugins.onAssembly(new ParallelMapTry<>(this, mapper, errorHandler)); @@ -255,7 +255,7 @@ public final ParallelFlowable map(@NonNull Function ParallelFlowable map(@NonNull Function mapper, @NonNull BiFunction errorHandler) { + public final <@NonNull R> ParallelFlowable map(@NonNull Function mapper, @NonNull BiFunction errorHandler) { Objects.requireNonNull(mapper, "mapper is null"); Objects.requireNonNull(errorHandler, "errorHandler is null"); return RxJavaPlugins.onAssembly(new ParallelMapTry<>(this, mapper, errorHandler)); @@ -473,7 +473,7 @@ public final Flowable reduce(@NonNull BiFunction reducer) { @NonNull @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) @SchedulerSupport(SchedulerSupport.NONE) - public final ParallelFlowable reduce(@NonNull Supplier initialSupplier, @NonNull BiFunction reducer) { + public final <@NonNull R> ParallelFlowable reduce(@NonNull Supplier initialSupplier, @NonNull BiFunction reducer) { Objects.requireNonNull(initialSupplier, "initialSupplier is null"); Objects.requireNonNull(reducer, "reducer is null"); return RxJavaPlugins.onAssembly(new ParallelReduce<>(this, initialSupplier, reducer)); @@ -1044,7 +1044,7 @@ public final ParallelFlowable doOnCancel(@NonNull Action onCancel) { @NonNull @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) @SchedulerSupport(SchedulerSupport.NONE) - public final ParallelFlowable collect(@NonNull Supplier collectionSupplier, @NonNull BiConsumer collector) { + public final <@NonNull C> ParallelFlowable collect(@NonNull Supplier collectionSupplier, @NonNull BiConsumer collector) { Objects.requireNonNull(collectionSupplier, "collectionSupplier is null"); Objects.requireNonNull(collector, "collector is null"); return RxJavaPlugins.onAssembly(new ParallelCollect<>(this, collectionSupplier, collector)); @@ -1126,7 +1126,7 @@ public final ParallelFlowable collect(@NonNull Supplier coll @NonNull @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) - public final ParallelFlowable compose(@NonNull ParallelTransformer composer) { + public final <@NonNull U> ParallelFlowable compose(@NonNull ParallelTransformer composer) { return RxJavaPlugins.onAssembly(Objects.requireNonNull(composer, "composer is null").apply(this)); } @@ -1154,7 +1154,7 @@ public final ParallelFlowable compose(@NonNull ParallelTransformer @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final ParallelFlowable flatMap(@NonNull Function> mapper) { + public final <@NonNull R> ParallelFlowable flatMap(@NonNull Function> mapper) { return flatMap(mapper, false, Flowable.bufferSize(), Flowable.bufferSize()); } @@ -1184,8 +1184,8 @@ public final ParallelFlowable flatMap(@NonNull Function ParallelFlowable flatMap( - @NonNull Function> mapper, boolean delayError) { + public final <@NonNull R> ParallelFlowable flatMap( + @NonNull Function> mapper, boolean delayError) { return flatMap(mapper, delayError, Flowable.bufferSize(), Flowable.bufferSize()); } @@ -1218,8 +1218,8 @@ public final ParallelFlowable flatMap( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final ParallelFlowable flatMap( - @NonNull Function> mapper, boolean delayError, int maxConcurrency) { + public final <@NonNull R> ParallelFlowable flatMap( + @NonNull Function> mapper, boolean delayError, int maxConcurrency) { return flatMap(mapper, delayError, maxConcurrency, Flowable.bufferSize()); } @@ -1252,8 +1252,8 @@ public final ParallelFlowable flatMap( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final ParallelFlowable flatMap( - @NonNull Function> mapper, + public final <@NonNull R> ParallelFlowable flatMap( + @NonNull Function> mapper, boolean delayError, int maxConcurrency, int prefetch) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); @@ -1284,8 +1284,8 @@ public final ParallelFlowable flatMap( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final ParallelFlowable concatMap( - @NonNull Function> mapper) { + public final <@NonNull R> ParallelFlowable concatMap( + @NonNull Function> mapper) { return concatMap(mapper, 2); } @@ -1315,8 +1315,8 @@ public final ParallelFlowable concatMap( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final ParallelFlowable concatMap( - @NonNull Function> mapper, + public final <@NonNull R> ParallelFlowable concatMap( + @NonNull Function> mapper, int prefetch) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); @@ -1348,8 +1348,8 @@ public final ParallelFlowable concatMap( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final ParallelFlowable concatMapDelayError( - @NonNull Function> mapper, + public final <@NonNull R> ParallelFlowable concatMapDelayError( + @NonNull Function> mapper, boolean tillTheEnd) { return concatMapDelayError(mapper, 2, tillTheEnd); } @@ -1381,8 +1381,8 @@ public final ParallelFlowable concatMapDelayError( @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final ParallelFlowable concatMapDelayError( - @NonNull Function> mapper, + public final <@NonNull R> ParallelFlowable concatMapDelayError( + @NonNull Function> mapper, int prefetch, boolean tillTheEnd) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); @@ -1419,7 +1419,7 @@ public final ParallelFlowable concatMapDelayError( @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final ParallelFlowable flatMapIterable(@NonNull Function> mapper) { + public final <@NonNull U> ParallelFlowable flatMapIterable(@NonNull Function> mapper) { return flatMapIterable(mapper, Flowable.bufferSize()); } @@ -1455,7 +1455,7 @@ public final ParallelFlowable flatMapIterable(@NonNull Function ParallelFlowable flatMapIterable(@NonNull Function> mapper, int bufferSize) { + public final <@NonNull U> ParallelFlowable flatMapIterable(@NonNull Function> mapper, int bufferSize) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); return RxJavaPlugins.onAssembly(new ParallelFlatMapIterable<>(this, mapper, bufferSize)); @@ -1486,7 +1486,7 @@ public final ParallelFlowable flatMapIterable(@NonNull Function ParallelFlowable mapOptional(@NonNull Function> mapper) { + public final <@NonNull R> ParallelFlowable mapOptional(@NonNull Function> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new ParallelMapOptional<>(this, mapper)); } @@ -1516,7 +1516,7 @@ public final ParallelFlowable mapOptional(@NonNull Function ParallelFlowable mapOptional(@NonNull Function> mapper, @NonNull ParallelFailureHandling errorHandler) { + public final <@NonNull R> ParallelFlowable mapOptional(@NonNull Function> mapper, @NonNull ParallelFailureHandling errorHandler) { Objects.requireNonNull(mapper, "mapper is null"); Objects.requireNonNull(errorHandler, "errorHandler is null"); return RxJavaPlugins.onAssembly(new ParallelMapTryOptional<>(this, mapper, errorHandler)); @@ -1548,7 +1548,7 @@ public final ParallelFlowable mapOptional(@NonNull Function ParallelFlowable mapOptional(@NonNull Function> mapper, @NonNull BiFunction errorHandler) { + public final <@NonNull R> ParallelFlowable mapOptional(@NonNull Function> mapper, @NonNull BiFunction errorHandler) { Objects.requireNonNull(mapper, "mapper is null"); Objects.requireNonNull(errorHandler, "errorHandler is null"); return RxJavaPlugins.onAssembly(new ParallelMapTryOptional<>(this, mapper, errorHandler)); @@ -1604,7 +1604,7 @@ public final ParallelFlowable mapOptional(@NonNull Function ParallelFlowable flatMapStream(@NonNull Function> mapper) { + public final <@NonNull R> ParallelFlowable flatMapStream(@NonNull Function> mapper) { return flatMapStream(mapper, Flowable.bufferSize()); } @@ -1658,7 +1658,7 @@ public final ParallelFlowable mapOptional(@NonNull Function ParallelFlowable flatMapStream(@NonNull Function> mapper, int prefetch) { + public final <@NonNull R> ParallelFlowable flatMapStream(@NonNull Function> mapper, int prefetch) { Objects.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); return RxJavaPlugins.onAssembly(new ParallelFlatMapStream<>(this, mapper, prefetch)); @@ -1688,7 +1688,7 @@ public final ParallelFlowable mapOptional(@NonNull Function Flowable collect(@NonNull Collector collector) { + public final <@NonNull A, @NonNull R> Flowable collect(@NonNull Collector collector) { Objects.requireNonNull(collector, "collector is null"); return RxJavaPlugins.onAssembly(new ParallelCollector<>(this, collector)); } diff --git a/src/main/java/io/reactivex/rxjava3/parallel/ParallelFlowableConverter.java b/src/main/java/io/reactivex/rxjava3/parallel/ParallelFlowableConverter.java index 7033261e65..47510faf37 100644 --- a/src/main/java/io/reactivex/rxjava3/parallel/ParallelFlowableConverter.java +++ b/src/main/java/io/reactivex/rxjava3/parallel/ParallelFlowableConverter.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/parallel/ParallelTransformer.java b/src/main/java/io/reactivex/rxjava3/parallel/ParallelTransformer.java index a10a73ead4..f35f71567c 100644 --- a/src/main/java/io/reactivex/rxjava3/parallel/ParallelTransformer.java +++ b/src/main/java/io/reactivex/rxjava3/parallel/ParallelTransformer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -32,4 +32,4 @@ public interface ParallelTransformer<@NonNull Upstream, @NonNull Downstream> { */ @NonNull ParallelFlowable apply(@NonNull ParallelFlowable upstream); -} \ No newline at end of file +} diff --git a/src/main/java/io/reactivex/rxjava3/parallel/package-info.java b/src/main/java/io/reactivex/rxjava3/parallel/package-info.java index 7c9cc785ad..09605021f0 100644 --- a/src/main/java/io/reactivex/rxjava3/parallel/package-info.java +++ b/src/main/java/io/reactivex/rxjava3/parallel/package-info.java @@ -1,21 +1,18 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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. */ /** * Contains the base type {@link io.reactivex.rxjava3.parallel.ParallelFlowable}, * a sub-DSL for working with {@link io.reactivex.rxjava3.core.Flowable} sequences in parallel. */ -package io.reactivex.rxjava3.parallel; \ No newline at end of file +package io.reactivex.rxjava3.parallel; diff --git a/src/main/java/io/reactivex/rxjava3/plugins/RxJavaPlugins.java b/src/main/java/io/reactivex/rxjava3/plugins/RxJavaPlugins.java index 408eae8d36..2949253b31 100644 --- a/src/main/java/io/reactivex/rxjava3/plugins/RxJavaPlugins.java +++ b/src/main/java/io/reactivex/rxjava3/plugins/RxJavaPlugins.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,11 +10,12 @@ * 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 io.reactivex.rxjava3.plugins; import java.lang.Thread.UncaughtExceptionHandler; import java.util.Objects; -import java.util.concurrent.ThreadFactory; +import java.util.concurrent.*; import org.reactivestreams.Subscriber; @@ -95,22 +96,26 @@ public final class RxJavaPlugins { @SuppressWarnings("rawtypes") @Nullable - static volatile BiFunction onFlowableSubscribe; + static volatile BiFunction onFlowableSubscribe; @SuppressWarnings("rawtypes") @Nullable - static volatile BiFunction onMaybeSubscribe; + static volatile BiFunction onMaybeSubscribe; @SuppressWarnings("rawtypes") @Nullable - static volatile BiFunction onObservableSubscribe; + static volatile BiFunction onObservableSubscribe; @SuppressWarnings("rawtypes") @Nullable - static volatile BiFunction onSingleSubscribe; + static volatile BiFunction onSingleSubscribe; + + @Nullable + static volatile BiFunction onCompletableSubscribe; + @SuppressWarnings("rawtypes") @Nullable - static volatile BiFunction onCompletableSubscribe; + static volatile BiFunction onParallelSubscribe; @Nullable static volatile BooleanSupplier onBeforeBlocking; @@ -397,10 +402,13 @@ static boolean isBug(Throwable error) { return true; } // the sender didn't honor the request amount - // it's either due to an operator bug or concurrent onNext if (error instanceof MissingBackpressureException) { return true; } + // it's either due to an operator bug or concurrent onNext + if (error instanceof QueueOverflowException) { + return true; + } // general protocol violations // it's either due to an operator bug or concurrent onNext if (error instanceof IllegalStateException) { @@ -525,6 +533,7 @@ public static void reset() { setOnMaybeSubscribe(null); setOnParallelAssembly(null); + setOnParallelSubscribe(null); setFailOnNonBlockingScheduler(false); setOnBeforeBlocking(null); @@ -661,7 +670,7 @@ public static void setSingleSchedulerHandler(@Nullable Function getOnCompletableSubscribe() { + public static BiFunction getOnCompletableSubscribe() { return onCompletableSubscribe; } @@ -691,7 +700,7 @@ public static void setSingleSchedulerHandler(@Nullable Function getOnFlowableSubscribe() { + public static BiFunction getOnFlowableSubscribe() { return onFlowableSubscribe; } @@ -701,7 +710,7 @@ public static void setSingleSchedulerHandler(@Nullable Function getOnMaybeSubscribe() { + public static BiFunction getOnMaybeSubscribe() { return onMaybeSubscribe; } @@ -731,7 +740,7 @@ public static void setSingleSchedulerHandler(@Nullable Function getOnSingleSubscribe() { + public static BiFunction getOnSingleSubscribe() { return onSingleSubscribe; } @@ -761,7 +770,7 @@ public static void setSingleSchedulerHandler(@Nullable Function getOnObservableSubscribe() { + public static BiFunction getOnObservableSubscribe() { return onObservableSubscribe; } @@ -781,7 +790,7 @@ public static void setOnCompletableAssembly(@Nullable Function onCompletableSubscribe) { + @Nullable BiFunction onCompletableSubscribe) { if (lockdown) { throw new IllegalStateException("Plugins can't be changed anymore"); } @@ -829,7 +838,7 @@ public static void setOnConnectableFlowableAssembly(@Nullable Function onFlowableSubscribe) { + public static void setOnFlowableSubscribe(@Nullable BiFunction onFlowableSubscribe) { if (lockdown) { throw new IllegalStateException("Plugins can't be changed anymore"); } @@ -841,7 +850,7 @@ public static void setOnFlowableSubscribe(@Nullable BiFunction onMaybeSubscribe) { + public static void setOnMaybeSubscribe(@Nullable BiFunction onMaybeSubscribe) { if (lockdown) { throw new IllegalStateException("Plugins can't be changed anymore"); } @@ -878,7 +887,7 @@ public static void setOnConnectableObservableAssembly(@Nullable Function onObservableSubscribe) { + @Nullable BiFunction onObservableSubscribe) { if (lockdown) { throw new IllegalStateException("Plugins can't be changed anymore"); } @@ -902,7 +911,7 @@ public static void setOnSingleAssembly(@Nullable Function onSingleSubscribe) { + public static void setOnSingleSubscribe(@Nullable BiFunction onSingleSubscribe) { if (lockdown) { throw new IllegalStateException("Plugins can't be changed anymore"); } @@ -918,8 +927,8 @@ public static void setOnSingleSubscribe(@Nullable BiFunction Subscriber<@NonNull ? super T> onSubscribe(@NonNull Flowable source, @NonNull Subscriber<@NonNull ? super T> subscriber) { - BiFunction f = onFlowableSubscribe; + public static <@NonNull T> Subscriber onSubscribe(@NonNull Flowable source, @NonNull Subscriber subscriber) { + BiFunction f = onFlowableSubscribe; if (f != null) { return apply(f, source, subscriber); } @@ -935,8 +944,8 @@ public static void setOnSingleSubscribe(@Nullable BiFunction Observer onSubscribe(@NonNull Observable source, @NonNull Observer observer) { - BiFunction f = onObservableSubscribe; + public static <@NonNull T> Observer onSubscribe(@NonNull Observable source, @NonNull Observer observer) { + BiFunction f = onObservableSubscribe; if (f != null) { return apply(f, source, observer); } @@ -952,8 +961,8 @@ public static Observer onSubscribe(@NonNull Observable source, */ @SuppressWarnings({ "rawtypes", "unchecked" }) @NonNull - public static SingleObserver onSubscribe(@NonNull Single source, @NonNull SingleObserver observer) { - BiFunction f = onSingleSubscribe; + public static <@NonNull T> SingleObserver onSubscribe(@NonNull Single source, @NonNull SingleObserver observer) { + BiFunction f = onSingleSubscribe; if (f != null) { return apply(f, source, observer); } @@ -968,7 +977,7 @@ public static SingleObserver onSubscribe(@NonNull Single sourc */ @NonNull public static CompletableObserver onSubscribe(@NonNull Completable source, @NonNull CompletableObserver observer) { - BiFunction f = onCompletableSubscribe; + BiFunction f = onCompletableSubscribe; if (f != null) { return apply(f, source, observer); } @@ -984,14 +993,31 @@ public static CompletableObserver onSubscribe(@NonNull Completable source, @NonN */ @SuppressWarnings({ "rawtypes", "unchecked" }) @NonNull - public static MaybeObserver onSubscribe(@NonNull Maybe source, @NonNull MaybeObserver observer) { - BiFunction f = onMaybeSubscribe; + public static <@NonNull T> MaybeObserver onSubscribe(@NonNull Maybe source, @NonNull MaybeObserver observer) { + BiFunction f = onMaybeSubscribe; if (f != null) { return apply(f, source, observer); } return observer; } + /** + * Calls the associated hook function. + * @param the value type + * @param source the hook's input value + * @param subscribers the array of subscribers + * @return the value returned by the hook + */ + @SuppressWarnings({ "rawtypes" }) + @NonNull + public static <@NonNull T> Subscriber[] onSubscribe(@NonNull ParallelFlowable source, @NonNull Subscriber[] subscribers) { + BiFunction f = onParallelSubscribe; + if (f != null) { + return apply(f, source, subscribers); + } + return subscribers; + } + /** * Calls the associated hook function. * @param the value type @@ -1000,7 +1026,7 @@ public static MaybeObserver onSubscribe(@NonNull Maybe source, */ @SuppressWarnings({ "rawtypes", "unchecked" }) @NonNull - public static Maybe onAssembly(@NonNull Maybe source) { + public static <@NonNull T> Maybe onAssembly(@NonNull Maybe source) { Function f = onMaybeAssembly; if (f != null) { return apply(f, source); @@ -1016,7 +1042,7 @@ public static Maybe onAssembly(@NonNull Maybe source) { */ @SuppressWarnings({ "rawtypes", "unchecked" }) @NonNull - public static Flowable onAssembly(@NonNull Flowable source) { + public static <@NonNull T> Flowable onAssembly(@NonNull Flowable source) { Function f = onFlowableAssembly; if (f != null) { return apply(f, source); @@ -1032,7 +1058,7 @@ public static Flowable onAssembly(@NonNull Flowable source) { */ @SuppressWarnings({ "rawtypes", "unchecked" }) @NonNull - public static ConnectableFlowable onAssembly(@NonNull ConnectableFlowable source) { + public static <@NonNull T> ConnectableFlowable onAssembly(@NonNull ConnectableFlowable source) { Function f = onConnectableFlowableAssembly; if (f != null) { return apply(f, source); @@ -1048,7 +1074,7 @@ public static ConnectableFlowable onAssembly(@NonNull ConnectableFlowable */ @SuppressWarnings({ "rawtypes", "unchecked" }) @NonNull - public static Observable onAssembly(@NonNull Observable source) { + public static <@NonNull T> Observable onAssembly(@NonNull Observable source) { Function f = onObservableAssembly; if (f != null) { return apply(f, source); @@ -1064,7 +1090,7 @@ public static Observable onAssembly(@NonNull Observable source) { */ @SuppressWarnings({ "rawtypes", "unchecked" }) @NonNull - public static ConnectableObservable onAssembly(@NonNull ConnectableObservable source) { + public static <@NonNull T> ConnectableObservable onAssembly(@NonNull ConnectableObservable source) { Function f = onConnectableObservableAssembly; if (f != null) { return apply(f, source); @@ -1080,7 +1106,7 @@ public static ConnectableObservable onAssembly(@NonNull ConnectableObserv */ @SuppressWarnings({ "rawtypes", "unchecked" }) @NonNull - public static Single onAssembly(@NonNull Single source) { + public static <@NonNull T> Single onAssembly(@NonNull Single source) { Function f = onSingleAssembly; if (f != null) { return apply(f, source); @@ -1128,6 +1154,32 @@ public static void setOnParallelAssembly(@Nullable FunctionHistory: 3.0.11 - experimental + * @param handler the hook function to set, null allowed + * @since 3.1.0 + */ + @SuppressWarnings("rawtypes") + public static void setOnParallelSubscribe(@Nullable BiFunction handler) { + if (lockdown) { + throw new IllegalStateException("Plugins can't be changed anymore"); + } + onParallelSubscribe = handler; + } + + /** + * Returns the current hook function. + *

History: 3.0.11 - experimental + * @return the hook function, may be null + * @since 3.1.0 + */ + @SuppressWarnings("rawtypes") + @Nullable + public static BiFunction getOnParallelSubscribe() { + return onParallelSubscribe; + } + /** * Calls the associated hook function. *

History: 2.0.6 - experimental; 2.1 - beta @@ -1138,7 +1190,7 @@ public static void setOnParallelAssembly(@Nullable Function ParallelFlowable onAssembly(@NonNull ParallelFlowable source) { + public static <@NonNull T> ParallelFlowable onAssembly(@NonNull ParallelFlowable source) { Function f = onParallelAssembly; if (f != null) { return apply(f, source); @@ -1253,6 +1305,26 @@ public static Scheduler createSingleScheduler(@NonNull ThreadFactory threadFacto return new SingleScheduler(Objects.requireNonNull(threadFactory, "threadFactory is null")); } + /** + * Create an instance of a {@link Scheduler} by wrapping an existing {@link Executor}. + *

+ * This method allows creating an {@code Executor}-backed {@code Scheduler} before the {@link Schedulers} class + * would initialize the standard {@code Scheduler}s. + * + * @param executor the {@code Executor} to wrap and turn into a {@code Scheduler}. + * @param interruptibleWorker if {@code true}, the tasks submitted to the {@link io.reactivex.rxjava3.core.Scheduler.Worker Scheduler.Worker} will + * be interrupted when the task is disposed. + * @param fair if {@code true}, tasks submitted to the {@code Scheduler} or {@code Worker} will be executed by the underlying {@code Executor} one after the other, still + * in a FIFO and non-overlapping manner, but allows interleaving with other tasks submitted to the underlying {@code Executor}. + * If {@code false}, the underlying FIFO scheme will execute as many tasks as it can before giving up the underlying {@code Executor} thread. + * @return the new {@code Scheduler} wrapping the {@code Executor} + * @since 3.1.0 + */ + @NonNull + public static Scheduler createExecutorScheduler(@NonNull Executor executor, boolean interruptibleWorker, boolean fair) { + return new ExecutorScheduler(executor, interruptibleWorker, fair); + } + /** * Wraps the call to the function in try-catch and propagates thrown * checked exceptions as RuntimeException. @@ -1263,7 +1335,7 @@ public static Scheduler createSingleScheduler(@NonNull ThreadFactory threadFacto * @return the result of the function call */ @NonNull - static R apply(@NonNull Function f, @NonNull T t) { + static <@NonNull T, @NonNull R> R apply(@NonNull Function f, @NonNull T t) { try { return f.apply(t); } catch (Throwable ex) { @@ -1283,7 +1355,7 @@ static R apply(@NonNull Function f, @NonNull T t) { * @return the result of the function call */ @NonNull - static R apply(@NonNull BiFunction f, @NonNull T t, @NonNull U u) { + static <@NonNull T, @NonNull U, @NonNull R> R apply(@NonNull BiFunction f, @NonNull T t, @NonNull U u) { try { return f.apply(t, u); } catch (Throwable ex) { diff --git a/src/main/java/io/reactivex/rxjava3/plugins/package-info.java b/src/main/java/io/reactivex/rxjava3/plugins/package-info.java index a3105506a4..49390584df 100644 --- a/src/main/java/io/reactivex/rxjava3/plugins/package-info.java +++ b/src/main/java/io/reactivex/rxjava3/plugins/package-info.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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. */ /** diff --git a/src/main/java/io/reactivex/rxjava3/processors/AsyncProcessor.java b/src/main/java/io/reactivex/rxjava3/processors/AsyncProcessor.java index 8037c67ffe..b20c8b23ae 100644 --- a/src/main/java/io/reactivex/rxjava3/processors/AsyncProcessor.java +++ b/src/main/java/io/reactivex/rxjava3/processors/AsyncProcessor.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.processors; import java.util.concurrent.atomic.AtomicReference; @@ -113,7 +114,7 @@ * * @param the value type */ -public final class AsyncProcessor extends FlowableProcessor { +public final class AsyncProcessor<@NonNull T> extends FlowableProcessor { @SuppressWarnings("rawtypes") static final AsyncSubscription[] EMPTY = new AsyncSubscription[0]; @@ -228,7 +229,7 @@ public Throwable getThrowable() { } @Override - protected void subscribeActual(@NonNull Subscriber<@NonNull ? super T> s) { + protected void subscribeActual(@NonNull Subscriber s) { AsyncSubscription as = new AsyncSubscription<>(s, this); s.onSubscribe(as); if (add(as)) { @@ -336,12 +337,12 @@ public T getValue() { return subscribers.get() == TERMINATED ? value : null; } - static final class AsyncSubscription extends DeferredScalarSubscription { + static final class AsyncSubscription<@NonNull T> extends DeferredScalarSubscription { private static final long serialVersionUID = 5629876084736248016L; final AsyncProcessor parent; - AsyncSubscription(Subscriber<@NonNull ? super T> actual, AsyncProcessor parent) { + AsyncSubscription(Subscriber actual, AsyncProcessor parent) { super(actual); this.parent = parent; } diff --git a/src/main/java/io/reactivex/rxjava3/processors/BehaviorProcessor.java b/src/main/java/io/reactivex/rxjava3/processors/BehaviorProcessor.java index 54f16af80d..2e5117ca56 100644 --- a/src/main/java/io/reactivex/rxjava3/processors/BehaviorProcessor.java +++ b/src/main/java/io/reactivex/rxjava3/processors/BehaviorProcessor.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -160,7 +160,7 @@ * @param * the type of item expected to be observed and emitted by the Processor */ -public final class BehaviorProcessor extends FlowableProcessor { +public final class BehaviorProcessor<@NonNull T> extends FlowableProcessor { final AtomicReference[]> subscribers; static final Object[] EMPTY_ARRAY = new Object[0]; @@ -239,7 +239,7 @@ public static BehaviorProcessor create() { } @Override - protected void subscribeActual(@NonNull Subscriber<@NonNull ? super T> s) { + protected void subscribeActual(@NonNull Subscriber s) { BehaviorSubscription bs = new BehaviorSubscription<>(s, this); s.onSubscribe(bs); if (add(bs)) { @@ -306,17 +306,14 @@ public void onComplete() { } /** - * Tries to emit the item to all currently subscribed Subscribers if all of them - * has requested some value, returns false otherwise. - *

- * This method should be called in a sequential manner just like the onXXX methods - * of the PublishProcessor. + * Tries to emit the item to all currently subscribed {@link Subscriber}s if all of them + * has requested some value, returns {@code false} otherwise. *

- * Calling with a null value will terminate the PublishProcessor and a NullPointerException - * is signaled to the Subscribers. + * This method should be called in a sequential manner just like the {@code onXXX} methods + * of this {@code BehaviorProcessor}. *

History: 2.0.8 - experimental - * @param t the item to emit, not null - * @return true if the item was emitted to all Subscribers + * @param t the item to emit, not {@code null} + * @return {@code true} if the item was emitted to all {@code Subscriber}s * @throws NullPointerException if {@code t} is {@code null} * @since 2.2 */ @@ -472,7 +469,7 @@ static final class BehaviorSubscription<@NonNull T> extends AtomicLong implement private static final long serialVersionUID = 3293175281126227086L; - final Subscriber<@NonNull ? super T> downstream; + final Subscriber downstream; final BehaviorProcessor state; boolean next; @@ -485,7 +482,7 @@ static final class BehaviorSubscription<@NonNull T> extends AtomicLong implement long index; - BehaviorSubscription(Subscriber<@NonNull ? super T> actual, BehaviorProcessor state) { + BehaviorSubscription(Subscriber actual, BehaviorProcessor state) { this.downstream = actual; this.state = state; } @@ -593,7 +590,7 @@ public boolean test(Object o) { return false; } cancel(); - downstream.onError(new MissingBackpressureException("Could not deliver value due to lack of requests")); + downstream.onError(MissingBackpressureException.createDefault()); return true; } diff --git a/src/main/java/io/reactivex/rxjava3/processors/FlowableProcessor.java b/src/main/java/io/reactivex/rxjava3/processors/FlowableProcessor.java index 86622298f6..2bfbb33bd0 100644 --- a/src/main/java/io/reactivex/rxjava3/processors/FlowableProcessor.java +++ b/src/main/java/io/reactivex/rxjava3/processors/FlowableProcessor.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/processors/MulticastProcessor.java b/src/main/java/io/reactivex/rxjava3/processors/MulticastProcessor.java index c1e47500a1..14a7a55ee2 100644 --- a/src/main/java/io/reactivex/rxjava3/processors/MulticastProcessor.java +++ b/src/main/java/io/reactivex/rxjava3/processors/MulticastProcessor.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -20,10 +20,9 @@ import io.reactivex.rxjava3.annotations.*; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.internal.functions.ObjectHelper; -import io.reactivex.rxjava3.internal.fuseable.*; -import io.reactivex.rxjava3.internal.queue.*; import io.reactivex.rxjava3.internal.subscriptions.*; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.*; import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** @@ -130,7 +129,7 @@ */ @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) -public final class MulticastProcessor extends FlowableProcessor { +public final class MulticastProcessor<@NonNull T> extends FlowableProcessor { final AtomicInteger wip; @@ -296,7 +295,7 @@ public void onNext(@NonNull T t) { ExceptionHelper.nullCheck(t, "onNext called with a null value."); if (!queue.offer(t)) { SubscriptionHelper.cancel(upstream); - onError(new MissingBackpressureException()); + onError(MissingBackpressureException.createDefault()); return; } } @@ -370,7 +369,7 @@ public Throwable getThrowable() { } @Override - protected void subscribeActual(@NonNull Subscriber<@NonNull ? super T> s) { + protected void subscribeActual(@NonNull Subscriber s) { MulticastSubscription ms = new MulticastSubscription<>(s, this); s.onSubscribe(ms); if (add(ms)) { @@ -584,17 +583,17 @@ void drain() { } } - static final class MulticastSubscription extends AtomicLong implements Subscription { + static final class MulticastSubscription<@NonNull T> extends AtomicLong implements Subscription { private static final long serialVersionUID = -363282618957264509L; - final Subscriber<@NonNull ? super T> downstream; + final Subscriber downstream; final MulticastProcessor parent; long emitted; - MulticastSubscription(Subscriber<@NonNull ? super T> actual, MulticastProcessor parent) { + MulticastSubscription(Subscriber actual, MulticastProcessor parent) { this.downstream = actual; this.parent = parent; } diff --git a/src/main/java/io/reactivex/rxjava3/processors/PublishProcessor.java b/src/main/java/io/reactivex/rxjava3/processors/PublishProcessor.java index b507a2225b..73507844d2 100644 --- a/src/main/java/io/reactivex/rxjava3/processors/PublishProcessor.java +++ b/src/main/java/io/reactivex/rxjava3/processors/PublishProcessor.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.processors; import java.util.concurrent.atomic.*; @@ -106,7 +107,7 @@ * @param the value type multicasted to Subscribers. * @see MulticastProcessor */ -public final class PublishProcessor extends FlowableProcessor { +public final class PublishProcessor<@NonNull T> extends FlowableProcessor { /** The terminated indicator for the subscribers array. */ @SuppressWarnings("rawtypes") static final PublishSubscription[] TERMINATED = new PublishSubscription[0]; @@ -141,7 +142,7 @@ public static PublishProcessor create() { } @Override - protected void subscribeActual(@NonNull Subscriber<@NonNull ? super T> t) { + protected void subscribeActual(@NonNull Subscriber t) { PublishSubscription ps = new PublishSubscription<>(t, this); t.onSubscribe(ps); if (add(ps)) { @@ -270,17 +271,14 @@ public void onComplete() { } /** - * Tries to emit the item to all currently subscribed Subscribers if all of them - * has requested some value, returns false otherwise. - *

- * This method should be called in a sequential manner just like the onXXX methods - * of the PublishProcessor. + * Tries to emit the item to all currently subscribed {@link Subscriber}s if all of them + * has requested some value, returns {@code false} otherwise. *

- * Calling with a null value will terminate the PublishProcessor and a NullPointerException - * is signaled to the Subscribers. + * This method should be called in a sequential manner just like the {@code onXXX} methods + * of this {@code PublishProcessor}. *

History: 2.0.8 - experimental - * @param t the item to emit, not null - * @return true if the item was emitted to all Subscribers + * @param t the item to emit, not {@code null} + * @return {@code true} if the item was emitted to all {@code Subscriber}s * @throws NullPointerException if {@code t} is {@code null} * @since 2.2 */ @@ -340,7 +338,7 @@ static final class PublishSubscription<@NonNull T> extends AtomicLong implements private static final long serialVersionUID = 3562861878281475070L; /** The actual subscriber. */ - final Subscriber<@NonNull ? super T> downstream; + final Subscriber downstream; /** The parent processor servicing this subscriber. */ final PublishProcessor parent; @@ -349,7 +347,7 @@ static final class PublishSubscription<@NonNull T> extends AtomicLong implements * @param actual the actual subscriber * @param parent the parent PublishProcessor */ - PublishSubscription(Subscriber<@NonNull ? super T> actual, PublishProcessor parent) { + PublishSubscription(Subscriber actual, PublishProcessor parent) { this.downstream = actual; this.parent = parent; } @@ -364,7 +362,7 @@ public void onNext(T t) { BackpressureHelper.producedCancel(this, 1); } else { cancel(); - downstream.onError(new MissingBackpressureException("Could not emit value due to lack of requests")); + downstream.onError(MissingBackpressureException.createDefault()); } } diff --git a/src/main/java/io/reactivex/rxjava3/processors/ReplayProcessor.java b/src/main/java/io/reactivex/rxjava3/processors/ReplayProcessor.java index 1c92e9d0ef..ae6a7d3960 100644 --- a/src/main/java/io/reactivex/rxjava3/processors/ReplayProcessor.java +++ b/src/main/java/io/reactivex/rxjava3/processors/ReplayProcessor.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -141,7 +141,7 @@ * * @param the value type */ -public final class ReplayProcessor extends FlowableProcessor { +public final class ReplayProcessor<@NonNull T> extends FlowableProcessor { /** An empty array to avoid allocation in getValues(). */ private static final Object[] EMPTY_ARRAY = new Object[0]; @@ -345,7 +345,7 @@ public static ReplayProcessor createWithTimeAndSize(long maxAge, @NonNull } @Override - protected void subscribeActual(Subscriber<@NonNull ? super T> s) { + protected void subscribeActual(Subscriber s) { ReplaySubscription rs = new ReplaySubscription<>(s, this); s.onSubscribe(rs); @@ -584,7 +584,7 @@ void remove(ReplaySubscription rs) { * * @param the value type */ - interface ReplayBuffer { + interface ReplayBuffer<@NonNull T> { void next(T value); @@ -612,10 +612,10 @@ interface ReplayBuffer { void trimHead(); } - static final class ReplaySubscription extends AtomicInteger implements Subscription { + static final class ReplaySubscription<@NonNull T> extends AtomicInteger implements Subscription { private static final long serialVersionUID = 466549804534799122L; - final Subscriber<@NonNull ? super T> downstream; + final Subscriber downstream; final ReplayProcessor state; Object index; @@ -626,7 +626,7 @@ static final class ReplaySubscription extends AtomicInteger implements Subscr long emitted; - ReplaySubscription(Subscriber<@NonNull ? super T> actual, ReplayProcessor state) { + ReplaySubscription(Subscriber actual, ReplayProcessor state) { this.downstream = actual; this.state = state; this.requested = new AtomicLong(); @@ -728,7 +728,7 @@ public void replay(ReplaySubscription rs) { int missed = 1; final List b = buffer; - final Subscriber<@NonNull ? super T> a = rs.downstream; + final Subscriber a = rs.downstream; Integer indexObject = (Integer)rs.index; int index; @@ -846,7 +846,7 @@ static final class TimedNode extends AtomicReference> { } } - static final class SizeBoundReplayBuffer + static final class SizeBoundReplayBuffer<@NonNull T> implements ReplayBuffer { final int maxSize; @@ -967,7 +967,7 @@ public void replay(ReplaySubscription rs) { } int missed = 1; - final Subscriber<@NonNull ? super T> a = rs.downstream; + final Subscriber a = rs.downstream; Node index = (Node)rs.index; if (index == null) { @@ -1253,7 +1253,7 @@ public void replay(ReplaySubscription rs) { } int missed = 1; - final Subscriber<@NonNull ? super T> a = rs.downstream; + final Subscriber a = rs.downstream; TimedNode index = (TimedNode)rs.index; if (index == null) { diff --git a/src/main/java/io/reactivex/rxjava3/processors/SerializedProcessor.java b/src/main/java/io/reactivex/rxjava3/processors/SerializedProcessor.java index e7740b6523..e40d935c51 100644 --- a/src/main/java/io/reactivex/rxjava3/processors/SerializedProcessor.java +++ b/src/main/java/io/reactivex/rxjava3/processors/SerializedProcessor.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/processors/UnicastProcessor.java b/src/main/java/io/reactivex/rxjava3/processors/UnicastProcessor.java index 7d7e20a075..ad7e7f66b6 100644 --- a/src/main/java/io/reactivex/rxjava3/processors/UnicastProcessor.java +++ b/src/main/java/io/reactivex/rxjava3/processors/UnicastProcessor.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -20,10 +20,10 @@ import io.reactivex.rxjava3.annotations.*; import io.reactivex.rxjava3.internal.functions.*; -import io.reactivex.rxjava3.internal.fuseable.QueueSubscription; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.*; import io.reactivex.rxjava3.internal.util.*; +import io.reactivex.rxjava3.operators.QueueSubscription; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** @@ -147,7 +147,7 @@ * @param the value type received and emitted by this Processor subclass * @since 2.0 */ -public final class UnicastProcessor extends FlowableProcessor { +public final class UnicastProcessor<@NonNull T> extends FlowableProcessor { final SpscLinkedArrayQueue queue; @@ -159,7 +159,7 @@ public final class UnicastProcessor extends FlowableProcessor { Throwable error; - final AtomicReference> downstream; + final AtomicReference> downstream; volatile boolean cancelled; @@ -282,7 +282,7 @@ void doTerminate() { } } - void drainRegular(Subscriber<@NonNull ? super T> a) { + void drainRegular(Subscriber a) { int missed = 1; final SpscLinkedArrayQueue q = queue; @@ -326,7 +326,7 @@ void drainRegular(Subscriber<@NonNull ? super T> a) { } } - void drainFused(Subscriber<@NonNull ? super T> a) { + void drainFused(Subscriber a) { int missed = 1; final SpscLinkedArrayQueue q = queue; @@ -374,7 +374,7 @@ void drain() { int missed = 1; - Subscriber<@NonNull ? super T> a = downstream.get(); + Subscriber a = downstream.get(); for (;;) { if (a != null) { @@ -394,7 +394,7 @@ void drain() { } } - boolean checkTerminated(boolean failFast, boolean d, boolean empty, Subscriber<@NonNull ? super T> a, SpscLinkedArrayQueue q) { + boolean checkTerminated(boolean failFast, boolean d, boolean empty, Subscriber a, SpscLinkedArrayQueue q) { if (cancelled) { q.clear(); downstream.lazySet(null); @@ -475,7 +475,7 @@ public void onComplete() { } @Override - protected void subscribeActual(Subscriber<@NonNull ? super T> s) { + protected void subscribeActual(Subscriber s) { if (!once.get() && once.compareAndSet(false, true)) { s.onSubscribe(wip); diff --git a/src/main/java/io/reactivex/rxjava3/processors/package-info.java b/src/main/java/io/reactivex/rxjava3/processors/package-info.java index be2bb7c954..f4119c9ba8 100644 --- a/src/main/java/io/reactivex/rxjava3/processors/package-info.java +++ b/src/main/java/io/reactivex/rxjava3/processors/package-info.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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. */ /** diff --git a/src/main/java/io/reactivex/rxjava3/schedulers/SchedulerRunnableIntrospection.java b/src/main/java/io/reactivex/rxjava3/schedulers/SchedulerRunnableIntrospection.java index aec3170138..97f8efcc9d 100644 --- a/src/main/java/io/reactivex/rxjava3/schedulers/SchedulerRunnableIntrospection.java +++ b/src/main/java/io/reactivex/rxjava3/schedulers/SchedulerRunnableIntrospection.java @@ -1,8 +1,11 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. + * * Licensed 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. diff --git a/src/main/java/io/reactivex/rxjava3/schedulers/Schedulers.java b/src/main/java/io/reactivex/rxjava3/schedulers/Schedulers.java index 4d4c3517a5..cb25652404 100644 --- a/src/main/java/io/reactivex/rxjava3/schedulers/Schedulers.java +++ b/src/main/java/io/reactivex/rxjava3/schedulers/Schedulers.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -22,22 +22,27 @@ import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** - * Static factory methods for returning standard Scheduler instances. + * Static factory methods for returning standard {@link Scheduler} instances. *

* The initial and runtime values of the various scheduler types can be overridden via the * {@code RxJavaPlugins.setInit(scheduler name)SchedulerHandler()} and * {@code RxJavaPlugins.set(scheduler name)SchedulerHandler()} respectively. + * Note that overriding any initial {@code Scheduler} via the {@link RxJavaPlugins} + * has to happen before the {@code Schedulers} class is accessed. *

* Supported system properties ({@code System.getProperty()}): *

    - *
  • {@code rx3.io-keep-alive-time} (long): sets the keep-alive time of the {@link #io()} Scheduler workers, default is {@link IoScheduler#KEEP_ALIVE_TIME_DEFAULT}
  • - *
  • {@code rx3.io-priority} (int): sets the thread priority of the {@link #io()} Scheduler, default is {@link Thread#NORM_PRIORITY}
  • - *
  • {@code rx3.computation-threads} (int): sets the number of threads in the {@link #computation()} Scheduler, default is the number of available CPUs
  • - *
  • {@code rx3.computation-priority} (int): sets the thread priority of the {@link #computation()} Scheduler, default is {@link Thread#NORM_PRIORITY}
  • - *
  • {@code rx3.newthread-priority} (int): sets the thread priority of the {@link #newThread()} Scheduler, default is {@link Thread#NORM_PRIORITY}
  • - *
  • {@code rx3.single-priority} (int): sets the thread priority of the {@link #single()} Scheduler, default is {@link Thread#NORM_PRIORITY}
  • - *
  • {@code rx3.purge-enabled} (boolean): enables periodic purging of all Scheduler's backing thread pools, default is false
  • - *
  • {@code rx3.purge-period-seconds} (int): specifies the periodic purge interval of all Scheduler's backing thread pools, default is 1 second
  • + *
  • {@code rx3.io-keep-alive-time} (long): sets the keep-alive time of the {@link #io()} {@code Scheduler} workers, default is {@link IoScheduler#KEEP_ALIVE_TIME_DEFAULT}
  • + *
  • {@code rx3.io-priority} (int): sets the thread priority of the {@link #io()} {@code Scheduler}, default is {@link Thread#NORM_PRIORITY}
  • + *
  • {@code rx3.io-scheduled-release} (boolean): {@code true} sets the worker release mode of the + * {@link #io()} {@code Scheduler} to scheduled, default is {@code false} for eager mode.
  • + *
  • {@code rx3.computation-threads} (int): sets the number of threads in the {@link #computation()} {@code Scheduler}, default is the number of available CPUs
  • + *
  • {@code rx3.computation-priority} (int): sets the thread priority of the {@link #computation()} {@code Scheduler}, default is {@link Thread#NORM_PRIORITY}
  • + *
  • {@code rx3.newthread-priority} (int): sets the thread priority of the {@link #newThread()} {@code Scheduler}, default is {@link Thread#NORM_PRIORITY}
  • + *
  • {@code rx3.single-priority} (int): sets the thread priority of the {@link #single()} {@code Scheduler}, default is {@link Thread#NORM_PRIORITY}
  • + *
  • {@code rx3.purge-enabled} (boolean): enables purging of all {@code Scheduler}'s backing thread pools, default is {@code true}
  • + *
  • {@code rx3.scheduler.use-nanotime} (boolean): {@code true} instructs {@code Scheduler} to use {@link System#nanoTime()} for {@link Scheduler#now(TimeUnit)}, + * instead of default {@link System#currentTimeMillis()} ({@code false})
  • *
*/ public final class Schedulers { @@ -105,32 +110,32 @@ private Schedulers() { * not disposing a worker that has timed/delayed tasks not cancelled by other means may leak resources and/or * execute those tasks "unexpectedly". *

- * If the {@link RxJavaPlugins#setFailOnNonBlockingScheduler(boolean)} is set to true, attempting to execute + * If the {@link RxJavaPlugins#setFailOnNonBlockingScheduler(boolean)} is set to {@code true}, attempting to execute * operators that block while running on this scheduler will throw an {@link IllegalStateException}. *

* You can control certain properties of this standard scheduler via system properties that have to be set - * before the {@link Schedulers} class is referenced in your code. + * before the {@code Schedulers} class is referenced in your code. *

Supported system properties ({@code System.getProperty()}): *

    - *
  • {@code rx3.computation-threads} (int): sets the number of threads in the {@code computation()} Scheduler, default is the number of available CPUs
  • - *
  • {@code rx3.computation-priority} (int): sets the thread priority of the {@code computation()} Scheduler, default is {@link Thread#NORM_PRIORITY}
  • + *
  • {@code rx3.computation-threads} (int): sets the number of threads in the {@code computation()} {@code Scheduler}, default is the number of available CPUs
  • + *
  • {@code rx3.computation-priority} (int): sets the thread priority of the {@code computation()} {@code Scheduler}, default is {@link Thread#NORM_PRIORITY}
  • *
*

* The default value of this scheduler can be overridden at initialization time via the * {@link RxJavaPlugins#setInitComputationSchedulerHandler(io.reactivex.rxjava3.functions.Function)} plugin method. * Note that due to possible initialization cycles, using any of the other scheduler-returning methods will - * result in a {@code NullPointerException}. - * Once the {@link Schedulers} class has been initialized, you can override the returned {@link Scheduler} instance + * result in a {@link NullPointerException}. + * Once the {@code Schedulers} class has been initialized, you can override the returned {@code Scheduler} instance * via the {@link RxJavaPlugins#setComputationSchedulerHandler(io.reactivex.rxjava3.functions.Function)} method. *

- * It is possible to create a fresh instance of this scheduler with a custom ThreadFactory, via the + * It is possible to create a fresh instance of this scheduler with a custom {@link ThreadFactory}, via the * {@link RxJavaPlugins#createComputationScheduler(ThreadFactory)} method. Note that such custom * instances require a manual call to {@link Scheduler#shutdown()} to allow the JVM to exit or the * (J2EE) container to unload properly. *

Operators on the base reactive classes that use this scheduler are marked with the * @{@link io.reactivex.rxjava3.annotations.SchedulerSupport SchedulerSupport}({@link io.reactivex.rxjava3.annotations.SchedulerSupport#COMPUTATION COMPUTATION}) * annotation. - * @return a {@link Scheduler} meant for computation-bound work + * @return a {@code Scheduler} meant for computation-bound work */ @NonNull public static Scheduler computation() { @@ -146,7 +151,7 @@ public static Scheduler computation() { * that will try to reuse previously started instances used by the worker * returned by {@link io.reactivex.rxjava3.core.Scheduler#createWorker()} but otherwise will start a new backing * {@link ScheduledExecutorService} instance. Note that this scheduler may create an unbounded number - * of worker threads that can result in system slowdowns or {@code OutOfMemoryError}. Therefore, for casual uses + * of worker threads that can result in system slowdowns or {@link OutOfMemoryError}. Therefore, for casual uses * or when implementing an operator, the Worker instances must be disposed via {@link io.reactivex.rxjava3.core.Scheduler.Worker#dispose()}. *

* It is not recommended to perform computational work on this scheduler. Use {@link #computation()} instead. @@ -154,28 +159,46 @@ public static Scheduler computation() { * Unhandled errors will be delivered to the scheduler Thread's {@link java.lang.Thread.UncaughtExceptionHandler}. *

* You can control certain properties of this standard scheduler via system properties that have to be set - * before the {@link Schedulers} class is referenced in your code. + * before the {@code Schedulers} class is referenced in your code. *

Supported system properties ({@code System.getProperty()}): *

    - *
  • {@code rx3.io-keep-alive-time} (long): sets the keep-alive time of the {@code io()} Scheduler workers, default is {@link IoScheduler#KEEP_ALIVE_TIME_DEFAULT}
  • - *
  • {@code rx3.io-priority} (int): sets the thread priority of the {@code io()} Scheduler, default is {@link Thread#NORM_PRIORITY}
  • + *
  • {@code rx3.io-keep-alive-time} (long): sets the keep-alive time of the {@code io()} {@code Scheduler} workers, default is {@link IoScheduler#KEEP_ALIVE_TIME_DEFAULT}
  • + *
  • {@code rx3.io-priority} (int): sets the thread priority of the {@code io()} {@code Scheduler}, default is {@link Thread#NORM_PRIORITY}
  • + *
  • {@code rx3.io-scheduled-release} (boolean): {@code true} sets the worker release mode of the + * {@code #io()} {@code Scheduler} to scheduled, default is {@code false} for eager mode.
  • *
*

* The default value of this scheduler can be overridden at initialization time via the * {@link RxJavaPlugins#setInitIoSchedulerHandler(io.reactivex.rxjava3.functions.Function)} plugin method. * Note that due to possible initialization cycles, using any of the other scheduler-returning methods will - * result in a {@code NullPointerException}. - * Once the {@link Schedulers} class has been initialized, you can override the returned {@link Scheduler} instance + * result in a {@link NullPointerException}. + * Once the {@code Schedulers} class has been initialized, you can override the returned {@code Scheduler} instance * via the {@link RxJavaPlugins#setIoSchedulerHandler(io.reactivex.rxjava3.functions.Function)} method. *

- * It is possible to create a fresh instance of this scheduler with a custom ThreadFactory, via the + * It is possible to create a fresh instance of this scheduler with a custom {@link ThreadFactory}, via the * {@link RxJavaPlugins#createIoScheduler(ThreadFactory)} method. Note that such custom * instances require a manual call to {@link Scheduler#shutdown()} to allow the JVM to exit or the * (J2EE) container to unload properly. *

Operators on the base reactive classes that use this scheduler are marked with the * @{@link io.reactivex.rxjava3.annotations.SchedulerSupport SchedulerSupport}({@link io.reactivex.rxjava3.annotations.SchedulerSupport#IO IO}) * annotation. - * @return a {@link Scheduler} meant for IO-bound work + *

+ * When the {@link io.reactivex.rxjava3.core.Scheduler.Worker Scheduler.Worker} is disposed, + * the underlying worker can be released to the cached worker pool in two modes: + *

    + *
  • In eager mode (default), the underlying worker is returned immediately to the cached worker pool + * and can be reused much quicker by operators. The drawback is that if the currently running task doesn't + * respond to interruption in time or at all, this may lead to delays or deadlock with the reuse use of the + * underlying worker. + *
  • + *
  • In scheduled mode (enabled via the system parameter {@code rx3.io-scheduled-release} + * set to {@code true}), the underlying worker is returned to the cached worker pool only after the currently running task + * has finished. This can help prevent premature reuse of the underlying worker and likely won't lead to delays or + * deadlock with such reuses. The drawback is that the delay in release may lead to an excess amount of underlying + * workers being created. + *
  • + *
+ * @return a {@code Scheduler} meant for IO-bound work */ @NonNull public static Scheduler io() { @@ -194,7 +217,7 @@ public static Scheduler io() { * by RxJava itself but may be found in external libraries. *

* This scheduler can't be overridden via an {@link RxJavaPlugins} method. - * @return a {@link Scheduler} that queues work on the current thread + * @return a {@code Scheduler} that queues work on the current thread */ @NonNull public static Scheduler trampoline() { @@ -207,33 +230,33 @@ public static Scheduler trampoline() { * The default implementation of this scheduler creates a new, single-threaded {@link ScheduledExecutorService} for * each invocation of the {@link Scheduler#scheduleDirect(Runnable)} (plus its overloads) and {@link Scheduler#createWorker()} * methods, thus an unbounded number of worker threads may be created that can - * result in system slowdowns or {@code OutOfMemoryError}. Therefore, for casual uses or when implementing an operator, + * result in system slowdowns or {@link OutOfMemoryError}. Therefore, for casual uses or when implementing an operator, * the Worker instances must be disposed via {@link io.reactivex.rxjava3.core.Scheduler.Worker#dispose()}. *

* Unhandled errors will be delivered to the scheduler Thread's {@link java.lang.Thread.UncaughtExceptionHandler}. *

* You can control certain properties of this standard scheduler via system properties that have to be set - * before the {@link Schedulers} class is referenced in your code. + * before the {@code Schedulers} class is referenced in your code. *

Supported system properties ({@code System.getProperty()}): *

    - *
  • {@code rx3.newthread-priority} (int): sets the thread priority of the {@code newThread()} Scheduler, default is {@link Thread#NORM_PRIORITY}
  • + *
  • {@code rx3.newthread-priority} (int): sets the thread priority of the {@code newThread()} {@code Scheduler}, default is {@link Thread#NORM_PRIORITY}
  • *
*

* The default value of this scheduler can be overridden at initialization time via the * {@link RxJavaPlugins#setInitNewThreadSchedulerHandler(io.reactivex.rxjava3.functions.Function)} plugin method. * Note that due to possible initialization cycles, using any of the other scheduler-returning methods will - * result in a {@code NullPointerException}. - * Once the {@link Schedulers} class has been initialized, you can override the returned {@link Scheduler} instance + * result in a {@link NullPointerException}. + * Once the {@code Schedulers} class has been initialized, you can override the returned {@code Scheduler} instance * via the {@link RxJavaPlugins#setNewThreadSchedulerHandler(io.reactivex.rxjava3.functions.Function)} method. *

- * It is possible to create a fresh instance of this scheduler with a custom ThreadFactory, via the + * It is possible to create a fresh instance of this scheduler with a custom {@link ThreadFactory}, via the * {@link RxJavaPlugins#createNewThreadScheduler(ThreadFactory)} method. Note that such custom * instances require a manual call to {@link Scheduler#shutdown()} to allow the JVM to exit or the * (J2EE) container to unload properly. *

Operators on the base reactive classes that use this scheduler are marked with the * @{@link io.reactivex.rxjava3.annotations.SchedulerSupport SchedulerSupport}({@link io.reactivex.rxjava3.annotations.SchedulerSupport#NEW_THREAD NEW_TRHEAD}) * annotation. - * @return a {@link Scheduler} that creates new threads + * @return a {@code Scheduler} that creates new threads */ @NonNull public static Scheduler newThread() { @@ -247,7 +270,7 @@ public static Scheduler newThread() { * Uses: *

    *
  • event loop
  • - *
  • support Schedulers.from(Executor) and from(ExecutorService) with delayed scheduling
  • + *
  • support {@code Schedulers.from(}{@link Executor}{@code )} and {@code from(}{@link ExecutorService}{@code )} with delayed scheduling
  • *
  • support benchmarks that pipeline data from some thread to another thread and * avoid core-bashing of computation's round-robin nature
  • *
@@ -258,31 +281,31 @@ public static Scheduler newThread() { * not disposing a worker that has timed/delayed tasks not cancelled by other means may leak resources and/or * execute those tasks "unexpectedly". *

- * If the {@link RxJavaPlugins#setFailOnNonBlockingScheduler(boolean)} is set to true, attempting to execute + * If the {@link RxJavaPlugins#setFailOnNonBlockingScheduler(boolean)} is set to {@code true}, attempting to execute * operators that block while running on this scheduler will throw an {@link IllegalStateException}. *

* You can control certain properties of this standard scheduler via system properties that have to be set - * before the {@link Schedulers} class is referenced in your code. + * before the {@code Schedulers} class is referenced in your code. *

Supported system properties ({@code System.getProperty()}): *

    - *
  • {@code rx3.single-priority} (int): sets the thread priority of the {@code single()} Scheduler, default is {@link Thread#NORM_PRIORITY}
  • + *
  • {@code rx3.single-priority} (int): sets the thread priority of the {@code single()} {@code Scheduler}, default is {@link Thread#NORM_PRIORITY}
  • *
*

* The default value of this scheduler can be overridden at initialization time via the * {@link RxJavaPlugins#setInitSingleSchedulerHandler(io.reactivex.rxjava3.functions.Function)} plugin method. * Note that due to possible initialization cycles, using any of the other scheduler-returning methods will - * result in a {@code NullPointerException}. - * Once the {@link Schedulers} class has been initialized, you can override the returned {@link Scheduler} instance + * result in a {@link NullPointerException}. + * Once the {@code Schedulers} class has been initialized, you can override the returned {@code Scheduler} instance * via the {@link RxJavaPlugins#setSingleSchedulerHandler(io.reactivex.rxjava3.functions.Function)} method. *

- * It is possible to create a fresh instance of this scheduler with a custom ThreadFactory, via the + * It is possible to create a fresh instance of this scheduler with a custom {@link ThreadFactory}, via the * {@link RxJavaPlugins#createSingleScheduler(ThreadFactory)} method. Note that such custom * instances require a manual call to {@link Scheduler#shutdown()} to allow the JVM to exit or the * (J2EE) container to unload properly. *

Operators on the base reactive classes that use this scheduler are marked with the * @{@link io.reactivex.rxjava3.annotations.SchedulerSupport SchedulerSupport}({@link io.reactivex.rxjava3.annotations.SchedulerSupport#SINGLE SINGLE}) * annotation. - * @return a {@link Scheduler} that shares a single backing thread. + * @return a {@code Scheduler} that shares a single backing thread. * @since 2.0 */ @NonNull @@ -291,11 +314,11 @@ public static Scheduler single() { } /** - * Wraps an {@link Executor} into a new Scheduler instance and delegates {@code schedule()} + * Wraps an {@link Executor} into a new {@link Scheduler} instance and delegates {@code schedule()} * calls to it. *

* If the provided executor doesn't support any of the more specific standard Java executor - * APIs, cancelling tasks scheduled by this scheduler can't be interrupted when they are + * APIs, tasks scheduled by this scheduler can't be interrupted when they are * executing but only prevented from running prior to that. In addition, tasks scheduled with * a time delay or periodically will use the {@link #single()} scheduler for the timed waiting * before posting the actual task to the given executor. @@ -304,24 +327,24 @@ public static Scheduler single() { * {@link #from(Executor, boolean)} overload to enable task interruption via this wrapper. *

* If the provided executor supports the standard Java {@link ExecutorService} API, - * cancelling tasks scheduled by this scheduler can be cancelled/interrupted by calling + * tasks scheduled by this scheduler can be cancelled/interrupted by calling * {@link io.reactivex.rxjava3.disposables.Disposable#dispose()}. In addition, tasks scheduled with * a time delay or periodically will use the {@link #single()} scheduler for the timed waiting * before posting the actual task to the given executor. *

* If the provided executor supports the standard Java {@link ScheduledExecutorService} API, - * cancelling tasks scheduled by this scheduler can be cancelled/interrupted by calling + * tasks scheduled by this scheduler can be cancelled/interrupted by calling * {@link io.reactivex.rxjava3.disposables.Disposable#dispose()}. In addition, tasks scheduled with * a time delay or periodically will use the provided executor. Note, however, if the provided * {@code ScheduledExecutorService} instance is not single threaded, tasks scheduled * with a time delay close to each other may end up executing in different order than * the original schedule() call was issued. This limitation may be lifted in a future patch. *

- * The implementation of the Worker of this wrapper Scheduler is eager and will execute as many + * The implementation of the Worker of this wrapper {@code Scheduler} is eager and will execute as many * non-delayed tasks as it can, which may result in a longer than expected occupation of a - * thread of the given backing Executor. In other terms, it does not allow per-Runnable fairness - * in case the worker runs on a shared underlying thread of the Executor. - * See {@link #from(Executor, boolean, boolean)} to create a wrapper that uses the underlying Executor + * thread of the given backing {@code Executor}. In other terms, it does not allow per-{@link Runnable} fairness + * in case the worker runs on a shared underlying thread of the {@code Executor}. + * See {@link #from(Executor, boolean, boolean)} to create a wrapper that uses the underlying {@code Executor} * more fairly. *

* Starting, stopping and restarting this scheduler is not supported (no-op) and the provided @@ -340,26 +363,40 @@ public static Scheduler single() { * } * *

+ * Note that the provided {@code Executor} should avoid throwing a {@link RejectedExecutionException} + * (for example, by shutting it down prematurely or using a bounded-queue {@code ExecutorService}) + * because such circumstances prevent RxJava from progressing flow-related activities correctly. + * If the {@link Executor#execute(Runnable)} or {@link ExecutorService#submit(Callable)} throws, + * the {@code RejectedExecutionException} is routed to the global error handler via + * {@link RxJavaPlugins#onError(Throwable)}. To avoid shutdown-related problems, it is recommended + * all flows using the returned {@code Scheduler} to be canceled/disposed before the underlying + * {@code Executor} is shut down. To avoid problems due to the {@code Executor} having a bounded-queue, + * it is recommended to rephrase the flow to utilize backpressure as the means to limit outstanding work. + *

* This type of scheduler is less sensitive to leaking {@link io.reactivex.rxjava3.core.Scheduler.Worker Scheduler.Worker} instances, although * not disposing a worker that has timed/delayed tasks not cancelled by other means may leak resources and/or * execute those tasks "unexpectedly". *

- * Note that this method returns a new {@link Scheduler} instance, even for the same {@link Executor} instance. + * Note that this method returns a new {@code Scheduler} instance, even for the same {@code Executor} instance. + *

+ * It is possible to wrap an {@code Executor} into a {@code Scheduler} without triggering the initialization of all the + * standard schedulers by using the {@link RxJavaPlugins#createExecutorScheduler(Executor, boolean, boolean)} method + * before the {@code Schedulers} class itself is accessed. * @param executor * the executor to wrap - * @return the new Scheduler wrapping the Executor + * @return the new {@code Scheduler} wrapping the {@code Executor} * @see #from(Executor, boolean, boolean) */ @NonNull public static Scheduler from(@NonNull Executor executor) { - return new ExecutorScheduler(executor, false, false); + return from(executor, false, false); } /** - * Wraps an {@link Executor} into a new Scheduler instance and delegates {@code schedule()} + * Wraps an {@link Executor} into a new {@link Scheduler} instance and delegates {@code schedule()} * calls to it. *

- * The tasks scheduled by the returned {@link Scheduler} and its {@link io.reactivex.rxjava3.core.Scheduler.Worker Scheduler.Worker} + * The tasks scheduled by the returned {@code Scheduler} and its {@link io.reactivex.rxjava3.core.Scheduler.Worker Scheduler.Worker} * can be optionally interrupted. *

* If the provided executor doesn't support any of the more specific standard Java executor @@ -368,24 +405,24 @@ public static Scheduler from(@NonNull Executor executor) { * before posting the actual task to the given executor. *

* If the provided executor supports the standard Java {@link ExecutorService} API, - * canceling tasks scheduled by this scheduler can be cancelled/interrupted by calling + * tasks scheduled by this scheduler can be cancelled/interrupted by calling * {@link io.reactivex.rxjava3.disposables.Disposable#dispose()}. In addition, tasks scheduled with * a time delay or periodically will use the {@link #single()} scheduler for the timed waiting * before posting the actual task to the given executor. *

* If the provided executor supports the standard Java {@link ScheduledExecutorService} API, - * canceling tasks scheduled by this scheduler can be cancelled/interrupted by calling + * tasks scheduled by this scheduler can be cancelled/interrupted by calling * {@link io.reactivex.rxjava3.disposables.Disposable#dispose()}. In addition, tasks scheduled with * a time delay or periodically will use the provided executor. Note, however, if the provided * {@code ScheduledExecutorService} instance is not single threaded, tasks scheduled * with a time delay close to each other may end up executing in different order than * the original schedule() call was issued. This limitation may be lifted in a future patch. *

- * The implementation of the Worker of this wrapper Scheduler is eager and will execute as many + * The implementation of the {@code Worker} of this wrapper {@code Scheduler} is eager and will execute as many * non-delayed tasks as it can, which may result in a longer than expected occupation of a - * thread of the given backing Executor. In other terms, it does not allow per-Runnable fairness - * in case the worker runs on a shared underlying thread of the Executor. - * See {@link #from(Executor, boolean, boolean)} to create a wrapper that uses the underlying Executor + * thread of the given backing {@code Executor}. In other terms, it does not allow per-{@link Runnable} fairness + * in case the worker runs on a shared underlying thread of the {@code Executor}. + * See {@link #from(Executor, boolean, boolean)} to create a wrapper that uses the underlying {@code Executor} * more fairly. *

* Starting, stopping and restarting this scheduler is not supported (no-op) and the provided @@ -404,30 +441,44 @@ public static Scheduler from(@NonNull Executor executor) { * } * *

+ * Note that the provided {@code Executor} should avoid throwing a {@link RejectedExecutionException} + * (for example, by shutting it down prematurely or using a bounded-queue {@code ExecutorService}) + * because such circumstances prevent RxJava from progressing flow-related activities correctly. + * If the {@link Executor#execute(Runnable)} or {@link ExecutorService#submit(Callable)} throws, + * the {@code RejectedExecutionException} is routed to the global error handler via + * {@link RxJavaPlugins#onError(Throwable)}. To avoid shutdown-related problems, it is recommended + * all flows using the returned {@code Scheduler} to be canceled/disposed before the underlying + * {@code Executor} is shut down. To avoid problems due to the {@code Executor} having a bounded-queue, + * it is recommended to rephrase the flow to utilize backpressure as the means to limit outstanding work. + *

* This type of scheduler is less sensitive to leaking {@link io.reactivex.rxjava3.core.Scheduler.Worker Scheduler.Worker} instances, although * not disposing a worker that has timed/delayed tasks not cancelled by other means may leak resources and/or * execute those tasks "unexpectedly". *

- * Note that this method returns a new {@link Scheduler} instance, even for the same {@link Executor} instance. + * Note that this method returns a new {@code Scheduler} instance, even for the same {@code Executor} instance. + *

+ * It is possible to wrap an {@code Executor} into a {@code Scheduler} without triggering the initialization of all the + * standard schedulers by using the {@link RxJavaPlugins#createExecutorScheduler(Executor, boolean, boolean)} method + * before the {@code Schedulers} class itself is accessed. *

History: 2.2.6 - experimental * @param executor * the executor to wrap - * @param interruptibleWorker if {@code true} the tasks submitted to the {@link io.reactivex.rxjava3.core.Scheduler.Worker Scheduler.Worker} will + * @param interruptibleWorker if {@code true}, the tasks submitted to the {@link io.reactivex.rxjava3.core.Scheduler.Worker Scheduler.Worker} will * be interrupted when the task is disposed. - * @return the new Scheduler wrapping the Executor + * @return the new {@code Scheduler} wrapping the {@code Executor} * @since 3.0.0 * @see #from(Executor, boolean, boolean) */ @NonNull public static Scheduler from(@NonNull Executor executor, boolean interruptibleWorker) { - return new ExecutorScheduler(executor, interruptibleWorker, false); + return from(executor, interruptibleWorker, false); } /** - * Wraps an {@link Executor} into a new Scheduler instance and delegates {@code schedule()} + * Wraps an {@link Executor} into a new {@link Scheduler} instance and delegates {@code schedule()} * calls to it. *

- * The tasks scheduled by the returned {@link Scheduler} and its {@link io.reactivex.rxjava3.core.Scheduler.Worker Scheduler.Worker} + * The tasks scheduled by the returned {@code Scheduler} and its {@link io.reactivex.rxjava3.core.Scheduler.Worker Scheduler.Worker} * can be optionally interrupted. *

* If the provided executor doesn't support any of the more specific standard Java executor @@ -436,27 +487,27 @@ public static Scheduler from(@NonNull Executor executor, boolean interruptibleWo * before posting the actual task to the given executor. *

* If the provided executor supports the standard Java {@link ExecutorService} API, - * canceling tasks scheduled by this scheduler can be cancelled/interrupted by calling + * tasks scheduled by this scheduler can be cancelled/interrupted by calling * {@link io.reactivex.rxjava3.disposables.Disposable#dispose()}. In addition, tasks scheduled with * a time delay or periodically will use the {@link #single()} scheduler for the timed waiting * before posting the actual task to the given executor. *

* If the provided executor supports the standard Java {@link ScheduledExecutorService} API, - * canceling tasks scheduled by this scheduler can be cancelled/interrupted by calling + * tasks scheduled by this scheduler can be cancelled/interrupted by calling * {@link io.reactivex.rxjava3.disposables.Disposable#dispose()}. In addition, tasks scheduled with * a time delay or periodically will use the provided executor. Note, however, if the provided * {@code ScheduledExecutorService} instance is not single threaded, tasks scheduled * with a time delay close to each other may end up executing in different order than * the original schedule() call was issued. This limitation may be lifted in a future patch. *

- * The implementation of the Worker of this wrapper Scheduler can operate in both eager (non-fair) and + * The implementation of the Worker of this wrapper {@code Scheduler} can operate in both eager (non-fair) and * fair modes depending on the specified parameter. In eager mode, it will execute as many * non-delayed tasks as it can, which may result in a longer than expected occupation of a - * thread of the given backing Executor. In other terms, it does not allow per-Runnable fairness - * in case the worker runs on a shared underlying thread of the Executor. In fair mode, + * thread of the given backing {@code Executor}. In other terms, it does not allow per-{@link Runnable} fairness + * in case the worker runs on a shared underlying thread of the {@code Executor}. In fair mode, * non-delayed tasks will still be executed in a FIFO and non-overlapping manner, but after each task, - * the execution for the next task is rescheduled with the same underlying Executor, allowing interleaving - * from both the same Scheduler or other external usages of the underlying Executor. + * the execution for the next task is rescheduled with the same underlying {@code Executor}, allowing interleaving + * from both the same {@code Scheduler} or other external usages of the underlying {@code Executor}. *

* Starting, stopping and restarting this scheduler is not supported (no-op) and the provided * executor's lifecycle must be managed externally: @@ -474,28 +525,43 @@ public static Scheduler from(@NonNull Executor executor, boolean interruptibleWo * } * *

+ * Note that the provided {@code Executor} should avoid throwing a {@link RejectedExecutionException} + * (for example, by shutting it down prematurely or using a bounded-queue {@code ExecutorService}) + * because such circumstances prevent RxJava from progressing flow-related activities correctly. + * If the {@link Executor#execute(Runnable)} or {@link ExecutorService#submit(Callable)} throws, + * the {@code RejectedExecutionException} is routed to the global error handler via + * {@link RxJavaPlugins#onError(Throwable)}. To avoid shutdown-related problems, it is recommended + * all flows using the returned {@code Scheduler} to be canceled/disposed before the underlying + * {@code Executor} is shut down. To avoid problems due to the {@code Executor} having a bounded-queue, + * it is recommended to rephrase the flow to utilize backpressure as the means to limit outstanding work. + *

* This type of scheduler is less sensitive to leaking {@link io.reactivex.rxjava3.core.Scheduler.Worker Scheduler.Worker} instances, although * not disposing a worker that has timed/delayed tasks not cancelled by other means may leak resources and/or * execute those tasks "unexpectedly". *

- * Note that this method returns a new {@link Scheduler} instance, even for the same {@link Executor} instance. + * Note that this method returns a new {@code Scheduler} instance, even for the same {@code Executor} instance. + *

+ * It is possible to wrap an {@code Executor} into a {@code Scheduler} without triggering the initialization of all the + * standard schedulers by using the {@link RxJavaPlugins#createExecutorScheduler(Executor, boolean, boolean)} method + * before the {@code Schedulers} class itself is accessed. + * * @param executor * the executor to wrap - * @param interruptibleWorker if {@code true} the tasks submitted to the {@link io.reactivex.rxjava3.core.Scheduler.Worker Scheduler.Worker} will + * @param interruptibleWorker if {@code true}, the tasks submitted to the {@link io.reactivex.rxjava3.core.Scheduler.Worker Scheduler.Worker} will * be interrupted when the task is disposed. - * @param fair if {@code true} tasks submitted to the will be executed by the underlying {@link Executor} one after the other, still + * @param fair if {@code true}, tasks submitted to the {@code Scheduler} or {@code Worker} will be executed by the underlying {@code Executor} one after the other, still * in a FIFO and non-overlapping manner, but allows interleaving with other tasks submitted to the underlying {@code Executor}. * If {@code false}, the underlying FIFO scheme will execute as many tasks as it can before giving up the underlying {@code Executor} thread. - * @return the new Scheduler wrapping the Executor + * @return the new {@code Scheduler} wrapping the {@code Executor} * @since 3.0.0 */ @NonNull public static Scheduler from(@NonNull Executor executor, boolean interruptibleWorker, boolean fair) { - return new ExecutorScheduler(executor, interruptibleWorker, fair); + return RxJavaPlugins.createExecutorScheduler(executor, interruptibleWorker, fair); } /** - * Shuts down the standard Schedulers. + * Shuts down the standard {@link Scheduler}s. *

The operation is idempotent and thread-safe. */ public static void shutdown() { @@ -504,11 +570,10 @@ public static void shutdown() { newThread().shutdown(); single().shutdown(); trampoline().shutdown(); - SchedulerPoolFactory.shutdown(); } /** - * Starts the standard Schedulers. + * Starts the standard {@link Scheduler}s. *

The operation is idempotent and thread-safe. */ public static void start() { @@ -517,7 +582,6 @@ public static void start() { newThread().start(); single().start(); trampoline().start(); - SchedulerPoolFactory.start(); } static final class IOTask implements Supplier { diff --git a/src/main/java/io/reactivex/rxjava3/schedulers/TestScheduler.java b/src/main/java/io/reactivex/rxjava3/schedulers/TestScheduler.java index 3e05665283..33aca58a48 100644 --- a/src/main/java/io/reactivex/rxjava3/schedulers/TestScheduler.java +++ b/src/main/java/io/reactivex/rxjava3/schedulers/TestScheduler.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -15,20 +15,28 @@ import java.util.Queue; import java.util.concurrent.*; +import java.util.concurrent.atomic.AtomicReference; -import io.reactivex.rxjava3.annotations.NonNull; +import io.reactivex.rxjava3.annotations.*; import io.reactivex.rxjava3.core.Scheduler; -import io.reactivex.rxjava3.disposables.*; +import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.internal.disposables.EmptyDisposable; +import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** * A special, non thread-safe scheduler for testing operators that require * a scheduler without introducing real concurrency and allows manually advancing * a virtual time. + *

+ * By default, the tasks submitted via the various {@code schedule} methods are not + * wrapped by the {@link RxJavaPlugins#onSchedule(Runnable)} hook. To enable this behavior, + * create a {@code TestScheduler} via {@link #TestScheduler(boolean)} or {@link #TestScheduler(long, TimeUnit, boolean)}. */ public final class TestScheduler extends Scheduler { /** The ordered queue for the runnable tasks. */ final Queue queue = new PriorityBlockingQueue<>(11); + /** Use the {@link RxJavaPlugins#onSchedule(Runnable)} hook when scheduling tasks. */ + final boolean useOnScheduleHook; /** The per-scheduler global order counter. */ long counter; // Storing time in nanoseconds internally. @@ -38,7 +46,20 @@ public final class TestScheduler extends Scheduler { * Creates a new TestScheduler with initial virtual time of zero. */ public TestScheduler() { - // No-op. + this(false); + } + + /** + * Creates a new TestScheduler with the option to use the + * {@link RxJavaPlugins#onSchedule(Runnable)} hook when scheduling tasks. + *

History: 3.0.10 - experimental + * @param useOnScheduleHook if {@code true}, the tasks submitted to this + * TestScheduler is wrapped via the + * {@link RxJavaPlugins#onSchedule(Runnable)} hook + * @since 3.1.0 + */ + public TestScheduler(boolean useOnScheduleHook) { + this.useOnScheduleHook = useOnScheduleHook; } /** @@ -50,7 +71,26 @@ public TestScheduler() { * the units of time that {@code delayTime} is expressed in */ public TestScheduler(long delayTime, TimeUnit unit) { + this(delayTime, unit, false); + } + + /** + * Creates a new TestScheduler with the specified initial virtual time + * and with the option to use the + * {@link RxJavaPlugins#onSchedule(Runnable)} hook when scheduling tasks. + *

History: 3.0.10 - experimental + * @param delayTime + * the point in time to move the Scheduler's clock to + * @param unit + * the units of time that {@code delayTime} is expressed in + * @param useOnScheduleHook if {@code true}, the tasks submitted to this + * TestScheduler is wrapped via the + * {@link RxJavaPlugins#onSchedule(Runnable)} hook + * @since 3.1.0 + */ + public TestScheduler(long delayTime, TimeUnit unit, boolean useOnScheduleHook) { time = unit.toNanos(delayTime); + this.useOnScheduleHook = useOnScheduleHook; } static final class TimedRunnable implements Comparable { @@ -163,10 +203,13 @@ public Disposable schedule(@NonNull Runnable run, long delayTime, @NonNull TimeU if (disposed) { return EmptyDisposable.INSTANCE; } + if (useOnScheduleHook) { + run = RxJavaPlugins.onSchedule(run); + } final TimedRunnable timedAction = new TimedRunnable(this, time + unit.toNanos(delayTime), run, counter++); queue.add(timedAction); - return Disposable.fromRunnable(new QueueRemove(timedAction)); + return new QueueRemove(timedAction); } @NonNull @@ -175,9 +218,12 @@ public Disposable schedule(@NonNull Runnable run) { if (disposed) { return EmptyDisposable.INSTANCE; } + if (useOnScheduleHook) { + run = RxJavaPlugins.onSchedule(run); + } final TimedRunnable timedAction = new TimedRunnable(this, 0, run, counter++); queue.add(timedAction); - return Disposable.fromRunnable(new QueueRemove(timedAction)); + return new QueueRemove(timedAction); } @Override @@ -185,16 +231,25 @@ public long now(@NonNull TimeUnit unit) { return TestScheduler.this.now(unit); } - final class QueueRemove implements Runnable { - final TimedRunnable timedAction; + final class QueueRemove extends AtomicReference implements Disposable { + + private static final long serialVersionUID = -7874968252110604360L; QueueRemove(TimedRunnable timedAction) { - this.timedAction = timedAction; + this.lazySet(timedAction); + } + + @Override + public void dispose() { + TimedRunnable tr = getAndSet(null); + if (tr != null) { + queue.remove(tr); + } } @Override - public void run() { - queue.remove(timedAction); + public boolean isDisposed() { + return get() == null; } } } diff --git a/src/main/java/io/reactivex/rxjava3/schedulers/Timed.java b/src/main/java/io/reactivex/rxjava3/schedulers/Timed.java index a7b6cc46e7..3ef1940984 100644 --- a/src/main/java/io/reactivex/rxjava3/schedulers/Timed.java +++ b/src/main/java/io/reactivex/rxjava3/schedulers/Timed.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/schedulers/package-info.java b/src/main/java/io/reactivex/rxjava3/schedulers/package-info.java index 4bbd9e0da2..1f96d0fd2a 100644 --- a/src/main/java/io/reactivex/rxjava3/schedulers/package-info.java +++ b/src/main/java/io/reactivex/rxjava3/schedulers/package-info.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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. */ + /** * Contains notably the factory class of {@link io.reactivex.rxjava3.schedulers.Schedulers Schedulers} providing methods for * retrieving the standard scheduler instances, the {@link io.reactivex.rxjava3.schedulers.TestScheduler TestScheduler} for testing flows diff --git a/src/main/java/io/reactivex/rxjava3/subjects/AsyncSubject.java b/src/main/java/io/reactivex/rxjava3/subjects/AsyncSubject.java index cfeafcd4a8..dd4957fd39 100644 --- a/src/main/java/io/reactivex/rxjava3/subjects/AsyncSubject.java +++ b/src/main/java/io/reactivex/rxjava3/subjects/AsyncSubject.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/subjects/BehaviorSubject.java b/src/main/java/io/reactivex/rxjava3/subjects/BehaviorSubject.java index ce89f7b856..2b19ecdd26 100644 --- a/src/main/java/io/reactivex/rxjava3/subjects/BehaviorSubject.java +++ b/src/main/java/io/reactivex/rxjava3/subjects/BehaviorSubject.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -59,9 +59,9 @@ * * TestObserver<Integer> to1 = observable.test(); * - * observable.onNext(1); + * subject.onNext(1); * // this will "clear" the cache - * observable.onNext(EMPTY); + * subject.onNext(EMPTY); * * TestObserver<Integer> to2 = observable.test(); * diff --git a/src/main/java/io/reactivex/rxjava3/subjects/CompletableSubject.java b/src/main/java/io/reactivex/rxjava3/subjects/CompletableSubject.java index 9753d276a1..57be7dbced 100644 --- a/src/main/java/io/reactivex/rxjava3/subjects/CompletableSubject.java +++ b/src/main/java/io/reactivex/rxjava3/subjects/CompletableSubject.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/subjects/MaybeSubject.java b/src/main/java/io/reactivex/rxjava3/subjects/MaybeSubject.java index f06d8c1aae..39dbb78d9c 100644 --- a/src/main/java/io/reactivex/rxjava3/subjects/MaybeSubject.java +++ b/src/main/java/io/reactivex/rxjava3/subjects/MaybeSubject.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/subjects/PublishSubject.java b/src/main/java/io/reactivex/rxjava3/subjects/PublishSubject.java index 2c3a847832..6c2d5ac033 100644 --- a/src/main/java/io/reactivex/rxjava3/subjects/PublishSubject.java +++ b/src/main/java/io/reactivex/rxjava3/subjects/PublishSubject.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/subjects/ReplaySubject.java b/src/main/java/io/reactivex/rxjava3/subjects/ReplaySubject.java index dfa3032ad3..e103594ba5 100644 --- a/src/main/java/io/reactivex/rxjava3/subjects/ReplaySubject.java +++ b/src/main/java/io/reactivex/rxjava3/subjects/ReplaySubject.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -652,8 +652,6 @@ static final class UnboundedReplayBuffer final List buffer; - volatile boolean done; - volatile int size; UnboundedReplayBuffer(int capacityHint) { @@ -671,7 +669,6 @@ public void addFinal(Object notificationLite) { buffer.add(notificationLite); trimHead(); size++; - done = true; } @Override @@ -772,20 +769,17 @@ public void replay(ReplayDisposable rs) { Object o = b.get(index); - if (done) { - if (index + 1 == s) { - s = size; - if (index + 1 == s) { - if (NotificationLite.isComplete(o)) { - a.onComplete(); - } else { - a.onError(NotificationLite.getError(o)); - } - rs.index = null; - rs.cancelled = true; - return; - } - } + if (NotificationLite.isComplete(o)) { + a.onComplete(); + rs.index = null; + rs.cancelled = true; + return; + } else + if (NotificationLite.isError(o)) { + a.onError(NotificationLite.getError(o)); + rs.index = null; + rs.cancelled = true; + return; } a.onNext((T)o); @@ -856,8 +850,6 @@ static final class SizeBoundReplayBuffer Node tail; - volatile boolean done; - SizeBoundReplayBuffer(int maxSize) { this.maxSize = maxSize; Node h = new Node<>(null); @@ -895,7 +887,6 @@ public void addFinal(Object notificationLite) { t.lazySet(n); // releases both the tail and size trimHead(); - done = true; } /** @@ -1000,18 +991,17 @@ public void replay(ReplayDisposable rs) { Object o = n.value; - if (done) { - if (n.get() == null) { - - if (NotificationLite.isComplete(o)) { - a.onComplete(); - } else { - a.onError(NotificationLite.getError(o)); - } - rs.index = null; - rs.cancelled = true; - return; - } + if (NotificationLite.isComplete(o)) { + a.onComplete(); + rs.index = null; + rs.cancelled = true; + return; + } else + if (NotificationLite.isError(o)) { + a.onError(NotificationLite.getError(o)); + rs.index = null; + rs.cancelled = true; + return; } a.onNext((T)o); @@ -1069,8 +1059,6 @@ static final class SizeAndTimeBoundReplayBuffer TimedNode tail; - volatile boolean done; - SizeAndTimeBoundReplayBuffer(int maxSize, long maxAge, TimeUnit unit, Scheduler scheduler) { this.maxSize = maxSize; this.maxAge = maxAge; @@ -1163,8 +1151,6 @@ public void addFinal(Object notificationLite) { size++; t.lazySet(n); // releases both the tail and size trimFinal(); - - done = true; } /** @@ -1290,18 +1276,17 @@ public void replay(ReplayDisposable rs) { Object o = n.value; - if (done) { - if (n.get() == null) { - - if (NotificationLite.isComplete(o)) { - a.onComplete(); - } else { - a.onError(NotificationLite.getError(o)); - } - rs.index = null; - rs.cancelled = true; - return; - } + if (NotificationLite.isComplete(o)) { + a.onComplete(); + rs.index = null; + rs.cancelled = true; + return; + } else + if (NotificationLite.isError(o)) { + a.onError(NotificationLite.getError(o)); + rs.index = null; + rs.cancelled = true; + return; } a.onNext((T)o); diff --git a/src/main/java/io/reactivex/rxjava3/subjects/SerializedSubject.java b/src/main/java/io/reactivex/rxjava3/subjects/SerializedSubject.java index 137cefc895..09a45b1da2 100644 --- a/src/main/java/io/reactivex/rxjava3/subjects/SerializedSubject.java +++ b/src/main/java/io/reactivex/rxjava3/subjects/SerializedSubject.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/subjects/SingleSubject.java b/src/main/java/io/reactivex/rxjava3/subjects/SingleSubject.java index 6f8f8b6f35..7559f0329d 100644 --- a/src/main/java/io/reactivex/rxjava3/subjects/SingleSubject.java +++ b/src/main/java/io/reactivex/rxjava3/subjects/SingleSubject.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/subjects/Subject.java b/src/main/java/io/reactivex/rxjava3/subjects/Subject.java index 35d26d49b5..b76a15da33 100644 --- a/src/main/java/io/reactivex/rxjava3/subjects/Subject.java +++ b/src/main/java/io/reactivex/rxjava3/subjects/Subject.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/subjects/UnicastSubject.java b/src/main/java/io/reactivex/rxjava3/subjects/UnicastSubject.java index 63afa9c335..3092dc73c0 100644 --- a/src/main/java/io/reactivex/rxjava3/subjects/UnicastSubject.java +++ b/src/main/java/io/reactivex/rxjava3/subjects/UnicastSubject.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -21,10 +21,10 @@ import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.internal.disposables.EmptyDisposable; import io.reactivex.rxjava3.internal.functions.*; -import io.reactivex.rxjava3.internal.fuseable.SimpleQueue; import io.reactivex.rxjava3.internal.observers.BasicIntQueueDisposable; -import io.reactivex.rxjava3.internal.queue.SpscLinkedArrayQueue; import io.reactivex.rxjava3.internal.util.ExceptionHelper; +import io.reactivex.rxjava3.operators.SimpleQueue; +import io.reactivex.rxjava3.operators.SpscLinkedArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; /** diff --git a/src/main/java/io/reactivex/rxjava3/subjects/package-info.java b/src/main/java/io/reactivex/rxjava3/subjects/package-info.java index 88fde8391d..a2736d7eee 100644 --- a/src/main/java/io/reactivex/rxjava3/subjects/package-info.java +++ b/src/main/java/io/reactivex/rxjava3/subjects/package-info.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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. */ /** @@ -21,7 +18,8 @@ *

* Available subject classes with their respective base classes and consumer interfaces: *
- *

The available observer types.
Reactive typeBase interfaceSimpleDisposableResource
{@link io.reactivex.rxjava3.core.Observable Observable}
+ *
+ * * * *
The available subject classes with their respective base classes and consumer interfaces.
Subject typeBase classConsumer interface
{@link io.reactivex.rxjava3.subjects.Subject Subject} diff --git a/src/main/java/io/reactivex/rxjava3/subscribers/DefaultSubscriber.java b/src/main/java/io/reactivex/rxjava3/subscribers/DefaultSubscriber.java index 6a936eb8d9..9f8385b586 100644 --- a/src/main/java/io/reactivex/rxjava3/subscribers/DefaultSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/subscribers/DefaultSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/subscribers/DisposableSubscriber.java b/src/main/java/io/reactivex/rxjava3/subscribers/DisposableSubscriber.java index 566b0097f7..a321283018 100644 --- a/src/main/java/io/reactivex/rxjava3/subscribers/DisposableSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/subscribers/DisposableSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/subscribers/ResourceSubscriber.java b/src/main/java/io/reactivex/rxjava3/subscribers/ResourceSubscriber.java index 7d9411048a..95dccfd2b1 100644 --- a/src/main/java/io/reactivex/rxjava3/subscribers/ResourceSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/subscribers/ResourceSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/main/java/io/reactivex/rxjava3/subscribers/SafeSubscriber.java b/src/main/java/io/reactivex/rxjava3/subscribers/SafeSubscriber.java index 0db19796fa..f66c34b9b9 100644 --- a/src/main/java/io/reactivex/rxjava3/subscribers/SafeSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/subscribers/SafeSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.subscribers; import org.reactivestreams.*; @@ -27,7 +28,7 @@ * * @param the value type */ -public final class SafeSubscriber implements FlowableSubscriber, Subscription { +public final class SafeSubscriber<@NonNull T> implements FlowableSubscriber, Subscription { /** The actual Subscriber. */ final Subscriber downstream; /** The subscription. */ diff --git a/src/main/java/io/reactivex/rxjava3/subscribers/SerializedSubscriber.java b/src/main/java/io/reactivex/rxjava3/subscribers/SerializedSubscriber.java index 9698d97e21..1ea8b4021a 100644 --- a/src/main/java/io/reactivex/rxjava3/subscribers/SerializedSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/subscribers/SerializedSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.subscribers; import org.reactivestreams.*; diff --git a/src/main/java/io/reactivex/rxjava3/subscribers/TestSubscriber.java b/src/main/java/io/reactivex/rxjava3/subscribers/TestSubscriber.java index b3a67a89fe..1d96e7cfd3 100644 --- a/src/main/java/io/reactivex/rxjava3/subscribers/TestSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/subscribers/TestSubscriber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.subscribers; import java.util.concurrent.atomic.*; diff --git a/src/main/java/io/reactivex/rxjava3/subscribers/package-info.java b/src/main/java/io/reactivex/rxjava3/subscribers/package-info.java index 348792062a..592aea185b 100644 --- a/src/main/java/io/reactivex/rxjava3/subscribers/package-info.java +++ b/src/main/java/io/reactivex/rxjava3/subscribers/package-info.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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. */ /** diff --git a/src/main/module/module-info.java b/src/main/module/module-info.java new file mode 100644 index 0000000000..4bed327f1a --- /dev/null +++ b/src/main/module/module-info.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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. + */ + +module io.reactivex.rxjava3 { + exports io.reactivex.rxjava3.annotations; + exports io.reactivex.rxjava3.core; + exports io.reactivex.rxjava3.disposables; + exports io.reactivex.rxjava3.exceptions; + exports io.reactivex.rxjava3.flowables; + exports io.reactivex.rxjava3.functions; + exports io.reactivex.rxjava3.observables; + exports io.reactivex.rxjava3.observers; + exports io.reactivex.rxjava3.operators; + exports io.reactivex.rxjava3.parallel; + exports io.reactivex.rxjava3.plugins; + exports io.reactivex.rxjava3.processors; + exports io.reactivex.rxjava3.schedulers; + exports io.reactivex.rxjava3.subjects; + exports io.reactivex.rxjava3.subscribers; + + requires transitive org.reactivestreams; +} \ No newline at end of file diff --git a/src/test/java/io/reactivex/rxjava3/completable/CapturingUncaughtExceptionHandler.java b/src/test/java/io/reactivex/rxjava3/completable/CapturingUncaughtExceptionHandler.java index 66738a5513..8379925bee 100644 --- a/src/test/java/io/reactivex/rxjava3/completable/CapturingUncaughtExceptionHandler.java +++ b/src/test/java/io/reactivex/rxjava3/completable/CapturingUncaughtExceptionHandler.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.completable; diff --git a/src/test/java/io/reactivex/rxjava3/completable/CompletableRetryTest.java b/src/test/java/io/reactivex/rxjava3/completable/CompletableRetryTest.java index c805f68c6f..3d3ad65968 100644 --- a/src/test/java/io/reactivex/rxjava3/completable/CompletableRetryTest.java +++ b/src/test/java/io/reactivex/rxjava3/completable/CompletableRetryTest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2017-present, RxJava Contributors. +/* + * Copyright (c) 2016-present, RxJava Contributors. * * Licensed 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 diff --git a/src/test/java/io/reactivex/rxjava3/completable/CompletableTest.java b/src/test/java/io/reactivex/rxjava3/completable/CompletableTest.java index 904a31701a..9f64b81d12 100644 --- a/src/test/java/io/reactivex/rxjava3/completable/CompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/completable/CompletableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/completable/CompletableTimerTest.java b/src/test/java/io/reactivex/rxjava3/completable/CompletableTimerTest.java index 17f1e7beae..cad1780eb6 100644 --- a/src/test/java/io/reactivex/rxjava3/completable/CompletableTimerTest.java +++ b/src/test/java/io/reactivex/rxjava3/completable/CompletableTimerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/core/BackpressureEnumTest.java b/src/test/java/io/reactivex/rxjava3/core/BackpressureEnumTest.java index 583899167d..e007bfe8ef 100644 --- a/src/test/java/io/reactivex/rxjava3/core/BackpressureEnumTest.java +++ b/src/test/java/io/reactivex/rxjava3/core/BackpressureEnumTest.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.core; import static org.junit.Assert.*; diff --git a/src/test/java/io/reactivex/rxjava3/core/ConverterTest.java b/src/test/java/io/reactivex/rxjava3/core/ConverterTest.java index 68006e3c64..1d0ddd5e40 100644 --- a/src/test/java/io/reactivex/rxjava3/core/ConverterTest.java +++ b/src/test/java/io/reactivex/rxjava3/core/ConverterTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/core/DisposeTaskTest.java b/src/test/java/io/reactivex/rxjava3/core/DisposeTaskTest.java index 64a13fdb6d..d429b588f7 100644 --- a/src/test/java/io/reactivex/rxjava3/core/DisposeTaskTest.java +++ b/src/test/java/io/reactivex/rxjava3/core/DisposeTaskTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/core/NotificationTest.java b/src/test/java/io/reactivex/rxjava3/core/NotificationTest.java index 1cebd84f0d..b26262c15c 100644 --- a/src/test/java/io/reactivex/rxjava3/core/NotificationTest.java +++ b/src/test/java/io/reactivex/rxjava3/core/NotificationTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/core/PeriodicDirectTaskTest.java b/src/test/java/io/reactivex/rxjava3/core/PeriodicDirectTaskTest.java index cd8469ae07..077171acdb 100644 --- a/src/test/java/io/reactivex/rxjava3/core/PeriodicDirectTaskTest.java +++ b/src/test/java/io/reactivex/rxjava3/core/PeriodicDirectTaskTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/core/Retry.java b/src/test/java/io/reactivex/rxjava3/core/Retry.java index a738e0e3c7..5d543afb1c 100644 --- a/src/test/java/io/reactivex/rxjava3/core/Retry.java +++ b/src/test/java/io/reactivex/rxjava3/core/Retry.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -75,4 +75,4 @@ public Statement apply(Statement base, Description description) { private Statement statement(final Statement base, final Description description) { return new RetryStatement(base, description); } -} \ No newline at end of file +} diff --git a/src/test/java/io/reactivex/rxjava3/core/RxJavaTest.java b/src/test/java/io/reactivex/rxjava3/core/RxJavaTest.java index 8eaf638916..1e6d9fd33d 100644 --- a/src/test/java/io/reactivex/rxjava3/core/RxJavaTest.java +++ b/src/test/java/io/reactivex/rxjava3/core/RxJavaTest.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.core; import java.util.concurrent.TimeUnit; diff --git a/src/test/java/io/reactivex/rxjava3/core/SchedulerTest.java b/src/test/java/io/reactivex/rxjava3/core/SchedulerTest.java index a8e661fe75..bbb36f1594 100644 --- a/src/test/java/io/reactivex/rxjava3/core/SchedulerTest.java +++ b/src/test/java/io/reactivex/rxjava3/core/SchedulerTest.java @@ -1,25 +1,61 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.core; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import org.junit.After; import org.junit.Test; +import java.util.concurrent.TimeUnit; + public class SchedulerTest { + private static final String DRIFT_USE_NANOTIME = "rx3.scheduler.use-nanotime"; + + @After + public void cleanup() { + // reset value to default in order to not influence other tests + Scheduler.IS_DRIFT_USE_NANOTIME = false; + } + + @Test + public void driftUseNanoTimeNotSetByDefault() { + assertFalse(Scheduler.IS_DRIFT_USE_NANOTIME); + assertFalse(Boolean.getBoolean(DRIFT_USE_NANOTIME)); + } + + @Test + public void computeNow_currentTimeMillis() { + TimeUnit unit = TimeUnit.MILLISECONDS; + assertTrue(isInRange(System.currentTimeMillis(), Scheduler.computeNow(unit), unit, 250, TimeUnit.MILLISECONDS)); + } + + @Test + public void computeNow_nanoTime() { + TimeUnit unit = TimeUnit.NANOSECONDS; + Scheduler.IS_DRIFT_USE_NANOTIME = true; + + assertFalse(isInRange(System.currentTimeMillis(), Scheduler.computeNow(unit), unit, 250, TimeUnit.MILLISECONDS)); + assertTrue(isInRange(System.nanoTime(), Scheduler.computeNow(unit), TimeUnit.NANOSECONDS, 250, TimeUnit.MILLISECONDS)); + } + + private boolean isInRange(long start, long stop, TimeUnit source, long maxDiff, TimeUnit diffUnit) { + long diff = Math.abs(stop - start); + return diffUnit.convert(diff, source) <= maxDiff; + } @Test public void clockDriftCalculation() { diff --git a/src/test/java/io/reactivex/rxjava3/core/TransformerTest.java b/src/test/java/io/reactivex/rxjava3/core/TransformerTest.java index 20725c80fa..c672196b60 100644 --- a/src/test/java/io/reactivex/rxjava3/core/TransformerTest.java +++ b/src/test/java/io/reactivex/rxjava3/core/TransformerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/core/XFlatMapTest.java b/src/test/java/io/reactivex/rxjava3/core/XFlatMapTest.java index 06394de7ab..16ebfcb9a3 100644 --- a/src/test/java/io/reactivex/rxjava3/core/XFlatMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/core/XFlatMapTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/disposables/CompositeDisposableTest.java b/src/test/java/io/reactivex/rxjava3/disposables/CompositeDisposableTest.java index 73d605c2cc..3f76d283d7 100644 --- a/src/test/java/io/reactivex/rxjava3/disposables/CompositeDisposableTest.java +++ b/src/test/java/io/reactivex/rxjava3/disposables/CompositeDisposableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -290,7 +290,7 @@ public void tryRemoveIfNotIn() { cd.remove(cd1); cd.add(cd2); - cd.remove(cd1); // try removing agian + cd.remove(cd1); // try removing again } @Test(expected = NullPointerException.class) diff --git a/src/test/java/io/reactivex/rxjava3/disposables/DisposableTest.java b/src/test/java/io/reactivex/rxjava3/disposables/DisposableTest.java index b966a1db0f..e541d404da 100644 --- a/src/test/java/io/reactivex/rxjava3/disposables/DisposableTest.java +++ b/src/test/java/io/reactivex/rxjava3/disposables/DisposableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/disposables/FutureDisposableTest.java b/src/test/java/io/reactivex/rxjava3/disposables/FutureDisposableTest.java index 3ae97dd306..544e39ad1b 100644 --- a/src/test/java/io/reactivex/rxjava3/disposables/FutureDisposableTest.java +++ b/src/test/java/io/reactivex/rxjava3/disposables/FutureDisposableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/disposables/SequentialDisposableTest.java b/src/test/java/io/reactivex/rxjava3/disposables/SequentialDisposableTest.java index 62248db45e..3066343301 100644 --- a/src/test/java/io/reactivex/rxjava3/disposables/SequentialDisposableTest.java +++ b/src/test/java/io/reactivex/rxjava3/disposables/SequentialDisposableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/disposables/SerialDisposableTests.java b/src/test/java/io/reactivex/rxjava3/disposables/SerialDisposableTests.java index aa53f2ecb0..3a2e73582b 100644 --- a/src/test/java/io/reactivex/rxjava3/disposables/SerialDisposableTests.java +++ b/src/test/java/io/reactivex/rxjava3/disposables/SerialDisposableTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/exceptions/CompositeExceptionTest.java b/src/test/java/io/reactivex/rxjava3/exceptions/CompositeExceptionTest.java index 331a7dce9c..cc34f62b89 100644 --- a/src/test/java/io/reactivex/rxjava3/exceptions/CompositeExceptionTest.java +++ b/src/test/java/io/reactivex/rxjava3/exceptions/CompositeExceptionTest.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.exceptions; import static org.junit.Assert.*; @@ -150,7 +148,7 @@ public void compositeExceptionFromTwoDuplicateComposites() { cex.getCause().printStackTrace(); } - /** + /* * This hijacks the Throwable.printStackTrace() output and puts it in a string, where we can look for * "CIRCULAR REFERENCE" (a String added by Throwable.printEnclosedStackTrace) */ diff --git a/src/test/java/io/reactivex/rxjava3/exceptions/ExceptionsTest.java b/src/test/java/io/reactivex/rxjava3/exceptions/ExceptionsTest.java index 3d2e1eeec4..b6aa069010 100644 --- a/src/test/java/io/reactivex/rxjava3/exceptions/ExceptionsTest.java +++ b/src/test/java/io/reactivex/rxjava3/exceptions/ExceptionsTest.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.exceptions; import static org.junit.Assert.*; diff --git a/src/test/java/io/reactivex/rxjava3/exceptions/OnErrorNotImplementedExceptionTest.java b/src/test/java/io/reactivex/rxjava3/exceptions/OnErrorNotImplementedExceptionTest.java index b8a78de7dc..70ba775bc1 100644 --- a/src/test/java/io/reactivex/rxjava3/exceptions/OnErrorNotImplementedExceptionTest.java +++ b/src/test/java/io/reactivex/rxjava3/exceptions/OnErrorNotImplementedExceptionTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/exceptions/TestException.java b/src/test/java/io/reactivex/rxjava3/exceptions/TestException.java index 8618c7df5e..7bcdd318fd 100644 --- a/src/test/java/io/reactivex/rxjava3/exceptions/TestException.java +++ b/src/test/java/io/reactivex/rxjava3/exceptions/TestException.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -14,7 +14,7 @@ package io.reactivex.rxjava3.exceptions; /** - * Exception for testing if unchecked expections propagate as-is without confusing with + * Exception for testing if unchecked exceptions propagate as-is without confusing with * other type of common exceptions. */ public final class TestException extends RuntimeException { diff --git a/src/test/java/io/reactivex/rxjava3/flowable/Burst.java b/src/test/java/io/reactivex/rxjava3/flowable/Burst.java index 791ec79a2f..efa0993042 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/Burst.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/Burst.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.flowable; import java.util.*; diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableBackpressureTests.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableBackpressureTests.java index 7d0687dd72..e6b3a02c68 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableBackpressureTests.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableBackpressureTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -24,7 +24,7 @@ import org.reactivestreams.*; import io.reactivex.rxjava3.core.*; -import io.reactivex.rxjava3.exceptions.MissingBackpressureException; +import io.reactivex.rxjava3.exceptions.QueueOverflowException; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.BackpressureHelper; @@ -132,7 +132,7 @@ public void mergeSync() { assertEquals(num, ts.values().size()); // either one can starve the other, but neither should be capable of doing more than 5 batches (taking 4.1) // TODO is it possible to make this deterministic rather than one possibly starving the other? - // benjchristensen => In general I'd say it's not worth trying to make it so, as "fair" algoritms generally take a performance hit + // benjchristensen => In general I'd say it's not worth trying to make it so, as "fair" algorithms generally take a performance hit assertTrue(c1.get() < Flowable.bufferSize() * 5); assertTrue(c2.get() < Flowable.bufferSize() * 5); } @@ -154,7 +154,7 @@ public void mergeAsync() { assertEquals(num, ts.values().size()); // either one can starve the other, but neither should be capable of doing more than 5 batches (taking 4.1) // TODO is it possible to make this deterministic rather than one possibly starving the other? - // benjchristensen => In general I'd say it's not worth trying to make it so, as "fair" algoritms generally take a performance hit + // benjchristensen => In general I'd say it's not worth trying to make it so, as "fair" algorithms generally take a performance hit int max = Flowable.bufferSize() * 7; assertTrue("" + c1.get() + " >= " + max, c1.get() < max); assertTrue("" + c2.get() + " >= " + max, c2.get() < max); @@ -206,7 +206,7 @@ public void mergeAsyncThenObserveOn() { assertEquals(num, ts.values().size()); // either one can starve the other, but neither should be capable of doing more than 5 batches (taking 4.1) // TODO is it possible to make this deterministic rather than one possibly starving the other? - // benjchristensen => In general I'd say it's not worth trying to make it so, as "fair" algoritms generally take a performance hit + // benjchristensen => In general I'd say it's not worth trying to make it so, as "fair" algorithms generally take a performance hit // akarnokd => run this in a loop over 10k times and never saw values get as high as 7*SIZE, but since observeOn delays the unsubscription non-deterministically, the test will remain unreliable assertTrue(c1.get() < Flowable.bufferSize() * 7); assertTrue(c2.get() < Flowable.bufferSize() * 7); @@ -475,7 +475,7 @@ public Integer apply(Integer v) { int vc = ts.values().size(); assertTrue("10 < " + vc, vc <= 10); - ts.assertError(MissingBackpressureException.class); + ts.assertError(QueueOverflowException.class); } @Test diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableCollectTest.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableCollectTest.java index ea93877cdc..7077995982 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableCollectTest.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableCollectTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableCombineLatestTests.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableCombineLatestTests.java index 3adac790ae..107c5e583f 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableCombineLatestTests.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableCombineLatestTests.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.flowable; import org.junit.Test; diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableConcatTests.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableConcatTests.java index 5d54f9df5f..5efb4195e6 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableConcatTests.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableConcatTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.flowable; import static org.junit.Assert.assertEquals; diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableConversionTest.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableConversionTest.java index a579a82ae7..7079f833f2 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableConversionTest.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableConversionTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableCovarianceTest.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableCovarianceTest.java index ae50092ce9..9d7ca31319 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableCovarianceTest.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableCovarianceTest.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.flowable; diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableDoAfterNextTest.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableDoAfterNextTest.java index 58f21b10d3..eb6878edbd 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableDoAfterNextTest.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableDoAfterNextTest.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.flowable; import static org.junit.Assert.assertEquals; diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableDoOnTest.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableDoOnTest.java index b1b12c5577..f4ff588d53 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableDoOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableDoOnTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableErrorHandlingTests.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableErrorHandlingTests.java index df123ee304..e15c7a1dec 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableErrorHandlingTests.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableErrorHandlingTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableEventStream.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableEventStream.java index 861d67c68d..2428d6cb04 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableEventStream.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableEventStream.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableEventStreamTest.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableEventStreamTest.java index 8965376b8a..dd38b88afc 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableEventStreamTest.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableEventStreamTest.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.flowable; diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableFuseableTest.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableFuseableTest.java index 02fa0e5be7..7bf54e8aba 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableFuseableTest.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableFuseableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.flowable; import java.util.Arrays; @@ -17,7 +18,7 @@ import org.junit.Test; import io.reactivex.rxjava3.core.*; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.testsupport.TestHelper; public class FlowableFuseableTest extends RxJavaTest { diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableGroupByTests.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableGroupByTests.java index b7e4edcab4..e37934eadd 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableGroupByTests.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableGroupByTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableMergeTests.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableMergeTests.java index e200cd0f12..d549c3fbb4 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableMergeTests.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableMergeTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableNotificationTest.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableNotificationTest.java index 2e2b95bbd8..08d1994fcb 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableNotificationTest.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableNotificationTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableNullTests.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableNullTests.java index b08d6824e5..748a12d3c3 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableNullTests.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableNullTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableReduceTests.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableReduceTests.java index 1e6abe83c9..5dd3c28cb2 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableReduceTests.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableReduceTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableStartWithTests.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableStartWithTests.java index 7ac13a4bd6..28549b1a90 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableStartWithTests.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableStartWithTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableSubscriberTest.java index 2a27aaada0..b1eb9ce600 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableSubscriberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableTests.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableTests.java index 7662f3ebdf..1fa80701be 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableTests.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableThrottleLastTests.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableThrottleLastTests.java index c6db747cf1..c5c858c430 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableThrottleLastTests.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableThrottleLastTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -13,10 +13,14 @@ package io.reactivex.rxjava3.flowable; -import static org.mockito.Mockito.inOrder; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.*; import java.util.concurrent.TimeUnit; +import io.reactivex.rxjava3.core.Observer; +import io.reactivex.rxjava3.exceptions.TestException; +import io.reactivex.rxjava3.functions.Action; import org.junit.Test; import org.mockito.InOrder; import org.reactivestreams.Subscriber; @@ -28,6 +32,72 @@ public class FlowableThrottleLastTests extends RxJavaTest { + @Test + public void throttleWithDroppedCallbackException() throws Throwable { + Subscriber subscriber = TestHelper.mockSubscriber(); + Action whenDisposed = mock(Action.class); + + TestScheduler s = new TestScheduler(); + PublishProcessor o = PublishProcessor.create(); + o.doOnCancel(whenDisposed) + .throttleLast(500, TimeUnit.MILLISECONDS, s, e-> { + if (e == 1) { + throw new TestException("forced"); + } + }) + .subscribe(subscriber); + + // send events with simulated time increments + s.advanceTimeTo(0, TimeUnit.MILLISECONDS); + o.onNext(1); // skip + o.onNext(2); // deliver + s.advanceTimeTo(501, TimeUnit.MILLISECONDS); + + InOrder inOrder = inOrder(subscriber); + inOrder.verify(subscriber).onError(any(TestException.class)); + inOrder.verifyNoMoreInteractions(); + verify(whenDisposed).run(); + } + + @Test + public void throttleWithDroppedCallback() { + Subscriber subscriber = TestHelper.mockSubscriber(); + Observer dropCallbackObserver = TestHelper.mockObserver(); + + TestScheduler s = new TestScheduler(); + PublishProcessor o = PublishProcessor.create(); + o.throttleLast(500, TimeUnit.MILLISECONDS, s, dropCallbackObserver::onNext).subscribe(subscriber); + + // send events with simulated time increments + s.advanceTimeTo(0, TimeUnit.MILLISECONDS); + o.onNext(1); // skip + o.onNext(2); // deliver + s.advanceTimeTo(501, TimeUnit.MILLISECONDS); + o.onNext(3); // skip + s.advanceTimeTo(600, TimeUnit.MILLISECONDS); + o.onNext(4); // skip + s.advanceTimeTo(700, TimeUnit.MILLISECONDS); + o.onNext(5); // skip + o.onNext(6); // deliver + s.advanceTimeTo(1001, TimeUnit.MILLISECONDS); + o.onNext(7); // deliver + s.advanceTimeTo(1501, TimeUnit.MILLISECONDS); + o.onComplete(); + + InOrder inOrder = inOrder(subscriber); + InOrder dropCallbackOrder = inOrder(dropCallbackObserver); + dropCallbackOrder.verify(dropCallbackObserver).onNext(1); + inOrder.verify(subscriber).onNext(2); + dropCallbackOrder.verify(dropCallbackObserver).onNext(3); + dropCallbackOrder.verify(dropCallbackObserver).onNext(4); + dropCallbackOrder.verify(dropCallbackObserver).onNext(5); + inOrder.verify(subscriber).onNext(6); + inOrder.verify(subscriber).onNext(7); + inOrder.verify(subscriber).onComplete(); + inOrder.verifyNoMoreInteractions(); + dropCallbackOrder.verifyNoMoreInteractions(); + } + @Test public void throttle() { Subscriber subscriber = TestHelper.mockSubscriber(); diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableThrottleWithTimeoutTests.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableThrottleWithTimeoutTests.java index f84d27a00d..be94bf9d38 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableThrottleWithTimeoutTests.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableThrottleWithTimeoutTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableWindowTests.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableWindowTests.java index f96a010728..2ba648282f 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableWindowTests.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableWindowTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/flowable/FlowableZipTests.java b/src/test/java/io/reactivex/rxjava3/flowable/FlowableZipTests.java index e1b2e2809b..7f77992bfe 100644 --- a/src/test/java/io/reactivex/rxjava3/flowable/FlowableZipTests.java +++ b/src/test/java/io/reactivex/rxjava3/flowable/FlowableZipTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/SubscribeWithTest.java b/src/test/java/io/reactivex/rxjava3/internal/SubscribeWithTest.java index e1b858507a..a24562a854 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/SubscribeWithTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/SubscribeWithTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/disposables/ArrayCompositeDisposableTest.java b/src/test/java/io/reactivex/rxjava3/internal/disposables/ArrayCompositeDisposableTest.java index 8871cc4e50..c0319dfd3a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/disposables/ArrayCompositeDisposableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/disposables/ArrayCompositeDisposableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/disposables/CancellableDisposableTest.java b/src/test/java/io/reactivex/rxjava3/internal/disposables/CancellableDisposableTest.java index 03f54c9218..ab40e7c03c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/disposables/CancellableDisposableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/disposables/CancellableDisposableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/disposables/DisposableHelperTest.java b/src/test/java/io/reactivex/rxjava3/internal/disposables/DisposableHelperTest.java index 0332b02556..a3102ea44f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/disposables/DisposableHelperTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/disposables/DisposableHelperTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/disposables/EmptyDisposableTest.java b/src/test/java/io/reactivex/rxjava3/internal/disposables/EmptyDisposableTest.java index b66f27036e..1f0d370dcd 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/disposables/EmptyDisposableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/disposables/EmptyDisposableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,7 +18,7 @@ import org.junit.Test; import io.reactivex.rxjava3.core.RxJavaTest; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.testsupport.TestHelper; public class EmptyDisposableTest extends RxJavaTest { diff --git a/src/test/java/io/reactivex/rxjava3/internal/disposables/ListCompositeDisposableTest.java b/src/test/java/io/reactivex/rxjava3/internal/disposables/ListCompositeDisposableTest.java index 0325d00500..1a0070e22d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/disposables/ListCompositeDisposableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/disposables/ListCompositeDisposableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/functions/FunctionsTest.java b/src/test/java/io/reactivex/rxjava3/internal/functions/FunctionsTest.java index d919e8dfc8..635fcc4472 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/functions/FunctionsTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/functions/FunctionsTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/functions/ObjectHelperTest.java b/src/test/java/io/reactivex/rxjava3/internal/functions/ObjectHelperTest.java index 16c182061d..fb7e912da4 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/functions/ObjectHelperTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/functions/ObjectHelperTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/fuseable/CancellableQueueFuseableTest.java b/src/test/java/io/reactivex/rxjava3/internal/fuseable/CancellableQueueFuseableTest.java index abc3332381..67144abea2 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/fuseable/CancellableQueueFuseableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/fuseable/CancellableQueueFuseableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/CollectWithCollectorTckTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/CollectWithCollectorTckTest.java index 99fb2dcff9..4745b9c809 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/CollectWithCollectorTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/CollectWithCollectorTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/CompletableFromCompletionStageTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/CompletableFromCompletionStageTest.java index 3519cc5454..6e9bf78e1d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/CompletableFromCompletionStageTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/CompletableFromCompletionStageTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/CompletableToCompletionStageTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/CompletableToCompletionStageTest.java index 91fdfb9cde..8917b1c675 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/CompletableToCompletionStageTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/CompletableToCompletionStageTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream0HTckTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream0HTckTest.java index 57365f5857..e499ac1b9a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream0HTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream0HTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream0TckTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream0TckTest.java index 232ded7321..fa33b67ebf 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream0TckTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream0TckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream1HTckTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream1HTckTest.java index aa65a19ca7..ee1a27b548 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream1HTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream1HTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream1TckTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream1TckTest.java index 20e99b1ec1..21492d61b8 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream1TckTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream1TckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream2HTckTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream2HTckTest.java index 0c06e4de40..14e44d69ee 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream2HTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream2HTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream2TckTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream2TckTest.java index d799a720c9..c42e6f7a80 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream2TckTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlatMapStream2TckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableBlockingStreamTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableBlockingStreamTest.java index 2cf932f40e..be49e2ed11 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableBlockingStreamTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableBlockingStreamTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableCollectWithCollectorTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableCollectWithCollectorTest.java index ecef7665e0..3a8a1d5b19 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableCollectWithCollectorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableCollectWithCollectorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableFlatMapStreamTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableFlatMapStreamTest.java index 548a66a709..c865d35a52 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableFlatMapStreamTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableFlatMapStreamTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -274,7 +274,7 @@ protected void subscribeActual(Subscriber s) { } .flatMapStream(v -> Stream.of(1, 2), 1) .test(0) - .assertFailure(MissingBackpressureException.class); + .assertFailure(QueueOverflowException.class); TestHelper.assertUndeliverable(errors, 0, TestException.class); }); diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableFromCompletionStageTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableFromCompletionStageTest.java index 8a71bbd9b3..aebeea58b6 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableFromCompletionStageTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableFromCompletionStageTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableFromOptionalTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableFromOptionalTest.java index 6676bcee61..743dc0f573 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableFromOptionalTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableFromOptionalTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableFromStreamTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableFromStreamTest.java index 7d5f7a0a74..57a8caf6bf 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableFromStreamTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableFromStreamTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -26,7 +26,9 @@ import io.reactivex.rxjava3.annotations.NonNull; import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.TestException; -import io.reactivex.rxjava3.internal.fuseable.*; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueSubscription; +import io.reactivex.rxjava3.operators.SimpleQueue; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableMapOptionalTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableMapOptionalTest.java index 3e3f418790..fbffd79001 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableMapOptionalTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableMapOptionalTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -23,9 +23,9 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.internal.schedulers.ImmediateThinScheduler; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.processors.*; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableStageSubscriberOrDefaultTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableStageSubscriberOrDefaultTest.java index 882fd83dfb..d63a81c8ef 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableStageSubscriberOrDefaultTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableStageSubscriberOrDefaultTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableStageSubscriberOrErrorTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableStageSubscriberOrErrorTest.java index c34e4739fa..763a1e0444 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableStageSubscriberOrErrorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableStageSubscriberOrErrorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FromCompletionStageTckTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FromCompletionStageTckTest.java index 2c48611cd9..6d2e9d2155 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FromCompletionStageTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FromCompletionStageTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FromOptional0TckTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FromOptional0TckTest.java index 76c1246eb3..ff30aa4b2d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FromOptional0TckTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FromOptional0TckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FromOptional1TckTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FromOptional1TckTest.java index 27e596d708..f6b56a582d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FromOptional1TckTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FromOptional1TckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FromStreamTckTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FromStreamTckTest.java index 06f3b02b97..a0995dad39 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/FromStreamTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/FromStreamTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/MapOptionalTckTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/MapOptionalTckTest.java index b7cb4d9725..345159da4a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/MapOptionalTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/MapOptionalTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsFlowableTckTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsFlowableTckTest.java index 94906fdd2f..55e6778d3f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsFlowableTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsFlowableTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsFlowableTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsFlowableTest.java index 8e1e75b8e0..d8377eac60 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsFlowableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsFlowableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -28,8 +28,9 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueSubscription; import io.reactivex.rxjava3.subjects.MaybeSubject; import io.reactivex.rxjava3.subscribers.TestSubscriber; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsObservableTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsObservableTest.java index dd0fb5c2ed..145112987d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsObservableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsObservableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -27,8 +27,9 @@ import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.subjects.MaybeSubject; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFromCompletionStageTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFromCompletionStageTest.java index 90ad2bc626..552a4afc10 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFromCompletionStageTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFromCompletionStageTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFromOptionalTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFromOptionalTest.java index 4e09fea0b1..8af5faf5d7 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFromOptionalTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFromOptionalTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeMapOptionalTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeMapOptionalTest.java index e8b9f2aac3..a8adbcb6f8 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeMapOptionalTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeMapOptionalTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeToCompletionStageTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeToCompletionStageTest.java index c6c83e68a3..12e4ca5f1e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeToCompletionStageTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeToCompletionStageTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableBlockingStreamTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableBlockingStreamTest.java index b62bedb6f8..275b38a57b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableBlockingStreamTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableBlockingStreamTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableCollectWithCollectorTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableCollectWithCollectorTest.java index 923a7dbaa3..f18f42a3d0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableCollectWithCollectorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableCollectWithCollectorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableFlatMapStreamTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableFlatMapStreamTest.java index 8341aa03dd..5afcfa33ff 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableFlatMapStreamTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableFlatMapStreamTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableFromCompletionStageTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableFromCompletionStageTest.java index 612ab0724b..2be5ecf510 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableFromCompletionStageTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableFromCompletionStageTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableFromOptionalTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableFromOptionalTest.java index e2e4059e70..5fbeb1f2ff 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableFromOptionalTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableFromOptionalTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableFromStreamTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableFromStreamTest.java index 6074e54689..2b943e5338 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableFromStreamTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableFromStreamTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -26,8 +26,10 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.TestException; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.SimpleQueue; import io.reactivex.rxjava3.testsupport.*; public class ObservableFromStreamTest extends RxJavaTest { diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableMapOptionalTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableMapOptionalTest.java index ba38417b12..1b0a7f0a7d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableMapOptionalTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableMapOptionalTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -23,7 +23,7 @@ import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.subjects.*; import io.reactivex.rxjava3.testsupport.TestHelper; diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableStageSubscriberOrDefaultTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableStageSubscriberOrDefaultTest.java index 9b02622c9b..f652c9b327 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableStageSubscriberOrDefaultTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableStageSubscriberOrDefaultTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableStageSubscriberOrErrorTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableStageSubscriberOrErrorTest.java index d8e6fbe918..5646fc3d59 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableStageSubscriberOrErrorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableStageSubscriberOrErrorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ParallelCollectorTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ParallelCollectorTest.java index 42f7748a03..9d0fc09f62 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ParallelCollectorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ParallelCollectorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ParallelFlatMapStreamTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ParallelFlatMapStreamTest.java index 0f39d4c842..f1d34491d5 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ParallelFlatMapStreamTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ParallelFlatMapStreamTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ParallelMapOptionalTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ParallelMapOptionalTest.java index 67cab4087e..ca7385b7f6 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ParallelMapOptionalTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ParallelMapOptionalTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ParallelMapTryOptionalTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ParallelMapTryOptionalTest.java index b7cae91568..459b3f884a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/ParallelMapTryOptionalTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/ParallelMapTryOptionalTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleFlattenStreamAsFlowableTckTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleFlattenStreamAsFlowableTckTest.java index 509429d4af..53c4206510 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleFlattenStreamAsFlowableTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleFlattenStreamAsFlowableTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleFlattenStreamAsFlowableTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleFlattenStreamAsFlowableTest.java index 72dc8fb239..6e74b42370 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleFlattenStreamAsFlowableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleFlattenStreamAsFlowableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -28,8 +28,9 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueSubscription; import io.reactivex.rxjava3.subjects.SingleSubject; import io.reactivex.rxjava3.subscribers.TestSubscriber; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleFlattenStreamAsObservableTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleFlattenStreamAsObservableTest.java index 2b3a624d50..2c50634823 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleFlattenStreamAsObservableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleFlattenStreamAsObservableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -27,8 +27,9 @@ import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.subjects.SingleSubject; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleFromCompletionStageTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleFromCompletionStageTest.java index 7adb3664be..c62996e586 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleFromCompletionStageTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleFromCompletionStageTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleMapOptionalTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleMapOptionalTest.java index b8ab17a17c..56bc5dbae5 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleMapOptionalTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleMapOptionalTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleToCompletionStageTest.java b/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleToCompletionStageTest.java index 2560c68ed8..2709b6ee40 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleToCompletionStageTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/jdk8/SingleToCompletionStageTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/observers/BasicFuseableObserverTest.java b/src/test/java/io/reactivex/rxjava3/internal/observers/BasicFuseableObserverTest.java index 1764ea6a47..f48d0a574e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/observers/BasicFuseableObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/observers/BasicFuseableObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/observers/BasicQueueDisposableTest.java b/src/test/java/io/reactivex/rxjava3/internal/observers/BasicQueueDisposableTest.java index e5ed0fb605..d9bf994746 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/observers/BasicQueueDisposableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/observers/BasicQueueDisposableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/observers/BlockingFirstObserverTest.java b/src/test/java/io/reactivex/rxjava3/internal/observers/BlockingFirstObserverTest.java index 0b33e6ddff..3a65016574 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/observers/BlockingFirstObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/observers/BlockingFirstObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/observers/BlockingMultiObserverTest.java b/src/test/java/io/reactivex/rxjava3/internal/observers/BlockingMultiObserverTest.java index b9ec5d276b..0ea5b468ac 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/observers/BlockingMultiObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/observers/BlockingMultiObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/observers/BlockingObserverTest.java b/src/test/java/io/reactivex/rxjava3/internal/observers/BlockingObserverTest.java index 1a07bdf907..cbf8b7ce7c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/observers/BlockingObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/observers/BlockingObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/observers/CallbackCompletableObserverTest.java b/src/test/java/io/reactivex/rxjava3/internal/observers/CallbackCompletableObserverTest.java index e52ab8c023..46c4cc4463 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/observers/CallbackCompletableObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/observers/CallbackCompletableObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -24,7 +24,7 @@ public final class CallbackCompletableObserverTest extends RxJavaTest { @Test public void emptyActionShouldReportNoCustomOnError() { - CallbackCompletableObserver o = new CallbackCompletableObserver(Functions.EMPTY_ACTION); + CallbackCompletableObserver o = new CallbackCompletableObserver(Functions.ON_ERROR_MISSING, Functions.EMPTY_ACTION); assertFalse(o.hasCustomOnError()); } diff --git a/src/test/java/io/reactivex/rxjava3/internal/observers/CompletableConsumersTest.java b/src/test/java/io/reactivex/rxjava3/internal/observers/CompletableConsumersTest.java new file mode 100644 index 0000000000..eb17ead3db --- /dev/null +++ b/src/test/java/io/reactivex/rxjava3/internal/observers/CompletableConsumersTest.java @@ -0,0 +1,221 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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. + */ + +/* + * Copyright 2016-2019 David Karnok + * + * Licensed 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 io.reactivex.rxjava3.internal.observers; + +import static org.junit.Assert.*; + +import java.io.IOException; +import java.util.*; + +import org.junit.Test; + +import io.reactivex.rxjava3.core.*; +import io.reactivex.rxjava3.disposables.*; +import io.reactivex.rxjava3.exceptions.CompositeException; +import io.reactivex.rxjava3.functions.*; +import io.reactivex.rxjava3.observers.LambdaConsumerIntrospection; +import io.reactivex.rxjava3.plugins.RxJavaPlugins; +import io.reactivex.rxjava3.subjects.CompletableSubject; +import io.reactivex.rxjava3.testsupport.TestHelper; + +public class CompletableConsumersTest implements Consumer, Action { + + final CompositeDisposable composite = new CompositeDisposable(); + + final CompletableSubject processor = CompletableSubject.create(); + + final List events = new ArrayList<>(); + + @Override + public void run() throws Exception { + events.add("OnComplete"); + } + + @Override + public void accept(Object t) throws Exception { + events.add(t); + } + + @Test + public void onErrorNormal() { + + processor.subscribe(this, this, composite); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onComplete(); + + assertEquals(0, composite.size()); + + assertEquals(Arrays.asList("OnComplete"), events); + + } + + @Test + public void onErrorError() { + + Disposable d = processor.subscribe(this, this, composite); + + assertTrue(d.getClass().toString(), ((LambdaConsumerIntrospection)d).hasCustomOnError()); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onError(new IOException()); + + assertTrue(events.toString(), events.get(0) instanceof IOException); + + assertEquals(0, composite.size()); + } + + @Test + public void onCompleteNormal() { + + processor.subscribe(this, this, composite); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onComplete(); + + assertEquals(0, composite.size()); + + assertEquals(Arrays.asList("OnComplete"), events); + + } + + @Test + public void onCompleteError() { + + processor.subscribe(this, this, composite); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onError(new IOException()); + + assertTrue(events.toString(), events.get(0) instanceof IOException); + + assertEquals(0, composite.size()); + } + + @Test + public void onCompleteDispose() { + + Disposable d = processor.subscribe(this, this, composite); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + assertFalse(d.isDisposed()); + + d.dispose(); + d.dispose(); + + assertTrue(d.isDisposed()); + + assertEquals(0, composite.size()); + + assertFalse(processor.hasObservers()); + } + + @Test + public void onErrorCrash() { + List errors = TestHelper.trackPluginErrors(); + try { + processor.subscribe(this, t -> { + throw new IOException(t); + }, composite); + + processor.onError(new IllegalArgumentException()); + + assertTrue(events.toString(), events.isEmpty()); + + TestHelper.assertError(errors, 0, CompositeException.class); + List inners = TestHelper.compositeList(errors.get(0)); + TestHelper.assertError(inners, 0, IllegalArgumentException.class); + TestHelper.assertError(inners, 1, IOException.class); + } finally { + RxJavaPlugins.reset(); + } + } + + @Test + public void onCompleteCrash() { + List errors = TestHelper.trackPluginErrors(); + try { + processor.subscribe(new Action() { + @Override + public void run() throws Exception { + throw new IOException(); + } + }, this, composite); + + processor.onComplete(); + + assertTrue(events.toString(), events.isEmpty()); + + TestHelper.assertUndeliverable(errors, 0, IOException.class); + } finally { + RxJavaPlugins.reset(); + } + } + + @Test + public void badSource() { + List errors = TestHelper.trackPluginErrors(); + try { + new Completable() { + @Override + protected void subscribeActual( + CompletableObserver observer) { + observer.onSubscribe(Disposable.empty()); + observer.onComplete(); + + observer.onSubscribe(Disposable.empty()); + observer.onComplete(); + observer.onError(new IOException()); + } + }.subscribe(this, this, composite); + + assertEquals(Arrays.asList("OnComplete"), events); + + TestHelper.assertUndeliverable(errors, 0, IOException.class); + } finally { + RxJavaPlugins.reset(); + } + } +} diff --git a/src/test/java/io/reactivex/rxjava3/internal/observers/ConsumerSingleObserverTest.java b/src/test/java/io/reactivex/rxjava3/internal/observers/ConsumerSingleObserverTest.java index 5e264bc4d7..f6ebdb498f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/observers/ConsumerSingleObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/observers/ConsumerSingleObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/observers/DeferredScalarDisposableTest.java b/src/test/java/io/reactivex/rxjava3/internal/observers/DeferredScalarDisposableTest.java index 5604005992..19c5b7db27 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/observers/DeferredScalarDisposableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/observers/DeferredScalarDisposableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/observers/DeferredScalarObserverTest.java b/src/test/java/io/reactivex/rxjava3/internal/observers/DeferredScalarObserverTest.java index e9668c81ce..165de9b467 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/observers/DeferredScalarObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/observers/DeferredScalarObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -22,8 +22,9 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.*; import io.reactivex.rxjava3.exceptions.*; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/observers/DisposableLambdaObserverTest.java b/src/test/java/io/reactivex/rxjava3/internal/observers/DisposableLambdaObserverTest.java index 964301f6e4..294892507b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/observers/DisposableLambdaObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/observers/DisposableLambdaObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/observers/EmptyCompletableObserverTest.java b/src/test/java/io/reactivex/rxjava3/internal/observers/EmptyCompletableObserverTest.java index e873326375..c58de8f0f9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/observers/EmptyCompletableObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/observers/EmptyCompletableObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/observers/FutureMultiObserverTest.java b/src/test/java/io/reactivex/rxjava3/internal/observers/FutureMultiObserverTest.java index 69b4524123..7499b99ca1 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/observers/FutureMultiObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/observers/FutureMultiObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/observers/FutureObserverTest.java b/src/test/java/io/reactivex/rxjava3/internal/observers/FutureObserverTest.java index e74efba8bd..8c475eb038 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/observers/FutureObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/observers/FutureObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/observers/FutureSingleObserverTest.java b/src/test/java/io/reactivex/rxjava3/internal/observers/FutureSingleObserverTest.java index eb11be24c3..db8b414347 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/observers/FutureSingleObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/observers/FutureSingleObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/observers/InnerQueuedObserverTest.java b/src/test/java/io/reactivex/rxjava3/internal/observers/InnerQueuedObserverTest.java index 84b9d14360..549c72534a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/observers/InnerQueuedObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/observers/InnerQueuedObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/observers/LambdaObserverTest.java b/src/test/java/io/reactivex/rxjava3/internal/observers/LambdaObserverTest.java index c19b6ff2db..7ce4307419 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/observers/LambdaObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/observers/LambdaObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/observers/MaybeConsumersTest.java b/src/test/java/io/reactivex/rxjava3/internal/observers/MaybeConsumersTest.java new file mode 100644 index 0000000000..92b32c000e --- /dev/null +++ b/src/test/java/io/reactivex/rxjava3/internal/observers/MaybeConsumersTest.java @@ -0,0 +1,273 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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. + */ + +/* + * Copyright 2016-2019 David Karnok + * + * Licensed 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 io.reactivex.rxjava3.internal.observers; + +import static org.junit.Assert.*; + +import java.io.IOException; +import java.util.*; + +import org.junit.Test; + +import io.reactivex.rxjava3.core.*; +import io.reactivex.rxjava3.disposables.*; +import io.reactivex.rxjava3.exceptions.CompositeException; +import io.reactivex.rxjava3.functions.*; +import io.reactivex.rxjava3.internal.functions.Functions; +import io.reactivex.rxjava3.observers.LambdaConsumerIntrospection; +import io.reactivex.rxjava3.plugins.RxJavaPlugins; +import io.reactivex.rxjava3.subjects.MaybeSubject; +import io.reactivex.rxjava3.testsupport.TestHelper; + +public class MaybeConsumersTest implements Consumer, Action { + + final CompositeDisposable composite = new CompositeDisposable(); + + final MaybeSubject processor = MaybeSubject.create(); + + final List events = new ArrayList<>(); + + @Override + public void run() throws Exception { + events.add("OnComplete"); + } + + @Override + public void accept(Object t) throws Exception { + events.add(t); + } + + static Disposable subscribeAutoDispose(Maybe source, CompositeDisposable composite, + Consumer onSuccess, Consumer onError, Action onComplete) { + return source.subscribe(onSuccess, onError, onComplete, composite); + } + + @Test + public void onSuccessNormal() { + + Disposable d = subscribeAutoDispose(processor, composite, this, Functions.ON_ERROR_MISSING, () -> { }); + + assertFalse(d.getClass().toString(), ((LambdaConsumerIntrospection)d).hasCustomOnError()); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onSuccess(1); + + assertEquals(0, composite.size()); + + assertEquals(Arrays.asList(1), events); + + } + + @Test + public void onErrorNormal() { + + subscribeAutoDispose(processor, composite, this, this, this); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onSuccess(1); + + assertEquals(0, composite.size()); + + assertEquals(Arrays.asList(1), events); + + } + + @Test + public void onErrorError() { + + Disposable d = subscribeAutoDispose(processor, composite, this, this, this); + + assertTrue(d.getClass().toString(), ((LambdaConsumerIntrospection)d).hasCustomOnError()); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onError(new IOException()); + + assertTrue(events.toString(), events.get(0) instanceof IOException); + + assertEquals(0, composite.size()); + } + + @Test + public void onCompleteNormal() { + + subscribeAutoDispose(processor, composite, this, this, this); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onComplete(); + + assertEquals(0, composite.size()); + + assertEquals(Arrays.asList("OnComplete"), events); + + } + + @Test + public void onCompleteError() { + + subscribeAutoDispose(processor, composite, this, this, this); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onError(new IOException()); + + assertTrue(events.toString(), events.get(0) instanceof IOException); + + assertEquals(0, composite.size()); + } + + @Test + public void onCompleteDispose() { + + Disposable d = subscribeAutoDispose(processor, composite, this, this, this); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + assertFalse(d.isDisposed()); + + d.dispose(); + d.dispose(); + + assertTrue(d.isDisposed()); + + assertEquals(0, composite.size()); + + assertFalse(processor.hasObservers()); + } + + @Test + public void onSuccessCrash() { + List errors = TestHelper.trackPluginErrors(); + try { + subscribeAutoDispose(processor, composite, new Consumer() { + @Override + public void accept(Object t) throws Exception { + throw new IOException(); + } + }, this, this); + + processor.onSuccess(1); + + assertTrue(events.toString(), events.isEmpty()); + + TestHelper.assertUndeliverable(errors, 0, IOException.class); + } finally { + RxJavaPlugins.reset(); + } + } + + @Test + public void onErrorCrash() { + List errors = TestHelper.trackPluginErrors(); + try { + subscribeAutoDispose(processor, composite, this, new Consumer() { + @Override + public void accept(Throwable t) throws Exception { + throw new IOException(t); + } + }, this); + + processor.onError(new IllegalArgumentException()); + + assertTrue(events.toString(), events.isEmpty()); + + TestHelper.assertError(errors, 0, CompositeException.class); + List inners = TestHelper.compositeList(errors.get(0)); + TestHelper.assertError(inners, 0, IllegalArgumentException.class); + TestHelper.assertError(inners, 1, IOException.class); + } finally { + RxJavaPlugins.reset(); + } + } + + @Test + public void onCompleteCrash() { + List errors = TestHelper.trackPluginErrors(); + try { + subscribeAutoDispose(processor, composite, this, this, new Action() { + @Override + public void run() throws Exception { + throw new IOException(); + } + }); + + processor.onComplete(); + + assertTrue(events.toString(), events.isEmpty()); + + TestHelper.assertUndeliverable(errors, 0, IOException.class); + } finally { + RxJavaPlugins.reset(); + } + } + + @Test + public void badSource() { + List errors = TestHelper.trackPluginErrors(); + try { + subscribeAutoDispose( + new Maybe() { + @Override + protected void subscribeActual( + MaybeObserver observer) { + observer.onSubscribe(Disposable.empty()); + observer.onComplete(); + + observer.onSubscribe(Disposable.empty()); + observer.onSuccess(2); + observer.onComplete(); + observer.onError(new IOException()); + } + }, composite, this, this, this + ); + + assertEquals(Arrays.asList("OnComplete"), events); + + TestHelper.assertUndeliverable(errors, 0, IOException.class); + } finally { + RxJavaPlugins.reset(); + } + } +} diff --git a/src/test/java/io/reactivex/rxjava3/internal/observers/ObservableConsumersTest.java b/src/test/java/io/reactivex/rxjava3/internal/observers/ObservableConsumersTest.java new file mode 100644 index 0000000000..b5d26340e7 --- /dev/null +++ b/src/test/java/io/reactivex/rxjava3/internal/observers/ObservableConsumersTest.java @@ -0,0 +1,324 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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. + */ + +/* + * Copyright 2016-2019 David Karnok + * + * Licensed 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 io.reactivex.rxjava3.internal.observers; + +import static org.junit.Assert.*; + +import java.io.IOException; +import java.util.*; + +import org.junit.Test; + +import io.reactivex.rxjava3.core.Observable; +import io.reactivex.rxjava3.core.Observer; +import io.reactivex.rxjava3.disposables.*; +import io.reactivex.rxjava3.exceptions.*; +import io.reactivex.rxjava3.functions.*; +import io.reactivex.rxjava3.internal.functions.Functions; +import io.reactivex.rxjava3.observers.LambdaConsumerIntrospection; +import io.reactivex.rxjava3.plugins.RxJavaPlugins; +import io.reactivex.rxjava3.subjects.PublishSubject; +import io.reactivex.rxjava3.testsupport.TestHelper; + +public class ObservableConsumersTest implements Consumer, Action { + + final CompositeDisposable composite = new CompositeDisposable(); + + final PublishSubject processor = PublishSubject.create(); + + final List events = new ArrayList<>(); + + @Override + public void run() throws Exception { + events.add("OnComplete"); + } + + @Override + public void accept(Object t) throws Exception { + events.add(t); + } + + static Disposable subscribeAutoDispose(Observable source, CompositeDisposable composite, + Consumer onNext, Consumer onError, Action onComplete) { + return source.subscribe(onNext, onError, onComplete, composite); + } + + @Test + public void onNextNormal() { + + Disposable d = subscribeAutoDispose(processor, composite, this, Functions.ON_ERROR_MISSING, () -> { }); + + assertFalse(d.getClass().toString(), ((LambdaConsumerIntrospection)d).hasCustomOnError()); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onNext(1); + + assertTrue(composite.size() > 0); + + assertEquals(Arrays.asList(1), events); + + processor.onComplete(); + + assertEquals(Arrays.asList(1), events); + + assertEquals(0, composite.size()); + } + + @Test + public void onErrorNormal() { + + subscribeAutoDispose(processor, composite, this, Functions.ON_ERROR_MISSING, () -> { }); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onNext(1); + + assertTrue(composite.size() > 0); + + assertEquals(Arrays.asList(1), events); + + processor.onComplete(); + + assertEquals(Arrays.asList(1), events); + + assertEquals(0, composite.size()); + } + + @Test + public void onErrorError() { + + Disposable d = subscribeAutoDispose(processor, composite, this, this, this); + + assertTrue(d.getClass().toString(), ((LambdaConsumerIntrospection)d).hasCustomOnError()); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onNext(1); + + assertTrue(composite.size() > 0); + + assertEquals(Arrays.asList(1), events); + + processor.onError(new IOException()); + + assertEquals(events.toString(), 1, events.get(0)); + assertTrue(events.toString(), events.get(1) instanceof IOException); + + assertEquals(0, composite.size()); + } + + @Test + public void onCompleteNormal() { + + subscribeAutoDispose(processor, composite, this, this, this); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onNext(1); + + assertTrue(composite.size() > 0); + + assertEquals(Arrays.asList(1), events); + + processor.onComplete(); + + assertEquals(Arrays.asList(1, "OnComplete"), events); + + assertEquals(0, composite.size()); + } + + @Test + public void onCompleteError() { + + subscribeAutoDispose(processor, composite, this, this, this); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onNext(1); + + assertTrue(composite.size() > 0); + + assertEquals(Arrays.asList(1), events); + + processor.onError(new IOException()); + + assertEquals(events.toString(), 1, events.get(0)); + assertTrue(events.toString(), events.get(1) instanceof IOException); + + assertEquals(0, composite.size()); + } + + @Test + public void onCompleteDispose() { + + Disposable d = subscribeAutoDispose(processor, composite, this, this, this); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + assertFalse(d.isDisposed()); + + d.dispose(); + d.dispose(); + + assertTrue(d.isDisposed()); + + assertEquals(0, composite.size()); + + assertFalse(processor.hasObservers()); + } + + @Test + public void onNextCrash() { + List errors = TestHelper.trackPluginErrors(); + try { + subscribeAutoDispose(processor, composite, new Consumer() { + @Override + public void accept(Object t) throws Exception { + throw new IOException(); + } + }, this, this); + + processor.onNext(1); + + assertTrue(errors.toString(), errors.isEmpty()); + + assertTrue(events.toString(), events.get(0) instanceof IOException); + } finally { + RxJavaPlugins.reset(); + } + } + + @Test + public void onNextCrashOnError() { + List errors = TestHelper.trackPluginErrors(); + try { + subscribeAutoDispose(processor, composite, this, new Consumer() { + @Override + public void accept(Throwable t) throws Exception { + throw new IOException(t); + } + }, this); + + processor.onError(new IllegalArgumentException()); + + assertTrue(events.toString(), events.isEmpty()); + + TestHelper.assertError(errors, 0, CompositeException.class); + List inners = TestHelper.compositeList(errors.get(0)); + TestHelper.assertError(inners, 0, IllegalArgumentException.class); + TestHelper.assertError(inners, 1, IOException.class); + } finally { + RxJavaPlugins.reset(); + } + } + + @Test + public void onNextCrashNoError() { + List errors = TestHelper.trackPluginErrors(); + try { + subscribeAutoDispose(processor, composite, t -> { + throw new IOException(); + }, Functions.ON_ERROR_MISSING, () -> { }); + + processor.onNext(1); + + assertTrue(events.toString(), events.isEmpty()); + + TestHelper.assertError(errors, 0, OnErrorNotImplementedException.class); + assertTrue(errors.get(0).getCause() instanceof IOException); + } finally { + RxJavaPlugins.reset(); + } + } + + @Test + public void onCompleteCrash() { + List errors = TestHelper.trackPluginErrors(); + try { + subscribeAutoDispose(processor, composite, this, this, new Action() { + @Override + public void run() throws Exception { + throw new IOException(); + } + }); + + processor.onNext(1); + processor.onComplete(); + + assertEquals(Arrays.asList(1), events); + + TestHelper.assertUndeliverable(errors, 0, IOException.class); + } finally { + RxJavaPlugins.reset(); + } + } + + @Test + public void badSource() { + List errors = TestHelper.trackPluginErrors(); + try { + subscribeAutoDispose( + new Observable() { + @Override + protected void subscribeActual( + Observer observer) { + observer.onSubscribe(Disposable.empty()); + observer.onNext(1); + observer.onComplete(); + + observer.onSubscribe(Disposable.empty()); + observer.onNext(2); + observer.onComplete(); + observer.onError(new IOException()); + } + }, composite, this, this, this + ); + + assertEquals(Arrays.asList(1, "OnComplete"), events); + + TestHelper.assertUndeliverable(errors, 0, IOException.class); + } finally { + RxJavaPlugins.reset(); + } + } +} diff --git a/src/test/java/io/reactivex/rxjava3/internal/observers/QueueDrainObserverTest.java b/src/test/java/io/reactivex/rxjava3/internal/observers/QueueDrainObserverTest.java index 9afd31e95f..eb2523a466 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/observers/QueueDrainObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/observers/QueueDrainObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -17,8 +17,8 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.*; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.SpscArrayQueue; import io.reactivex.rxjava3.testsupport.TestHelper; public class QueueDrainObserverTest extends RxJavaTest { diff --git a/src/test/java/io/reactivex/rxjava3/internal/observers/SingleConsumersTest.java b/src/test/java/io/reactivex/rxjava3/internal/observers/SingleConsumersTest.java new file mode 100644 index 0000000000..a840d8f71a --- /dev/null +++ b/src/test/java/io/reactivex/rxjava3/internal/observers/SingleConsumersTest.java @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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. + */ + +/* + * Copyright 2016-2019 David Karnok + * + * Licensed 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 io.reactivex.rxjava3.internal.observers; + +import static org.junit.Assert.*; + +import java.io.IOException; +import java.util.*; + +import org.junit.Test; + +import io.reactivex.rxjava3.core.*; +import io.reactivex.rxjava3.disposables.*; +import io.reactivex.rxjava3.exceptions.CompositeException; +import io.reactivex.rxjava3.functions.Consumer; +import io.reactivex.rxjava3.internal.functions.Functions; +import io.reactivex.rxjava3.observers.LambdaConsumerIntrospection; +import io.reactivex.rxjava3.plugins.RxJavaPlugins; +import io.reactivex.rxjava3.subjects.SingleSubject; +import io.reactivex.rxjava3.testsupport.TestHelper; + +public class SingleConsumersTest implements Consumer { + + final CompositeDisposable composite = new CompositeDisposable(); + + final SingleSubject processor = SingleSubject.create(); + + final List events = new ArrayList<>(); + + @Override + public void accept(Object t) throws Exception { + events.add(t); + } + + static Disposable subscribeAutoDispose(Single source, CompositeDisposable composite, + Consumer onSuccess, Consumer onError) { + return source.subscribe(onSuccess, onError, composite); + } + + @Test + public void onSuccessNormal() { + + Disposable d = subscribeAutoDispose(processor, composite, this, Functions.ON_ERROR_MISSING); + + assertFalse(d.getClass().toString(), ((LambdaConsumerIntrospection)d).hasCustomOnError()); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onSuccess(1); + + assertEquals(0, composite.size()); + + assertEquals(Arrays.asList(1), events); + + } + + @Test + public void onErrorNormal() { + + subscribeAutoDispose(processor, composite, this, this); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onSuccess(1); + + assertEquals(0, composite.size()); + + assertEquals(Arrays.asList(1), events); + + } + + @Test + public void onErrorError() { + + Disposable d = subscribeAutoDispose(processor, composite, this, this); + + assertTrue(d.getClass().toString(), ((LambdaConsumerIntrospection)d).hasCustomOnError()); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onError(new IOException()); + + assertTrue(events.toString(), events.get(0) instanceof IOException); + + assertEquals(0, composite.size()); + } + + @Test + public void onSuccessCrash() { + List errors = TestHelper.trackPluginErrors(); + try { + subscribeAutoDispose(processor, composite, new Consumer() { + @Override + public void accept(Object t) throws Exception { + throw new IOException(); + } + }, this); + + processor.onSuccess(1); + + assertTrue(events.toString(), events.isEmpty()); + + TestHelper.assertUndeliverable(errors, 0, IOException.class); + } finally { + RxJavaPlugins.reset(); + } + } + + @Test + public void onErrorCrash() { + List errors = TestHelper.trackPluginErrors(); + try { + subscribeAutoDispose(processor, composite, this, new Consumer() { + @Override + public void accept(Throwable t) throws Exception { + throw new IOException(t); + } + }); + + processor.onError(new IllegalArgumentException()); + + assertTrue(events.toString(), events.isEmpty()); + + TestHelper.assertError(errors, 0, CompositeException.class); + List inners = TestHelper.compositeList(errors.get(0)); + TestHelper.assertError(inners, 0, IllegalArgumentException.class); + TestHelper.assertError(inners, 1, IOException.class); + } finally { + RxJavaPlugins.reset(); + } + } + + @Test + public void badSource() { + List errors = TestHelper.trackPluginErrors(); + try { + subscribeAutoDispose( + new Single() { + @Override + protected void subscribeActual( + SingleObserver observer) { + observer.onSubscribe(Disposable.empty()); + observer.onSuccess(1); + + observer.onSubscribe(Disposable.empty()); + observer.onSuccess(2); + observer.onError(new IOException()); + } + }, composite, this, this + ); + + assertEquals(Arrays.asList(1), events); + + TestHelper.assertUndeliverable(errors, 0, IOException.class); + } finally { + RxJavaPlugins.reset(); + } + } +} diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAmbTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAmbTest.java index 60c69b5f20..0c9971017b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAmbTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAmbTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAndThenCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAndThenCompletableTest.java index f32196364d..070fa8cb4d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAndThenCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAndThenCompletableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAndThenTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAndThenTest.java index b72fda422c..943d44b9f2 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAndThenTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAndThenTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAwaitTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAwaitTest.java index b7d6d61ea3..b614e2d79e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAwaitTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAwaitTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableBlockingSubscribeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableBlockingSubscribeTest.java index e70aac7157..a84f78ad73 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableBlockingSubscribeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableBlockingSubscribeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableCacheTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableCacheTest.java index fd286681c8..3e6193a2e9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableCacheTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableCacheTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcatArrayDelayErrorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcatArrayDelayErrorTest.java index 229d00acc6..418afc70cc 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcatArrayDelayErrorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcatArrayDelayErrorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcatDelayErrorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcatDelayErrorTest.java index fd3124a96c..8a9f9477d8 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcatDelayErrorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcatDelayErrorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcatTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcatTest.java index aaf925df78..11bc1a9b06 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcatTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcatTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -52,9 +52,9 @@ public void subscribe(Subscriber s) { }), 1 ) .test() - .assertFailure(MissingBackpressureException.class); + .assertFailure(QueueOverflowException.class); - TestHelper.assertError(errors, 0, MissingBackpressureException.class); + TestHelper.assertError(errors, 0, QueueOverflowException.class); } finally { RxJavaPlugins.reset(); } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableCreateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableCreateTest.java index d0323011fb..bda1166ef9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableCreateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableCreateTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDelaySubscriptionTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDelaySubscriptionTest.java index d467d8e2cf..6e524eff27 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDelaySubscriptionTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDelaySubscriptionTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDelayTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDelayTest.java index 94e34fe728..c84972863d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDelayTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDelayTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDetachTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDetachTest.java index b5b52b67c2..5373499d30 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDetachTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDetachTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDisposeOnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDisposeOnTest.java index 3ef469b121..73a4e58c77 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDisposeOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDisposeOnTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoFinallyTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoFinallyTest.java index 815482b02f..14bd307b37 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoFinallyTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoFinallyTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoOnLifecycleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoOnLifecycleTest.java index 3e85e1e027..1f66038f19 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoOnLifecycleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoOnLifecycleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoOnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoOnTest.java index c2bf494837..6f9698afbf 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoOnTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromActionTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromActionTest.java index 7c979d4881..e697a91d34 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromActionTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromActionTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromCallableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromCallableTest.java index 57c11b8a7b..940444f7a9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromCallableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromCallableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromMaybeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromMaybeTest.java index 2651f04f2c..db201e07a7 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromMaybeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromMaybeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromObservableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromObservableTest.java index ab72061437..5fc8ba08c6 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromObservableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromObservableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromPublisherTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromPublisherTest.java index c6d37d738d..177dc4e156 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromPublisherTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromPublisherTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromRunnableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromRunnableTest.java index a1a7298e03..2b3e9a6514 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromRunnableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromRunnableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromSingleTest.java index e8595f299e..14e5a29ac9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromSupplierTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromSupplierTest.java index 5aca1f7847..453fc4c2c0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromSupplierTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromSupplierTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableHideTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableHideTest.java index 59352d76a5..16afcaa075 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableHideTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableHideTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableLiftTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableLiftTest.java index 4f0ba23ce8..21cf3fb305 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableLiftTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableLiftTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMaterializeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMaterializeTest.java index aa77e6a975..8c301f50fa 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMaterializeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMaterializeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeIterableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeIterableTest.java index 1f392a9f7c..cf3dc03c69 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeIterableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeIterableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeTest.java index 80f43a7a35..38166ea659 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMergeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableObserveOnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableObserveOnTest.java index 6d5cc21064..f4613f5c59 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableObserveOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableObserveOnTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableOnErrorXTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableOnErrorXTest.java index 531f13b8cc..d7b1cae653 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableOnErrorXTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableOnErrorXTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletablePeekTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletablePeekTest.java index ddc5a16056..827599e353 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletablePeekTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletablePeekTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableRepeatWhenTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableRepeatWhenTest.java index 6a80eda644..d9a262b317 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableRepeatWhenTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableRepeatWhenTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableResumeNextTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableResumeNextTest.java index fb5390cdcc..a8f0390c63 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableResumeNextTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableResumeNextTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSafeSubscribeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSafeSubscribeTest.java index 234fb0290c..40c618ac0a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSafeSubscribeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSafeSubscribeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSequenceEqualTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSequenceEqualTest.java index b7b68ad321..9e3fd56b99 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSequenceEqualTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSequenceEqualTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableStartWithTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableStartWithTest.java index 065a600a0e..4b2ed6d588 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableStartWithTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableStartWithTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSubscribeOnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSubscribeOnTest.java index 22d826fc70..3c20a12588 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSubscribeOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSubscribeOnTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSubscribeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSubscribeTest.java index 7c140db31d..f0fded5996 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSubscribeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSubscribeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSwitchOnNextTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSwitchOnNextTest.java index ad6147fef5..312f9653ed 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSwitchOnNextTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSwitchOnNextTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTakeUntilTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTakeUntilTest.java index 3458ef9772..1eefff1956 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTakeUntilTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTakeUntilTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTimeoutTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTimeoutTest.java index a2f0771ab4..86f2f2890a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTimeoutTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTimeoutTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTimerTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTimerTest.java index 7f6b339961..bfd87a1af6 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTimerTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableTimerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -37,7 +37,7 @@ public void dispose() { public void timerInterruptible() throws Exception { ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(); try { - for (Scheduler s : new Scheduler[] { Schedulers.single(), Schedulers.computation(), Schedulers.newThread(), Schedulers.io(), Schedulers.from(exec) }) { + for (Scheduler s : new Scheduler[] { Schedulers.single(), Schedulers.computation(), Schedulers.newThread(), Schedulers.io(), Schedulers.from(exec, true) }) { final AtomicBoolean interrupted = new AtomicBoolean(); TestObserver to = Completable.timer(1, TimeUnit.MILLISECONDS, s) .doOnComplete(new Action() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToFlowableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToFlowableTest.java index d1fdb548fa..8c10ea5225 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToFlowableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToFlowableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToFutureTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToFutureTest.java index 7501a2fe85..c857e95ebb 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToFutureTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToFutureTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToObservableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToObservableTest.java index 96404e8167..7ad93e9bef 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToObservableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToObservableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableUnsafeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableUnsafeTest.java index 4581a8944d..72b28edea0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableUnsafeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableUnsafeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableUsingTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableUsingTest.java index 6a7ddd564b..72e4d16491 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableUsingTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableUsingTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/AbstractFlowableWithUpstreamTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/AbstractFlowableWithUpstreamTest.java index e109a0a544..65f593211c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/AbstractFlowableWithUpstreamTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/AbstractFlowableWithUpstreamTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableLatestTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableLatestTest.java index 825c74e321..a842c39c2b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableLatestTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableLatestTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableMostRecentTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableMostRecentTest.java index 82ae58730f..92513b3072 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableMostRecentTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableMostRecentTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableNextTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableNextTest.java index 714bde2e21..718a7ba6a1 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableNextTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableNextTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableToFutureTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableToFutureTest.java index cf8ad48a5f..6da74eea03 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableToFutureTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableToFutureTest.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.operators.flowable; import static org.junit.Assert.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableToIteratorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableToIteratorTest.java index 64b22b1785..e5ad7806d3 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableToIteratorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableToIteratorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -152,7 +152,7 @@ public void emptyThrowsNoSuch() { it.next(); } - @Test(expected = MissingBackpressureException.class) + @Test(expected = QueueOverflowException.class) public void overflowQueue() { Iterator it = new Flowable() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BufferUntilSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BufferUntilSubscriberTest.java index 69abd706eb..6cdc17d210 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BufferUntilSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BufferUntilSubscriberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAllTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAllTest.java index 387a2017dd..2b66a48bd0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAllTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAllTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAmbTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAmbTest.java index bae0033d30..1a1ceca926 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAmbTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAmbTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -402,7 +402,8 @@ public void disposed() { @Test public void manySources() { - Flowable[] a = new Flowable[32]; + @SuppressWarnings("unchecked") + Flowable[] a = new Flowable[32]; Arrays.fill(a, Flowable.never()); a[31] = Flowable.just(1); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAnyTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAnyTest.java index e121cbc924..2f18a90c64 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAnyTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAnyTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAsObservableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAsObservableTest.java index 15cd39ea0a..d922ef48c3 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAsObservableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAsObservableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAutoConnectTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAutoConnectTest.java index d2213dd911..07d1e66214 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAutoConnectTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAutoConnectTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBlockingTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBlockingTest.java index db560e0327..a1facf4046 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBlockingTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBlockingTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferTest.java index 5abdd7bf9d..c1b08990bb 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCacheTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCacheTest.java index b736b48122..e71315351d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCacheTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCacheTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCastTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCastTest.java index c39b1972f0..dc26fdccaa 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCastTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCastTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCombineLatestTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCombineLatestTest.java index 06b29eadbe..0f07148179 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCombineLatestTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCombineLatestTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -30,9 +30,9 @@ import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.internal.operators.flowable.FlowableZipTest.ArgsToString; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.processors.PublishProcessor; import io.reactivex.rxjava3.schedulers.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatDelayErrorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatDelayErrorTest.java index 22e23a4391..39d6cf6ff5 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatDelayErrorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatDelayErrorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEagerTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEagerTest.java index 7d6392b318..3711aecec4 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEagerTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEagerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapSchedulerTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapSchedulerTest.java index bb01b50a20..027157ce02 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapSchedulerTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapSchedulerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -66,6 +66,56 @@ public Publisher apply(String v) .assertResult("RxSingleScheduler"); } + @Test + public void innerScalarRequestRace() { + Flowable just = Flowable.just(1); + int n = 1000; + for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { + PublishProcessor> source = PublishProcessor.create(); + + TestSubscriber ts = source + .concatMap(v -> v, n + 1, ImmediateThinScheduler.INSTANCE) + .test(1L); + + TestHelper.race(() -> { + for (int j = 0; j < n; j++) { + source.onNext(just); + } + }, () -> { + for (int j = 0; j < n; j++) { + ts.request(1); + } + }); + + ts.assertValueCount(n); + } + } + + @Test + public void innerScalarRequestRaceDelayError() { + Flowable just = Flowable.just(1); + int n = 1000; + for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { + PublishProcessor> source = PublishProcessor.create(); + + TestSubscriber ts = source + .concatMapDelayError(v -> v, true, n + 1, ImmediateThinScheduler.INSTANCE) + .test(1L); + + TestHelper.race(() -> { + for (int j = 0; j < n; j++) { + source.onNext(just); + } + }, () -> { + for (int j = 0; j < n; j++) { + ts.request(1); + } + }); + + ts.assertValueCount(n); + } + } + @Test public void boundaryFusionDelayError() { Flowable.range(1, 10000) @@ -305,7 +355,7 @@ public Flowable apply(Integer t) throws Throwable { } @Test - public void issue2890NoStackoverflow() throws InterruptedException { + public void issue2890NoStackoverflow() throws InterruptedException, TimeoutException { final ExecutorService executor = Executors.newFixedThreadPool(2); final Scheduler sch = Schedulers.from(executor); @@ -350,7 +400,11 @@ public void onError(Throwable e) { } }); - executor.awaitTermination(20000, TimeUnit.MILLISECONDS); + long awaitTerminationTimeoutMillis = 100_000; + if (!executor.awaitTermination(awaitTerminationTimeoutMillis, TimeUnit.MILLISECONDS)) { + throw new TimeoutException("Completed " + counter.get() + "/" + n + " before timed out after " + + awaitTerminationTimeoutMillis + " milliseconds."); + } assertEquals(n, counter.get()); } @@ -570,7 +624,7 @@ protected void subscribeActual(Subscriber s) { } .concatMap(Functions.justFunction(Flowable.just(2)), 8, ImmediateThinScheduler.INSTANCE) .test(0L) - .assertFailure(IllegalStateException.class); + .assertFailure(QueueOverflowException.class); } @Test diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapTest.java index 4ff32a9eb4..10df043ba5 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -24,8 +24,8 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.operators.flowable.FlowableConcatMap.WeakScalarSubscription; -import io.reactivex.rxjava3.processors.UnicastProcessor; +import io.reactivex.rxjava3.internal.operators.flowable.FlowableConcatMap.SimpleScalarSubscription; +import io.reactivex.rxjava3.processors.*; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.subscribers.TestSubscriber; import io.reactivex.rxjava3.testsupport.TestHelper; @@ -33,9 +33,9 @@ public class FlowableConcatMapTest extends RxJavaTest { @Test - public void weakSubscriptionRequest() { + public void simpleSubscriptionRequest() { TestSubscriber ts = new TestSubscriber<>(0); - WeakScalarSubscription ws = new WeakScalarSubscription<>(1, ts); + SimpleScalarSubscription ws = new SimpleScalarSubscription<>(1, ts); ts.onSubscribe(ws); ws.request(0); @@ -79,6 +79,56 @@ public Publisher apply(String v) .assertResult("RxSingleScheduler"); } + @Test + public void innerScalarRequestRace() { + Flowable just = Flowable.just(1); + int n = 1000; + for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { + PublishProcessor> source = PublishProcessor.create(); + + TestSubscriber ts = source + .concatMap(v -> v, n + 1) + .test(1L); + + TestHelper.race(() -> { + for (int j = 0; j < n; j++) { + source.onNext(just); + } + }, () -> { + for (int j = 0; j < n; j++) { + ts.request(1); + } + }); + + ts.assertValueCount(n); + } + } + + @Test + public void innerScalarRequestRaceDelayError() { + Flowable just = Flowable.just(1); + int n = 1000; + for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { + PublishProcessor> source = PublishProcessor.create(); + + TestSubscriber ts = source + .concatMapDelayError(v -> v, true, n + 1) + .test(1L); + + TestHelper.race(() -> { + for (int j = 0; j < n; j++) { + source.onNext(just); + } + }, () -> { + for (int j = 0; j < n; j++) { + ts.request(1); + } + }); + + ts.assertValueCount(n); + } + } + @Test public void boundaryFusionDelayError() { Flowable.range(1, 10000) diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatTest.java index 282179b9fe..5a0634ffb6 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -729,7 +729,7 @@ public void subscribe(Subscriber s) { } @Test - public void issue2890NoStackoverflow() throws InterruptedException { + public void issue2890NoStackoverflow() throws InterruptedException, TimeoutException { final ExecutorService executor = Executors.newFixedThreadPool(2); final Scheduler sch = Schedulers.from(executor); @@ -774,7 +774,11 @@ public void onError(Throwable e) { } }); - executor.awaitTermination(20000, TimeUnit.MILLISECONDS); + long awaitTerminationTimeoutMillis = 100_000; + if (!executor.awaitTermination(awaitTerminationTimeoutMillis, TimeUnit.MILLISECONDS)) { + throw new TimeoutException("Completed " + counter.get() + "/" + n + " before timed out after " + + awaitTerminationTimeoutMillis + " milliseconds."); + } assertEquals(n, counter.get()); } @@ -1287,7 +1291,7 @@ protected void subscribeActual(Subscriber s) { } .concatMap(Functions.justFunction(Flowable.just(2)), 8) .test(0L) - .assertFailure(IllegalStateException.class); + .assertFailure(QueueOverflowException.class); } @Test diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithCompletableTest.java index fcf199dfd0..845c814dbc 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithCompletableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithMaybeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithMaybeTest.java index a855c09c26..5b45eafc7f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithMaybeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithMaybeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithSingleTest.java index 4301746a86..8a7ed3cd65 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCountTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCountTest.java index 158a3232f0..608138e357 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCountTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCountTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCreateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCreateTest.java index 8ca745dc0b..4c3b735476 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCreateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCreateTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounceTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounceTest.java index bfb33f0e8e..01122106c8 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounceTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounceTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -21,6 +21,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; +import io.reactivex.rxjava3.functions.Action; import org.junit.*; import org.mockito.InOrder; import org.reactivestreams.*; @@ -41,16 +42,86 @@ public class FlowableDebounceTest extends RxJavaTest { private TestScheduler scheduler; - private Subscriber Subscriber; + private Subscriber subscriber; private Scheduler.Worker innerScheduler; @Before public void before() { scheduler = new TestScheduler(); - Subscriber = TestHelper.mockSubscriber(); + subscriber = TestHelper.mockSubscriber(); innerScheduler = scheduler.createWorker(); } + @Test + public void debounceWithOnDroppedCallbackWithEx() throws Throwable { + Flowable source = Flowable.unsafeCreate(new Publisher() { + @Override + public void subscribe(Subscriber subscriber) { + subscriber.onSubscribe(new BooleanSubscription()); + publishNext(subscriber, 100, "one"); // Should be skipped since "two" will arrive before the timeout expires. + publishNext(subscriber, 400, "two"); // Should be published since "three" will arrive after the timeout expires. + publishNext(subscriber, 900, "three"); // Should be skipped since "four" will arrive before the timout expires. + publishNext(subscriber, 999, "four"); // Should be skipped since onComplete will arrive before the timeout expires. + publishCompleted(subscriber, 1000); // Should be published as soon as the timeout expires. + } + }); + + Action whenDisposed = mock(Action.class); + + Flowable sampled = source + .doOnCancel(whenDisposed) + .debounce(400, TimeUnit.MILLISECONDS, scheduler, e -> { + if ("three".equals(e)) { + throw new TestException("forced"); + } + }); + sampled.subscribe(subscriber); + + InOrder inOrder = inOrder(subscriber); + + scheduler.advanceTimeTo(1000, TimeUnit.MILLISECONDS); + inOrder.verify(subscriber, times(1)).onNext("two"); + inOrder.verify(subscriber, times(1)).onError(any(TestException.class)); + inOrder.verify(subscriber, times(0)).onNext("three"); + inOrder.verify(subscriber, times(0)).onNext("four"); + inOrder.verify(subscriber, times(0)).onComplete(); + inOrder.verifyNoMoreInteractions(); + verify(whenDisposed).run(); + } + + @Test + public void debounceWithOnDroppedCallback() { + Flowable source = Flowable.unsafeCreate(new Publisher() { + @Override + public void subscribe(Subscriber subscriber) { + subscriber.onSubscribe(new BooleanSubscription()); + publishNext(subscriber, 100, "one"); // Should be skipped since "two" will arrive before the timeout expires. + publishNext(subscriber, 400, "two"); // Should be published since "three" will arrive after the timeout expires. + publishNext(subscriber, 900, "three"); // Should be skipped since "four" will arrive before the timout expires. + publishNext(subscriber, 999, "four"); // Should be skipped since onComplete will arrive before the timeout expires. + publishCompleted(subscriber, 1000); // Should be published as soon as the timeout expires. + } + }); + + Observer dropCallbackObserver = TestHelper.mockObserver(); + Flowable sampled = source.debounce(400, TimeUnit.MILLISECONDS, scheduler, dropCallbackObserver::onNext); + sampled.subscribe(subscriber); + + scheduler.advanceTimeTo(0, TimeUnit.MILLISECONDS); + InOrder inOrder = inOrder(subscriber); + InOrder dropCallbackOrder = inOrder(dropCallbackObserver); + + // must go to 800 since it must be 400 after when two is sent, which is at 400 + scheduler.advanceTimeTo(800, TimeUnit.MILLISECONDS); + inOrder.verify(subscriber, times(1)).onNext("two"); + dropCallbackOrder.verify(dropCallbackObserver, times(1)).onNext("one"); + scheduler.advanceTimeTo(1000, TimeUnit.MILLISECONDS); + dropCallbackOrder.verify(dropCallbackObserver, times(1)).onNext("three"); + inOrder.verify(subscriber, times(1)).onComplete(); + inOrder.verifyNoMoreInteractions(); + dropCallbackOrder.verifyNoMoreInteractions(); + } + @Test public void debounceWithCompleted() { Flowable source = Flowable.unsafeCreate(new Publisher() { @@ -65,15 +136,15 @@ public void subscribe(Subscriber subscriber) { }); Flowable sampled = source.debounce(400, TimeUnit.MILLISECONDS, scheduler); - sampled.subscribe(Subscriber); + sampled.subscribe(subscriber); scheduler.advanceTimeTo(0, TimeUnit.MILLISECONDS); - InOrder inOrder = inOrder(Subscriber); + InOrder inOrder = inOrder(subscriber); // must go to 800 since it must be 400 after when two is sent, which is at 400 scheduler.advanceTimeTo(800, TimeUnit.MILLISECONDS); - inOrder.verify(Subscriber, times(1)).onNext("two"); + inOrder.verify(subscriber, times(1)).onNext("two"); scheduler.advanceTimeTo(1000, TimeUnit.MILLISECONDS); - inOrder.verify(Subscriber, times(1)).onComplete(); + inOrder.verify(subscriber, times(1)).onComplete(); inOrder.verifyNoMoreInteractions(); } @@ -97,13 +168,13 @@ public void subscribe(Subscriber subscriber) { }); Flowable sampled = source.debounce(200, TimeUnit.MILLISECONDS, scheduler); - sampled.subscribe(Subscriber); + sampled.subscribe(subscriber); scheduler.advanceTimeTo(0, TimeUnit.MILLISECONDS); - InOrder inOrder = inOrder(Subscriber); - inOrder.verify(Subscriber, times(0)).onNext(anyString()); + InOrder inOrder = inOrder(subscriber); + inOrder.verify(subscriber, times(0)).onNext(anyString()); scheduler.advanceTimeTo(1000, TimeUnit.MILLISECONDS); - inOrder.verify(Subscriber, times(1)).onComplete(); + inOrder.verify(subscriber, times(1)).onComplete(); inOrder.verifyNoMoreInteractions(); } @@ -121,15 +192,15 @@ public void subscribe(Subscriber subscriber) { }); Flowable sampled = source.debounce(400, TimeUnit.MILLISECONDS, scheduler); - sampled.subscribe(Subscriber); + sampled.subscribe(subscriber); scheduler.advanceTimeTo(0, TimeUnit.MILLISECONDS); - InOrder inOrder = inOrder(Subscriber); + InOrder inOrder = inOrder(subscriber); // 100 + 400 means it triggers at 500 scheduler.advanceTimeTo(500, TimeUnit.MILLISECONDS); - inOrder.verify(Subscriber).onNext("one"); + inOrder.verify(subscriber).onNext("one"); scheduler.advanceTimeTo(701, TimeUnit.MILLISECONDS); - inOrder.verify(Subscriber).onError(any(TestException.class)); + inOrder.verify(subscriber).onError(any(TestException.class)); inOrder.verifyNoMoreInteractions(); } @@ -530,7 +601,7 @@ public void timedBadRequest() { public void timedLateEmit() { TestSubscriber ts = new TestSubscriber<>(); DebounceTimedSubscriber sub = new DebounceTimedSubscriber<>( - ts, 1, TimeUnit.SECONDS, new TestScheduler().createWorker()); + ts, 1, TimeUnit.SECONDS, new TestScheduler().createWorker(), null); sub.onSubscribe(new BooleanSubscription()); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDefaultIfEmptyTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDefaultIfEmptyTest.java index dadec04fbe..fc2c7e15a8 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDefaultIfEmptyTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDefaultIfEmptyTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDeferTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDeferTest.java index 8a1b48d4e9..caec2443fc 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDeferTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDeferTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelaySubscriptionOtherTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelaySubscriptionOtherTest.java index fba8aedbac..57a8af4586 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelaySubscriptionOtherTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelaySubscriptionOtherTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.flowable; import java.util.concurrent.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelayTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelayTest.java index 79740ee44c..4d67594a17 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelayTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelayTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -20,6 +20,7 @@ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; +import java.util.concurrent.locks.LockSupport; import org.junit.*; import org.mockito.InOrder; @@ -28,6 +29,7 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.*; +import io.reactivex.rxjava3.internal.disposables.SequentialDisposable; import io.reactivex.rxjava3.internal.functions.Functions; import io.reactivex.rxjava3.processors.PublishProcessor; import io.reactivex.rxjava3.schedulers.*; @@ -1030,4 +1032,38 @@ public Publisher apply(Integer t) throws Exception { .to(TestHelper.testConsumer()) .assertFailureAndMessage(NullPointerException.class, "The itemDelay returned a null Publisher"); } + + @Test + public void cancelShouldPreventRandomSubsequentEmissions() { + for (int attempt = 1; attempt < 100; attempt ++) { + + SequentialDisposable disposable = new SequentialDisposable(); + ConcurrentLinkedQueue sink = new ConcurrentLinkedQueue<>(); + + disposable.replace( + Flowable.range(1, 10) + .delay(1, TimeUnit.MICROSECONDS, Schedulers.computation(), true) + .doOnNext(v -> { + if (v == 1) { + Schedulers.computation().scheduleDirect(disposable::dispose); + } + sink.offer(v); + }) + .subscribe()); + + LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(1)); + + Integer last = null; + + while (!sink.isEmpty()) { + Integer current = sink.poll(); + + if (last != null && last + 1 != current) { + fail("Emission hole: " + last + " -> " + current); + } + + last = current; + } + } + } } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDematerializeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDematerializeTest.java index 2571dc481e..89a1454614 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDematerializeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDematerializeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDetachTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDetachTest.java index 3c87bfeb9a..23d895ca08 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDetachTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDetachTest.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.operators.flowable; import java.lang.ref.WeakReference; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinctTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinctTest.java index 87d5cda476..362283c719 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinctTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinctTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -27,9 +27,10 @@ import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; import io.reactivex.rxjava3.internal.util.ExceptionHelper; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueSubscription; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.processors.UnicastProcessor; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinctUntilChangedTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinctUntilChangedTest.java index 9d9aa55fd8..00525b562b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinctUntilChangedTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinctUntilChangedTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -28,8 +28,8 @@ import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.processors.*; import io.reactivex.rxjava3.subscribers.TestSubscriber; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterNextTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterNextTest.java index 2ef5d0e082..1e36eee49f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterNextTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterNextTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -23,7 +23,7 @@ import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.Consumer; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.processors.UnicastProcessor; import io.reactivex.rxjava3.subscribers.TestSubscriber; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterTerminateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterTerminateTest.java index cee677cf41..ab1a3bd8ab 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterTerminateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterTerminateTest.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.operators.flowable; import static org.junit.Assert.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoFinallyTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoFinallyTest.java index 3610593751..79cba18b3d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoFinallyTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoFinallyTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -24,7 +24,8 @@ import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.*; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueSubscription; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.processors.UnicastProcessor; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnEachTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnEachTest.java index fc346086b6..484d62c19e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnEachTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnEachTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -29,8 +29,9 @@ import io.reactivex.rxjava3.flowables.ConnectableFlowable; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.processors.UnicastProcessor; import io.reactivex.rxjava3.subscribers.TestSubscriber; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnLifecycleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnLifecycleTest.java index 524a0b5acb..e1df09d7ee 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnLifecycleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnLifecycleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnRequestTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnRequestTest.java index b07470a398..3e123089dc 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnRequestTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnRequestTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnSubscribeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnSubscribeTest.java index c9ea4359d1..6dff7a5321 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnSubscribeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnSubscribeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnUnsubscribeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnUnsubscribeTest.java index eab0324ba8..d060928dee 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnUnsubscribeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnUnsubscribeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtTest.java index 56297cbe05..0e36e075a8 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFilterTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFilterTest.java index 586a7b56c2..4b62f1e2a4 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFilterTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFilterTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -28,8 +28,9 @@ import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.processors.*; import io.reactivex.rxjava3.subscribers.TestSubscriber; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFirstTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFirstTest.java index efcdb290c0..b6100ddeb3 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFirstTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFirstTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapCompletableTest.java index 3d14dd0eb2..5e4e5c8f77 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapCompletableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -26,8 +26,9 @@ import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueSubscription; import io.reactivex.rxjava3.processors.PublishProcessor; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.subscribers.TestSubscriber; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapMaybeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapMaybeTest.java index 14a0418d15..a377761f0c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapMaybeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapMaybeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapSingleTest.java index cd34417ea9..b13e8316af 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapTest.java index 935182fd7a..be94c5e57c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -1391,7 +1391,7 @@ protected void subscribeActual(@NonNull Subscriber<@NonNull ? super @NonNull Int } .flatMap(v -> Flowable.just(v), 1) .test(0L) - .assertFailure(MissingBackpressureException.class); + .assertFailure(QueueOverflowException.class); } @Test @@ -1413,7 +1413,7 @@ protected void subscribeActual(@NonNull Subscriber<@NonNull ? super @NonNull Int } }) .test() - .assertFailure(MissingBackpressureException.class, 1); + .assertFailure(QueueOverflowException.class, 1); } @Test @@ -1430,7 +1430,7 @@ protected void subscribeActual(@NonNull Subscriber<@NonNull ? super @NonNull Int } }, false, 1, 1) .test(0L) - .assertFailure(MissingBackpressureException.class); + .assertFailure(QueueOverflowException.class); } @Test diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlattenIterableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlattenIterableTest.java index c65cf4b5b4..2cb9392e19 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlattenIterableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlattenIterableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -26,10 +26,11 @@ import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.operators.flowable.FlowableFlattenIterable.FlattenIterableSubscriber; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; import io.reactivex.rxjava3.internal.util.ExceptionHelper; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueSubscription; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.processors.PublishProcessor; import io.reactivex.rxjava3.subscribers.TestSubscriber; @@ -813,7 +814,7 @@ protected void subscribeActual(Subscriber s) { } .flatMapIterable(Functions.justFunction(Arrays.asList(1)), 1) .test(0L) - .assertFailure(MissingBackpressureException.class); + .assertFailure(QueueOverflowException.class); } @Test diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableForEachTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableForEachTest.java index 0064f61c3f..e74d5caf26 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableForEachTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableForEachTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromActionTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromActionTest.java index b19a03159c..5395ae3068 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromActionTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromActionTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -24,7 +24,7 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.subscribers.TestSubscriber; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromArrayTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromArrayTest.java index d4dda81754..d3195ad8b2 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromArrayTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromArrayTest.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.operators.flowable; @@ -21,7 +18,7 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.functions.Predicate; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.ScalarSupplier; +import io.reactivex.rxjava3.operators.ScalarSupplier; import io.reactivex.rxjava3.subscribers.TestSubscriber; import io.reactivex.rxjava3.testsupport.TestHelper; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCallableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCallableTest.java index f8f3ed670c..b603fd2d9b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCallableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCallableTest.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.operators.flowable; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCompletableTest.java index 5e05936816..fc8e4ec977 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCompletableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -25,6 +25,7 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.fuseable.*; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.subscribers.TestSubscriber; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromIterableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromIterableTest.java index 1880d2be43..5fe804a310 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromIterableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromIterableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -30,8 +30,10 @@ import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.util.CrashingIterable; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueSubscription; +import io.reactivex.rxjava3.operators.SimpleQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.subscribers.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromMaybeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromMaybeTest.java index 5eca34f9cb..d33b9f1e40 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromMaybeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromMaybeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,7 +19,7 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.TestException; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.subjects.MaybeSubject; import io.reactivex.rxjava3.subscribers.TestSubscriber; import io.reactivex.rxjava3.testsupport.TestSubscriberEx; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromObservableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromObservableTest.java index 0ef64d192c..f9f666d7fd 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromObservableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromObservableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromRunnableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromRunnableTest.java index f133c8fb99..19ef5eb018 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromRunnableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromRunnableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -25,7 +25,7 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.Supplier; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.subscribers.TestSubscriber; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSingleTest.java index 01f6b1661f..1aa1503299 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,7 +19,7 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.TestException; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.subjects.SingleSubject; import io.reactivex.rxjava3.subscribers.TestSubscriber; import io.reactivex.rxjava3.testsupport.TestSubscriberEx; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSourceTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSourceTest.java index fefbf1533e..6506c010ea 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSourceTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSourceTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -137,7 +137,7 @@ public void normalError() { ts.assertError(MissingBackpressureException.class); ts.assertNotComplete(); - Assert.assertEquals("create: could not emit value due to lack of requests", ts.errors().get(0).getMessage()); + Assert.assertEquals("create: " + MissingBackpressureException.DEFAULT_MESSAGE, ts.errors().get(0).getMessage()); } @Test diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSupplierTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSupplierTest.java index 5753e8ff66..423b1409c1 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSupplierTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSupplierTest.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.operators.flowable; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGenerateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGenerateTest.java index 23989c717b..9274685118 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGenerateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGenerateTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupByTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupByTest.java index 9512cab905..d0d7dbea44 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupByTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupByTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -35,9 +35,9 @@ import io.reactivex.rxjava3.flowables.GroupedFlowable; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.internal.schedulers.ImmediateThinScheduler; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.processors.PublishProcessor; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.subjects.PublishSubject; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupJoinTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupJoinTest.java index 40539769e9..fe83ad9fff 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupJoinTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupJoinTest.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.operators.flowable; import static org.junit.Assert.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableHideTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableHideTest.java index c2162b2872..f95775ebda 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableHideTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableHideTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElementsTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElementsTest.java index 2558b4a433..dfc0e11680 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElementsTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElementsTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -23,8 +23,9 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.observers.DisposableCompletableObserver; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueSubscription; import io.reactivex.rxjava3.processors.PublishProcessor; import io.reactivex.rxjava3.subscribers.*; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableInternalHelperTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableInternalHelperTest.java index e570842c98..1549f01d63 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableInternalHelperTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableInternalHelperTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.flowable; import org.junit.Test; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIntervalRangeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIntervalRangeTest.java index 70156bcd81..f8bc3355e9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIntervalRangeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIntervalRangeTest.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.operators.flowable; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIntervalTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIntervalTest.java index 68b8bd59fd..7fde08d47f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIntervalTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIntervalTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableJoinTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableJoinTest.java index b74fa0752f..fe28a93320 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableJoinTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableJoinTest.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.operators.flowable; import static org.mockito.ArgumentMatchers.any; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLastTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLastTest.java index 1897d236d6..3164802ab6 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLastTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLastTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLiftTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLiftTest.java index c208b8370b..68227e8dfc 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLiftTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLiftTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapNotificationTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapNotificationTest.java index 0deec9376b..905cda5548 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapNotificationTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapNotificationTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapTest.java index f7898ac5a9..3d77fe5d46 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -27,9 +27,10 @@ import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.schedulers.ImmediateThinScheduler; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.processors.*; import io.reactivex.rxjava3.schedulers.Schedulers; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMaterializeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMaterializeTest.java index 1d798e6272..0f9c3df225 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMaterializeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMaterializeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeDelayErrorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeDelayErrorTest.java index 64a2206e84..1959921168 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeDelayErrorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeDelayErrorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeMaxConcurrentTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeMaxConcurrentTest.java index b2582430bb..25b9cd825a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeMaxConcurrentTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeMaxConcurrentTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeTest.java index 3a1d65fc33..57b7a4a667 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -204,7 +204,7 @@ public void mergeArrayWithThreading() { TestSubscriber ts = new TestSubscriber<>(stringSubscriber); m.subscribe(ts); - ts.awaitDone(5, TimeUnit.SECONDS); + ts.awaitDone(10, TimeUnit.SECONDS); ts.assertNoErrors(); verify(stringSubscriber, never()).onError(any(Throwable.class)); @@ -598,7 +598,7 @@ public void run() { TestSubscriber ts = new TestSubscriber<>(); merge.subscribe(ts); - ts.awaitDone(5, TimeUnit.SECONDS); + ts.awaitDone(10, TimeUnit.SECONDS); ts.assertComplete(); List onNextEvents = ts.values(); assertEquals(300, onNextEvents.size()); @@ -645,7 +645,7 @@ public void run() { TestSubscriber ts = new TestSubscriber<>(); merge.subscribe(ts); - ts.awaitDone(5, TimeUnit.SECONDS); + ts.awaitDone(10, TimeUnit.SECONDS); ts.assertNoErrors(); ts.assertComplete(); List onNextEvents = ts.values(); @@ -706,7 +706,7 @@ public void onNext(Integer t) { }; Flowable.merge(f1.take(Flowable.bufferSize() * 2), Flowable.just(-99)).subscribe(testSubscriber); - testSubscriber.awaitDone(5, TimeUnit.SECONDS); + testSubscriber.awaitDone(10, TimeUnit.SECONDS); List onNextEvents = testSubscriber.values(); @@ -752,7 +752,7 @@ public void onNext(Integer t) { }; Flowable.merge(f1.take(Flowable.bufferSize() * 2), f2.take(Flowable.bufferSize() * 2)).observeOn(Schedulers.computation()).subscribe(testSubscriber); - testSubscriber.awaitDone(5, TimeUnit.SECONDS); + testSubscriber.awaitDone(10, TimeUnit.SECONDS); if (testSubscriber.errors().size() > 0) { testSubscriber.errors().get(0).printStackTrace(); } @@ -795,7 +795,7 @@ public void onNext(Integer t) { }; Flowable.merge(f1).observeOn(Schedulers.computation()).take(Flowable.bufferSize() * 2).subscribe(testSubscriber); - testSubscriber.awaitDone(5, TimeUnit.SECONDS); + testSubscriber.awaitDone(10, TimeUnit.SECONDS); if (testSubscriber.errors().size() > 0) { testSubscriber.errors().get(0).printStackTrace(); } @@ -850,7 +850,7 @@ public void onNext(Integer t) { }; Flowable.merge(f1).observeOn(Schedulers.computation()).take(Flowable.bufferSize() * 2).subscribe(testSubscriber); - testSubscriber.awaitDone(5, TimeUnit.SECONDS); + testSubscriber.awaitDone(10, TimeUnit.SECONDS); if (testSubscriber.errors().size() > 0) { testSubscriber.errors().get(0).printStackTrace(); } @@ -868,7 +868,7 @@ public void onNext(Integer t) { public void merge1AsyncStreamOf1() { TestSubscriber ts = new TestSubscriber<>(); mergeNAsyncStreamsOfN(1, 1).subscribe(ts); - ts.awaitDone(5, TimeUnit.SECONDS); + ts.awaitDone(10, TimeUnit.SECONDS); ts.assertNoErrors(); assertEquals(1, ts.values().size()); } @@ -877,7 +877,7 @@ public void merge1AsyncStreamOf1() { public void merge1AsyncStreamOf1000() { TestSubscriber ts = new TestSubscriber<>(); mergeNAsyncStreamsOfN(1, 1000).subscribe(ts); - ts.awaitDone(5, TimeUnit.SECONDS); + ts.awaitDone(10, TimeUnit.SECONDS); ts.assertNoErrors(); assertEquals(1000, ts.values().size()); } @@ -886,7 +886,7 @@ public void merge1AsyncStreamOf1000() { public void merge10AsyncStreamOf1000() { TestSubscriber ts = new TestSubscriber<>(); mergeNAsyncStreamsOfN(10, 1000).subscribe(ts); - ts.awaitDone(5, TimeUnit.SECONDS); + ts.awaitDone(10, TimeUnit.SECONDS); ts.assertNoErrors(); assertEquals(10000, ts.values().size()); } @@ -895,7 +895,7 @@ public void merge10AsyncStreamOf1000() { public void merge1000AsyncStreamOf1000() { TestSubscriber ts = new TestSubscriber<>(); mergeNAsyncStreamsOfN(1000, 1000).subscribe(ts); - ts.awaitDone(5, TimeUnit.SECONDS); + ts.awaitDone(10, TimeUnit.SECONDS); ts.assertNoErrors(); assertEquals(1000000, ts.values().size()); } @@ -904,7 +904,7 @@ public void merge1000AsyncStreamOf1000() { public void merge2000AsyncStreamOf100() { TestSubscriber ts = new TestSubscriber<>(); mergeNAsyncStreamsOfN(2000, 100).subscribe(ts); - ts.awaitDone(5, TimeUnit.SECONDS); + ts.awaitDone(10, TimeUnit.SECONDS); ts.assertNoErrors(); assertEquals(200000, ts.values().size()); } @@ -913,7 +913,7 @@ public void merge2000AsyncStreamOf100() { public void merge100AsyncStreamOf1() { TestSubscriber ts = new TestSubscriber<>(); mergeNAsyncStreamsOfN(100, 1).subscribe(ts); - ts.awaitDone(5, TimeUnit.SECONDS); + ts.awaitDone(10, TimeUnit.SECONDS); ts.assertNoErrors(); assertEquals(100, ts.values().size()); } @@ -935,7 +935,7 @@ public Flowable apply(Integer i) { public void merge1SyncStreamOf1() { TestSubscriber ts = new TestSubscriber<>(); mergeNSyncStreamsOfN(1, 1).subscribe(ts); - ts.awaitDone(5, TimeUnit.SECONDS); + ts.awaitDone(10, TimeUnit.SECONDS); ts.assertNoErrors(); assertEquals(1, ts.values().size()); } @@ -944,7 +944,7 @@ public void merge1SyncStreamOf1() { public void merge1SyncStreamOf1000000() { TestSubscriber ts = new TestSubscriber<>(); mergeNSyncStreamsOfN(1, 1000000).subscribe(ts); - ts.awaitDone(5, TimeUnit.SECONDS); + ts.awaitDone(10, TimeUnit.SECONDS); ts.assertNoErrors(); assertEquals(1000000, ts.values().size()); } @@ -953,7 +953,7 @@ public void merge1SyncStreamOf1000000() { public void merge1000SyncStreamOf1000() { TestSubscriber ts = new TestSubscriber<>(); mergeNSyncStreamsOfN(1000, 1000).subscribe(ts); - ts.awaitDone(5, TimeUnit.SECONDS); + ts.awaitDone(10, TimeUnit.SECONDS); ts.assertNoErrors(); assertEquals(1000000, ts.values().size()); } @@ -962,7 +962,7 @@ public void merge1000SyncStreamOf1000() { public void merge10000SyncStreamOf10() { TestSubscriber ts = new TestSubscriber<>(); mergeNSyncStreamsOfN(10000, 10).subscribe(ts); - ts.awaitDone(5, TimeUnit.SECONDS); + ts.awaitDone(10, TimeUnit.SECONDS); ts.assertNoErrors(); assertEquals(100000, ts.values().size()); } @@ -971,7 +971,7 @@ public void merge10000SyncStreamOf10() { public void merge1000000SyncStreamOf1() { TestSubscriber ts = new TestSubscriber<>(); mergeNSyncStreamsOfN(1000000, 1).subscribe(ts); - ts.awaitDone(5, TimeUnit.SECONDS); + ts.awaitDone(10, TimeUnit.SECONDS); ts.assertNoErrors(); assertEquals(1000000, ts.values().size()); } @@ -1043,7 +1043,7 @@ public void subscribe(Subscriber s) { }); Flowable.merge(os).subscribe(ts); - ts.awaitDone(5, TimeUnit.SECONDS); + ts.awaitDone(10, TimeUnit.SECONDS); ts.assertNoErrors(); assertEquals(10000, ts.values().size()); } @@ -1196,7 +1196,7 @@ public void run() { latch.countDown(); } }).subscribe(); - boolean a = latch.await(2, TimeUnit.SECONDS); + boolean a = latch.await(10, TimeUnit.SECONDS); if (!a) { for (String s : messages) { System.out.println("DEBUG => " + s); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithCompletableTest.java index c074796be6..8eab622ccf 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithCompletableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithMaybeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithMaybeTest.java index 655d75fe08..aeef5bb09b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithMaybeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithMaybeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithSingleTest.java index c187880426..23612f5754 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableObserveOnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableObserveOnTest.java index a2bf5505ce..e4e3d6f3fe 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableObserveOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableObserveOnTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -31,11 +31,13 @@ import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.operators.flowable.FlowableObserveOn.BaseObserveOnSubscriber; import io.reactivex.rxjava3.internal.schedulers.ImmediateThinScheduler; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueSubscription; +import io.reactivex.rxjava3.operators.SimpleQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.processors.*; import io.reactivex.rxjava3.schedulers.*; @@ -577,13 +579,13 @@ public void onNext(Integer t) { assertEquals(1, errors.size()); System.out.println("Errors: " + errors); Throwable t = errors.get(0); - if (t instanceof MissingBackpressureException) { + if (t instanceof QueueOverflowException) { // success, we expect this } else { - if (t.getCause() instanceof MissingBackpressureException) { + if (t.getCause() instanceof QueueOverflowException) { // this is also okay } else { - fail("Expecting MissingBackpressureException"); + fail("Expecting QueueOverflowException"); } } } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferStrategyTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferStrategyTest.java index 000d504211..217162c206 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferStrategyTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferStrategyTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -15,7 +15,9 @@ import static io.reactivex.rxjava3.core.BackpressureOverflowStrategy.*; import static io.reactivex.rxjava3.internal.functions.Functions.EMPTY_ACTION; -import static org.junit.Assert.assertEquals; +import static org.junit.Assert.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.*; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @@ -28,8 +30,9 @@ import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; +import io.reactivex.rxjava3.processors.PublishProcessor; import io.reactivex.rxjava3.subscribers.*; -import io.reactivex.rxjava3.testsupport.TestHelper; +import io.reactivex.rxjava3.testsupport.*; public class FlowableOnBackpressureBufferStrategyTest extends RxJavaTest { @@ -225,4 +228,98 @@ public void cancelOnDrain() { .requestMore(10) .assertResult(1); } + + @Test + public void onDroppedNormalDropOldest() throws Throwable { + PublishProcessor pp = PublishProcessor.create(); + + @SuppressWarnings("unchecked") + Consumer onDropped = mock(Consumer.class); + + TestSubscriber ts = pp.onBackpressureBuffer(1, null, BackpressureOverflowStrategy.DROP_OLDEST, onDropped) + .test(0L); + + ts.assertEmpty(); + + pp.onNext(1); + + ts.assertEmpty(); + verify(onDropped, never()).accept(any()); + + pp.onNext(2); + + ts.assertEmpty(); + + verify(onDropped).accept(1); + } + + @Test + public void onDroppedNormalDropLatest() throws Throwable { + PublishProcessor pp = PublishProcessor.create(); + + @SuppressWarnings("unchecked") + Consumer onDropped = mock(Consumer.class); + + TestSubscriber ts = pp.onBackpressureBuffer(2, null, BackpressureOverflowStrategy.DROP_LATEST, onDropped) + .test(0L); + + ts.assertEmpty(); + + pp.onNext(1); + + pp.onNext(2); + + ts.assertEmpty(); + verify(onDropped, never()).accept(any()); + + pp.onNext(3); + + ts.assertEmpty(); + + verify(onDropped).accept(2); + } + + @Test + public void onDroppedNormalError() throws Throwable { + PublishProcessor pp = PublishProcessor.create(); + + @SuppressWarnings("unchecked") + Consumer onDropped = mock(Consumer.class); + + TestSubscriber ts = pp.onBackpressureBuffer(1, null, BackpressureOverflowStrategy.ERROR, onDropped) + .test(0L); + + ts.assertEmpty(); + + pp.onNext(1); + + ts.assertEmpty(); + verify(onDropped, never()).accept(any()); + + pp.onNext(2); + + ts.assertFailure(MissingBackpressureException.class); + + verify(onDropped).accept(2); + } + + @Test + public void onDroppedCrash() throws Throwable { + PublishProcessor pp = PublishProcessor.create(); + + Consumer onDropped = v -> { throw new TestException(); }; + + TestSubscriberEx ts = pp.onBackpressureBuffer(1, null, BackpressureOverflowStrategy.DROP_OLDEST, onDropped) + .subscribeWith(new TestSubscriberEx(0L)); + + ts.assertEmpty(); + + pp.onNext(1); + + ts.assertEmpty(); + + pp.onNext(2); + + ts.assertFailure(TestException.class); + } } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferTest.java index 588127bae4..657ce36f1b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -14,6 +14,8 @@ package io.reactivex.rxjava3.internal.operators.flowable; import static org.junit.Assert.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.*; import java.util.List; import java.util.concurrent.*; @@ -26,9 +28,9 @@ import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.processors.PublishProcessor; import io.reactivex.rxjava3.schedulers.Schedulers; @@ -350,4 +352,50 @@ public void doubleOnSubscribe() { public void badRequest() { TestHelper.assertBadRequestReported(Flowable.never().onBackpressureBuffer()); } + + @Test + public void onDroppedNormal() throws Throwable { + PublishProcessor pp = PublishProcessor.create(); + + @SuppressWarnings("unchecked") + Consumer onDropped = mock(Consumer.class); + + TestSubscriber ts = pp.onBackpressureBuffer(1, false, false, () -> { }, onDropped) + .test(0L); + + ts.assertEmpty(); + + pp.onNext(1); + + ts.assertEmpty(); + verify(onDropped, never()).accept(any()); + + pp.onNext(2); + + ts.assertFailure(MissingBackpressureException.class); + + verify(onDropped).accept(2); + } + + @Test + public void onDroppedCrash() throws Throwable { + PublishProcessor pp = PublishProcessor.create(); + + Consumer onDropped = v -> { throw new TestException(); }; + + TestSubscriberEx ts = pp.onBackpressureBuffer(1, false, false, () -> { }, onDropped) + .subscribeWith(new TestSubscriberEx(0L)); + + ts.assertEmpty(); + + pp.onNext(1); + + ts.assertEmpty(); + + pp.onNext(2); + + ts.assertFailure(MissingBackpressureException.class); + + assertTrue(ts.errors().get(0).getCause() instanceof TestException); + } } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureDropTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureDropTest.java index 811e27f766..0dfec9422c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureDropTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureDropTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureErrorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureErrorTest.java index ef65662586..2693bf3014 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureErrorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureErrorTest.java @@ -1,11 +1,11 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. - *

+ * * Licensed 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. diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureLatestTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureLatestTest.java index 438ebb1415..f0d50994ed 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureLatestTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureLatestTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -17,6 +17,7 @@ import java.util.concurrent.TimeUnit; import org.junit.*; +import org.mockito.InOrder; import org.reactivestreams.Publisher; import io.reactivex.rxjava3.core.*; @@ -27,6 +28,8 @@ import io.reactivex.rxjava3.subscribers.TestSubscriber; import io.reactivex.rxjava3.testsupport.*; +import static org.mockito.Mockito.inOrder; + public class FlowableOnBackpressureLatestTest extends RxJavaTest { @Test public void simple() { @@ -62,6 +65,68 @@ public void simpleBackpressure() { ts.assertNotComplete(); } + @Test + public void simpleBackpressureWithOnDroppedCallback() { + PublishProcessor source = PublishProcessor.create(); + TestSubscriberEx ts = new TestSubscriberEx<>(0L); + + Observer dropCallbackObserver = TestHelper.mockObserver(); + + source.onBackpressureLatest(dropCallbackObserver::onNext) + .subscribe(ts); + + ts.assertNoValues(); + + source.onNext(1); + source.onNext(2); + source.onNext(3); + + ts.request(1); + + ts.assertValues(3); + + source.onNext(4); + source.onNext(5); + + ts.request(2); + + ts.assertValues(3,5); + + InOrder dropCallbackOrder = inOrder(dropCallbackObserver); + dropCallbackOrder.verify(dropCallbackObserver).onNext(1); + dropCallbackOrder.verify(dropCallbackObserver).onNext(2); + dropCallbackOrder.verify(dropCallbackObserver).onNext(4); + dropCallbackOrder.verifyNoMoreInteractions(); + } + + @Test + public void simpleBackpressureWithOnDroppedCallbackEx() { + PublishProcessor source = PublishProcessor.create(); + TestSubscriberEx ts = new TestSubscriberEx<>(0L); + + source.onBackpressureLatest(e -> { + if (e == 3) { + throw new TestException("forced"); + } + }) + .subscribe(ts); + + ts.assertNoValues(); + + source.onNext(1); + source.onNext(2); + + ts.request(1); + + ts.assertValues(2); + + source.onNext(3); + source.onNext(4); + + ts.assertError(TestException.class); + ts.assertValues(2); + } + @Test public void synchronousDrop() { PublishProcessor source = PublishProcessor.create(); @@ -105,7 +170,7 @@ public void synchronousDrop() { } @Test - public void asynchronousDrop() throws InterruptedException { + public void asynchronousDrop() { TestSubscriberEx ts = new TestSubscriberEx(1L) { final Random rnd = new Random(); @Override @@ -133,6 +198,12 @@ public void onNext(Integer t) { int n = ts.values().size(); System.out.println("testAsynchronousDrop -> " + n); Assert.assertTrue("All events received?", n < m); + int previous = 0; + for (Integer current : ts.values()) { + Assert.assertTrue("The sequence must be increasing [current value=" + previous + + ", previous value=" + current + "]", previous <= current); + previous = current; + } } @Test diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureReduceTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureReduceTest.java new file mode 100644 index 0000000000..5f7b7ad957 --- /dev/null +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureReduceTest.java @@ -0,0 +1,261 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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 io.reactivex.rxjava3.internal.operators.flowable; + +import io.reactivex.rxjava3.core.Flowable; +import io.reactivex.rxjava3.core.RxJavaTest; +import io.reactivex.rxjava3.exceptions.TestException; +import io.reactivex.rxjava3.functions.BiFunction; +import io.reactivex.rxjava3.processors.PublishProcessor; +import io.reactivex.rxjava3.schedulers.Schedulers; +import io.reactivex.rxjava3.subscribers.TestSubscriber; +import io.reactivex.rxjava3.testsupport.TestHelper; +import io.reactivex.rxjava3.testsupport.TestSubscriberEx; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Random; +import java.util.concurrent.TimeUnit; + +public class FlowableOnBackpressureReduceTest extends RxJavaTest { + + static final BiFunction TEST_INT_REDUCER = (previous, current) -> previous + current + 50; + + static final BiFunction TEST_OBJECT_REDUCER = (previous, current) -> current; + + @Test + public void simple() { + TestSubscriberEx ts = new TestSubscriberEx<>(); + + Flowable.range(1, 5).onBackpressureReduce(TEST_INT_REDUCER).subscribe(ts); + + ts.assertNoErrors(); + ts.assertTerminated(); + ts.assertValues(1, 2, 3, 4, 5); + } + + @Test + public void simpleError() { + TestSubscriberEx ts = new TestSubscriberEx<>(); + + Flowable.range(1, 5).concatWith(Flowable.error(new TestException())) + .onBackpressureReduce(TEST_INT_REDUCER).subscribe(ts); + + ts.assertTerminated(); + ts.assertError(TestException.class); + ts.assertValues(1, 2, 3, 4, 5); + } + + @Test + public void simpleBackpressure() { + TestSubscriber ts = new TestSubscriber<>(2L); + + Flowable.range(1, 5).onBackpressureReduce(TEST_INT_REDUCER).subscribe(ts); + + ts.assertNoErrors(); + ts.assertValues(1, 2); + ts.assertNotComplete(); + } + + @Test + public void synchronousDrop() { + PublishProcessor source = PublishProcessor.create(); + TestSubscriberEx ts = new TestSubscriberEx<>(0L); + + source.onBackpressureReduce(TEST_INT_REDUCER).subscribe(ts); + + ts.assertNoValues(); + + source.onNext(1); + ts.request(2); + + ts.assertValue(1); + + source.onNext(2); + + ts.assertValues(1, 2); + + source.onNext(3); + source.onNext(4); //3 + 4 + 50 == 57 + source.onNext(5); //57 + 5 + 50 == 112 + source.onNext(6); //112 + 6 + 50 == 168 + + ts.request(2); + + ts.assertValues(1, 2, 168); + + source.onNext(7); + + ts.assertValues(1, 2, 168, 7); + + source.onNext(8); + source.onNext(9); //8 + 9 + 50 == 67 + source.onComplete(); + + ts.request(1); + + ts.assertValues(1, 2, 168, 7, 67); + ts.assertNoErrors(); + ts.assertTerminated(); + } + + @Test + public void reduceBackpressuredSync() { + PublishProcessor source = PublishProcessor.create(); + TestSubscriberEx ts = new TestSubscriberEx<>(0L); + + source.onBackpressureReduce(Integer::sum).subscribe(ts); + + source.onNext(1); + source.onNext(2); + source.onNext(3); + + ts.request(1); + + ts.assertValuesOnly(6); + + source.onNext(4); + source.onComplete(); + + ts.assertValuesOnly(6); + + ts.request(1); + ts.assertResult(6, 4); + } + + private TestSubscriberEx createDelayedSubscriber() { + return new TestSubscriberEx(1L) { + final Random rnd = new Random(); + + @Override + public void onNext(T t) { + super.onNext(t); + if (rnd.nextDouble() < 0.001) { + try { + Thread.sleep(1); + } catch (InterruptedException ex) { + ex.printStackTrace(); + } + } + request(1); + } + }; + } + + private void assertValuesDropped(TestSubscriberEx ts, int totalValues) { + int n = ts.values().size(); + System.out.println("testAsynchronousDrop -> " + n); + Assert.assertTrue("All events received?", n < totalValues); + } + + private void assertIncreasingSequence(TestSubscriberEx ts) { + int previous = 0; + for (Integer current : ts.values()) { + Assert.assertTrue("The sequence must be increasing [current value=" + previous + + ", previous value=" + current + "]", previous <= current); + previous = current; + } + } + + @Test + public void asynchronousDrop() { + TestSubscriberEx ts = createDelayedSubscriber(); + int m = 100000; + Flowable.range(1, m) + .subscribeOn(Schedulers.computation()) + .onBackpressureReduce((previous, current) -> { + //in that case it works like onBackpressureLatest + //the output sequence of number must be increasing + return current; + }) + .observeOn(Schedulers.io()) + .subscribe(ts); + + ts.awaitDone(2, TimeUnit.SECONDS); + ts.assertTerminated(); + assertValuesDropped(ts, m); + assertIncreasingSequence(ts); + } + + @Test + public void asynchronousDrop2() { + TestSubscriberEx ts = createDelayedSubscriber(); + int m = 100000; + Flowable.rangeLong(1, m) + .subscribeOn(Schedulers.computation()) + .onBackpressureReduce(Long::sum) + .observeOn(Schedulers.io()) + .subscribe(ts); + + ts.awaitDone(2, TimeUnit.SECONDS); + ts.assertTerminated(); + assertValuesDropped(ts, m); + long sum = 0; + for (Long i : ts.values()) { + sum += i; + } + //sum = (A1 + An) * n / 2 = 100_001 * 50_000 = 50_000_00000 + 50_000 = 50_000_50_000 + Assert.assertEquals("Wrong sum: " + sum, 5000050000L, sum); + } + + @Test + public void nullPointerFromReducer() { + PublishProcessor source = PublishProcessor.create(); + TestSubscriberEx ts = new TestSubscriberEx<>(0); + source.onBackpressureReduce((l, r) -> null).subscribe(ts); + + source.onNext(1); + source.onNext(2); + + TestHelper.assertError(ts.errors(), 0, NullPointerException.class, "The reducer returned a null value"); + } + + @Test + public void exceptionFromReducer() { + PublishProcessor source = PublishProcessor.create(); + TestSubscriberEx ts = new TestSubscriberEx<>(0); + source.onBackpressureReduce((l, r) -> { + throw new TestException("Test exception"); + }).subscribe(ts); + + source.onNext(1); + source.onNext(2); + + TestHelper.assertError(ts.errors(), 0, TestException.class, "Test exception"); + } + + @Test + public void doubleOnSubscribe() { + TestHelper.checkDoubleOnSubscribeFlowable(f -> f.onBackpressureReduce(TEST_OBJECT_REDUCER)); + } + + @Test + public void take() { + Flowable.just(1, 2) + .onBackpressureReduce(TEST_INT_REDUCER) + .take(1) + .test() + .assertResult(1); + } + + @Test + public void dispose() { + TestHelper.checkDisposed(Flowable.never().onBackpressureReduce(TEST_OBJECT_REDUCER)); + } + + @Test + public void badRequest() { + TestHelper.assertBadRequestReported(Flowable.never().onBackpressureReduce(TEST_OBJECT_REDUCER)); + } +} diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureReduceWithTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureReduceWithTest.java new file mode 100644 index 0000000000..32cee35603 --- /dev/null +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureReduceWithTest.java @@ -0,0 +1,331 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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 io.reactivex.rxjava3.internal.operators.flowable; + +import io.reactivex.rxjava3.core.Flowable; +import io.reactivex.rxjava3.core.RxJavaTest; +import io.reactivex.rxjava3.exceptions.TestException; +import io.reactivex.rxjava3.functions.BiFunction; +import io.reactivex.rxjava3.functions.Supplier; +import io.reactivex.rxjava3.processors.PublishProcessor; +import io.reactivex.rxjava3.schedulers.Schedulers; +import io.reactivex.rxjava3.testsupport.TestHelper; +import io.reactivex.rxjava3.testsupport.TestSubscriberEx; +import org.junit.Assert; +import org.junit.Test; + +import java.util.*; +import java.util.concurrent.TimeUnit; + +public class FlowableOnBackpressureReduceWithTest extends RxJavaTest { + + private static BiFunction, T, List> createTestReducer() { + return (list, number) -> { + list.add(number); + return list; + }; + } + + private static Supplier> createTestSupplier() { + return ArrayList::new; + } + + @Test + public void simple() { + TestSubscriberEx> ts = new TestSubscriberEx<>(); + + Flowable.range(1, 5).onBackpressureReduce(createTestSupplier(), createTestReducer()).subscribe(ts); + + ts.assertNoErrors(); + ts.assertTerminated(); + ts.assertValues( + Collections.singletonList(1), + Collections.singletonList(2), + Collections.singletonList(3), + Collections.singletonList(4), + Collections.singletonList(5) + ); + } + + @Test + public void simpleError() { + TestSubscriberEx> ts = new TestSubscriberEx<>(); + + Flowable.range(1, 5).concatWith(Flowable.error(new TestException())) + .onBackpressureReduce(createTestSupplier(), createTestReducer()).subscribe(ts); + + ts.assertTerminated(); + ts.assertError(TestException.class); + ts.assertValues( + Collections.singletonList(1), + Collections.singletonList(2), + Collections.singletonList(3), + Collections.singletonList(4), + Collections.singletonList(5) + ); + } + + @Test + public void simpleBackpressure() { + TestSubscriberEx> ts = new TestSubscriberEx<>(2L); + + Flowable.range(1, 5).onBackpressureReduce(createTestSupplier(), createTestReducer()).subscribe(ts); + + ts.assertNoErrors(); + ts.assertValues( + Collections.singletonList(1), + Collections.singletonList(2) + ); + ts.assertNotComplete(); + } + + @Test + public void reduceBackpressuredSync() { + PublishProcessor source = PublishProcessor.create(); + TestSubscriberEx ts = new TestSubscriberEx<>(0L); + + source.onBackpressureReduce(() -> 0, Integer::sum).subscribe(ts); + + source.onNext(1); + source.onNext(2); + source.onNext(3); + + ts.request(1); + + ts.assertValuesOnly(6); + + source.onNext(4); + source.onComplete(); + + ts.assertValuesOnly(6); + + ts.request(1); + ts.assertResult(6, 4); + } + + @Test + public void synchronousDrop() { + PublishProcessor source = PublishProcessor.create(); + TestSubscriberEx> ts = new TestSubscriberEx<>(0L); + + source.onBackpressureReduce(createTestSupplier(), createTestReducer()).subscribe(ts); + + ts.assertNoValues(); + + source.onNext(1); + ts.request(2); + + ts.assertValues(Collections.singletonList(1)); + + source.onNext(2); + + ts.assertValues( + Collections.singletonList(1), + Collections.singletonList(2) + ); + + source.onNext(3); + source.onNext(4); + source.onNext(5); + source.onNext(6); + + ts.request(2); + + ts.assertValues( + Collections.singletonList(1), + Collections.singletonList(2), + Arrays.asList(3, 4, 5, 6) + ); + + source.onNext(7); + + ts.assertValues( + Collections.singletonList(1), + Collections.singletonList(2), + Arrays.asList(3, 4, 5, 6), + Collections.singletonList(7) + ); + + source.onNext(8); + source.onNext(9); + source.onComplete(); + + ts.request(1); + + ts.assertValues( + Collections.singletonList(1), + Collections.singletonList(2), + Arrays.asList(3, 4, 5, 6), + Collections.singletonList(7), + Arrays.asList(8, 9) + ); + ts.assertNoErrors(); + ts.assertTerminated(); + } + + private TestSubscriberEx createDelayedSubscriber() { + return new TestSubscriberEx(1L) { + final Random rnd = new Random(); + + @Override + public void onNext(T t) { + super.onNext(t); + if (rnd.nextDouble() < 0.001) { + try { + Thread.sleep(1); + } catch (InterruptedException ex) { + ex.printStackTrace(); + } + } + request(1); + } + }; + } + + private void assertValuesDropped(TestSubscriberEx ts, int totalValues) { + int n = ts.values().size(); + System.out.println("testAsynchronousDrop -> " + n); + Assert.assertTrue("All events received?", n < totalValues); + } + + private void assertIncreasingSequence(TestSubscriberEx ts) { + int previous = 0; + for (Integer current : ts.values()) { + Assert.assertTrue("The sequence must be increasing [current value=" + previous + + ", previous value=" + current + "]", previous <= current); + previous = current; + } + } + + @Test + public void asynchronousDrop() { + TestSubscriberEx ts = createDelayedSubscriber(); + int m = 100000; + Flowable.range(1, m) + .subscribeOn(Schedulers.computation()) + .onBackpressureReduce((Supplier>) Collections::emptyList, (list, current) -> { + //in that case it works like onBackpressureLatest + //the output sequence of number must be increasing + return Collections.singletonList(current); + }) + .observeOn(Schedulers.io()) + .concatMap(Flowable::fromIterable) + .subscribe(ts); + + ts.awaitDone(2, TimeUnit.SECONDS); + ts.assertTerminated(); + assertValuesDropped(ts, m); + assertIncreasingSequence(ts); + } + + @Test + public void asynchronousDrop2() { + TestSubscriberEx ts = createDelayedSubscriber(); + int m = 100000; + Flowable.rangeLong(1, m) + .subscribeOn(Schedulers.computation()) + .onBackpressureReduce(createTestSupplier(), createTestReducer()) + .observeOn(Schedulers.io()) + .concatMap(list -> Flowable.just(list.stream().reduce(Long::sum).orElseThrow(() -> { + throw new IllegalArgumentException("No value in list"); + }))) + .subscribe(ts); + + ts.awaitDone(2, TimeUnit.SECONDS); + ts.assertTerminated(); + assertValuesDropped(ts, m); + long sum = 0; + for (Long i : ts.values()) { + sum += i; + } + //sum = (A1 + An) * n / 2 = 100_001 * 50_000 = 50_000_00000 + 50_000 = 50_000_50_000 + Assert.assertEquals("Wrong sum: " + sum, 5000050000L, sum); + } + + @Test + public void nullPointerFromReducer() { + PublishProcessor source = PublishProcessor.create(); + TestSubscriberEx> ts = new TestSubscriberEx<>(0L); + source.onBackpressureReduce(createTestSupplier(), (BiFunction, ? super Integer, List>) (list, number) -> null).subscribe(ts); + + source.onNext(1); + source.onNext(2); + + TestHelper.assertError(ts.errors(), 0, NullPointerException.class, "The reducer returned a null value"); + } + + @Test + public void nullPointerFromSupplier() { + PublishProcessor source = PublishProcessor.create(); + TestSubscriberEx> ts = new TestSubscriberEx<>(0L); + source.onBackpressureReduce(() -> null, createTestReducer()).subscribe(ts); + + source.onNext(1); + source.onNext(2); + + TestHelper.assertError(ts.errors(), 0, NullPointerException.class, "The supplier returned a null value"); + } + + @Test + public void exceptionFromReducer() { + PublishProcessor source = PublishProcessor.create(); + TestSubscriberEx> ts = new TestSubscriberEx<>(0L); + source.onBackpressureReduce(createTestSupplier(), (BiFunction, ? super Integer, List>) (l, r) -> { + throw new TestException("Test exception"); + }).subscribe(ts); + + source.onNext(1); + source.onNext(2); + + TestHelper.assertError(ts.errors(), 0, TestException.class, "Test exception"); + } + + @Test + public void exceptionFromSupplier() { + PublishProcessor source = PublishProcessor.create(); + TestSubscriberEx> ts = new TestSubscriberEx<>(0L); + source.onBackpressureReduce(() -> { + throw new TestException("Test exception"); + }, createTestReducer()).subscribe(ts); + + source.onNext(1); + source.onNext(2); + + TestHelper.assertError(ts.errors(), 0, TestException.class, "Test exception"); + } + + @Test + public void doubleOnSubscribe() { + TestHelper.checkDoubleOnSubscribeFlowable(f -> f.onBackpressureReduce(createTestSupplier(), createTestReducer())); + } + + @Test + public void take() { + Flowable.just(1, 2) + .onBackpressureReduce(createTestSupplier(), createTestReducer()) + .take(1) + .test() + .assertResult(Collections.singletonList(1)); + } + + @Test + public void dispose() { + TestHelper.checkDisposed(Flowable.never().onBackpressureReduce(createTestSupplier(), createTestReducer())); + } + + @Test + public void badRequest() { + TestHelper.assertBadRequestReported(Flowable.never().onBackpressureReduce(createTestSupplier(), createTestReducer())); + } +} diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorCompleteTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorCompleteTest.java index c1c89cbe27..0a6f137ce2 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorCompleteTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorCompleteTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorResumeNextViaFlowableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorResumeNextViaFlowableTest.java index b8829893fa..8b94b0d6f0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorResumeNextViaFlowableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorResumeNextViaFlowableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorResumeNextViaFunctionTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorResumeNextViaFunctionTest.java index 51de11ae7b..982ffecd1d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorResumeNextViaFunctionTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorResumeNextViaFunctionTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorReturnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorReturnTest.java index ecde026f95..15007f0228 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorReturnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorReturnTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishFunctionTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishFunctionTest.java index 62998eb543..5511fd0123 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishFunctionTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishFunctionTest.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.operators.flowable; @@ -192,7 +189,7 @@ public void overflowMissingBackpressureException() { ts.assertError(MissingBackpressureException.class); ts.assertNotComplete(); - Assert.assertEquals("Could not emit value due to lack of requests", + Assert.assertEquals(MissingBackpressureException.DEFAULT_MESSAGE, ts.errors().get(0).getMessage()); Assert.assertFalse("Source has subscribers?", pp.hasSubscribers()); } @@ -215,7 +212,7 @@ public void overflowMissingBackpressureExceptionDelayed() { ts.assertError(MissingBackpressureException.class); ts.assertNotComplete(); - Assert.assertEquals("Could not emit value due to lack of requests", ts.errors().get(0).getMessage()); + Assert.assertEquals(MissingBackpressureException.DEFAULT_MESSAGE, ts.errors().get(0).getMessage()); Assert.assertFalse("Source has subscribers?", pp.hasSubscribers()); } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishMulticastTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishMulticastTest.java index 0fb61a84c5..0e1bdbbdc0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishMulticastTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishMulticastTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -20,9 +20,9 @@ import org.junit.Test; import io.reactivex.rxjava3.core.RxJavaTest; -import io.reactivex.rxjava3.internal.fuseable.QueueSubscription; import io.reactivex.rxjava3.internal.operators.flowable.FlowablePublishMulticast.*; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; +import io.reactivex.rxjava3.operators.QueueSubscription; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.processors.UnicastProcessor; import io.reactivex.rxjava3.subscribers.TestSubscriber; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishTest.java index a3fb489e9f..c3355e9a38 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -905,9 +905,9 @@ public void subscribe(FlowableEmitter s) throws Exception { .test(0L) // 3.x emits errors last, even the full queue errors .requestMore(10) - .assertFailure(MissingBackpressureException.class, 0, 1, 2, 3, 4, 5, 6, 7); + .assertFailure(QueueOverflowException.class, 0, 1, 2, 3, 4, 5, 6, 7); - TestHelper.assertError(errors, 0, MissingBackpressureException.class); + TestHelper.assertError(errors, 0, QueueOverflowException.class); } finally { RxJavaPlugins.reset(); } @@ -1596,7 +1596,7 @@ protected void subscribeActual(Subscriber s) { .refCount() .test(0) .requestMore(1) - .assertFailure(MissingBackpressureException.class, 1); + .assertFailure(QueueOverflowException.class, 1); } @Test diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeLongTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeLongTest.java index d22cecfe5b..bc24ab787c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeLongTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeLongTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -26,7 +26,7 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.subscribers.*; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeTest.java index 628edd30c0..53264bddc0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -26,7 +26,7 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.subscribers.*; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceTest.java index 170b826bd7..16b491a352 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceWithSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceWithSingleTest.java index d3da48ffe5..3de991aa2e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceWithSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceWithSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRefCountTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRefCountTest.java index 02a730b610..48fbb633ae 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRefCountTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRefCountTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatTest.java index 29959688ad..9086c32a87 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplayEagerTruncateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplayEagerTruncateTest.java index 62612f886b..d2a4ba56da 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplayEagerTruncateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplayEagerTruncateTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplayTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplayTest.java index 2a799af71f..b644629a6d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplayTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplayTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryTest.java index 607801bd19..224ae32d40 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -621,7 +621,7 @@ public void run() { } } - /** Observer for listener on seperate thread. */ + /** Observer for listener on separate thread. */ static final class AsyncSubscriber extends DefaultSubscriber { protected CountDownLatch latch = new CountDownLatch(1); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryWithPredicateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryWithPredicateTest.java index b70b742201..2180ac8873 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryWithPredicateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryWithPredicateTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSampleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSampleTest.java index 3c47d264ca..1bc6456695 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSampleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSampleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScalarXMapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScalarXMapTest.java index 5a47a46d9b..fab387470e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScalarXMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScalarXMapTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScanTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScanTest.java index 6ebac502b0..5c6e4fa901 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScanTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScanTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqualTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqualTest.java index a3e997d882..c73b57777b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqualTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqualTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSerializeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSerializeTest.java index 9407df90cf..913c598126 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSerializeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSerializeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleTest.java index 0eb0853c0a..85fbfbc00d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLastTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLastTest.java index 7b1fb2a45f..69eac72c54 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLastTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLastTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLastTimedTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLastTimedTest.java index 66d9aa86b6..f2f1ff2598 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLastTimedTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLastTimedTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipTest.java index cb902082c3..eac3c94df8 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipTimedTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipTimedTest.java index 74532ad63c..82012097e7 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipTimedTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipTimedTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipUntilTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipUntilTest.java index b579f0e5d6..d5bbdf969a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipUntilTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipUntilTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipWhileTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipWhileTest.java index 3ab4f9af64..3fd42350d2 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipWhileTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipWhileTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableStartWithTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableStartWithTest.java index 68f4ee6272..6aa442c00b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableStartWithTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableStartWithTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSubscribeOnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSubscribeOnTest.java index 1554345f61..01ee614fd5 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSubscribeOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSubscribeOnTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -202,7 +202,7 @@ public void onNext(Integer t) { System.out.println("First schedule: " + t); assertTrue(t.getName().startsWith("Rx")); ts.request(10); - ts.awaitDone(5, TimeUnit.SECONDS); + ts.awaitDone(20, TimeUnit.SECONDS); System.out.println("After reschedule: " + ts.lastThread()); assertEquals(t, ts.lastThread()); } @@ -254,7 +254,7 @@ public void onNext(Integer t) { } }).subscribeOn(Schedulers.newThread()).subscribe(ts); - ts.awaitDone(5, TimeUnit.SECONDS); + ts.awaitDone(20, TimeUnit.SECONDS); ts.assertNoErrors(); } @@ -330,7 +330,7 @@ public void subscribe(FlowableEmitter s) throws Exception { .subscribeOn(Schedulers.single()) .observeOn(Schedulers.computation()) .test() - .awaitDone(5, TimeUnit.SECONDS) + .awaitDone(20, TimeUnit.SECONDS) .assertNoErrors() .assertComplete(); @@ -355,7 +355,7 @@ public void subscribe(FlowableEmitter s) throws Exception { .subscribeOn(Schedulers.single()) .observeOn(Schedulers.computation()) .test() - .awaitDone(5, TimeUnit.SECONDS) + .awaitDone(20, TimeUnit.SECONDS) .assertValueCount(Flowable.bufferSize()) .assertNoErrors() .assertComplete(); @@ -377,7 +377,7 @@ public void subscribe(FlowableEmitter s) throws Exception { .subscribeOn(Schedulers.single(), false) .observeOn(Schedulers.computation()) .test() - .awaitDone(5, TimeUnit.SECONDS) + .awaitDone(20, TimeUnit.SECONDS) .assertNoErrors() .assertComplete(); @@ -402,7 +402,7 @@ public void subscribe(FlowableEmitter s) throws Exception { .subscribeOn(Schedulers.single(), true) .observeOn(Schedulers.computation()) .test() - .awaitDone(5, TimeUnit.SECONDS) + .awaitDone(20, TimeUnit.SECONDS) .assertValueCount(Flowable.bufferSize()) .assertNoErrors() .assertComplete(); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchIfEmptyTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchIfEmptyTest.java index de348ee6a0..d38a657b99 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchIfEmptyTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchIfEmptyTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchTest.java index e7cd7c3db0..9f200e3c56 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -1076,7 +1076,7 @@ protected void subscribeActual(Subscriber s) { } }), 8) .test(1L) - .assertFailure(MissingBackpressureException.class, 0); + .assertFailure(QueueOverflowException.class, 0); } @Test @@ -1377,4 +1377,19 @@ Flowable createFlowable(AtomicInteger inner) { inner.incrementAndGet(); }); } + + @Test + public void innerOnSubscribeOuterCancelRace() { + TestSubscriber ts = new TestSubscriber(); + + Flowable.just(1) + .hide() + .switchMap(v -> Flowable.just(1) + .doOnSubscribe(d -> ts.cancel()) + .scan(1, (a, b) -> a) + ) + .subscribe(ts); + + ts.assertEmpty(); + } } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastOneTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastOneTest.java index 373fe4fbe4..1e51a40249 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastOneTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastOneTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTest.java index 9c413985aa..6008461ed5 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTimedTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTimedTest.java index 836700d2aa..83814dd797 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTimedTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTimedTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeTest.java index fa9ea0725d..50728f6206 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeTest2.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeTest2.java index 089c148099..da2aa5657e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeTest2.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeTest2.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeTimedTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeTimedTest.java index 34d39b125a..776236a7cd 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeTimedTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeTimedTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilPredicateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilPredicateTest.java index 4019ec4fd9..f88b7e27ae 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilPredicateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilPredicateTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilTest.java index 150143ba6f..a1f7fe9d42 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeWhileTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeWhileTest.java index f2c964cf28..805420f094 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeWhileTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeWhileTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleFirstTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleFirstTest.java index 4c26b2a9f8..68a559e3cd 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleFirstTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleFirstTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,6 +19,7 @@ import java.util.List; import java.util.concurrent.TimeUnit; +import io.reactivex.rxjava3.functions.Action; import org.junit.*; import org.mockito.InOrder; import org.reactivestreams.*; @@ -44,6 +45,77 @@ public void before() { subscriber = TestHelper.mockSubscriber(); } + @Test + public void throttlingWithDropCallbackCrashes() throws Throwable { + Flowable source = Flowable.unsafeCreate(new Publisher() { + @Override + public void subscribe(Subscriber subscriber) { + subscriber.onSubscribe(new BooleanSubscription()); + publishNext(subscriber, 100, "one"); // publish as it's first + publishNext(subscriber, 300, "two"); // skip as it's last within the first 400 + publishNext(subscriber, 900, "three"); // publish + publishNext(subscriber, 905, "four"); // skip + publishCompleted(subscriber, 1000); // Should be published as soon as the timeout expires. + } + }); + + Action whenDisposed = mock(Action.class); + + Flowable sampled = source + .doOnCancel(whenDisposed) + .throttleFirst(400, TimeUnit.MILLISECONDS, scheduler, e -> { + if ("two".equals(e)) { + throw new TestException("forced"); + } + }); + sampled.subscribe(subscriber); + + InOrder inOrder = inOrder(subscriber); + + scheduler.advanceTimeTo(1000, TimeUnit.MILLISECONDS); + inOrder.verify(subscriber, times(1)).onNext("one"); + inOrder.verify(subscriber, times(1)).onError(any(TestException.class)); + inOrder.verify(subscriber, times(0)).onNext("two"); + inOrder.verify(subscriber, times(0)).onNext("three"); + inOrder.verify(subscriber, times(0)).onNext("four"); + inOrder.verify(subscriber, times(0)).onComplete(); + inOrder.verifyNoMoreInteractions(); + verify(whenDisposed).run(); + } + + @Test + public void throttlingWithDropCallback() { + Flowable source = Flowable.unsafeCreate(new Publisher() { + @Override + public void subscribe(Subscriber subscriber) { + subscriber.onSubscribe(new BooleanSubscription()); + publishNext(subscriber, 100, "one"); // publish as it's first + publishNext(subscriber, 300, "two"); // skip as it's last within the first 400 + publishNext(subscriber, 900, "three"); // publish + publishNext(subscriber, 905, "four"); // skip + publishCompleted(subscriber, 1000); // Should be published as soon as the timeout expires. + } + }); + + Observer dropCallbackObserver = TestHelper.mockObserver(); + Flowable sampled = source.throttleFirst(400, TimeUnit.MILLISECONDS, scheduler, dropCallbackObserver::onNext); + sampled.subscribe(subscriber); + + InOrder inOrder = inOrder(subscriber); + InOrder dropCallbackOrder = inOrder(dropCallbackObserver); + + scheduler.advanceTimeTo(1000, TimeUnit.MILLISECONDS); + inOrder.verify(subscriber, times(1)).onNext("one"); + inOrder.verify(subscriber, times(0)).onNext("two"); + dropCallbackOrder.verify(dropCallbackObserver, times(1)).onNext("two"); + inOrder.verify(subscriber, times(1)).onNext("three"); + inOrder.verify(subscriber, times(0)).onNext("four"); + dropCallbackOrder.verify(dropCallbackObserver, times(1)).onNext("four"); + inOrder.verify(subscriber, times(1)).onComplete(); + inOrder.verifyNoMoreInteractions(); + dropCallbackOrder.verifyNoMoreInteractions(); + } + @Test public void throttlingWithCompleted() { Flowable source = Flowable.unsafeCreate(new Publisher() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleLatestTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleLatestTest.java index 45457f5577..2b26ec98d4 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleLatestTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleLatestTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -23,10 +23,11 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; +import io.reactivex.rxjava3.internal.subscriptions.EmptySubscription; import io.reactivex.rxjava3.processors.PublishProcessor; import io.reactivex.rxjava3.schedulers.TestScheduler; import io.reactivex.rxjava3.subscribers.TestSubscriber; -import io.reactivex.rxjava3.testsupport.TestHelper; +import io.reactivex.rxjava3.testsupport.*; public class FlowableThrottleLatestTest extends RxJavaTest { @@ -278,4 +279,480 @@ public void onNext(Integer t) { ts.assertResult(1, 2); } + + /** Emit 1, 2, 3, then advance time by a second; 1 and 3 should end up in downstream, 2 should be dropped. */ + @Test + public void onDroppedBasicNoEmitLast() { + PublishProcessor pp =PublishProcessor.create(); + + TestScheduler sch = new TestScheduler(); + + TestSubscriber drops = new TestSubscriber<>(); + drops.onSubscribe(EmptySubscription.INSTANCE); + + TestSubscriber ts = pp.throttleLatest(1, TimeUnit.SECONDS, sch, false, drops::onNext) + .test(); + + ts.assertEmpty(); + drops.assertEmpty(); + + pp.onNext(1); + + ts.assertValuesOnly(1); + drops.assertEmpty(); + + pp.onNext(2); + + ts.assertValuesOnly(1); + drops.assertEmpty(); + + pp.onNext(3); + + ts.assertValuesOnly(1); + drops.assertValuesOnly(2); + + sch.advanceTimeBy(1, TimeUnit.SECONDS); + + ts.assertValuesOnly(1, 3); + drops.assertValuesOnly(2); + + pp.onComplete(); + + ts.assertResult(1, 3); + + drops.assertValuesOnly(2); + } + + /** Emit 1, 2, 3; 1 should end up in downstream, 2, 3 should be dropped. */ + @Test + public void onDroppedBasicNoEmitLastDropLast() { + PublishProcessor pp =PublishProcessor.create(); + + TestScheduler sch = new TestScheduler(); + + TestSubscriber drops = new TestSubscriber<>(); + drops.onSubscribe(EmptySubscription.INSTANCE); + + TestSubscriber ts = pp.throttleLatest(1, TimeUnit.SECONDS, sch, false, drops::onNext) + .test(); + + ts.assertEmpty(); + drops.assertEmpty(); + + pp.onNext(1); + + ts.assertValuesOnly(1); + drops.assertEmpty(); + + pp.onNext(2); + + ts.assertValuesOnly(1); + drops.assertEmpty(); + + pp.onNext(3); + + ts.assertValuesOnly(1); + drops.assertValuesOnly(2); + + pp.onComplete(); + + ts.assertResult(1); + + drops.assertValuesOnly(2, 3); + } + + /** Emit 1, 2, 3; 1 and 3 should end up in downstream, 2 should be dropped. */ + @Test + public void onDroppedBasicEmitLast() { + PublishProcessor pp =PublishProcessor.create(); + + TestScheduler sch = new TestScheduler(); + + TestSubscriber drops = new TestSubscriber<>(); + drops.onSubscribe(EmptySubscription.INSTANCE); + + TestSubscriber ts = pp.throttleLatest(1, TimeUnit.SECONDS, sch, true, drops::onNext) + .test(); + + ts.assertEmpty(); + drops.assertEmpty(); + + pp.onNext(1); + + ts.assertValuesOnly(1); + drops.assertEmpty(); + + pp.onNext(2); + + ts.assertValuesOnly(1); + drops.assertEmpty(); + + pp.onNext(3); + + ts.assertValuesOnly(1); + drops.assertValuesOnly(2); + + pp.onComplete(); + + ts.assertResult(1, 3); + + drops.assertValuesOnly(2); + } + + /** Emit 1, 2, 3; 3 should trigger an error to the downstream because 2 is dropped and the callback crashes. */ + @Test + public void onDroppedBasicNoEmitLastFirstDropCrash() throws Throwable { + PublishProcessor pp =PublishProcessor.create(); + + TestScheduler sch = new TestScheduler(); + + Action whenDisposed = mock(Action.class); + + TestSubscriber ts = pp + .doOnCancel(whenDisposed) + .throttleLatest(1, TimeUnit.SECONDS, sch, false, d -> { + if (d == 2) { + throw new TestException("forced"); + } + }) + .test(); + + ts.assertEmpty(); + + pp.onNext(1); + + ts.assertValuesOnly(1); + + pp.onNext(2); + + ts.assertValuesOnly(1); + + pp.onNext(3); + + ts.assertFailure(TestException.class, 1); + + verify(whenDisposed).run(); + } + + /** + * Emit 1, 2, Error; the error should trigger the drop callback and crash it too, + * downstream gets 1, composite(source, drop-crash). + */ + @Test + public void onDroppedBasicNoEmitLastOnErrorDropCrash() throws Throwable { + PublishProcessor pp =PublishProcessor.create(); + + TestScheduler sch = new TestScheduler(); + + Action whenDisposed = mock(Action.class); + + TestSubscriberEx ts = pp + .doOnCancel(whenDisposed) + .throttleLatest(1, TimeUnit.SECONDS, sch, false, d -> { throw new TestException("forced " + d); }) + .subscribeWith(new TestSubscriberEx<>()); + + ts.assertEmpty(); + + pp.onNext(1); + + ts.assertValuesOnly(1); + + pp.onNext(2); + + ts.assertValuesOnly(1); + + pp.onError(new TestException("source")); + + ts.assertFailure(CompositeException.class, 1); + + TestHelper.assertCompositeExceptions(ts, TestException.class, "source", TestException.class, "forced 2"); + + verify(whenDisposed, never()).run(); + } + + /** + * Emit 1, 2, 3; 3 should trigger a drop-crash for 2, which then would trigger the error path and drop-crash for 3, + * the last item not delivered, downstream gets 1, composite(drop-crash 2, drop-crash 3). + */ + @Test + public void onDroppedBasicEmitLastOnErrorDropCrash() throws Throwable { + PublishProcessor pp =PublishProcessor.create(); + + TestScheduler sch = new TestScheduler(); + + Action whenDisposed = mock(Action.class); + + TestSubscriberEx ts = pp + .doOnCancel(whenDisposed) + .throttleLatest(1, TimeUnit.SECONDS, sch, true, d -> { throw new TestException("forced " + d); }) + .subscribeWith(new TestSubscriberEx<>()); + + ts.assertEmpty(); + + pp.onNext(1); + + ts.assertValuesOnly(1); + + pp.onNext(2); + + ts.assertValuesOnly(1); + + pp.onNext(3); + + ts.assertFailure(CompositeException.class, 1); + + TestHelper.assertCompositeExceptions(ts, TestException.class, "forced 2", TestException.class, "forced 3"); + + verify(whenDisposed).run(); + } + + /** Emit 1, complete; Downstream gets 1, complete, no drops. */ + @Test + public void onDroppedBasicNoEmitLastNoLastToDrop() { + PublishProcessor pp =PublishProcessor.create(); + + TestScheduler sch = new TestScheduler(); + + TestSubscriber drops = new TestSubscriber<>(); + drops.onSubscribe(EmptySubscription.INSTANCE); + + TestSubscriber ts = pp.throttleLatest(1, TimeUnit.SECONDS, sch, false, drops::onNext) + .test(); + + ts.assertEmpty(); + drops.assertEmpty(); + + pp.onNext(1); + + ts.assertValuesOnly(1); + drops.assertEmpty(); + + pp.onComplete(); + + ts.assertResult(1); + drops.assertEmpty(); + } + + /** Emit 1, error; Downstream gets 1, error, no drops. */ + @Test + public void onDroppedErrorNoEmitLastNoLastToDrop() { + PublishProcessor pp =PublishProcessor.create(); + + TestScheduler sch = new TestScheduler(); + + TestSubscriber drops = new TestSubscriber<>(); + drops.onSubscribe(EmptySubscription.INSTANCE); + + TestSubscriber ts = pp.throttleLatest(1, TimeUnit.SECONDS, sch, false, drops::onNext) + .test(); + + ts.assertEmpty(); + drops.assertEmpty(); + + pp.onNext(1); + + ts.assertValuesOnly(1); + drops.assertEmpty(); + + pp.onError(new TestException()); + + ts.assertFailure(TestException.class, 1); + drops.assertEmpty(); + } + + /** + * Emit 1, 2, complete; complete should crash drop, downstream gets 1, drop-crash 2. + */ + @Test + public void onDroppedHasLastNoEmitLastDropCrash() throws Throwable { + PublishProcessor pp =PublishProcessor.create(); + + TestScheduler sch = new TestScheduler(); + + Action whenDisposed = mock(Action.class); + + TestSubscriberEx ts = pp + .doOnCancel(whenDisposed) + .throttleLatest(1, TimeUnit.SECONDS, sch, false, d -> { throw new TestException("forced " + d); }) + .subscribeWith(new TestSubscriberEx<>()); + + ts.assertEmpty(); + + pp.onNext(1); + + ts.assertValuesOnly(1); + + pp.onNext(2); + + ts.assertValuesOnly(1); + + pp.onComplete(); + + ts.assertFailureAndMessage(TestException.class, "forced 2", 1); + + verify(whenDisposed, never()).run(); + } + + /** + * Emit 1, 2 then dispose the sequence; downstream gets 1, drop should get for 2. + */ + @Test + public void onDroppedDisposeDrops() throws Throwable { + PublishProcessor pp =PublishProcessor.create(); + + TestScheduler sch = new TestScheduler(); + + Action whenDisposed = mock(Action.class); + + TestSubscriber drops = new TestSubscriber<>(); + drops.onSubscribe(EmptySubscription.INSTANCE); + + TestSubscriberEx ts = pp + .doOnCancel(whenDisposed) + .throttleLatest(1, TimeUnit.SECONDS, sch, false, drops::onNext) + .subscribeWith(new TestSubscriberEx<>()); + + ts.assertEmpty(); + + pp.onNext(1); + + ts.assertValuesOnly(1); + + pp.onNext(2); + + ts.assertValuesOnly(1); + + ts.cancel(); + + ts.assertValuesOnly(1); + drops.assertValuesOnly(2); + + verify(whenDisposed).run(); + } + + /** + * Emit 1 then dispose the sequence; downstream gets 1, drop should not get called. + */ + @Test + public void onDroppedDisposeNoDrops() throws Throwable { + PublishProcessor pp =PublishProcessor.create(); + + TestScheduler sch = new TestScheduler(); + + Action whenDisposed = mock(Action.class); + + TestSubscriber drops = new TestSubscriber<>(); + drops.onSubscribe(EmptySubscription.INSTANCE); + + TestSubscriberEx ts = pp + .doOnCancel(whenDisposed) + .throttleLatest(1, TimeUnit.SECONDS, sch, false, drops::onNext) + .subscribeWith(new TestSubscriberEx<>()); + + ts.assertEmpty(); + + pp.onNext(1); + + ts.assertValuesOnly(1); + + ts.cancel(); + + ts.assertValuesOnly(1); + drops.assertEmpty(); + + verify(whenDisposed).run(); + } + + /** + * Emit 1, 2 then dispose the sequence; downstream gets 1, global error handler should get drop-crash 2. + */ + @Test + public void onDroppedDisposeCrashesDrop() throws Throwable { + TestHelper.withErrorTracking(errors -> { + PublishProcessor pp =PublishProcessor.create(); + + TestScheduler sch = new TestScheduler(); + + Action whenDisposed = mock(Action.class); + + TestSubscriberEx ts = pp + .doOnCancel(whenDisposed) + .throttleLatest(1, TimeUnit.SECONDS, sch, false, d -> { throw new TestException("forced " + d); }) + .subscribeWith(new TestSubscriberEx<>()); + + ts.assertEmpty(); + + pp.onNext(1); + + ts.assertValuesOnly(1); + + pp.onNext(2); + + ts.assertValuesOnly(1); + + ts.cancel(); + + ts.assertValuesOnly(1); + + verify(whenDisposed).run(); + + TestHelper.assertUndeliverable(errors, 0, TestException.class, "forced 2"); + }); + } + + /** Emit 1 but downstream is backpressured; downstream gets MBE, drops gets 1. */ + @Test + public void onDroppedBackpressured() throws Throwable { + PublishProcessor pp =PublishProcessor.create(); + + TestScheduler sch = new TestScheduler(); + + TestSubscriber drops = new TestSubscriber<>(); + drops.onSubscribe(EmptySubscription.INSTANCE); + + Action whenDisposed = mock(Action.class); + + TestSubscriber ts = pp + .doOnCancel(whenDisposed) + .throttleLatest(1, TimeUnit.SECONDS, sch, false, drops::onNext) + .test(0L); + + ts.assertEmpty(); + drops.assertEmpty(); + + pp.onNext(1); + + ts.assertFailure(MissingBackpressureException.class); + + drops.assertValuesOnly(1); + + verify(whenDisposed).run(); + } + + /** Emit 1 but downstream is backpressured; drop crashes, downstream gets composite(MBE, drop-crash 1). */ + @Test + public void onDroppedBackpressuredDropCrash() throws Throwable { + PublishProcessor pp =PublishProcessor.create(); + + TestScheduler sch = new TestScheduler(); + + Action whenDisposed = mock(Action.class); + + TestSubscriberEx ts = pp + .doOnCancel(whenDisposed) + .throttleLatest(1, TimeUnit.SECONDS, sch, false, d -> { throw new TestException("forced " + d); }) + .subscribeWith(new TestSubscriberEx<>(0L)); + + ts.assertEmpty(); + + pp.onNext(1); + + ts.assertFailure(CompositeException.class); + + TestHelper.assertCompositeExceptions(ts, + MissingBackpressureException.class, "Could not emit value due to lack of requests", + TestException.class, "forced 1"); + + verify(whenDisposed).run(); + } } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeIntervalTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeIntervalTest.java index 4153c92a22..e2e9550388 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeIntervalTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeIntervalTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutTests.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutTests.java index de0dcec14c..070bb620b0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutTests.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutWithSelectorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutWithSelectorTest.java index db09c48872..538a8e566a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutWithSelectorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutWithSelectorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimerTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimerTest.java index 4e299dcbd1..4f0216e612 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimerTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -352,7 +352,7 @@ public void timerDelayZero() { public void timerInterruptible() throws Exception { ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(); try { - for (Scheduler s : new Scheduler[] { Schedulers.single(), Schedulers.computation(), Schedulers.newThread(), Schedulers.io(), Schedulers.from(exec) }) { + for (Scheduler s : new Scheduler[] { Schedulers.single(), Schedulers.computation(), Schedulers.newThread(), Schedulers.io(), Schedulers.from(exec, true) }) { final AtomicBoolean interrupted = new AtomicBoolean(); TestSubscriber ts = Flowable.timer(1, TimeUnit.MILLISECONDS, s) .map(new Function() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimestampTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimestampTest.java index 05274da619..6d98c0c414 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimestampTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimestampTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToCompletableTest.java index cac1fa61b7..dff5a7462b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToCompletableTest.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.operators.flowable; import static org.junit.Assert.assertFalse; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToFutureTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToFutureTest.java index 4241dc8be9..8501a22e74 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToFutureTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToFutureTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToListTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToListTest.java index cad29e3fc8..208f371bb7 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToListTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToListTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToMapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToMapTest.java index 149a3f893c..736cf4caa5 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToMapTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToMultimapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToMultimapTest.java index 06e71d6beb..63db446ee6 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToMultimapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToMultimapTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToSingleTest.java index b88824b583..d064589b1d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToSortedListTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToSortedListTest.java index 5c7278da54..cadcb572b6 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToSortedListTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToSortedListTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUnsubscribeOnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUnsubscribeOnTest.java index 281b74e463..2a8efa4593 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUnsubscribeOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUnsubscribeOnTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUsingTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUsingTest.java index f32b599df4..d744c32747 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUsingTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUsingTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithFlowableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithFlowableTest.java index 0d9cd5dd1b..5f5d97af1e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithFlowableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithFlowableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithSizeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithSizeTest.java index ab38a160e8..bd50a20a2a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithSizeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithSizeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithStartEndFlowableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithStartEndFlowableTest.java index e6ffaed5bd..f2431eb8db 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithStartEndFlowableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithStartEndFlowableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithTimeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithTimeTest.java index 190d10f0af..6982b00cea 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithTimeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithTimeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFromTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFromTest.java index 655452057b..df325cd2c8 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFromTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFromTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZipCompletionTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZipCompletionTest.java index 3de4aa1e39..fe69ea6be5 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZipCompletionTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZipCompletionTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZipIterableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZipIterableTest.java index 871b603383..aee49596d9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZipIterableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZipIterableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZipTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZipTest.java index bc012f9713..47bbd491bd 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZipTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZipTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -30,8 +30,8 @@ import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.QueueSubscription; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; +import io.reactivex.rxjava3.operators.QueueSubscription; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.processors.PublishProcessor; import io.reactivex.rxjava3.schedulers.Schedulers; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/NotificationLiteTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/NotificationLiteTest.java index 3a5ff0dc57..2c4b42aa9c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/NotificationLiteTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/NotificationLiteTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/AbstractMaybeWithUpstreamTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/AbstractMaybeWithUpstreamTest.java index 0e953b262f..dca854d3c1 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/AbstractMaybeWithUpstreamTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/AbstractMaybeWithUpstreamTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeAmbTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeAmbTest.java index fb3a6aff5b..5475010163 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeAmbTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeAmbTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeBlockingSubscribeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeBlockingSubscribeTest.java index 647d385eef..e11548cdc9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeBlockingSubscribeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeBlockingSubscribeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCacheTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCacheTest.java index a8d42ef603..80f61f5931 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCacheTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCacheTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCallbackObserverTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCallbackObserverTest.java index e65b01e070..1758a1116b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCallbackObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCallbackObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArrayEagerDelayErrorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArrayEagerDelayErrorTest.java index 6608fbc424..94e77bf55a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArrayEagerDelayErrorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArrayEagerDelayErrorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArrayTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArrayTest.java index 681748c39d..c2d6fcc0ae 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArrayTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArrayTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatEagerTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatEagerTest.java index 5a1b42bb15..4c53fcddf3 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatEagerTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatEagerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatIterableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatIterableTest.java index 7b9c33db99..c8b9045263 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatIterableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatIterableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatMapCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatMapCompletableTest.java index e902bbf4df..dedd03a02e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatMapCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatMapCompletableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatMapSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatMapSingleTest.java index 2626b18e26..93695b5293 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatMapSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatMapSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatMapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatMapTest.java index 7504117df4..04e5abfafd 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatMapTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatPublisherTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatPublisherTest.java index 527de9734b..ad334cac7b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatPublisherTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatPublisherTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.maybe; import java.util.concurrent.Callable; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeContainsTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeContainsTest.java index 07a7abc77b..ca019517d8 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeContainsTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeContainsTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCountTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCountTest.java index 669cb4e28c..b223358ef2 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCountTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCountTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCreateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCreateTest.java index b0857c432f..6bd42bce44 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCreateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCreateTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayOtherTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayOtherTest.java index 8ca50837ec..f482834e29 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayOtherTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayOtherTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelaySubscriptionTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelaySubscriptionTest.java index cc7a981050..dae5d6f68c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelaySubscriptionTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelaySubscriptionTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayTest.java index 14448c3f2c..4485f58f5e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDematerializeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDematerializeTest.java index 5c75a92a10..4f78295f76 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDematerializeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDematerializeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDetachTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDetachTest.java index 2c96cbfe88..6498e98371 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDetachTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDetachTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoAfterSuccessTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoAfterSuccessTest.java index 045f23de64..a961f0b11c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoAfterSuccessTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoAfterSuccessTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoFinallyTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoFinallyTest.java index fe54a5a299..f98c3cf810 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoFinallyTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoFinallyTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnEventTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnEventTest.java index abe91714e7..37614ec793 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnEventTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnEventTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnLifecycleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnLifecycleTest.java index b8921b7eb9..39d71105ca 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnLifecycleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnLifecycleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnTerminateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnTerminateTest.java index cfcb6a548f..4471db0ee1 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnTerminateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnTerminateTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeEmptyTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeEmptyTest.java index c477416241..a219718936 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeEmptyTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeEmptyTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,7 +18,7 @@ import org.junit.Test; import io.reactivex.rxjava3.core.*; -import io.reactivex.rxjava3.internal.fuseable.ScalarSupplier; +import io.reactivex.rxjava3.operators.ScalarSupplier; public class MaybeEmptyTest extends RxJavaTest { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeEqualTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeEqualTest.java index 8a42f12d5b..e7b6ea4302 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeEqualTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeEqualTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeErrorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeErrorTest.java index b75eea1906..f67dc7884b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeErrorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeErrorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFilterSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFilterSingleTest.java index 2647f760ce..52682cc208 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFilterSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFilterSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapBiSelectorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapBiSelectorTest.java index f0db482a62..67227bb422 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapBiSelectorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapBiSelectorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapCompletableTest.java index a76af597b2..053f1e3e40 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapCompletableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableFlowableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableFlowableTest.java index aed3f49199..e4bcaa9f77 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableFlowableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableFlowableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -24,8 +24,9 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.util.CrashingIterable; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueSubscription; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.subjects.*; import io.reactivex.rxjava3.subscribers.TestSubscriber; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableObservableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableObservableTest.java index 601da820a7..d06f626119 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableObservableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableObservableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -25,8 +25,9 @@ import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.util.CrashingIterable; +import io.reactivex.rxjava3.operators.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapNotificationTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapNotificationTest.java index 6faec2ab9a..1d4d4f0d5e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapNotificationTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapNotificationTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingleElementTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingleElementTest.java index cc92e023ab..2f5cf42426 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingleElementTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingleElementTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingleTest.java index 4904678a61..cdf7f36f1f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlattenTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlattenTest.java index bcdaa3f061..30c0cfdeb8 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlattenTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlattenTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromActionTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromActionTest.java index 4f1cc27355..32f37c1cd7 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromActionTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromActionTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromCallableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromCallableTest.java index 28284b0a78..dec0d8e33e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromCallableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromCallableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromCompletableTest.java index c891714b69..40f00e371a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromCompletableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromFutureTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromFutureTest.java index 98ea62255e..fb88c60a72 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromFutureTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromFutureTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromObservableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromObservableTest.java index de2039a4d0..311f33e4d4 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromObservableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromObservableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromPubisherTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromPubisherTest.java index bcbef3dc9f..c51c23bae4 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromPubisherTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromPubisherTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromRunnableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromRunnableTest.java index 37325c69c8..5d1db4ad4d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromRunnableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromRunnableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromSingleTest.java index 108c38d30f..27c13626f6 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromSupplierTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromSupplierTest.java index a9a74f46a5..bcbe0783cc 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromSupplierTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromSupplierTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeHideTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeHideTest.java index 4428b57699..11a1cbb145 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeHideTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeHideTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -20,7 +20,7 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.ScalarSupplier; +import io.reactivex.rxjava3.operators.ScalarSupplier; import io.reactivex.rxjava3.processors.PublishProcessor; import io.reactivex.rxjava3.testsupport.TestHelper; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIgnoreElementTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIgnoreElementTest.java index c41def19d3..a7ab2f2024 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIgnoreElementTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIgnoreElementTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmptySingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmptySingleTest.java index 5a6021a48b..23ead59639 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmptySingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmptySingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmptyTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmptyTest.java index a7c208d2b5..a3a4a893c9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmptyTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmptyTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeJustTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeJustTest.java index 6e61427a15..a49ac11a41 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeJustTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeJustTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,7 +18,7 @@ import org.junit.Test; import io.reactivex.rxjava3.core.*; -import io.reactivex.rxjava3.internal.fuseable.ScalarSupplier; +import io.reactivex.rxjava3.operators.ScalarSupplier; public class MaybeJustTest extends RxJavaTest { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMapTest.java index 5259886976..b58b78b26f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMapTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMaterializeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMaterializeTest.java index 57a478d112..0c7f570434 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMaterializeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMaterializeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMergeArrayTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMergeArrayTest.java index 0ddc2eefe1..bf4f7313dc 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMergeArrayTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMergeArrayTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -23,8 +23,9 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.TestException; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.operators.maybe.MaybeMergeArray.MergeMaybeObserver; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueSubscription; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.subjects.*; import io.reactivex.rxjava3.subscribers.TestSubscriber; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMergeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMergeTest.java index 8ce37cb7be..0bf38ccc0f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMergeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMergeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMergeWithTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMergeWithTest.java index ab4a0b8955..dd4d0817a8 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMergeWithTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMergeWithTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOfTypeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOfTypeTest.java index 0e459ffffb..5d58b9ff90 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOfTypeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOfTypeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorXTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorXTest.java index 403d73db66..2cbc2fe427 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorXTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorXTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybePeekTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybePeekTest.java index cbf4d60b34..ade9039eca 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybePeekTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybePeekTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSafeSubscribeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSafeSubscribeTest.java index 5083c20f2c..85919751d4 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSafeSubscribeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSafeSubscribeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeStartWithTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeStartWithTest.java index 87969974d4..31b0314158 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeStartWithTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeStartWithTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSubscribeOnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSubscribeOnTest.java index 1043a848b8..3f5a29bc23 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSubscribeOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSubscribeOnTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmptySingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmptySingleTest.java index ceed4345d3..153b183287 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmptySingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmptySingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmptyTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmptyTest.java index 423d6ad1ac..f15f5ae8be 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmptyTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmptyTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchOnNextTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchOnNextTest.java index 6b217aa680..7a502faa28 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchOnNextTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchOnNextTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilPublisherTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilPublisherTest.java index e615c733e8..f5ce249514 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilPublisherTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilPublisherTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilTest.java index 5c7d8f956d..20ce1cfa41 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeIntervalTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeIntervalTest.java index 30b770aed4..bd50202ae4 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeIntervalTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeIntervalTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutPublisherTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutPublisherTest.java index 22e99bf9aa..efa2ce6ff6 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutPublisherTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutPublisherTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutTest.java index ba806c5a32..b5b61a6ffc 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimerTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimerTest.java index 06a54ad90c..05ffdf0562 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimerTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -37,7 +37,7 @@ public void dispose() { public void timerInterruptible() throws Exception { ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(); try { - for (Scheduler s : new Scheduler[] { Schedulers.single(), Schedulers.computation(), Schedulers.newThread(), Schedulers.io(), Schedulers.from(exec) }) { + for (Scheduler s : new Scheduler[] { Schedulers.single(), Schedulers.computation(), Schedulers.newThread(), Schedulers.io(), Schedulers.from(exec, true) }) { final AtomicBoolean interrupted = new AtomicBoolean(); TestObserver to = Maybe.timer(1, TimeUnit.MILLISECONDS, s) .map(new Function() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimestampTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimestampTest.java index 1ce230f8d0..935147a906 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimestampTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimestampTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToCompletableTest.java index 52b44e5f98..4bae2cc98f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToCompletableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToFlowableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToFlowableTest.java index 77d098c0ce..66e94da8d0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToFlowableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToFlowableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToFutureTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToFutureTest.java index 37723dc656..b36a299cd4 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToFutureTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToFutureTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToObservableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToObservableTest.java index c201bf20f8..6747203723 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToObservableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToObservableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToSingleTest.java index 9d641c9505..1ee84470f2 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUnsubscribeOnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUnsubscribeOnTest.java index 1e2d700136..3159fb411e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUnsubscribeOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUnsubscribeOnTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUsingTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUsingTest.java index e9621a2f64..0f083c93d2 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUsingTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUsingTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipArrayTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipArrayTest.java index 1407886997..2cbf8e4263 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipArrayTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipArrayTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -221,4 +221,21 @@ public void oneSourceOnly() { .test() .assertResult(Arrays.asList(1)); } + + @Test + public void onSuccessAfterDispose() { + AtomicReference> emitter = new AtomicReference<>(); + + TestObserver> to = Maybe.zipArray(Arrays::asList, + (MaybeSource)o -> emitter.set(o), Maybe.never()) + .test(); + + emitter.get().onSubscribe(Disposable.empty()); + + to.dispose(); + + emitter.get().onSuccess(1); + + to.assertEmpty(); + } } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipIterableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipIterableTest.java index 4f6e07f00a..2d60c22157 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipIterableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipIterableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/CompletableAndThenObservableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/CompletableAndThenObservableTest.java index 9c8dfa8754..a1e087bdf2 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/CompletableAndThenObservableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/CompletableAndThenObservableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/CompletableAndThenPublisherTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/CompletableAndThenPublisherTest.java index 9c0a498db5..bd9c9aa2d9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/CompletableAndThenPublisherTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/CompletableAndThenPublisherTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapCompletableTest.java index 28c90619bb..44acad42b1 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapCompletableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -28,7 +28,7 @@ import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; import io.reactivex.rxjava3.observers.TestObserver; import io.reactivex.rxjava3.plugins.RxJavaPlugins; -import io.reactivex.rxjava3.processors.PublishProcessor; +import io.reactivex.rxjava3.processors.*; import io.reactivex.rxjava3.subjects.CompletableSubject; import io.reactivex.rxjava3.testsupport.*; @@ -66,6 +66,14 @@ public void simpleLongPrefetch() { .assertResult(); } + @Test + public void simpleLongPrefetchHidden() { + Flowable.range(1, 1024).hide() + .concatMapCompletable(Functions.justFunction(Completable.complete()), 32) + .test() + .assertResult(); + } + @Test public void mainError() { Flowable.error(new TestException()) @@ -277,7 +285,7 @@ protected void subscribeActual(Subscriber s) { Functions.justFunction(Completable.never()), 1 ) .test() - .assertFailure(MissingBackpressureException.class); + .assertFailure(QueueOverflowException.class); TestHelper.assertUndeliverable(errors, 0, TestException.class); } finally { @@ -431,4 +439,54 @@ public Completable apply(Integer v) throws Throwable { } }); } + + @Test + public void basicNonFused() { + Flowable.range(1, 5).hide() + .concatMapCompletable(v -> Completable.complete().hide()) + .test() + .assertResult(); + } + + @Test + public void basicSyncFused() { + Flowable.range(1, 5) + .concatMapCompletable(v -> Completable.complete().hide()) + .test() + .assertResult(); + } + + @Test + public void basicAsyncFused() { + UnicastProcessor up = UnicastProcessor.create(); + TestHelper.emit(up, 1, 2, 3, 4, 5); + + up + .concatMapCompletable(v -> Completable.complete().hide()) + .test() + .assertResult(); + } + + @Test + public void basicFusionRejected() { + TestHelper.rejectFlowableFusion() + .concatMapCompletable(v -> Completable.complete().hide()) + .test() + .assertEmpty(); + } + + @Test + public void fusedPollCrash() { + Flowable.range(1, 5) + .map(v -> { + if (v == 3) { + throw new TestException(); + } + return v; + }) + .compose(TestHelper.flowableStripBoundary()) + .concatMapCompletable(v -> Completable.complete().hide()) + .test() + .assertFailure(TestException.class); + } } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapMaybeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapMaybeTest.java index 8a60f6c367..12b61a5e8c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapMaybeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapMaybeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,11 +19,11 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import io.reactivex.rxjava3.disposables.Disposable; import org.junit.Test; import org.reactivestreams.Subscriber; import io.reactivex.rxjava3.core.*; +import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.functions.Functions; @@ -31,7 +31,7 @@ import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; import io.reactivex.rxjava3.internal.util.ErrorMode; import io.reactivex.rxjava3.plugins.RxJavaPlugins; -import io.reactivex.rxjava3.processors.PublishProcessor; +import io.reactivex.rxjava3.processors.*; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.subjects.MaybeSubject; import io.reactivex.rxjava3.subscribers.TestSubscriber; @@ -54,15 +54,19 @@ public MaybeSource apply(Integer v) } @Test - public void simpleLong() { + public void simpleLongPrefetch() { Flowable.range(1, 1024) - .concatMapMaybe(new Function>() { - @Override - public MaybeSource apply(Integer v) - throws Exception { - return Maybe.just(v); - } - }, 32) + .concatMapMaybe(Maybe::just, 32) + .test() + .assertValueCount(1024) + .assertNoErrors() + .assertComplete(); + } + + @Test + public void simpleLongPrefetchHidden() { + Flowable.range(1, 1024).hide() + .concatMapMaybe(Maybe::just, 32) .test() .assertValueCount(1024) .assertNoErrors() @@ -245,7 +249,7 @@ protected void subscribeActual(Subscriber s) { Functions.justFunction(Maybe.never()), 1 ) .test() - .assertFailure(MissingBackpressureException.class); + .assertFailure(QueueOverflowException.class); TestHelper.assertUndeliverable(errors, 0, TestException.class); } finally { @@ -464,4 +468,54 @@ public Maybe apply(Integer v) throws Throwable { } }); } + + @Test + public void basicNonFused() { + Flowable.range(1, 5).hide() + .concatMapMaybe(v -> Maybe.just(v).hide()) + .test() + .assertResult(1, 2, 3, 4, 5); + } + + @Test + public void basicSyncFused() { + Flowable.range(1, 5) + .concatMapMaybe(v -> Maybe.just(v).hide()) + .test() + .assertResult(1, 2, 3, 4, 5); + } + + @Test + public void basicAsyncFused() { + UnicastProcessor up = UnicastProcessor.create(); + TestHelper.emit(up, 1, 2, 3, 4, 5); + + up + .concatMapMaybe(v -> Maybe.just(v).hide()) + .test() + .assertResult(1, 2, 3, 4, 5); + } + + @Test + public void basicFusionRejected() { + TestHelper.rejectFlowableFusion() + .concatMapMaybe(v -> Maybe.just(v).hide()) + .test() + .assertEmpty(); + } + + @Test + public void fusedPollCrash() { + Flowable.range(1, 5) + .map(v -> { + if (v == 3) { + throw new TestException(); + } + return v; + }) + .compose(TestHelper.flowableStripBoundary()) + .concatMapMaybe(v -> Maybe.just(v).hide()) + .test() + .assertFailure(TestException.class, 1, 2); + } } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapSingleTest.java index a2e5d73c09..60cb2f5de0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -30,7 +30,7 @@ import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; import io.reactivex.rxjava3.internal.util.ErrorMode; import io.reactivex.rxjava3.plugins.RxJavaPlugins; -import io.reactivex.rxjava3.processors.PublishProcessor; +import io.reactivex.rxjava3.processors.*; import io.reactivex.rxjava3.subjects.SingleSubject; import io.reactivex.rxjava3.subscribers.TestSubscriber; import io.reactivex.rxjava3.testsupport.*; @@ -52,15 +52,19 @@ public SingleSource apply(Integer v) } @Test - public void simpleLong() { + public void simpleLongPrefetch() { Flowable.range(1, 1024) - .concatMapSingle(new Function>() { - @Override - public SingleSource apply(Integer v) - throws Exception { - return Single.just(v); - } - }, 32) + .concatMapSingle(Single::just, 32) + .test() + .assertValueCount(1024) + .assertNoErrors() + .assertComplete(); + } + + @Test + public void simpleLongPrefetchHidden() { + Flowable.range(1, 1024).hide() + .concatMapSingle(Single::just, 32) .test() .assertValueCount(1024) .assertNoErrors() @@ -163,7 +167,7 @@ protected void subscribeActual(Subscriber s) { Functions.justFunction(Single.never()), 1 ) .test() - .assertFailure(MissingBackpressureException.class); + .assertFailure(QueueOverflowException.class); TestHelper.assertUndeliverable(errors, 0, TestException.class); } finally { @@ -382,4 +386,54 @@ public Single apply(Integer v) throws Throwable { } }); } + + @Test + public void basicNonFused() { + Flowable.range(1, 5).hide() + .concatMapSingle(v -> Single.just(v).hide()) + .test() + .assertResult(1, 2, 3, 4, 5); + } + + @Test + public void basicSyncFused() { + Flowable.range(1, 5) + .concatMapSingle(v -> Single.just(v).hide()) + .test() + .assertResult(1, 2, 3, 4, 5); + } + + @Test + public void basicAsyncFused() { + UnicastProcessor up = UnicastProcessor.create(); + TestHelper.emit(up, 1, 2, 3, 4, 5); + + up + .concatMapSingle(v -> Single.just(v).hide()) + .test() + .assertResult(1, 2, 3, 4, 5); + } + + @Test + public void basicFusionRejected() { + TestHelper.rejectFlowableFusion() + .concatMapSingle(v -> Single.just(v).hide()) + .test() + .assertEmpty(); + } + + @Test + public void fusedPollCrash() { + Flowable.range(1, 5) + .map(v -> { + if (v == 3) { + throw new TestException(); + } + return v; + }) + .compose(TestHelper.flowableStripBoundary()) + .concatMapSingle(v -> Single.just(v).hide()) + .test() + .assertFailure(TestException.class, 1, 2); + } } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapCompletableTest.java index bf18f90b05..cf2065cc72 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapCompletableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapMaybeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapMaybeTest.java index 8fd4b55d6f..1ace07440f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapMaybeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapMaybeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapSingleTest.java index a28413ab42..cd4d64a9eb 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapObservableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapObservableTest.java index 0b268e8d88..f91b5c6582 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapObservableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapObservableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapPublisherTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapPublisherTest.java index b7853ccac0..96948b05dc 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapPublisherTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapPublisherTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapCompletableTest.java index 540e0828af..e69e3e0ee5 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapCompletableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -474,4 +474,54 @@ public Completable apply(Integer v) throws Throwable { } }); } + + @Test + public void basicNonFused() { + Observable.range(1, 5).hide() + .concatMapCompletable(v -> Completable.complete().hide()) + .test() + .assertResult(); + } + + @Test + public void basicSyncFused() { + Observable.range(1, 5) + .concatMapCompletable(v -> Completable.complete().hide()) + .test() + .assertResult(); + } + + @Test + public void basicAsyncFused() { + UnicastSubject us = UnicastSubject.create(); + TestHelper.emit(us, 1, 2, 3, 4, 5); + + us + .concatMapCompletable(v -> Completable.complete().hide()) + .test() + .assertResult(); + } + + @Test + public void basicFusionRejected() { + TestHelper.rejectObservableFusion() + .concatMapCompletable(v -> Completable.complete().hide()) + .test() + .assertEmpty(); + } + + @Test + public void fusedPollCrash() { + Observable.range(1, 5) + .map(v -> { + if (v == 3) { + throw new TestException(); + } + return v; + }) + .compose(TestHelper.observableStripBoundary()) + .concatMapCompletable(v -> Completable.complete().hide()) + .test() + .assertFailure(TestException.class); + } } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapMaybeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapMaybeTest.java index 323cbc3270..0dcbd27408 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapMaybeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapMaybeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -485,4 +485,54 @@ public Maybe apply(Integer v) throws Throwable { } }); } + + @Test + public void basicNonFused() { + Observable.range(1, 5).hide() + .concatMapMaybe(v -> Maybe.just(v).hide()) + .test() + .assertResult(1, 2, 3, 4, 5); + } + + @Test + public void basicSyncFused() { + Observable.range(1, 5) + .concatMapMaybe(v -> Maybe.just(v).hide()) + .test() + .assertResult(1, 2, 3, 4, 5); + } + + @Test + public void basicAsyncFused() { + UnicastSubject us = UnicastSubject.create(); + TestHelper.emit(us, 1, 2, 3, 4, 5); + + us + .concatMapMaybe(v -> Maybe.just(v).hide()) + .test() + .assertResult(1, 2, 3, 4, 5); + } + + @Test + public void basicFusionRejected() { + TestHelper.rejectObservableFusion() + .concatMapMaybe(v -> Maybe.just(v).hide()) + .test() + .assertEmpty(); + } + + @Test + public void fusedPollCrash() { + Observable.range(1, 5) + .map(v -> { + if (v == 3) { + throw new TestException(); + } + return v; + }) + .compose(TestHelper.observableStripBoundary()) + .concatMapMaybe(v -> Maybe.just(v).hide()) + .test() + .assertFailure(TestException.class, 1, 2); + } } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapSingleTest.java index 90f15ac250..9f70b4addf 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -425,4 +425,54 @@ public Single apply(Integer v) throws Throwable { } }); } + + @Test + public void basicNonFused() { + Observable.range(1, 5).hide() + .concatMapSingle(v -> Single.just(v).hide()) + .test() + .assertResult(1, 2, 3, 4, 5); + } + + @Test + public void basicSyncFused() { + Observable.range(1, 5) + .concatMapSingle(v -> Single.just(v).hide()) + .test() + .assertResult(1, 2, 3, 4, 5); + } + + @Test + public void basicAsyncFused() { + UnicastSubject us = UnicastSubject.create(); + TestHelper.emit(us, 1, 2, 3, 4, 5); + + us + .concatMapSingle(v -> Single.just(v).hide()) + .test() + .assertResult(1, 2, 3, 4, 5); + } + + @Test + public void basicFusionRejected() { + TestHelper.rejectObservableFusion() + .concatMapSingle(v -> Single.just(v).hide()) + .test() + .assertEmpty(); + } + + @Test + public void fusedPollCrash() { + Observable.range(1, 5) + .map(v -> { + if (v == 3) { + throw new TestException(); + } + return v; + }) + .compose(TestHelper.observableStripBoundary()) + .concatMapSingle(v -> Single.just(v).hide()) + .test() + .assertFailure(TestException.class, 1, 2); + } } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapCompletableTest.java index 33ce7c27da..0efeb6f676 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapCompletableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapMaybeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapMaybeTest.java index 865544b22a..b2eabdd96f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapMaybeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapMaybeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapSingleTest.java index d5de085a1e..a98afae4de 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ScalarXMapZHelperTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ScalarXMapZHelperTest.java index 8a8e745c8b..2ac6eed7d3 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ScalarXMapZHelperTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ScalarXMapZHelperTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/SingleFlatMapObservableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/SingleFlatMapObservableTest.java index 3f9fcb74de..a002620b6a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/SingleFlatMapObservableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/mixed/SingleFlatMapObservableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/AbstractObservableWithUpstreamTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/AbstractObservableWithUpstreamTest.java index b578dcb8f6..5d49cd8b66 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/AbstractObservableWithUpstreamTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/AbstractObservableWithUpstreamTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableLatestTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableLatestTest.java index ef8e23ba21..feac576be7 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableLatestTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableLatestTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableMostRecentTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableMostRecentTest.java index cc04638ee7..ccf611bbd4 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableMostRecentTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableMostRecentTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableNextTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableNextTest.java index 82397f45dd..8274e9f9e3 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableNextTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableNextTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableToFutureTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableToFutureTest.java index bca24503c1..dacf971596 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableToFutureTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableToFutureTest.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.operators.observable; import static org.junit.Assert.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableToIteratorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableToIteratorTest.java index 2eb25e0dab..684eefbf61 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableToIteratorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableToIteratorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/Burst.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/Burst.java index 2bed435879..46b5df42f3 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/Burst.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/Burst.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import java.util.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAllTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAllTest.java index 9883764f28..fba37cb9f9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAllTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAllTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAmbTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAmbTest.java index 4948f1a13d..5ec9129d9f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAmbTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAmbTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -235,7 +235,8 @@ public void ambArraySingleElement() { @Test public void manySources() { - Observable[] a = new Observable[32]; + @SuppressWarnings("unchecked") + Observable[] a = new Observable[32]; Arrays.fill(a, Observable.never()); a[31] = Observable.just(1); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAnyTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAnyTest.java index 35faf30c19..cb85603fa1 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAnyTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAnyTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAutoConnectTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAutoConnectTest.java index 5ed5b3124e..16128ff195 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAutoConnectTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAutoConnectTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBlockingTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBlockingTest.java index a2d9854569..05fbb5a94c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBlockingTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBlockingTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferTest.java index 30c9efd221..8264a66494 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferUntilSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferUntilSubscriberTest.java index 6d49272de2..eb67fee441 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferUntilSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferUntilSubscriberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCacheTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCacheTest.java index 3ad0f0ef67..7f47ec95d8 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCacheTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCacheTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCastTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCastTest.java index 52576fb9b9..83fdb4b1e5 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCastTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCastTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCollectTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCollectTest.java index 0568b0d474..92867c2d79 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCollectTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCollectTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCombineLatestTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCombineLatestTest.java index d8f35d38d1..2b966ec29c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCombineLatestTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCombineLatestTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapCompletableTest.java index 55b880a9f9..931fcd403f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapCompletableTest.java @@ -1,15 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. - *

+ * * Licensed 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 io.reactivex.rxjava3.internal.operators.observable; import static org.junit.Assert.assertTrue; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapEagerTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapEagerTest.java index 079a8c8a47..1e75ff9aef 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapEagerTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapEagerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapSchedulerTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapSchedulerTest.java index 48ab5a2fc1..f2a6ede314 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapSchedulerTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapSchedulerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -307,7 +307,7 @@ public Observable apply(Integer t) throws Throwable { } @Test - public void issue2890NoStackoverflow() throws InterruptedException { + public void issue2890NoStackoverflow() throws InterruptedException, TimeoutException { final ExecutorService executor = Executors.newFixedThreadPool(2); final Scheduler sch = Schedulers.from(executor); @@ -352,7 +352,11 @@ public void onError(Throwable e) { } }); - executor.awaitTermination(20000, TimeUnit.MILLISECONDS); + long awaitTerminationTimeout = 100_000; + if (!executor.awaitTermination(awaitTerminationTimeout, TimeUnit.MILLISECONDS)) { + throw new TimeoutException("Completed " + counter.get() + "/" + n + " before timed out after " + + awaitTerminationTimeout + " milliseconds."); + } assertEquals(n, counter.get()); } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapTest.java index f8aa2cf42b..8fb29f2eb4 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatTest.java index 90e3dc112b..d14f803ee9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -683,7 +683,7 @@ public void subscribe(Observer observer) { } @Test - public void issue2890NoStackoverflow() throws InterruptedException { + public void issue2890NoStackoverflow() throws InterruptedException, TimeoutException { final ExecutorService executor = Executors.newFixedThreadPool(2); final Scheduler sch = Schedulers.from(executor); @@ -728,7 +728,11 @@ public void onError(Throwable e) { } }); - executor.awaitTermination(20000, TimeUnit.MILLISECONDS); + long awaitTerminationTimeout = 100_000; + if (!executor.awaitTermination(awaitTerminationTimeout, TimeUnit.MILLISECONDS)) { + throw new TimeoutException("Completed " + counter.get() + "/" + n + " before timed out after " + + awaitTerminationTimeout + " milliseconds."); + } assertEquals(n, counter.get()); } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithCompletableTest.java index fc2a8b8531..5e0d878a34 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithCompletableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithMaybeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithMaybeTest.java index 16ba059b8b..6c70e75a9d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithMaybeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithMaybeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithSingleTest.java index 2d05b58c2d..8ac2519c3c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCountTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCountTest.java index 4207fee66f..1390502816 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCountTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCountTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCreateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCreateTest.java index 2998f0a5a8..0b96fae6aa 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCreateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCreateTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDebounceTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDebounceTest.java index 4b3a64def7..fc4e7d8478 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDebounceTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDebounceTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -21,6 +21,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; +import io.reactivex.rxjava3.functions.Action; import org.junit.*; import org.mockito.InOrder; import org.reactivestreams.Publisher; @@ -50,6 +51,76 @@ public void before() { innerScheduler = scheduler.createWorker(); } + @Test + public void debounceWithOnDroppedCallbackWithEx() throws Throwable { + Observable source = Observable.unsafeCreate(new ObservableSource() { + @Override + public void subscribe(Observer observer) { + observer.onSubscribe(Disposable.empty()); + publishNext(observer, 100, "one"); // Should be skipped since "two" will arrive before the timeout expires. + publishNext(observer, 400, "two"); // Should be published since "three" will arrive after the timeout expires. + publishNext(observer, 900, "three"); // Should be skipped since onComplete will arrive before the timeout expires. + publishNext(observer, 999, "four"); // Should be skipped since onComplete will arrive before the timeout expires. + publishCompleted(observer, 1000); // Should be published as soon as the timeout expires. + } + }); + + Action whenDisposed = mock(Action.class); + Observable sampled = source + .doOnDispose(whenDisposed) + .debounce(400, TimeUnit.MILLISECONDS, scheduler, e -> { + if ("three".equals(e)) { + throw new TestException("forced"); + } + }); + sampled.subscribe(observer); + + scheduler.advanceTimeTo(0, TimeUnit.MILLISECONDS); + InOrder inOrder = inOrder(observer); + // must go to 800 since it must be 400 after when two is sent, which is at 400 + scheduler.advanceTimeTo(800, TimeUnit.MILLISECONDS); + inOrder.verify(observer, times(1)).onNext("two"); + scheduler.advanceTimeTo(1000, TimeUnit.MILLISECONDS); + inOrder.verify(observer, times(1)).onError(any(TestException.class)); + inOrder.verify(observer, never()).onNext("three"); + inOrder.verify(observer, never()).onNext("four"); + inOrder.verify(observer, never()).onComplete(); + inOrder.verifyNoMoreInteractions(); + verify(whenDisposed).run(); + } + + @Test + public void debounceWithOnDroppedCallback() { + Observable source = Observable.unsafeCreate(new ObservableSource() { + @Override + public void subscribe(Observer observer) { + observer.onSubscribe(Disposable.empty()); + publishNext(observer, 100, "one"); // Should be skipped since "two" will arrive before the timeout expires. + publishNext(observer, 400, "two"); // Should be published since "three" will arrive after the timeout expires. + publishNext(observer, 900, "three"); // Should be skipped since onComplete will arrive before the timeout expires. + publishNext(observer, 999, "four"); // Should be skipped since onComplete will arrive before the timeout expires. + publishCompleted(observer, 1000); // Should be published as soon as the timeout expires. + } + }); + + Observer drops = TestHelper.mockObserver(); + InOrder inOrderDrops = inOrder(drops); + Observable sampled = source.debounce(400, TimeUnit.MILLISECONDS, scheduler, drops::onNext); + sampled.subscribe(observer); + + scheduler.advanceTimeTo(0, TimeUnit.MILLISECONDS); + InOrder inOrder = inOrder(observer); + // must go to 800 since it must be 400 after when two is sent, which is at 400 + scheduler.advanceTimeTo(800, TimeUnit.MILLISECONDS); + inOrderDrops.verify(drops, times(1)).onNext("one"); + inOrder.verify(observer, times(1)).onNext("two"); + scheduler.advanceTimeTo(1000, TimeUnit.MILLISECONDS); + inOrderDrops.verify(drops, times(1)).onNext("three"); + inOrder.verify(observer, times(1)).onComplete(); + inOrder.verifyNoMoreInteractions(); + inOrderDrops.verifyNoMoreInteractions(); + } + @Test public void debounceWithCompleted() { Observable source = Observable.unsafeCreate(new ObservableSource() { @@ -489,7 +560,7 @@ protected void subscribeActual( public void timedLateEmit() { TestObserver to = new TestObserver<>(); DebounceTimedObserver sub = new DebounceTimedObserver<>( - to, 1, TimeUnit.SECONDS, new TestScheduler().createWorker()); + to, 1, TimeUnit.SECONDS, new TestScheduler().createWorker(), null); sub.onSubscribe(Disposable.empty()); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDefaultIfEmptyTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDefaultIfEmptyTest.java index 1ca00cf1b4..7a1d66e908 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDefaultIfEmptyTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDefaultIfEmptyTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDeferTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDeferTest.java index 50ded2e55a..cb919f02ff 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDeferTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDeferTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDelaySubscriptionOtherTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDelaySubscriptionOtherTest.java index 93b09456dd..02d988c2e8 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDelaySubscriptionOtherTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDelaySubscriptionOtherTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDelayTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDelayTest.java index 82b60d4701..778d2d4e64 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDelayTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDelayTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -20,6 +20,7 @@ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicReference; +import java.util.concurrent.locks.LockSupport; import org.junit.*; import org.mockito.InOrder; @@ -29,6 +30,7 @@ import io.reactivex.rxjava3.core.Observer; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.*; +import io.reactivex.rxjava3.internal.disposables.SequentialDisposable; import io.reactivex.rxjava3.internal.functions.Functions; import io.reactivex.rxjava3.observers.*; import io.reactivex.rxjava3.schedulers.*; @@ -978,4 +980,37 @@ public Observable apply(Integer t) throws Exception { .to(TestHelper.testConsumer()) .assertFailureAndMessage(NullPointerException.class, "The itemDelay returned a null ObservableSource"); } -} + + @Test + public void cancelShouldPreventRandomSubsequentEmissions() { + for (int attempt = 1; attempt < 100; attempt ++) { + + SequentialDisposable disposable = new SequentialDisposable(); + ConcurrentLinkedQueue sink = new ConcurrentLinkedQueue<>(); + + disposable.replace( + Observable.range(1, 10) + .delay(1, TimeUnit.MICROSECONDS, Schedulers.computation(), true) + .doOnNext(v -> { + if (v == 1) { + Schedulers.computation().scheduleDirect(disposable::dispose); + } + sink.offer(v); + }) + .subscribe()); + + LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(1)); + + Integer last = null; + + while (!sink.isEmpty()) { + Integer current = sink.poll(); + + if (last != null && last + 1 != current) { + fail("Emission hole: " + last + " -> " + current); + } + + last = current; + } + } + }} diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDematerializeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDematerializeTest.java index bc041cb1be..e28b71a629 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDematerializeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDematerializeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDetachTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDetachTest.java index 95cbf96f76..5e4e3d5fce 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDetachTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDetachTest.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.operators.observable; import java.lang.ref.WeakReference; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinctTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinctTest.java index 1f2614f284..178f700db5 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinctTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinctTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -29,8 +29,9 @@ import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.util.ExceptionHelper; +import io.reactivex.rxjava3.operators.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.subjects.UnicastSubject; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinctUntilChangedTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinctUntilChangedTest.java index 190506aed2..7f58ab2f89 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinctUntilChangedTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinctUntilChangedTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -26,8 +26,8 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.subjects.*; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoAfterNextTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoAfterNextTest.java index 9c750bba88..8338d2c9ec 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoAfterNextTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoAfterNextTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -24,8 +24,8 @@ import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.Consumer; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.subjects.UnicastSubject; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoFinallyTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoFinallyTest.java index d3a11c186d..3753b41127 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoFinallyTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoFinallyTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -26,7 +26,8 @@ import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.*; +import io.reactivex.rxjava3.operators.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.subjects.UnicastSubject; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnEachTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnEachTest.java index 6b8627b02b..1f71d2b0a3 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnEachTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnEachTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -28,8 +28,8 @@ import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.subjects.UnicastSubject; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnSubscribeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnSubscribeTest.java index 5a16beda68..f001d28ac0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnSubscribeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnSubscribeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnUnsubscribeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnUnsubscribeTest.java index a95f372d18..5ac217725b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnUnsubscribeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnUnsubscribeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAtTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAtTest.java index 679915dc51..8ce5cb047c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAtTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAtTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFilterTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFilterTest.java index 6bbb838da5..71585b1c33 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFilterTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFilterTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -23,7 +23,7 @@ import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.subjects.UnicastSubject; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFinallyTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFinallyTest.java index 7767ddb9fc..9f20203ed2 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFinallyTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFinallyTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFirstTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFirstTest.java index e022144ce2..9129f1d0cd 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFirstTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFirstTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapCompletableTest.java index 169186da49..facfb084d1 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapCompletableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -24,8 +24,9 @@ import io.reactivex.rxjava3.disposables.*; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.subjects.PublishSubject; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapMaybeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapMaybeTest.java index 6bb2b40dc3..0c0d29c8e7 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapMaybeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapMaybeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapSingleTest.java index 5eefbacb4a..1fa219111b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapTest.java index 1e083d217c..4622888628 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlattenIterableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlattenIterableTest.java index 8a2de4cf48..15d6aae37b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlattenIterableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlattenIterableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableForEachTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableForEachTest.java index 677b78414f..ac8312a893 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableForEachTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableForEachTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromActionTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromActionTest.java index 2b6d80896a..eb20166507 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromActionTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromActionTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -24,8 +24,8 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromCallableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromCallableTest.java index 43b1d96fef..c701f60c47 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromCallableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromCallableTest.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.operators.observable; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromCompletableTest.java index 68c9f10292..6cfd2eb0ad 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromCompletableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -26,6 +26,7 @@ import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromIterableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromIterableTest.java index ec6b70e31b..b816baf4b0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromIterableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromIterableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -29,9 +29,10 @@ import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.util.CrashingIterable; import io.reactivex.rxjava3.observers.*; +import io.reactivex.rxjava3.operators.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.testsupport.*; public class ObservableFromIterableTest extends RxJavaTest { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromMaybeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromMaybeTest.java index 185b363d57..e0175b4a59 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromMaybeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromMaybeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,8 +19,8 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.TestException; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.subjects.MaybeSubject; import io.reactivex.rxjava3.testsupport.TestObserverEx; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromRunnableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromRunnableTest.java index 834abbd978..b566f66775 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromRunnableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromRunnableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -25,8 +25,8 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.Supplier; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromSingleTest.java index d77498cea8..aaabb513b3 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -19,8 +19,8 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.TestException; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.subjects.SingleSubject; import io.reactivex.rxjava3.testsupport.TestObserverEx; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromSupplierTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromSupplierTest.java index 2b181a56fe..56e31ddfb7 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromSupplierTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromSupplierTest.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.operators.observable; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromTest.java index e3f6f91954..639d3c4d14 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -21,7 +21,8 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.*; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.ScalarSupplier; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGenerateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGenerateTest.java index f6beca1800..90a3d60eaf 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGenerateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGenerateTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupByTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupByTest.java index b9d37ef118..32c1abc2e2 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupByTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupByTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupJoinTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupJoinTest.java index 67f8eda0b7..7959f90a05 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupJoinTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupJoinTest.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.operators.observable; import static org.junit.Assert.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableHideTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableHideTest.java index 45361b1aed..0b624621ec 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableHideTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableHideTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIgnoreElementsTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIgnoreElementsTest.java index 43af8631e9..c7597c3a9f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIgnoreElementsTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIgnoreElementsTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableInternalHelperTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableInternalHelperTest.java index 9c02f95ebb..87fc866f74 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableInternalHelperTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableInternalHelperTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.observable; import static org.junit.Assert.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIntervalRangeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIntervalRangeTest.java index db42957fa5..637d9164be 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIntervalRangeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIntervalRangeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIntervalTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIntervalTest.java index 4f188093c5..e8126962de 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIntervalTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIntervalTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableJoinTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableJoinTest.java index a674d0680e..c6f439cdcb 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableJoinTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableJoinTest.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.operators.observable; import static org.mockito.ArgumentMatchers.any; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLastTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLastTest.java index 0bd5868332..cabed665f4 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLastTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLastTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLiftTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLiftTest.java index 64a95db947..b761a6ad02 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLiftTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLiftTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMapNotificationTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMapNotificationTest.java index 81b470ff99..0672f528c9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMapNotificationTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMapNotificationTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMapTest.java index 538feaaa7f..4919a74f0d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMapTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -26,7 +26,7 @@ import io.reactivex.rxjava3.core.Observer; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.subjects.UnicastSubject; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMaterializeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMaterializeTest.java index 0e1df287bc..02b16ad6ce 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMaterializeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMaterializeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeDelayErrorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeDelayErrorTest.java index fefce52867..da92bc0338 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeDelayErrorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeDelayErrorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeMaxConcurrentTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeMaxConcurrentTest.java index 9ab92edc12..e1388f39ad 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeMaxConcurrentTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeMaxConcurrentTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeTest.java index d5b9a45a6f..02ddf09fd0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithCompletableTest.java index e561eaac1e..4b9ee5a9d2 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithCompletableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithMaybeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithMaybeTest.java index 43f0a7fff7..3140c5c118 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithMaybeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithMaybeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithSingleTest.java index c6b083f41d..9d6171ba06 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableObserveOnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableObserveOnTest.java index 2b8c2e0274..5f41470db0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableObserveOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableObserveOnTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -31,11 +31,13 @@ import io.reactivex.rxjava3.disposables.*; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.operators.flowable.FlowableObserveOnTest.DisposeTrackingScheduler; import io.reactivex.rxjava3.internal.operators.observable.ObservableObserveOn.ObserveOnObserver; import io.reactivex.rxjava3.internal.schedulers.ImmediateThinScheduler; import io.reactivex.rxjava3.observers.*; +import io.reactivex.rxjava3.operators.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.SimpleQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.schedulers.*; import io.reactivex.rxjava3.subjects.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorCompleteTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorCompleteTest.java index 4c37745834..a4671dd535 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorCompleteTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorCompleteTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorResumeNextTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorResumeNextTest.java index 386b6c96a1..ed3e8dc571 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorResumeNextTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorResumeNextTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorResumeWithTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorResumeWithTest.java index f60ea43a25..7b659c9444 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorResumeWithTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorResumeWithTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorReturnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorReturnTest.java index 69c6c6889c..da7acf2b47 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorReturnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorReturnTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservablePublishTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservablePublishTest.java index a83372c03e..edec6a517d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservablePublishTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservablePublishTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRangeLongTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRangeLongTest.java index 7a58572d2f..c19219cdea 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRangeLongTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRangeLongTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -24,8 +24,8 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.functions.Consumer; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.observers.*; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.testsupport.*; public class ObservableRangeLongTest extends RxJavaTest { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRangeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRangeTest.java index e789b55093..0f461a7154 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRangeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRangeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -24,8 +24,8 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.functions.Consumer; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.observers.*; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.testsupport.*; public class ObservableRangeTest extends RxJavaTest { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRedoTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRedoTest.java index 2dc15f230e..adb2caf4a3 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRedoTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRedoTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceTest.java index d997e9899f..0feab233d3 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRefCountTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRefCountTest.java index 442f326e37..638f694a88 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRefCountTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRefCountTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeatTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeatTest.java index 78c793f1b4..8f3287e7e0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeatTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeatTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReplayEagerTruncateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReplayEagerTruncateTest.java index cf473d6e78..aa1bcb4359 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReplayEagerTruncateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReplayEagerTruncateTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReplayTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReplayTest.java index 94a7a6087f..8b4ef97d02 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReplayTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReplayTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableResourceWrapperTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableResourceWrapperTest.java index 228725c0a0..42d557e091 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableResourceWrapperTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableResourceWrapperTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryTest.java index 94009c5b86..13f19fb547 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -572,7 +572,7 @@ public void run() { } } - /** Observer for listener on seperate thread. */ + /** Observer for listener on separate thread. */ static final class AsyncObserver extends DefaultObserver { protected CountDownLatch latch = new CountDownLatch(1); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryWithPredicateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryWithPredicateTest.java index 5bb4fba7d8..bce6e9f659 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryWithPredicateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryWithPredicateTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSampleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSampleTest.java index 3e842e67ed..7da1bfcbda 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSampleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSampleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScalarXMapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScalarXMapTest.java index 4bfee7eb01..c27b2e17c0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScalarXMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScalarXMapTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -21,9 +21,9 @@ import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.disposables.EmptyDisposable; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.internal.operators.observable.ObservableScalarXMap.ScalarDisposable; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.testsupport.TestHelper; public class ObservableScalarXMapTest extends RxJavaTest { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScanTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScanTest.java index c482d121be..9a1765ceb3 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScanTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScanTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSequenceEqualTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSequenceEqualTest.java index da75e3ee94..645fafbb62 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSequenceEqualTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSequenceEqualTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSerializeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSerializeTest.java index 2457a9a312..9aa31211b5 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSerializeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSerializeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSingleTest.java index 2290c645ca..c511f28baf 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLastTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLastTest.java index 712da24ea9..1a10af31d2 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLastTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLastTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLastTimedTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLastTimedTest.java index 650575e7f3..a4171ea2df 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLastTimedTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLastTimedTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipTest.java index 93c4694616..c1fe2bf2bc 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipTimedTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipTimedTest.java index 1c3fc30e14..83edc3201b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipTimedTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipTimedTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipUntilTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipUntilTest.java index 290fc2c1f0..bb2c3ef127 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipUntilTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipUntilTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipWhileTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipWhileTest.java index ab1abdfa49..b6a0749088 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipWhileTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipWhileTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableStartWithTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableStartWithTest.java index 47cf4dc962..267f5be42a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableStartWithTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableStartWithTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSubscribeOnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSubscribeOnTest.java index 53ccf2b3a6..ab3890dcc6 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSubscribeOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSubscribeOnTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchIfEmptyTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchIfEmptyTest.java index 34e24d81cb..5dd3703c67 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchIfEmptyTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchIfEmptyTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchTest.java index 3587c58aec..72e6c93bb8 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -1438,4 +1438,19 @@ Observable createObservable(AtomicInteger inner) { inner.incrementAndGet(); }); } + + @Test + public void innerOnSubscribeOuterCancelRace() { + TestObserver to = new TestObserver(); + + Observable.just(1) + .hide() + .switchMap(v -> Observable.just(1) + .doOnSubscribe(d -> to.dispose()) + .scan(1, (a, b) -> a) + ) + .subscribe(to); + + to.assertEmpty(); + } } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastOneTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastOneTest.java index 92536eb95e..1bd19d6bc9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastOneTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastOneTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastTest.java index b9ed392381..f0a342e2e1 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastTimedTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastTimedTest.java index 3c671695ff..4e2bd6a5c0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastTimedTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastTimedTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeTest.java index 6fb3143410..0ecff80446 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeTimedTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeTimedTest.java index 32f6049afb..7edbfbcf20 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeTimedTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeTimedTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntilPredicateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntilPredicateTest.java index 143fe9d3ca..04d0ab5537 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntilPredicateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntilPredicateTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntilTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntilTest.java index 5e831b03b3..4bbf042acc 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntilTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntilTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeWhileTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeWhileTest.java index 1b35f4144f..0a9fc27136 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeWhileTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeWhileTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleFirstTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleFirstTest.java index 4aa693978e..fe296d572b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleFirstTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleFirstTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,6 +18,7 @@ import java.util.concurrent.TimeUnit; +import io.reactivex.rxjava3.functions.Action; import org.junit.*; import org.mockito.InOrder; @@ -41,6 +42,76 @@ public void before() { observer = TestHelper.mockObserver(); } + @Test + public void throttlingWithDropCallbackCrashes() throws Throwable { + Observable source = Observable.unsafeCreate(new ObservableSource() { + @Override + public void subscribe(Observer innerObserver) { + innerObserver.onSubscribe(Disposable.empty()); + publishNext(innerObserver, 100, "one"); // publish as it's first + publishNext(innerObserver, 300, "two"); // skip as it's last within the first 400 + publishNext(innerObserver, 900, "three"); // publish + publishNext(innerObserver, 905, "four"); // skip + publishCompleted(innerObserver, 1000); // Should be published as soon as the timeout expires. + } + }); + + Action whenDisposed = mock(Action.class); + Observable sampled = source + .doOnDispose(whenDisposed) + .throttleFirst(400, TimeUnit.MILLISECONDS, scheduler, e -> { + if ("two".equals(e)) { + throw new TestException("forced"); + } + }); + sampled.subscribe(observer); + + InOrder inOrder = inOrder(observer); + + scheduler.advanceTimeTo(1000, TimeUnit.MILLISECONDS); + inOrder.verify(observer, times(1)).onNext("one"); + inOrder.verify(observer, times(1)).onError(any(TestException.class)); + inOrder.verify(observer, times(0)).onNext("two"); + inOrder.verify(observer, times(0)).onNext("three"); + inOrder.verify(observer, times(0)).onNext("four"); + inOrder.verify(observer, times(0)).onComplete(); + inOrder.verifyNoMoreInteractions(); + verify(whenDisposed).run(); + } + + @Test + public void throttlingWithDropCallback() { + Observable source = Observable.unsafeCreate(new ObservableSource() { + @Override + public void subscribe(Observer innerObserver) { + innerObserver.onSubscribe(Disposable.empty()); + publishNext(innerObserver, 100, "one"); // publish as it's first + publishNext(innerObserver, 300, "two"); // skip as it's last within the first 400 + publishNext(innerObserver, 900, "three"); // publish + publishNext(innerObserver, 905, "four"); // skip + publishCompleted(innerObserver, 1000); // Should be published as soon as the timeout expires. + } + }); + + Observer dropCallbackObserver = TestHelper.mockObserver(); + Observable sampled = source.throttleFirst(400, TimeUnit.MILLISECONDS, scheduler, dropCallbackObserver::onNext); + sampled.subscribe(observer); + + InOrder inOrder = inOrder(observer); + InOrder dropCallbackOrder = inOrder(dropCallbackObserver); + + scheduler.advanceTimeTo(1000, TimeUnit.MILLISECONDS); + inOrder.verify(observer, times(1)).onNext("one"); + inOrder.verify(observer, times(0)).onNext("two"); + dropCallbackOrder.verify(dropCallbackObserver, times(1)).onNext("two"); + inOrder.verify(observer, times(1)).onNext("three"); + inOrder.verify(observer, times(0)).onNext("four"); + dropCallbackOrder.verify(dropCallbackObserver, times(1)).onNext("four"); + inOrder.verify(observer, times(1)).onComplete(); + inOrder.verifyNoMoreInteractions(); + dropCallbackOrder.verifyNoMoreInteractions(); + } + @Test public void throttlingWithCompleted() { Observable source = Observable.unsafeCreate(new ObservableSource() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleLatestTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleLatestTest.java index 5399f63fce..e1c15f3b1a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleLatestTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleLatestTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -20,12 +20,13 @@ import org.junit.Test; import io.reactivex.rxjava3.core.*; -import io.reactivex.rxjava3.exceptions.TestException; +import io.reactivex.rxjava3.disposables.Disposable; +import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.observers.TestObserver; import io.reactivex.rxjava3.schedulers.TestScheduler; import io.reactivex.rxjava3.subjects.PublishSubject; -import io.reactivex.rxjava3.testsupport.TestHelper; +import io.reactivex.rxjava3.testsupport.*; public class ObservableThrottleLatestTest extends RxJavaTest { @@ -221,4 +222,424 @@ public void onNext(Integer t) { to.assertResult(1, 2); } + + /** Emit 1, 2, 3, then advance time by a second; 1 and 3 should end up in downstream, 2 should be dropped. */ + @Test + public void onDroppedBasicNoEmitLast() { + PublishSubject ps = PublishSubject.create(); + + TestScheduler sch = new TestScheduler(); + + TestObserver drops = new TestObserver<>(); + drops.onSubscribe(Disposable.empty()); + + TestObserver to = ps.throttleLatest(1, TimeUnit.SECONDS, sch, false, drops::onNext) + .test(); + + to.assertEmpty(); + drops.assertEmpty(); + + ps.onNext(1); + + to.assertValuesOnly(1); + drops.assertEmpty(); + + ps.onNext(2); + + to.assertValuesOnly(1); + drops.assertEmpty(); + + ps.onNext(3); + + to.assertValuesOnly(1); + drops.assertValuesOnly(2); + + sch.advanceTimeBy(1, TimeUnit.SECONDS); + + to.assertValuesOnly(1, 3); + drops.assertValuesOnly(2); + + ps.onComplete(); + + to.assertResult(1, 3); + + drops.assertValuesOnly(2); + } + + /** Emit 1, 2, 3; 1 should end up in downstream, 2, 3 should be dropped. */ + @Test + public void onDroppedBasicNoEmitLastDropLast() { + PublishSubject ps = PublishSubject.create(); + + TestScheduler sch = new TestScheduler(); + + TestObserver drops = new TestObserver<>(); + drops.onSubscribe(Disposable.empty()); + + TestObserver to = ps.throttleLatest(1, TimeUnit.SECONDS, sch, false, drops::onNext) + .test(); + + to.assertEmpty(); + drops.assertEmpty(); + + ps.onNext(1); + + to.assertValuesOnly(1); + drops.assertEmpty(); + + ps.onNext(2); + + to.assertValuesOnly(1); + drops.assertEmpty(); + + ps.onNext(3); + + to.assertValuesOnly(1); + drops.assertValuesOnly(2); + + ps.onComplete(); + + to.assertResult(1); + + drops.assertValuesOnly(2, 3); + } + + /** Emit 1, 2, 3; 1 and 3 should end up in downstream, 2 should be dropped. */ + @Test + public void onDroppedBasicEmitLast() { + PublishSubject ps = PublishSubject.create(); + + TestScheduler sch = new TestScheduler(); + + TestObserver drops = new TestObserver<>(); + drops.onSubscribe(Disposable.empty()); + + TestObserver to = ps.throttleLatest(1, TimeUnit.SECONDS, sch, true, drops::onNext) + .test(); + + to.assertEmpty(); + drops.assertEmpty(); + + ps.onNext(1); + + to.assertValuesOnly(1); + drops.assertEmpty(); + + ps.onNext(2); + + to.assertValuesOnly(1); + drops.assertEmpty(); + + ps.onNext(3); + + to.assertValuesOnly(1); + drops.assertValuesOnly(2); + + ps.onComplete(); + + to.assertResult(1, 3); + + drops.assertValuesOnly(2); + } + + /** Emit 1, 2, 3; 3 should trigger an error to the downstream because 2 is dropped and the callback crashes. */ + @Test + public void onDroppedBasicNoEmitLastFirstDropCrash() throws Throwable { + PublishSubject ps = PublishSubject.create(); + + TestScheduler sch = new TestScheduler(); + + Action whenDisposed = mock(Action.class); + + TestObserver to = ps + .doOnDispose(whenDisposed) + .throttleLatest(1, TimeUnit.SECONDS, sch, false, d -> { + if (d == 2) { + throw new TestException("forced"); + } + }) + .test(); + + to.assertEmpty(); + + ps.onNext(1); + + to.assertValuesOnly(1); + + ps.onNext(2); + + to.assertValuesOnly(1); + + ps.onNext(3); + + to.assertFailure(TestException.class, 1); + + verify(whenDisposed).run(); + } + + /** + * Emit 1, 2, Error; the error should trigger the drop callback and crash it too, + * downstream gets 1, composite(source, drop-crash). + */ + @Test + public void onDroppedBasicNoEmitLastOnErrorDropCrash() throws Throwable { + PublishSubject ps = PublishSubject.create(); + + TestScheduler sch = new TestScheduler(); + + Action whenDisposed = mock(Action.class); + + TestObserverEx to = ps + .doOnDispose(whenDisposed) + .throttleLatest(1, TimeUnit.SECONDS, sch, false, d -> { throw new TestException("forced " + d); }) + .subscribeWith(new TestObserverEx<>()); + + to.assertEmpty(); + + ps.onNext(1); + + to.assertValuesOnly(1); + + ps.onNext(2); + + to.assertValuesOnly(1); + + ps.onError(new TestException("source")); + + to.assertFailure(CompositeException.class, 1); + + TestHelper.assertCompositeExceptions(to, TestException.class, "source", TestException.class, "forced 2"); + + verify(whenDisposed, never()).run(); + } + + /** + * Emit 1, 2, 3; 3 should trigger a drop-crash for 2, which then would trigger the error path and drop-crash for 3, + * the last item not delivered, downstream gets 1, composite(drop-crash 2, drop-crash 3). + */ + @Test + public void onDroppedBasicEmitLastOnErrorDropCrash() throws Throwable { + PublishSubject ps = PublishSubject.create(); + + TestScheduler sch = new TestScheduler(); + + Action whenDisposed = mock(Action.class); + + TestObserverEx to = ps + .doOnDispose(whenDisposed) + .throttleLatest(1, TimeUnit.SECONDS, sch, true, d -> { throw new TestException("forced " + d); }) + .subscribeWith(new TestObserverEx<>()); + + to.assertEmpty(); + + ps.onNext(1); + + to.assertValuesOnly(1); + + ps.onNext(2); + + to.assertValuesOnly(1); + + ps.onNext(3); + + to.assertFailure(CompositeException.class, 1); + + TestHelper.assertCompositeExceptions(to, TestException.class, "forced 2", TestException.class, "forced 3"); + + verify(whenDisposed).run(); + } + + /** Emit 1, complete; Downstream gets 1, complete, no drops. */ + @Test + public void onDroppedBasicNoEmitLastNoLastToDrop() { + PublishSubject ps = PublishSubject.create(); + + TestScheduler sch = new TestScheduler(); + + TestObserver drops = new TestObserver<>(); + drops.onSubscribe(Disposable.empty()); + + TestObserver to = ps.throttleLatest(1, TimeUnit.SECONDS, sch, false, drops::onNext) + .test(); + + to.assertEmpty(); + drops.assertEmpty(); + + ps.onNext(1); + + to.assertValuesOnly(1); + drops.assertEmpty(); + + ps.onComplete(); + + to.assertResult(1); + drops.assertEmpty(); + } + + /** Emit 1, error; Downstream gets 1, error, no drops. */ + @Test + public void onDroppedErrorNoEmitLastNoLastToDrop() { + PublishSubject ps = PublishSubject.create(); + + TestScheduler sch = new TestScheduler(); + + TestObserver drops = new TestObserver<>(); + drops.onSubscribe(Disposable.empty()); + + TestObserver to = ps.throttleLatest(1, TimeUnit.SECONDS, sch, false, drops::onNext) + .test(); + + to.assertEmpty(); + drops.assertEmpty(); + + ps.onNext(1); + + to.assertValuesOnly(1); + drops.assertEmpty(); + + ps.onError(new TestException()); + + to.assertFailure(TestException.class, 1); + drops.assertEmpty(); + } + + /** + * Emit 1, 2, complete; complete should crash drop, downstream gets 1, drop-crash 2. + */ + @Test + public void onDroppedHasLastNoEmitLastDropCrash() throws Throwable { + PublishSubject ps = PublishSubject.create(); + + TestScheduler sch = new TestScheduler(); + + Action whenDisposed = mock(Action.class); + + TestObserverEx to = ps + .doOnDispose(whenDisposed) + .throttleLatest(1, TimeUnit.SECONDS, sch, false, d -> { throw new TestException("forced " + d); }) + .subscribeWith(new TestObserverEx<>()); + + to.assertEmpty(); + + ps.onNext(1); + + to.assertValuesOnly(1); + + ps.onNext(2); + + to.assertValuesOnly(1); + + ps.onComplete(); + + to.assertFailureAndMessage(TestException.class, "forced 2", 1); + + verify(whenDisposed, never()).run(); + } + + /** + * Emit 1, 2 then dispose the sequence; downstream gets 1, drop should get for 2. + */ + @Test + public void onDroppedDisposeDrops() throws Throwable { + PublishSubject ps = PublishSubject.create(); + + TestScheduler sch = new TestScheduler(); + + Action whenDisposed = mock(Action.class); + + TestObserver drops = new TestObserver<>(); + drops.onSubscribe(Disposable.empty()); + + TestObserverEx to = ps + .doOnDispose(whenDisposed) + .throttleLatest(1, TimeUnit.SECONDS, sch, false, drops::onNext) + .subscribeWith(new TestObserverEx<>()); + + to.assertEmpty(); + + ps.onNext(1); + + to.assertValuesOnly(1); + + ps.onNext(2); + + to.assertValuesOnly(1); + + to.dispose(); + + to.assertValuesOnly(1); + drops.assertValuesOnly(2); + + verify(whenDisposed).run(); + } + + /** + * Emit 1 then dispose the sequence; downstream gets 1, drop should not get called. + */ + @Test + public void onDroppedDisposeNoDrops() throws Throwable { + PublishSubject ps = PublishSubject.create(); + + TestScheduler sch = new TestScheduler(); + + Action whenDisposed = mock(Action.class); + + TestObserver drops = new TestObserver<>(); + drops.onSubscribe(Disposable.empty()); + + TestObserverEx to = ps + .doOnDispose(whenDisposed) + .throttleLatest(1, TimeUnit.SECONDS, sch, false, drops::onNext) + .subscribeWith(new TestObserverEx<>()); + + to.assertEmpty(); + + ps.onNext(1); + + to.assertValuesOnly(1); + + to.dispose(); + + to.assertValuesOnly(1); + drops.assertEmpty(); + + verify(whenDisposed).run(); + } + + /** + * Emit 1, 2 then dispose the sequence; downstream gets 1, global error handler should get drop-crash 2. + */ + @Test + public void onDroppedDisposeCrashesDrop() throws Throwable { + TestHelper.withErrorTracking(errors -> { + PublishSubject ps = PublishSubject.create(); + + TestScheduler sch = new TestScheduler(); + + Action whenDisposed = mock(Action.class); + + TestObserverEx to = ps + .doOnDispose(whenDisposed) + .throttleLatest(1, TimeUnit.SECONDS, sch, false, d -> { throw new TestException("forced " + d); }) + .subscribeWith(new TestObserverEx<>()); + + to.assertEmpty(); + + ps.onNext(1); + + to.assertValuesOnly(1); + + ps.onNext(2); + + to.assertValuesOnly(1); + + to.dispose(); + + to.assertValuesOnly(1); + + verify(whenDisposed).run(); + + TestHelper.assertUndeliverable(errors, 0, TestException.class, "forced 2"); + }); + } } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeIntervalTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeIntervalTest.java index 5f935791b1..ce418200d8 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeIntervalTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeIntervalTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeoutTests.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeoutTests.java index fe7b2cd370..570eb3de5e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeoutTests.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeoutTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeoutWithSelectorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeoutWithSelectorTest.java index 44712626c3..2c6710cc89 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeoutWithSelectorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeoutWithSelectorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimerTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimerTest.java index 8eddbce491..9229d24fe3 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimerTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -317,7 +317,7 @@ public void timerDelayZero() { public void timerInterruptible() throws Exception { ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(); try { - for (Scheduler s : new Scheduler[] { Schedulers.single(), Schedulers.computation(), Schedulers.newThread(), Schedulers.io(), Schedulers.from(exec) }) { + for (Scheduler s : new Scheduler[] { Schedulers.single(), Schedulers.computation(), Schedulers.newThread(), Schedulers.io(), Schedulers.from(exec, true) }) { final AtomicBoolean interrupted = new AtomicBoolean(); TestObserver to = Observable.timer(1, TimeUnit.MILLISECONDS, s) .map(new Function() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimestampTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimestampTest.java index 597333ea66..084db67473 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimestampTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimestampTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToFutureTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToFutureTest.java index 2631dfac4e..0ac13be46a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToFutureTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToFutureTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToListTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToListTest.java index 020183f9fa..2d4185407d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToListTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToListTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToMapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToMapTest.java index 8838ff4b5a..72b39d0025 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToMapTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToMultimapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToMultimapTest.java index 0853b0acad..10bda16080 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToMultimapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToMultimapTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToSortedListTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToSortedListTest.java index 19c10c6622..0ea0be21b9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToSortedListTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToSortedListTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToXTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToXTest.java index 1afbba0225..c7cc6f3151 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToXTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToXTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUnsubscribeOnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUnsubscribeOnTest.java index 59b1a16da2..23f6d7256b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUnsubscribeOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUnsubscribeOnTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUsingTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUsingTest.java index 143524319d..de8d73fa36 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUsingTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUsingTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowWithObservableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowWithObservableTest.java index a623e3ded3..edfca3989d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowWithObservableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowWithObservableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowWithSizeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowWithSizeTest.java index 6c253eb52c..81d076e718 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowWithSizeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowWithSizeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowWithStartEndObservableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowWithStartEndObservableTest.java index 941ce58f79..659daaf7d1 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowWithStartEndObservableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowWithStartEndObservableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -702,4 +702,4 @@ public void mainIgnoresCancelBeforeOnError() throws Throwable { TestHelper.assertUndeliverable(errors, 0, IOException.class); }); } -} \ No newline at end of file +} diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowWithTimeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowWithTimeTest.java index 527ebc004b..ca8f90d04f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowWithTimeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowWithTimeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWithLatestFromTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWithLatestFromTest.java index c23c41fde1..cfe093ed6b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWithLatestFromTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWithLatestFromTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZipCompletionTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZipCompletionTest.java index 76d14495db..89dde2cdc5 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZipCompletionTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZipCompletionTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZipIterableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZipIterableTest.java index a4ce20c33c..ce4ee90939 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZipIterableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZipIterableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZipTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZipTest.java index d481c16662..ae7de66d6f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZipTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZipTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleAmbTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleAmbTest.java index acfa6528a6..8086aa7c1c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleAmbTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleAmbTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -249,7 +249,8 @@ public void run() { @Test public void manySources() { - Single[] sources = new Single[32]; + @SuppressWarnings("unchecked") + Single[] sources = new Single[32]; Arrays.fill(sources, Single.never()); sources[31] = Single.just(31); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleBlockingSubscribeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleBlockingSubscribeTest.java index 50eceede5c..a29c10975f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleBlockingSubscribeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleBlockingSubscribeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleCacheTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleCacheTest.java index 28eb94110b..ca46a92f12 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleCacheTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleCacheTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatArrayDelayErrorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatArrayDelayErrorTest.java index 10fec20410..00ff0d5ad1 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatArrayDelayErrorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatArrayDelayErrorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatArrayEagerDelayErrorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatArrayEagerDelayErrorTest.java index ce0df373bb..bfd96ad3a9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatArrayEagerDelayErrorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatArrayEagerDelayErrorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatDelayErrorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatDelayErrorTest.java index 83ae9cbf9e..18dc2c83d2 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatDelayErrorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatDelayErrorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatEagerTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatEagerTest.java index c21c5347d4..892ed8dd4d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatEagerTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatEagerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatMapCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatMapCompletableTest.java index 1a160f6465..3c603b26b9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatMapCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatMapCompletableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatMapMaybeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatMapMaybeTest.java index dd25e7a53f..24710d824a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatMapMaybeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatMapMaybeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatMapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatMapTest.java index b0b5af17a6..1fa2ebaf0b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatMapTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatPublisherTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatPublisherTest.java index bd31e28430..883903e1d9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatPublisherTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatPublisherTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.operators.single; import java.util.concurrent.Callable; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatTest.java index bf8c534f46..fb94277e43 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleContainstTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleContainstTest.java index 4a991c4cbf..2f5baa4ed0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleContainstTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleContainstTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleCreateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleCreateTest.java index 8f8519c961..862757560a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleCreateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleCreateTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDeferTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDeferTest.java index 962a3694c2..7fed907ab4 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDeferTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDeferTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayTest.java index 619a6c1241..bc137d1612 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDematerializeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDematerializeTest.java index 5bf1409498..6cd05b7128 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDematerializeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDematerializeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDetachTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDetachTest.java index ae13a0d9c0..17812c8957 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDetachTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDetachTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterSuccessTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterSuccessTest.java index 8c2070f736..de83cecb1a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterSuccessTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterSuccessTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterTerminateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterTerminateTest.java index f4c3adb720..6b98da8c66 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterTerminateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterTerminateTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoFinallyTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoFinallyTest.java index 365b34f185..64afc620ac 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoFinallyTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoFinallyTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnLifecycleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnLifecycleTest.java index 9208ab2be8..f14d03cc8d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnLifecycleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnLifecycleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnTerminateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnTerminateTest.java index 584c976d41..814a38bded 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnTerminateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnTerminateTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnTest.java index cf67202641..92ce91b65a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleEqualsTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleEqualsTest.java index 14bd931d76..9526299231 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleEqualsTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleEqualsTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleErrorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleErrorTest.java index b3619b5992..835ad2ad09 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleErrorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleErrorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapBiSelectorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapBiSelectorTest.java index 84a2a650c4..78705fe166 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapBiSelectorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapBiSelectorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapCompletableTest.java index 6e663394e5..c4af049aec 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapCompletableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableFlowableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableFlowableTest.java index d308998e6e..277b9aa13b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableFlowableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableFlowableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -25,8 +25,9 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.util.CrashingIterable; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueSubscription; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.subjects.*; import io.reactivex.rxjava3.subscribers.TestSubscriber; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableObservableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableObservableTest.java index 5d2bafc9c9..82448746b8 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableObservableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableObservableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -25,8 +25,9 @@ import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.Function; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.util.CrashingIterable; +import io.reactivex.rxjava3.operators.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapMaybeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapMaybeTest.java index c11780324f..6081a621e8 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapMaybeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapMaybeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapNotificationTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapNotificationTest.java index 266acc93f2..00f1337b2c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapNotificationTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapNotificationTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapTest.java index ea02529556..08d3d24c5a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromCallableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromCallableTest.java index 8a97b8a2d6..3352029989 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromCallableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromCallableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromMaybeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromMaybeTest.java index 50eed426a7..293cedf574 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromMaybeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromMaybeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromPublisherTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromPublisherTest.java index 74261bc7dd..080870b228 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromPublisherTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromPublisherTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromSupplierTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromSupplierTest.java index dd259f209b..927ec7f837 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromSupplierTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromSupplierTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromTest.java index 5c7bdfd5d2..a322d8852e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFromTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleHideTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleHideTest.java index 9c5609b571..d13218bc84 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleHideTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleHideTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleInternalHelperTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleInternalHelperTest.java index 7756ef5783..478a03d9ff 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleInternalHelperTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleInternalHelperTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleLiftTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleLiftTest.java index 1638cb993f..6fdd626bd3 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleLiftTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleLiftTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleMapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleMapTest.java index 625c4f1f5b..eb220e0580 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleMapTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleMaterializeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleMaterializeTest.java index 4bc05ea67d..46625b80ab 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleMaterializeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleMaterializeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleMergeArrayTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleMergeArrayTest.java index 9434a4fcc1..b2bda3a7d7 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleMergeArrayTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleMergeArrayTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleMergeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleMergeTest.java index 7aba476c86..dd4844da5b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleMergeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleMergeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleMiscTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleMiscTest.java index dad1322b22..93eebfe7ec 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleMiscTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleMiscTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleObserveOnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleObserveOnTest.java index afb4494bef..4abc87e51f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleObserveOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleObserveOnTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleOfTypeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleOfTypeTest.java index 3ce3a0d15e..9569e9a35d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleOfTypeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleOfTypeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleOnErrorCompleteTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleOnErrorCompleteTest.java index 189759d6c6..9b184ae7f8 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleOnErrorCompleteTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleOnErrorCompleteTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleOnErrorXTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleOnErrorXTest.java index 990a0fdec6..42e36eaba8 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleOnErrorXTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleOnErrorXTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleSafeSubscribeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleSafeSubscribeTest.java index 80abb4cb1a..d9711c67c0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleSafeSubscribeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleSafeSubscribeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleStartWithTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleStartWithTest.java index a3f7e7225a..3d01226d9a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleStartWithTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleStartWithTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleSubscribeOnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleSubscribeOnTest.java index 0c22190691..bec9782b0e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleSubscribeOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleSubscribeOnTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleSwitchOnNextTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleSwitchOnNextTest.java index 63c97f14ec..f3c119222d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleSwitchOnNextTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleSwitchOnNextTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleTakeUntilTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleTakeUntilTest.java index 0a2d27340a..c5389b0bbd 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleTakeUntilTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleTakeUntilTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleTimeIntervalTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleTimeIntervalTest.java index 09dd26eeba..ade198db50 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleTimeIntervalTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleTimeIntervalTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleTimeoutTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleTimeoutTest.java index c544fd3ae9..e54fc11207 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleTimeoutTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleTimeoutTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -28,7 +28,7 @@ import io.reactivex.rxjava3.functions.Action; import io.reactivex.rxjava3.observers.TestObserver; import io.reactivex.rxjava3.plugins.RxJavaPlugins; -import io.reactivex.rxjava3.schedulers.TestScheduler; +import io.reactivex.rxjava3.schedulers.*; import io.reactivex.rxjava3.subjects.*; import io.reactivex.rxjava3.testsupport.TestHelper; @@ -255,4 +255,24 @@ protected void subscribeActual(@NonNull SingleObserver assertTrue(d.isDisposed()); } + + @Test + public void timeoutWithZero() throws InterruptedException { + int n = 10_000; + Scheduler sch = Schedulers.single(); + for (int i = 0; i < n; i++) { + final int y = i; + final CountDownLatch latch = new CountDownLatch(1); + Disposable d = Single.never() + .timeout(0, TimeUnit.NANOSECONDS, sch) + .subscribe(v -> {}, e -> { + //System.out.println("timeout " + y); + latch.countDown(); + }); + if (!latch.await(2, TimeUnit.SECONDS)) { + System.out.println(d + " " + sch); + throw new IllegalStateException("Timeout did not work at y = " + y); + } + } + } } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleTimerTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleTimerTest.java index 2924364459..3b5797f498 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleTimerTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleTimerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -37,7 +37,7 @@ public void disposed() { public void timerInterruptible() throws Exception { ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(); try { - for (Scheduler s : new Scheduler[] { Schedulers.single(), Schedulers.computation(), Schedulers.newThread(), Schedulers.io(), Schedulers.from(exec) }) { + for (Scheduler s : new Scheduler[] { Schedulers.single(), Schedulers.computation(), Schedulers.newThread(), Schedulers.io(), Schedulers.from(exec, true) }) { final AtomicBoolean interrupted = new AtomicBoolean(); TestObserver to = Single.timer(1, TimeUnit.MILLISECONDS, s) .map(new Function() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleTimestampTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleTimestampTest.java index a282c0345e..206da8f428 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleTimestampTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleTimestampTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleToFlowableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleToFlowableTest.java index f4c344c801..1c9cf06385 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleToFlowableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleToFlowableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleToObservableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleToObservableTest.java index 35d38d49c7..f72bd4ac60 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleToObservableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleToObservableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleUnsubscribeOnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleUnsubscribeOnTest.java index d28c47ad08..fa07de729c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleUnsubscribeOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleUnsubscribeOnTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleUsingTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleUsingTest.java index d11c89ec8d..28c6b34ef7 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleUsingTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleUsingTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleZipArrayTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleZipArrayTest.java index 2720cd4559..df41235e38 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleZipArrayTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleZipArrayTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -16,10 +16,12 @@ import static org.junit.Assert.*; import java.util.*; +import java.util.concurrent.atomic.AtomicReference; import org.junit.Test; import io.reactivex.rxjava3.core.*; +import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; @@ -213,4 +215,21 @@ public void bothSucceed() { .test() .assertResult(Arrays.asList(1, 2)); } + + @Test + public void onSuccessAfterDispose() { + AtomicReference> emitter = new AtomicReference<>(); + + TestObserver> to = Single.zipArray(Arrays::asList, + (SingleSource)o -> emitter.set(o), Single.never()) + .test(); + + emitter.get().onSubscribe(Disposable.empty()); + + to.dispose(); + + emitter.get().onSuccess(1); + + to.assertEmpty(); + } } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleZipIterableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleZipIterableTest.java index 6fd6744479..c2293a2b89 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleZipIterableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleZipIterableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleZipTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleZipTest.java index 79380cfa5f..14f2e68267 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleZipTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleZipTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/schedulers/AbstractDirectTaskTest.java b/src/test/java/io/reactivex/rxjava3/internal/schedulers/AbstractDirectTaskTest.java index 85507fb7f1..cd10a10443 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/schedulers/AbstractDirectTaskTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/schedulers/AbstractDirectTaskTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -27,7 +27,7 @@ public class AbstractDirectTaskTest extends RxJavaTest { @Test public void cancelSetFuture() { - AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE) { + AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE, true) { private static final long serialVersionUID = 208585707945686116L; }; final Boolean[] interrupted = { null }; @@ -58,7 +58,7 @@ public boolean cancel(boolean mayInterruptIfRunning) { @Test public void cancelSetFutureCurrentThread() { - AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE) { + AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE, true) { private static final long serialVersionUID = 208585707945686116L; }; final Boolean[] interrupted = { null }; @@ -91,7 +91,7 @@ public boolean cancel(boolean mayInterruptIfRunning) { @Test public void setFutureCancel() { - AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE) { + AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE, true) { private static final long serialVersionUID = 208585707945686116L; }; final Boolean[] interrupted = { null }; @@ -119,7 +119,7 @@ public boolean cancel(boolean mayInterruptIfRunning) { @Test public void setFutureCancelSameThread() { - AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE) { + AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE, true) { private static final long serialVersionUID = 208585707945686116L; }; final Boolean[] interrupted = { null }; @@ -148,7 +148,7 @@ public boolean cancel(boolean mayInterruptIfRunning) { @Test public void finished() { - AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE) { + AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE, true) { private static final long serialVersionUID = 208585707945686116L; }; final Boolean[] interrupted = { null }; @@ -177,7 +177,7 @@ public boolean cancel(boolean mayInterruptIfRunning) { @Test public void finishedCancel() { - AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE) { + AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE, true) { private static final long serialVersionUID = 208585707945686116L; }; final Boolean[] interrupted = { null }; @@ -211,7 +211,7 @@ public boolean cancel(boolean mayInterruptIfRunning) { @Test public void disposeSetFutureRace() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { - final AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE) { + final AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE, true) { private static final long serialVersionUID = 208585707945686116L; }; @@ -241,4 +241,31 @@ public void run() { TestHelper.race(r1, r2); } } + + static class TestDirectTask extends AbstractDirectTask { + private static final long serialVersionUID = 587679821055711738L; + + TestDirectTask() { + super(Functions.EMPTY_RUNNABLE, true); + } + } + + @Test + public void toStringStates() { + TestDirectTask task = new TestDirectTask(); + + assertEquals("TestDirectTask[Waiting]", task.toString()); + + task.runner = Thread.currentThread(); + + assertEquals("TestDirectTask[Running on " + Thread.currentThread() + "]", task.toString()); + + task.dispose(); + + assertEquals("TestDirectTask[Disposed]", task.toString()); + + task.set(AbstractDirectTask.FINISHED); + + assertEquals("TestDirectTask[Finished]", task.toString()); + } } diff --git a/src/test/java/io/reactivex/rxjava3/internal/schedulers/BooleanRunnableTest.java b/src/test/java/io/reactivex/rxjava3/internal/schedulers/BooleanRunnableTest.java index 424d108e8a..237bb233eb 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/schedulers/BooleanRunnableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/schedulers/BooleanRunnableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/schedulers/ComputationSchedulerInternalTest.java b/src/test/java/io/reactivex/rxjava3/internal/schedulers/ComputationSchedulerInternalTest.java index 59ad5d1dfc..5c8aa1a65f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/schedulers/ComputationSchedulerInternalTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/schedulers/ComputationSchedulerInternalTest.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.schedulers; import static org.junit.Assert.assertEquals; diff --git a/src/test/java/io/reactivex/rxjava3/internal/schedulers/DisposeOnCancelTest.java b/src/test/java/io/reactivex/rxjava3/internal/schedulers/DisposeOnCancelTest.java index 8018806a37..224e33ae7d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/schedulers/DisposeOnCancelTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/schedulers/DisposeOnCancelTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/schedulers/ExecutorSchedulerDelayedRunnableTest.java b/src/test/java/io/reactivex/rxjava3/internal/schedulers/ExecutorSchedulerDelayedRunnableTest.java index 3dd9c59344..31c3112255 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/schedulers/ExecutorSchedulerDelayedRunnableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/schedulers/ExecutorSchedulerDelayedRunnableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/schedulers/ExecutorSchedulerInternalTest.java b/src/test/java/io/reactivex/rxjava3/internal/schedulers/ExecutorSchedulerInternalTest.java new file mode 100644 index 0000000000..64d4d1861c --- /dev/null +++ b/src/test/java/io/reactivex/rxjava3/internal/schedulers/ExecutorSchedulerInternalTest.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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 io.reactivex.rxjava3.internal.schedulers; + +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; + +public class ExecutorSchedulerInternalTest { + + @Test + public void helperHolder() { + assertNotNull(new ExecutorScheduler.SingleHolder()); + } + +} diff --git a/src/test/java/io/reactivex/rxjava3/internal/schedulers/ImmediateThinSchedulerTest.java b/src/test/java/io/reactivex/rxjava3/internal/schedulers/ImmediateThinSchedulerTest.java index cacb8fabeb..75710644d9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/schedulers/ImmediateThinSchedulerTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/schedulers/ImmediateThinSchedulerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/schedulers/InstantPeriodicTaskTest.java b/src/test/java/io/reactivex/rxjava3/internal/schedulers/InstantPeriodicTaskTest.java index 2f530f2afa..4a57e86781 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/schedulers/InstantPeriodicTaskTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/schedulers/InstantPeriodicTaskTest.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. - * - * Licensed 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 - * + * + * Licensed 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. + * + * 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 io.reactivex.rxjava3.internal.schedulers; diff --git a/src/test/java/io/reactivex/rxjava3/internal/schedulers/InterruptibleRunnableTest.java b/src/test/java/io/reactivex/rxjava3/internal/schedulers/InterruptibleRunnableTest.java index 9abc100862..e040b37419 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/schedulers/InterruptibleRunnableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/schedulers/InterruptibleRunnableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/schedulers/IoScheduledReleaseTest.java b/src/test/java/io/reactivex/rxjava3/internal/schedulers/IoScheduledReleaseTest.java new file mode 100644 index 0000000000..e3f55b75fb --- /dev/null +++ b/src/test/java/io/reactivex/rxjava3/internal/schedulers/IoScheduledReleaseTest.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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 io.reactivex.rxjava3.internal.schedulers; + +import io.reactivex.rxjava3.core.Completable; +import io.reactivex.rxjava3.core.Flowable; +import io.reactivex.rxjava3.core.RxJavaTest; +import io.reactivex.rxjava3.schedulers.Schedulers; +import org.junit.Test; + +import java.util.concurrent.TimeUnit; + +public class IoScheduledReleaseTest extends RxJavaTest { + + /* This test will be stuck in a deadlock if IoScheduler.USE_SCHEDULED_RELEASE is not set */ + @Test + public void scheduledRelease() { + boolean savedScheduledRelease = IoScheduler.USE_SCHEDULED_RELEASE; + IoScheduler.USE_SCHEDULED_RELEASE = true; + try { + Flowable.just("item") + .observeOn(Schedulers.io()) + .firstOrError() + .map(item -> { + for (int i = 0; i < 50; i++) { + Completable.complete() + .observeOn(Schedulers.io()) + .blockingAwait(); + } + return "Done"; + }) + .ignoreElement() + .test() + .awaitDone(5, TimeUnit.SECONDS) + .assertComplete(); + } finally { + IoScheduler.USE_SCHEDULED_RELEASE = savedScheduledRelease; + } + } +} diff --git a/src/test/java/io/reactivex/rxjava3/internal/schedulers/IoSchedulerInternalTest.java b/src/test/java/io/reactivex/rxjava3/internal/schedulers/IoSchedulerInternalTest.java index 77f638a2be..9a4b6f3be0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/schedulers/IoSchedulerInternalTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/schedulers/IoSchedulerInternalTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/schedulers/RxThreadFactoryTest.java b/src/test/java/io/reactivex/rxjava3/internal/schedulers/RxThreadFactoryTest.java index 83a65e65ac..d0cbb6a476 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/schedulers/RxThreadFactoryTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/schedulers/RxThreadFactoryTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/schedulers/ScheduledDirectPeriodicTaskTest.java b/src/test/java/io/reactivex/rxjava3/internal/schedulers/ScheduledDirectPeriodicTaskTest.java index 7736d5e40b..d41906b13a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/schedulers/ScheduledDirectPeriodicTaskTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/schedulers/ScheduledDirectPeriodicTaskTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -35,7 +35,7 @@ public void runnableThrows() { public void run() { throw new TestException(); } - }); + }, true); try { task.run(); diff --git a/src/test/java/io/reactivex/rxjava3/internal/schedulers/ScheduledRunnableTest.java b/src/test/java/io/reactivex/rxjava3/internal/schedulers/ScheduledRunnableTest.java index f0577e41ca..8d2fc1f7cc 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/schedulers/ScheduledRunnableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/schedulers/ScheduledRunnableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -399,4 +399,29 @@ public void withParentIsDisposed() { assertFalse(set.remove(run)); } + + @Test + public void toStringStates() { + CompositeDisposable set = new CompositeDisposable(); + ScheduledRunnable task = new ScheduledRunnable(Functions.EMPTY_RUNNABLE, set); + + assertEquals("ScheduledRunnable[Waiting]", task.toString()); + + task.set(ScheduledRunnable.THREAD_INDEX, Thread.currentThread()); + + assertEquals("ScheduledRunnable[Running on " + Thread.currentThread() + "]", task.toString()); + + task.dispose(); + + assertEquals("ScheduledRunnable[Disposed(Sync)]", task.toString()); + + task.set(ScheduledRunnable.FUTURE_INDEX, ScheduledRunnable.DONE); + + assertEquals("ScheduledRunnable[Finished]", task.toString()); + + task = new ScheduledRunnable(Functions.EMPTY_RUNNABLE, set); + task.dispose(); + + assertEquals("ScheduledRunnable[Disposed(Async)]", task.toString()); + } } diff --git a/src/test/java/io/reactivex/rxjava3/internal/schedulers/SchedulerMultiWorkerSupportTest.java b/src/test/java/io/reactivex/rxjava3/internal/schedulers/SchedulerMultiWorkerSupportTest.java index 21b4514be1..3d16867a1a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/schedulers/SchedulerMultiWorkerSupportTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/schedulers/SchedulerMultiWorkerSupportTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/schedulers/SchedulerPoolFactoryTest.java b/src/test/java/io/reactivex/rxjava3/internal/schedulers/SchedulerPoolFactoryTest.java index 1fcbf105b4..12afa708c4 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/schedulers/SchedulerPoolFactoryTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/schedulers/SchedulerPoolFactoryTest.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.schedulers; @@ -23,7 +20,6 @@ import io.reactivex.rxjava3.core.RxJavaTest; import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.testsupport.TestHelper; public class SchedulerPoolFactoryTest extends RxJavaTest { @@ -33,50 +29,6 @@ public void utilityClass() { TestHelper.checkUtilityClass(SchedulerPoolFactory.class); } - @Test - public void multiStartStop() { - SchedulerPoolFactory.shutdown(); - - SchedulerPoolFactory.shutdown(); - - SchedulerPoolFactory.tryStart(false); - - assertNull(SchedulerPoolFactory.PURGE_THREAD.get()); - - SchedulerPoolFactory.start(); - - // restart schedulers - Schedulers.shutdown(); - - Schedulers.start(); - } - - @Test - public void startRace() throws InterruptedException { - try { - for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { - SchedulerPoolFactory.shutdown(); - - Runnable r1 = new Runnable() { - @Override - public void run() { - SchedulerPoolFactory.start(); - } - }; - - TestHelper.race(r1, r1); - } - - } finally { - // restart schedulers - Schedulers.shutdown(); - - Thread.sleep(200); - - Schedulers.start(); - } - } - @Test public void boolPropertiesDisabledReturnsDefaultDisabled() throws Throwable { assertTrue(SchedulerPoolFactory.getBooleanProperty(false, "key", false, true, failingPropertiesAccessor)); @@ -101,30 +53,6 @@ public void boolPropertiesReturnsValue() throws Throwable { assertFalse(SchedulerPoolFactory.getBooleanProperty(true, "false", false, true, Functions.identity())); } - @Test - public void intPropertiesDisabledReturnsDefaultDisabled() throws Throwable { - assertEquals(-1, SchedulerPoolFactory.getIntProperty(false, "key", 0, -1, failingPropertiesAccessor)); - assertEquals(-1, SchedulerPoolFactory.getIntProperty(false, "key", 1, -1, failingPropertiesAccessor)); - } - - @Test - public void intPropertiesEnabledMissingReturnsDefaultMissing() throws Throwable { - assertEquals(-1, SchedulerPoolFactory.getIntProperty(true, "key", -1, 0, missingPropertiesAccessor)); - assertEquals(-1, SchedulerPoolFactory.getIntProperty(true, "key", -1, 1, missingPropertiesAccessor)); - } - - @Test - public void intPropertiesFailureReturnsDefaultMissing() throws Throwable { - assertEquals(-1, SchedulerPoolFactory.getIntProperty(true, "key", -1, 0, failingPropertiesAccessor)); - assertEquals(-1, SchedulerPoolFactory.getIntProperty(true, "key", -1, 1, failingPropertiesAccessor)); - } - - @Test - public void intPropertiesReturnsValue() throws Throwable { - assertEquals(1, SchedulerPoolFactory.getIntProperty(true, "1", 0, 4, Functions.identity())); - assertEquals(2, SchedulerPoolFactory.getIntProperty(true, "2", 3, 5, Functions.identity())); - } - static final Function failingPropertiesAccessor = new Function() { @Override public String apply(String v) throws Throwable { @@ -138,22 +66,4 @@ public String apply(String v) throws Throwable { return null; } }; - - @Test - public void putIntoPoolNoPurge() { - int s = SchedulerPoolFactory.POOLS.size(); - - SchedulerPoolFactory.tryPutIntoPool(false, null); - - assertEquals(s, SchedulerPoolFactory.POOLS.size()); - } - - @Test - public void putIntoPoolNonThreadPool() { - int s = SchedulerPoolFactory.POOLS.size(); - - SchedulerPoolFactory.tryPutIntoPool(true, null); - - assertEquals(s, SchedulerPoolFactory.POOLS.size()); - } } diff --git a/src/test/java/io/reactivex/rxjava3/internal/schedulers/SchedulerWhenTest.java b/src/test/java/io/reactivex/rxjava3/internal/schedulers/SchedulerWhenTest.java index d48228d20c..03e6a9300f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/schedulers/SchedulerWhenTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/schedulers/SchedulerWhenTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/schedulers/SingleSchedulerTest.java b/src/test/java/io/reactivex/rxjava3/internal/schedulers/SingleSchedulerTest.java index 9ab44b2ff1..c9f9cc5476 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/schedulers/SingleSchedulerTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/schedulers/SingleSchedulerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/schedulers/TrampolineSchedulerInternalTest.java b/src/test/java/io/reactivex/rxjava3/internal/schedulers/TrampolineSchedulerInternalTest.java index 912d07b215..b25620e2bf 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/schedulers/TrampolineSchedulerInternalTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/schedulers/TrampolineSchedulerInternalTest.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.schedulers; diff --git a/src/test/java/io/reactivex/rxjava3/internal/subscribers/BasicFuseableConditionalSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/internal/subscribers/BasicFuseableConditionalSubscriberTest.java index f8d40aaa14..c58d015abc 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/subscribers/BasicFuseableConditionalSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/subscribers/BasicFuseableConditionalSubscriberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -22,8 +22,9 @@ import io.reactivex.rxjava3.annotations.*; import io.reactivex.rxjava3.core.*; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.subscriptions.*; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.testsupport.*; public class BasicFuseableConditionalSubscriberTest extends RxJavaTest { diff --git a/src/test/java/io/reactivex/rxjava3/internal/subscribers/BasicFuseableSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/internal/subscribers/BasicFuseableSubscriberTest.java index afc79d2b2d..d6f85acc46 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/subscribers/BasicFuseableSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/subscribers/BasicFuseableSubscriberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/subscribers/BlockingSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/internal/subscribers/BlockingSubscriberTest.java index 563a52a984..a97f4ee93e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/subscribers/BlockingSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/subscribers/BlockingSubscriberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/subscribers/BoundedSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/internal/subscribers/BoundedSubscriberTest.java index 38abf77e87..68e955097d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/subscribers/BoundedSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/subscribers/BoundedSubscriberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/subscribers/DeferredScalarSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/internal/subscribers/DeferredScalarSubscriberTest.java index 698fcc18ac..dcfcb82377 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/subscribers/DeferredScalarSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/subscribers/DeferredScalarSubscriberTest.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.subscribers; diff --git a/src/test/java/io/reactivex/rxjava3/internal/subscribers/EmptyComponentTest.java b/src/test/java/io/reactivex/rxjava3/internal/subscribers/EmptyComponentTest.java index 60da2b7a29..c5cf3c88ca 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/subscribers/EmptyComponentTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/subscribers/EmptyComponentTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/subscribers/FlowableConsumersTest.java b/src/test/java/io/reactivex/rxjava3/internal/subscribers/FlowableConsumersTest.java new file mode 100644 index 0000000000..cc7083cde7 --- /dev/null +++ b/src/test/java/io/reactivex/rxjava3/internal/subscribers/FlowableConsumersTest.java @@ -0,0 +1,328 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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. + */ + +/* + * Copyright 2016-2019 David Karnok + * + * Licensed 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 io.reactivex.rxjava3.internal.subscribers; + +import static org.junit.Assert.*; + +import java.io.IOException; +import java.util.*; + +import org.junit.Test; +import org.reactivestreams.Subscriber; + +import io.reactivex.rxjava3.core.*; +import io.reactivex.rxjava3.disposables.*; +import io.reactivex.rxjava3.exceptions.*; +import io.reactivex.rxjava3.functions.*; +import io.reactivex.rxjava3.internal.functions.Functions; +import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; +import io.reactivex.rxjava3.observers.LambdaConsumerIntrospection; +import io.reactivex.rxjava3.plugins.RxJavaPlugins; +import io.reactivex.rxjava3.processors.PublishProcessor; +import io.reactivex.rxjava3.testsupport.TestHelper; + +public class FlowableConsumersTest implements Consumer, Action { + + final CompositeDisposable composite = new CompositeDisposable(); + + final PublishProcessor processor = PublishProcessor.create(); + + final List events = new ArrayList<>(); + + @Override + public void run() throws Exception { + events.add("OnComplete"); + } + + @Override + public void accept(Object t) throws Exception { + events.add(t); + } + + static Disposable subscribeAutoDispose(Flowable source, CompositeDisposable composite, + Consumer onNext, Consumer onError, Action onComplete) { + return source.subscribe(onNext, onError, onComplete, composite); + } + + @Test + public void onNextNormal() { + + Disposable d = subscribeAutoDispose(processor, composite, this, Functions.ON_ERROR_MISSING, () -> { }); + + assertFalse(d.getClass().toString(), ((LambdaConsumerIntrospection)d).hasCustomOnError()); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onNext(1); + + assertTrue(composite.size() > 0); + + assertEquals(Arrays.asList(1), events); + + processor.onComplete(); + + assertEquals(Arrays.asList(1), events); + + assertEquals(0, composite.size()); + } + + @Test + public void onErrorNormal() { + + subscribeAutoDispose(processor, composite, this, this, () -> { }); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onNext(1); + + assertTrue(composite.size() > 0); + + assertEquals(Arrays.asList(1), events); + + processor.onComplete(); + + assertEquals(Arrays.asList(1), events); + + assertEquals(0, composite.size()); + } + + @Test + public void onErrorError() { + + Disposable d = subscribeAutoDispose(processor, composite, this, this, this); + + assertTrue(d.getClass().toString(), ((LambdaConsumerIntrospection)d).hasCustomOnError()); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onNext(1); + + assertTrue(composite.size() > 0); + + assertEquals(Arrays.asList(1), events); + + processor.onError(new IOException()); + + assertEquals(events.toString(), 1, events.get(0)); + assertTrue(events.toString(), events.get(1) instanceof IOException); + + assertEquals(0, composite.size()); + } + + @Test + public void onCompleteNormal() { + + subscribeAutoDispose(processor, composite, this, this, this); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onNext(1); + + assertTrue(composite.size() > 0); + + assertEquals(Arrays.asList(1), events); + + processor.onComplete(); + + assertEquals(Arrays.asList(1, "OnComplete"), events); + + assertEquals(0, composite.size()); + } + + @Test + public void onCompleteError() { + + subscribeAutoDispose(processor, composite, this, this, this); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + processor.onNext(1); + + assertTrue(composite.size() > 0); + + assertEquals(Arrays.asList(1), events); + + processor.onError(new IOException()); + + assertEquals(events.toString(), 1, events.get(0)); + assertTrue(events.toString(), events.get(1) instanceof IOException); + + assertEquals(0, composite.size()); + } + + @Test + public void onCompleteDispose() { + + Disposable d = subscribeAutoDispose(processor, composite, this, this, this); + + assertTrue(composite.size() > 0); + + assertTrue(events.toString(), events.isEmpty()); + + assertFalse(d.isDisposed()); + + d.dispose(); + d.dispose(); + + assertTrue(d.isDisposed()); + + assertEquals(0, composite.size()); + + assertFalse(processor.hasSubscribers()); + } + + @Test + public void onNextCrash() { + List errors = TestHelper.trackPluginErrors(); + try { + subscribeAutoDispose(processor, composite, new Consumer() { + @Override + public void accept(Object t) throws Exception { + throw new IOException(); + } + }, this, this); + + processor.onNext(1); + + assertTrue(errors.toString(), errors.isEmpty()); + + assertTrue(events.toString(), events.get(0) instanceof IOException); + } finally { + RxJavaPlugins.reset(); + } + } + + @Test + public void onNextCrashOnError() { + List errors = TestHelper.trackPluginErrors(); + try { + subscribeAutoDispose(processor, composite, this, new Consumer() { + @Override + public void accept(Throwable t) throws Exception { + throw new IOException(t); + } + }, this); + + processor.onError(new IllegalArgumentException()); + + assertTrue(events.toString(), events.isEmpty()); + + TestHelper.assertError(errors, 0, CompositeException.class); + List inners = TestHelper.compositeList(errors.get(0)); + TestHelper.assertError(inners, 0, IllegalArgumentException.class); + TestHelper.assertError(inners, 1, IOException.class); + } finally { + RxJavaPlugins.reset(); + } + } + + @Test + public void onNextCrashNoError() { + List errors = TestHelper.trackPluginErrors(); + try { + subscribeAutoDispose(processor, composite, new Consumer() { + @Override + public void accept(Object t) throws Exception { + throw new IOException(); + } + }, Functions.ON_ERROR_MISSING, () -> { }); + + processor.onNext(1); + + assertTrue(events.toString(), events.isEmpty()); + + TestHelper.assertError(errors, 0, OnErrorNotImplementedException.class); + assertTrue(errors.get(0).getCause() instanceof IOException); + } finally { + RxJavaPlugins.reset(); + } + } + + @Test + public void onCompleteCrash() { + List errors = TestHelper.trackPluginErrors(); + try { + subscribeAutoDispose(processor, composite, this, this, new Action() { + @Override + public void run() throws Exception { + throw new IOException(); + } + }); + + processor.onNext(1); + processor.onComplete(); + + assertEquals(Arrays.asList(1), events); + + TestHelper.assertUndeliverable(errors, 0, IOException.class); + } finally { + RxJavaPlugins.reset(); + } + } + + @Test + public void badSource() { + List errors = TestHelper.trackPluginErrors(); + try { + subscribeAutoDispose( + new Flowable() { + @Override + protected void subscribeActual( + Subscriber s) { + s.onSubscribe(new BooleanSubscription()); + s.onNext(1); + s.onComplete(); + + s.onSubscribe(new BooleanSubscription()); + s.onNext(2); + s.onComplete(); + s.onError(new IOException()); + } + }, composite, this, this, this + ); + + assertEquals(Arrays.asList(1, "OnComplete"), events); + + TestHelper.assertUndeliverable(errors, 0, IOException.class); + } finally { + RxJavaPlugins.reset(); + } + } +} diff --git a/src/test/java/io/reactivex/rxjava3/internal/subscribers/FutureSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/internal/subscribers/FutureSubscriberTest.java index e8cf5c3a47..56de26e5d6 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/subscribers/FutureSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/subscribers/FutureSubscriberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/subscribers/InnerQueuedSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/internal/subscribers/InnerQueuedSubscriberTest.java index e6533166ce..7856ce5d3e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/subscribers/InnerQueuedSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/subscribers/InnerQueuedSubscriberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/subscribers/LambdaSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/internal/subscribers/LambdaSubscriberTest.java index a415835a4b..e7f3931096 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/subscribers/LambdaSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/subscribers/LambdaSubscriberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/subscribers/QueueDrainSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/internal/subscribers/QueueDrainSubscriberTest.java index 6d09484d55..985705b0e7 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/subscribers/QueueDrainSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/subscribers/QueueDrainSubscriberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -23,8 +23,8 @@ import io.reactivex.rxjava3.core.RxJavaTest; import io.reactivex.rxjava3.disposables.*; import io.reactivex.rxjava3.exceptions.MissingBackpressureException; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; +import io.reactivex.rxjava3.operators.SpscArrayQueue; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.subscribers.TestSubscriber; import io.reactivex.rxjava3.testsupport.TestHelper; diff --git a/src/test/java/io/reactivex/rxjava3/internal/subscribers/SinglePostCompleteSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/internal/subscribers/SinglePostCompleteSubscriberTest.java index 1a9bb1310b..8616e6ba3b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/subscribers/SinglePostCompleteSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/subscribers/SinglePostCompleteSubscriberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/subscribers/StrictSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/internal/subscribers/StrictSubscriberTest.java index 1b36462c47..ba4548d02e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/subscribers/StrictSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/subscribers/StrictSubscriberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/subscribers/SubscriberResourceWrapperTest.java b/src/test/java/io/reactivex/rxjava3/internal/subscribers/SubscriberResourceWrapperTest.java index bafc579b63..65f2817354 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/subscribers/SubscriberResourceWrapperTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/subscribers/SubscriberResourceWrapperTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/subscriptions/ArrayCompositeSubscriptionTest.java b/src/test/java/io/reactivex/rxjava3/internal/subscriptions/ArrayCompositeSubscriptionTest.java index 9dd0cab6a5..fc54cfe357 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/subscriptions/ArrayCompositeSubscriptionTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/subscriptions/ArrayCompositeSubscriptionTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/subscriptions/AsyncSubscriptionTest.java b/src/test/java/io/reactivex/rxjava3/internal/subscriptions/AsyncSubscriptionTest.java index 30d93a22ae..0375d72ba5 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/subscriptions/AsyncSubscriptionTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/subscriptions/AsyncSubscriptionTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/subscriptions/DeferredScalarSubscriptionTest.java b/src/test/java/io/reactivex/rxjava3/internal/subscriptions/DeferredScalarSubscriptionTest.java index dfe9e83f89..7ea8d58c3f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/subscriptions/DeferredScalarSubscriptionTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/subscriptions/DeferredScalarSubscriptionTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -18,7 +18,7 @@ import org.junit.Test; import io.reactivex.rxjava3.core.RxJavaTest; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.subscribers.TestSubscriber; import io.reactivex.rxjava3.testsupport.TestHelper; diff --git a/src/test/java/io/reactivex/rxjava3/internal/subscriptions/QueueSubscriptionTest.java b/src/test/java/io/reactivex/rxjava3/internal/subscriptions/QueueSubscriptionTest.java index fb3f66397f..92c37e0e52 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/subscriptions/QueueSubscriptionTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/subscriptions/QueueSubscriptionTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/subscriptions/ScalarSubscriptionTest.java b/src/test/java/io/reactivex/rxjava3/internal/subscriptions/ScalarSubscriptionTest.java index 55a564280c..377691e0a2 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/subscriptions/ScalarSubscriptionTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/subscriptions/ScalarSubscriptionTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/subscriptions/SubscriptionArbiterTest.java b/src/test/java/io/reactivex/rxjava3/internal/subscriptions/SubscriptionArbiterTest.java index 4651b2e3b8..7bc7eb937a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/subscriptions/SubscriptionArbiterTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/subscriptions/SubscriptionArbiterTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/subscriptions/SubscriptionHelperTest.java b/src/test/java/io/reactivex/rxjava3/internal/subscriptions/SubscriptionHelperTest.java index 13a2dc61aa..9bb222fbb8 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/subscriptions/SubscriptionHelperTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/subscriptions/SubscriptionHelperTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/AtomicThrowableTest.java b/src/test/java/io/reactivex/rxjava3/internal/util/AtomicThrowableTest.java index efe3b5c7b2..152039fac3 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/util/AtomicThrowableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/util/AtomicThrowableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/BackpressureHelperTest.java b/src/test/java/io/reactivex/rxjava3/internal/util/BackpressureHelperTest.java index ca0b0e2668..d13cde57be 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/util/BackpressureHelperTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/util/BackpressureHelperTest.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.util; import static org.junit.Assert.assertEquals; diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/BlockingHelperTest.java b/src/test/java/io/reactivex/rxjava3/internal/util/BlockingHelperTest.java index 419febcaee..0218185f08 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/util/BlockingHelperTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/util/BlockingHelperTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/CrashingIterable.java b/src/test/java/io/reactivex/rxjava3/internal/util/CrashingIterable.java index bb053c23b0..6bdbea27b1 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/util/CrashingIterable.java +++ b/src/test/java/io/reactivex/rxjava3/internal/util/CrashingIterable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/CrashingMappedIterable.java b/src/test/java/io/reactivex/rxjava3/internal/util/CrashingMappedIterable.java index caf09b372e..d6b9491e2b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/util/CrashingMappedIterable.java +++ b/src/test/java/io/reactivex/rxjava3/internal/util/CrashingMappedIterable.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/EndConsumerHelperTest.java b/src/test/java/io/reactivex/rxjava3/internal/util/EndConsumerHelperTest.java index 1cb96e732f..8ad1942946 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/util/EndConsumerHelperTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/util/EndConsumerHelperTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/ExceptionHelperTest.java b/src/test/java/io/reactivex/rxjava3/internal/util/ExceptionHelperTest.java index 70b70aea1f..130cf5767b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/util/ExceptionHelperTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/util/ExceptionHelperTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/HalfSerializerObserverTest.java b/src/test/java/io/reactivex/rxjava3/internal/util/HalfSerializerObserverTest.java index b948188173..ea8c405849 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/util/HalfSerializerObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/util/HalfSerializerObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.util; import static org.junit.Assert.assertTrue; diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/HalfSerializerSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/internal/util/HalfSerializerSubscriberTest.java index 65835788bb..1919864648 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/util/HalfSerializerSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/util/HalfSerializerSubscriberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.util; import static org.junit.Assert.assertTrue; diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/JavadocNoThrows.java b/src/test/java/io/reactivex/rxjava3/internal/util/JavadocNoThrows.java index 985ac202c3..1a55807dd0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/util/JavadocNoThrows.java +++ b/src/test/java/io/reactivex/rxjava3/internal/util/JavadocNoThrows.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.util; import java.io.File; diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/MarbleDimensions.java b/src/test/java/io/reactivex/rxjava3/internal/util/MarbleDimensions.java index aa388a684a..2fdc7fe2d6 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/util/MarbleDimensions.java +++ b/src/test/java/io/reactivex/rxjava3/internal/util/MarbleDimensions.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.internal.util; import java.awt.image.BufferedImage; diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/MergerBiFunctionTest.java b/src/test/java/io/reactivex/rxjava3/internal/util/MergerBiFunctionTest.java index dce15c4b28..b8a5f8b843 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/util/MergerBiFunctionTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/util/MergerBiFunctionTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/MiscUtilTest.java b/src/test/java/io/reactivex/rxjava3/internal/util/MiscUtilTest.java index 0ea0868e24..adc779a302 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/util/MiscUtilTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/util/MiscUtilTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/NotificationLiteTest.java b/src/test/java/io/reactivex/rxjava3/internal/util/NotificationLiteTest.java index 7e701ff5b9..7638a98ead 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/util/NotificationLiteTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/util/NotificationLiteTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/ObservableToFlowabeTestSync.java b/src/test/java/io/reactivex/rxjava3/internal/util/ObservableToFlowabeTestSync.java index fbe13a185e..7bf668e2f1 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/util/ObservableToFlowabeTestSync.java +++ b/src/test/java/io/reactivex/rxjava3/internal/util/ObservableToFlowabeTestSync.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/OpenHashSetTest.java b/src/test/java/io/reactivex/rxjava3/internal/util/OpenHashSetTest.java index c87bd13192..f8c1bdf04d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/util/OpenHashSetTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/util/OpenHashSetTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/OperatorArgumentNaming.java b/src/test/java/io/reactivex/rxjava3/internal/util/OperatorArgumentNaming.java index 727b522d05..1814a26bbc 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/util/OperatorArgumentNaming.java +++ b/src/test/java/io/reactivex/rxjava3/internal/util/OperatorArgumentNaming.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/OperatorMatrixGenerator.java b/src/test/java/io/reactivex/rxjava3/internal/util/OperatorMatrixGenerator.java index 714a6809f9..9c5f058ff4 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/util/OperatorMatrixGenerator.java +++ b/src/test/java/io/reactivex/rxjava3/internal/util/OperatorMatrixGenerator.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/QueueDrainHelperTest.java b/src/test/java/io/reactivex/rxjava3/internal/util/QueueDrainHelperTest.java index 5fac86182a..7929ea8782 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/util/QueueDrainHelperTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/util/QueueDrainHelperTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -27,9 +27,9 @@ import io.reactivex.rxjava3.disposables.*; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.BooleanSupplier; -import io.reactivex.rxjava3.internal.queue.SpscArrayQueue; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.SpscArrayQueue; import io.reactivex.rxjava3.subscribers.TestSubscriber; import io.reactivex.rxjava3.testsupport.TestHelper; diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/TestingHelper.java b/src/test/java/io/reactivex/rxjava3/internal/util/TestingHelper.java index 976757acd7..207c85236d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/util/TestingHelper.java +++ b/src/test/java/io/reactivex/rxjava3/internal/util/TestingHelper.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.internal.util; import java.util.*; diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/VolatileSizeArrayListTest.java b/src/test/java/io/reactivex/rxjava3/internal/util/VolatileSizeArrayListTest.java index c59537c988..3ce08aa3dc 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/util/VolatileSizeArrayListTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/util/VolatileSizeArrayListTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/maybe/MaybeCreateTest.java b/src/test/java/io/reactivex/rxjava3/maybe/MaybeCreateTest.java index 152a297e8d..e3bbfb4bfc 100644 --- a/src/test/java/io/reactivex/rxjava3/maybe/MaybeCreateTest.java +++ b/src/test/java/io/reactivex/rxjava3/maybe/MaybeCreateTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/maybe/MaybeRetryTest.java b/src/test/java/io/reactivex/rxjava3/maybe/MaybeRetryTest.java index 6c88f8501c..731dd03e23 100644 --- a/src/test/java/io/reactivex/rxjava3/maybe/MaybeRetryTest.java +++ b/src/test/java/io/reactivex/rxjava3/maybe/MaybeRetryTest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2017-present, RxJava Contributors. +/* + * Copyright (c) 2016-present, RxJava Contributors. * * Licensed 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 diff --git a/src/test/java/io/reactivex/rxjava3/maybe/MaybeTest.java b/src/test/java/io/reactivex/rxjava3/maybe/MaybeTest.java index 401bdcc918..acc7066c29 100644 --- a/src/test/java/io/reactivex/rxjava3/maybe/MaybeTest.java +++ b/src/test/java/io/reactivex/rxjava3/maybe/MaybeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -30,10 +30,10 @@ import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.internal.operators.flowable.FlowableZipTest.ArgsToString; import io.reactivex.rxjava3.internal.operators.maybe.*; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.processors.PublishProcessor; import io.reactivex.rxjava3.schedulers.Schedulers; diff --git a/src/test/java/io/reactivex/rxjava3/maybe/MaybeTimerTest.java b/src/test/java/io/reactivex/rxjava3/maybe/MaybeTimerTest.java index 03f229483b..286639042d 100644 --- a/src/test/java/io/reactivex/rxjava3/maybe/MaybeTimerTest.java +++ b/src/test/java/io/reactivex/rxjava3/maybe/MaybeTimerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observable/ObservableCombineLatestTests.java b/src/test/java/io/reactivex/rxjava3/observable/ObservableCombineLatestTests.java index b4b11420d1..957268ecf1 100644 --- a/src/test/java/io/reactivex/rxjava3/observable/ObservableCombineLatestTests.java +++ b/src/test/java/io/reactivex/rxjava3/observable/ObservableCombineLatestTests.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.observable; import org.junit.Test; diff --git a/src/test/java/io/reactivex/rxjava3/observable/ObservableConcatTests.java b/src/test/java/io/reactivex/rxjava3/observable/ObservableConcatTests.java index f867a165d2..53c4f99029 100644 --- a/src/test/java/io/reactivex/rxjava3/observable/ObservableConcatTests.java +++ b/src/test/java/io/reactivex/rxjava3/observable/ObservableConcatTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.observable; import static org.junit.Assert.assertEquals; diff --git a/src/test/java/io/reactivex/rxjava3/observable/ObservableCovarianceTest.java b/src/test/java/io/reactivex/rxjava3/observable/ObservableCovarianceTest.java index e7e3302fd8..54cf0f9908 100644 --- a/src/test/java/io/reactivex/rxjava3/observable/ObservableCovarianceTest.java +++ b/src/test/java/io/reactivex/rxjava3/observable/ObservableCovarianceTest.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.observable; diff --git a/src/test/java/io/reactivex/rxjava3/observable/ObservableDoOnTest.java b/src/test/java/io/reactivex/rxjava3/observable/ObservableDoOnTest.java index 6c3b5f54ab..0e7ed9ef88 100644 --- a/src/test/java/io/reactivex/rxjava3/observable/ObservableDoOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/observable/ObservableDoOnTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observable/ObservableErrorHandlingTests.java b/src/test/java/io/reactivex/rxjava3/observable/ObservableErrorHandlingTests.java index c524261032..9ec13895b0 100644 --- a/src/test/java/io/reactivex/rxjava3/observable/ObservableErrorHandlingTests.java +++ b/src/test/java/io/reactivex/rxjava3/observable/ObservableErrorHandlingTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observable/ObservableEventStream.java b/src/test/java/io/reactivex/rxjava3/observable/ObservableEventStream.java index 6b161dcb0a..48e637f5c3 100644 --- a/src/test/java/io/reactivex/rxjava3/observable/ObservableEventStream.java +++ b/src/test/java/io/reactivex/rxjava3/observable/ObservableEventStream.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observable/ObservableFuseableTest.java b/src/test/java/io/reactivex/rxjava3/observable/ObservableFuseableTest.java index 1d01a790ab..8de9b9bc0b 100644 --- a/src/test/java/io/reactivex/rxjava3/observable/ObservableFuseableTest.java +++ b/src/test/java/io/reactivex/rxjava3/observable/ObservableFuseableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.observable; import java.util.Arrays; @@ -17,7 +18,7 @@ import org.junit.Test; import io.reactivex.rxjava3.core.*; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.testsupport.TestHelper; public class ObservableFuseableTest extends RxJavaTest { diff --git a/src/test/java/io/reactivex/rxjava3/observable/ObservableGroupByTests.java b/src/test/java/io/reactivex/rxjava3/observable/ObservableGroupByTests.java index e5de6cdc85..1db6ebb908 100644 --- a/src/test/java/io/reactivex/rxjava3/observable/ObservableGroupByTests.java +++ b/src/test/java/io/reactivex/rxjava3/observable/ObservableGroupByTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observable/ObservableMergeTests.java b/src/test/java/io/reactivex/rxjava3/observable/ObservableMergeTests.java index 902bcd7ba1..25a3317b7f 100644 --- a/src/test/java/io/reactivex/rxjava3/observable/ObservableMergeTests.java +++ b/src/test/java/io/reactivex/rxjava3/observable/ObservableMergeTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observable/ObservableNullTests.java b/src/test/java/io/reactivex/rxjava3/observable/ObservableNullTests.java index 4189438e32..178adb6230 100644 --- a/src/test/java/io/reactivex/rxjava3/observable/ObservableNullTests.java +++ b/src/test/java/io/reactivex/rxjava3/observable/ObservableNullTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observable/ObservableReduceTests.java b/src/test/java/io/reactivex/rxjava3/observable/ObservableReduceTests.java index 8dec71b98e..01c2106aff 100644 --- a/src/test/java/io/reactivex/rxjava3/observable/ObservableReduceTests.java +++ b/src/test/java/io/reactivex/rxjava3/observable/ObservableReduceTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observable/ObservableScanTests.java b/src/test/java/io/reactivex/rxjava3/observable/ObservableScanTests.java index bc73a886b2..8bc33ac19f 100644 --- a/src/test/java/io/reactivex/rxjava3/observable/ObservableScanTests.java +++ b/src/test/java/io/reactivex/rxjava3/observable/ObservableScanTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observable/ObservableStartWithTests.java b/src/test/java/io/reactivex/rxjava3/observable/ObservableStartWithTests.java index 9c9261273c..8e0fe35add 100644 --- a/src/test/java/io/reactivex/rxjava3/observable/ObservableStartWithTests.java +++ b/src/test/java/io/reactivex/rxjava3/observable/ObservableStartWithTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observable/ObservableSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/observable/ObservableSubscriberTest.java index 60e8470ca4..c8a1047fe3 100644 --- a/src/test/java/io/reactivex/rxjava3/observable/ObservableSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/observable/ObservableSubscriberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observable/ObservableTest.java b/src/test/java/io/reactivex/rxjava3/observable/ObservableTest.java index 030687e989..87e6463d3c 100644 --- a/src/test/java/io/reactivex/rxjava3/observable/ObservableTest.java +++ b/src/test/java/io/reactivex/rxjava3/observable/ObservableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observable/ObservableThrottleLastTests.java b/src/test/java/io/reactivex/rxjava3/observable/ObservableThrottleLastTests.java index e93f9409e0..d8107cc434 100644 --- a/src/test/java/io/reactivex/rxjava3/observable/ObservableThrottleLastTests.java +++ b/src/test/java/io/reactivex/rxjava3/observable/ObservableThrottleLastTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -13,10 +13,10 @@ package io.reactivex.rxjava3.observable; -import static org.mockito.Mockito.inOrder; - import java.util.concurrent.TimeUnit; +import io.reactivex.rxjava3.exceptions.TestException; +import io.reactivex.rxjava3.functions.Action; import org.junit.Test; import org.mockito.InOrder; @@ -25,8 +25,78 @@ import io.reactivex.rxjava3.subjects.PublishSubject; import io.reactivex.rxjava3.testsupport.TestHelper; +import static org.mockito.Mockito.*; + public class ObservableThrottleLastTests extends RxJavaTest { + @Test + public void throttleLastWithDropCallbackException() throws Throwable { + Observer observer = TestHelper.mockObserver(); + + Action whenDisposed = mock(Action.class); + + TestScheduler s = new TestScheduler(); + PublishSubject o = PublishSubject.create(); + o.doOnDispose(whenDisposed) + .throttleLast(500, TimeUnit.MILLISECONDS, s, e -> { + if (e == 1) { + throw new TestException("Forced"); + } + }) + .subscribe(observer); + + // send events with simulated time increments + s.advanceTimeTo(0, TimeUnit.MILLISECONDS); + o.onNext(1); // skip + o.onNext(2); // try to deliver + s.advanceTimeTo(501, TimeUnit.MILLISECONDS); + + InOrder inOrder = inOrder(observer); + inOrder.verify(observer).onError(any(TestException.class)); + inOrder.verifyNoMoreInteractions(); + verify(whenDisposed).run(); + } + + @Test + public void throttleLastWithDropCallback() { + Observer observer = TestHelper.mockObserver(); + + Observer dropCallbackObserver = TestHelper.mockObserver(); + + TestScheduler s = new TestScheduler(); + PublishSubject o = PublishSubject.create(); + o.throttleLast(500, TimeUnit.MILLISECONDS, s, dropCallbackObserver::onNext).subscribe(observer); + + // send events with simulated time increments + s.advanceTimeTo(0, TimeUnit.MILLISECONDS); + o.onNext(1); // skip + o.onNext(2); // deliver + s.advanceTimeTo(501, TimeUnit.MILLISECONDS); + o.onNext(3); // skip + s.advanceTimeTo(600, TimeUnit.MILLISECONDS); + o.onNext(4); // skip + s.advanceTimeTo(700, TimeUnit.MILLISECONDS); + o.onNext(5); // skip + o.onNext(6); // deliver + s.advanceTimeTo(1001, TimeUnit.MILLISECONDS); + o.onNext(7); // deliver + s.advanceTimeTo(1501, TimeUnit.MILLISECONDS); + o.onComplete(); + + InOrder inOrder = inOrder(observer); + InOrder dropCallbackOrder = inOrder(dropCallbackObserver); + dropCallbackOrder.verify(dropCallbackObserver).onNext(1); + inOrder.verify(observer).onNext(2); + dropCallbackOrder.verify(dropCallbackObserver).onNext(3); + dropCallbackOrder.verify(dropCallbackObserver).onNext(4); + dropCallbackOrder.verify(dropCallbackObserver).onNext(5); + inOrder.verify(observer).onNext(6); + inOrder.verify(observer).onNext(7); + inOrder.verify(observer).onComplete(); + inOrder.verifyNoMoreInteractions(); + dropCallbackOrder.verifyNoMoreInteractions(); + } + @Test public void throttle() { Observer observer = TestHelper.mockObserver(); diff --git a/src/test/java/io/reactivex/rxjava3/observable/ObservableThrottleWithTimeoutTests.java b/src/test/java/io/reactivex/rxjava3/observable/ObservableThrottleWithTimeoutTests.java index bcacab5513..80f82fb5f4 100644 --- a/src/test/java/io/reactivex/rxjava3/observable/ObservableThrottleWithTimeoutTests.java +++ b/src/test/java/io/reactivex/rxjava3/observable/ObservableThrottleWithTimeoutTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observable/ObservableWindowTests.java b/src/test/java/io/reactivex/rxjava3/observable/ObservableWindowTests.java index 9e1076017a..4bc561bd1b 100644 --- a/src/test/java/io/reactivex/rxjava3/observable/ObservableWindowTests.java +++ b/src/test/java/io/reactivex/rxjava3/observable/ObservableWindowTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observable/ObservableZipTests.java b/src/test/java/io/reactivex/rxjava3/observable/ObservableZipTests.java index 1f67113348..b2b26719bb 100644 --- a/src/test/java/io/reactivex/rxjava3/observable/ObservableZipTests.java +++ b/src/test/java/io/reactivex/rxjava3/observable/ObservableZipTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observers/DisposableCompletableObserverTest.java b/src/test/java/io/reactivex/rxjava3/observers/DisposableCompletableObserverTest.java index 19ee3e7f06..fde1dc75de 100644 --- a/src/test/java/io/reactivex/rxjava3/observers/DisposableCompletableObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/observers/DisposableCompletableObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observers/DisposableMaybeObserverTest.java b/src/test/java/io/reactivex/rxjava3/observers/DisposableMaybeObserverTest.java index 36dc6a6d3b..7bd2f20a95 100644 --- a/src/test/java/io/reactivex/rxjava3/observers/DisposableMaybeObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/observers/DisposableMaybeObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observers/DisposableObserverTest.java b/src/test/java/io/reactivex/rxjava3/observers/DisposableObserverTest.java index c2b766e761..1b5b477552 100644 --- a/src/test/java/io/reactivex/rxjava3/observers/DisposableObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/observers/DisposableObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observers/DisposableSingleObserverTest.java b/src/test/java/io/reactivex/rxjava3/observers/DisposableSingleObserverTest.java index b6239d65ee..8dac144591 100644 --- a/src/test/java/io/reactivex/rxjava3/observers/DisposableSingleObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/observers/DisposableSingleObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observers/ResourceCompletableObserverTest.java b/src/test/java/io/reactivex/rxjava3/observers/ResourceCompletableObserverTest.java index f007940592..e2d1fa34ba 100644 --- a/src/test/java/io/reactivex/rxjava3/observers/ResourceCompletableObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/observers/ResourceCompletableObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observers/ResourceMaybeObserverTest.java b/src/test/java/io/reactivex/rxjava3/observers/ResourceMaybeObserverTest.java index 08d06044e7..257a5785f8 100644 --- a/src/test/java/io/reactivex/rxjava3/observers/ResourceMaybeObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/observers/ResourceMaybeObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observers/ResourceObserverTest.java b/src/test/java/io/reactivex/rxjava3/observers/ResourceObserverTest.java index 94934d82df..543095582b 100644 --- a/src/test/java/io/reactivex/rxjava3/observers/ResourceObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/observers/ResourceObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observers/ResourceSingleObserverTest.java b/src/test/java/io/reactivex/rxjava3/observers/ResourceSingleObserverTest.java index b720931088..10f17e18d6 100644 --- a/src/test/java/io/reactivex/rxjava3/observers/ResourceSingleObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/observers/ResourceSingleObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observers/SafeObserverTest.java b/src/test/java/io/reactivex/rxjava3/observers/SafeObserverTest.java index adcb092aea..77b3d7b9b9 100644 --- a/src/test/java/io/reactivex/rxjava3/observers/SafeObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/observers/SafeObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observers/SerializedObserverTest.java b/src/test/java/io/reactivex/rxjava3/observers/SerializedObserverTest.java index c631b7b114..689908f59f 100644 --- a/src/test/java/io/reactivex/rxjava3/observers/SerializedObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/observers/SerializedObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/observers/TestObserverTest.java b/src/test/java/io/reactivex/rxjava3/observers/TestObserverTest.java index 31e66d808b..f2d5f206c3 100644 --- a/src/test/java/io/reactivex/rxjava3/observers/TestObserverTest.java +++ b/src/test/java/io/reactivex/rxjava3/observers/TestObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -21,6 +21,7 @@ import java.util.concurrent.TimeUnit; import org.junit.Test; +import org.junit.function.ThrowingRunnable; import org.mockito.InOrder; import org.reactivestreams.Subscriber; @@ -39,6 +40,16 @@ public class TestObserverTest extends RxJavaTest { + static void assertThrowsWithMessage(String message, Class clazz, ThrowingRunnable run) { + assertEquals(message, assertThrows(clazz, run).getMessage()); + } + + static void assertThrowsWithMessageMatchRegex(String regex, Class clazz, ThrowingRunnable run) { + assertTrue(assertThrows(clazz, run).getMessage().matches(regex)); + } + + private static final String ASSERT_MESSAGE_REGEX = "\nexpected: (.*)\n\\s*got: (.*)"; + @Test public void assertTestObserver() { Flowable oi = Flowable.fromIterable(Arrays.asList(1, 2)); @@ -843,7 +854,7 @@ public void errorMeansDisposed() { @Test public void assertValuePredicateEmpty() { - assertThrows("No values", AssertionError.class, () -> { + assertThrowsWithMessage("No values (latch = 0, values = 0, errors = 0, completions = 1)", AssertionError.class, () -> { TestObserver to = new TestObserver<>(); Observable.empty().subscribe(to); @@ -871,7 +882,7 @@ public void assertValuePredicateMatch() { @Test public void assertValuePredicateNoMatch() { - assertThrows("Value not present", AssertionError.class, () -> { + assertThrowsWithMessage("Value 1 (class: Integer) at position 0 did not pass the predicate (latch = 0, values = 1, errors = 0, completions = 1)", AssertionError.class, () -> { TestObserver to = new TestObserver<>(); Observable.just(1).subscribe(to); @@ -886,7 +897,7 @@ public void assertValuePredicateNoMatch() { @Test public void assertValuePredicateMatchButMore() { - assertThrows("Value present but other values as well", AssertionError.class, () -> { + assertThrowsWithMessage("The first value passed the predicate but this consumer received more than one value (latch = 0, values = 2, errors = 0, completions = 1)", AssertionError.class, () -> { TestObserver to = new TestObserver<>(); Observable.just(1, 2).subscribe(to); @@ -901,7 +912,7 @@ public void assertValuePredicateMatchButMore() { @Test public void assertValueAtPredicateEmpty() { - assertThrows("No values", AssertionError.class, () -> { + assertThrowsWithMessage("No values (latch = 0, values = 0, errors = 0, completions = 1)", AssertionError.class, () -> { TestObserver to = new TestObserver<>(); Observable.empty().subscribe(to); @@ -929,7 +940,7 @@ public void assertValueAtPredicateMatch() { @Test public void assertValueAtPredicateNoMatch() { - assertThrows("Value not present", AssertionError.class, () -> { + assertThrowsWithMessage("Value 3 (class: Integer) at position 2 did not pass the predicate (latch = 0, values = 3, errors = 0, completions = 1)", AssertionError.class, () -> { TestObserver to = new TestObserver<>(); Observable.just(1, 2, 3).subscribe(to); @@ -944,7 +955,7 @@ public void assertValueAtPredicateNoMatch() { @Test public void assertValueAtInvalidIndex() { - assertThrows("Invalid index: 2 (latch = 0, values = 2, errors = 0, completions = 1)", AssertionError.class, () -> { + assertThrowsWithMessage("Index 2 is out of range [0, 2) (latch = 0, values = 2, errors = 0, completions = 1)", AssertionError.class, () -> { TestObserver to = new TestObserver<>(); Observable.just(1, 2).subscribe(to); @@ -957,9 +968,24 @@ public void assertValueAtInvalidIndex() { }); } + @Test + public void assertValueAtInvalidIndexNegative() { + assertThrowsWithMessage("Index -2 is out of range [0, 2) (latch = 0, values = 2, errors = 0, completions = 1)", AssertionError.class, () -> { + TestObserver to = new TestObserver<>(); + + Observable.just(1, 2).subscribe(to); + + to.assertValueAt(-2, new Predicate() { + @Override public boolean test(final Integer o) throws Exception { + return o == 1; + } + }); + }); + } + @Test public void assertValueAtIndexEmpty() { - assertThrows("No values", AssertionError.class, () -> { + assertThrowsWithMessage("No values (latch = 0, values = 0, errors = 0, completions = 1)", AssertionError.class, () -> { TestObserver to = new TestObserver<>(); Observable.empty().subscribe(to); @@ -979,7 +1005,7 @@ public void assertValueAtIndexMatch() { @Test public void assertValueAtIndexNoMatch() { - assertThrows("expected: b (class: String) but was: c (class: String) (latch = 0, values = 3, errors = 0, completions = 1)", AssertionError.class, () -> { + assertThrowsWithMessage("\nexpected: b (class: String)\ngot: c (class: String); Value at position 2 differ (latch = 0, values = 3, errors = 0, completions = 1)", AssertionError.class, () -> { TestObserver to = new TestObserver<>(); Observable.just("a", "b", "c").subscribe(to); @@ -988,9 +1014,108 @@ public void assertValueAtIndexNoMatch() { }); } + @Test + public void assertValueAtIndexThrowsMessageMatchRegex() { + assertThrowsWithMessageMatchRegex(ASSERT_MESSAGE_REGEX, AssertionError.class, () -> { + TestObserver to = new TestObserver<>(); + + Observable.just("a", "b", "c").subscribe(to); + + to.assertValueAt(2, "b"); + }); + } + + @Test + public void assertValuesCountNoMatch() { + assertThrowsWithMessage("\nexpected: 2 [a, b]\ngot: 3 [a, b, c]; Value count differs (latch = 0, values = 3, errors = 0, completions = 1)", AssertionError.class, () -> { + TestObserver to = new TestObserver<>(); + + Observable.just("a", "b", "c").subscribe(to); + + to.assertValues("a", "b"); + }); + } + + @Test + public void assertValuesCountThrowsMessageMatchRegex() { + assertThrowsWithMessageMatchRegex(ASSERT_MESSAGE_REGEX, AssertionError.class, () -> { + TestObserver to = new TestObserver<>(); + + Observable.just("a", "b", "c").subscribe(to); + + to.assertValues("a", "b"); + }); + } + + @Test + public void assertValuesNoMatch() { + assertThrowsWithMessage("\nexpected: d (class: String)\ngot: c (class: String); Value at position 2 differ (latch = 0, values = 3, errors = 0, completions = 1)", AssertionError.class, () -> { + TestObserver to = new TestObserver<>(); + + Observable.just("a", "b", "c").subscribe(to); + + to.assertValues("a", "b", "d"); + }); + } + + @Test + public void assertValuesThrowsMessageMatchRegex() { + assertThrowsWithMessageMatchRegex(ASSERT_MESSAGE_REGEX, AssertionError.class, () -> { + TestObserver to = new TestObserver<>(); + + Observable.just("a", "b", "c").subscribe(to); + + to.assertValues("a", "b", "d"); + }); + } + + @Test + public void assertValueCountNoMatch() { + assertThrowsWithMessage("\nexpected: 2\ngot: 3; Value counts differ (latch = 0, values = 3, errors = 0, completions = 1)", AssertionError.class, () -> { + TestObserver to = new TestObserver<>(); + + Observable.just("a", "b", "c").subscribe(to); + + to.assertValueCount(2); + }); + } + + @Test + public void assertValueCountThrowsMessageMatchRegex() { + assertThrowsWithMessageMatchRegex(ASSERT_MESSAGE_REGEX, AssertionError.class, () -> { + TestObserver to = new TestObserver<>(); + + Observable.just("a", "b", "c").subscribe(to); + + to.assertValueCount(2); + }); + } + + @Test + public void assertValueSequenceNoMatch() { + assertThrowsWithMessage("\nexpected: d (class: String)\ngot: c (class: String); Value at position 2 differ (latch = 0, values = 3, errors = 0, completions = 1)", AssertionError.class, () -> { + TestObserver to = new TestObserver<>(); + + Observable.just("a", "b", "c").subscribe(to); + + to.assertValueSequence(Arrays.asList("a", "b", "d")); + }); + } + + @Test + public void assertValueSequenceThrowsMessageMatchRegex() { + assertThrowsWithMessageMatchRegex(ASSERT_MESSAGE_REGEX, AssertionError.class, () -> { + TestObserver to = new TestObserver<>(); + + Observable.just("a", "b", "c").subscribe(to); + + to.assertValueSequence(Arrays.asList("a", "b", "d")); + }); + } + @Test public void assertValueAtIndexInvalidIndex() { - assertThrows("Invalid index: 2 (latch = 0, values = 2, errors = 0, completions = 1)", AssertionError.class, () -> { + assertThrowsWithMessage("Index 2 is out of range [0, 2) (latch = 0, values = 2, errors = 0, completions = 1)", AssertionError.class, () -> { TestObserver to = new TestObserver<>(); Observable.just("a", "b").subscribe(to); @@ -999,6 +1124,17 @@ public void assertValueAtIndexInvalidIndex() { }); } + @Test + public void assertValueAtIndexInvalidIndexNegative() { + assertThrowsWithMessage("Index -2 is out of range [0, 2) (latch = 0, values = 2, errors = 0, completions = 1)", AssertionError.class, () -> { + TestObserver to = new TestObserver<>(); + + Observable.just("a", "b").subscribe(to); + + to.assertValueAt(-2, "c"); + }); + } + @Test public void withTag() { try { diff --git a/src/test/java/io/reactivex/rxjava3/internal/queue/SimpleQueueTest.java b/src/test/java/io/reactivex/rxjava3/operators/SimpleQueueTest.java similarity index 97% rename from src/test/java/io/reactivex/rxjava3/internal/queue/SimpleQueueTest.java rename to src/test/java/io/reactivex/rxjava3/operators/SimpleQueueTest.java index e5673b49bc..b9f998c1de 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/queue/SimpleQueueTest.java +++ b/src/test/java/io/reactivex/rxjava3/operators/SimpleQueueTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -16,7 +16,7 @@ * https://github.com/JCTools/JCTools/blob/master/jctools-core/src/main/java/org/jctools/queues/atomic */ -package io.reactivex.rxjava3.internal.queue; +package io.reactivex.rxjava3.operators; import static org.junit.Assert.*; @@ -25,6 +25,7 @@ import org.junit.Test; import io.reactivex.rxjava3.core.RxJavaTest; +import io.reactivex.rxjava3.internal.queue.MpscLinkedQueue; public class SimpleQueueTest extends RxJavaTest { diff --git a/src/test/java/io/reactivex/rxjava3/parallel/ParallelCollectTest.java b/src/test/java/io/reactivex/rxjava3/parallel/ParallelCollectTest.java index a9509a46a5..f582966cf9 100644 --- a/src/test/java/io/reactivex/rxjava3/parallel/ParallelCollectTest.java +++ b/src/test/java/io/reactivex/rxjava3/parallel/ParallelCollectTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/parallel/ParallelDoOnNextTryTest.java b/src/test/java/io/reactivex/rxjava3/parallel/ParallelDoOnNextTryTest.java index 14f585d9d0..ba76f69cfb 100644 --- a/src/test/java/io/reactivex/rxjava3/parallel/ParallelDoOnNextTryTest.java +++ b/src/test/java/io/reactivex/rxjava3/parallel/ParallelDoOnNextTryTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/parallel/ParallelFilterTest.java b/src/test/java/io/reactivex/rxjava3/parallel/ParallelFilterTest.java index 93e3fb33c7..31e9b9a7c4 100644 --- a/src/test/java/io/reactivex/rxjava3/parallel/ParallelFilterTest.java +++ b/src/test/java/io/reactivex/rxjava3/parallel/ParallelFilterTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/parallel/ParallelFilterTryTest.java b/src/test/java/io/reactivex/rxjava3/parallel/ParallelFilterTryTest.java index 37377bab52..6940062989 100644 --- a/src/test/java/io/reactivex/rxjava3/parallel/ParallelFilterTryTest.java +++ b/src/test/java/io/reactivex/rxjava3/parallel/ParallelFilterTryTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/parallel/ParallelFlatMapIterableTest.java b/src/test/java/io/reactivex/rxjava3/parallel/ParallelFlatMapIterableTest.java index 4b5aeb0c78..8c18de1b0b 100644 --- a/src/test/java/io/reactivex/rxjava3/parallel/ParallelFlatMapIterableTest.java +++ b/src/test/java/io/reactivex/rxjava3/parallel/ParallelFlatMapIterableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/parallel/ParallelFlowableTest.java b/src/test/java/io/reactivex/rxjava3/parallel/ParallelFlowableTest.java index 1d1f97163f..c97bc5cf56 100644 --- a/src/test/java/io/reactivex/rxjava3/parallel/ParallelFlowableTest.java +++ b/src/test/java/io/reactivex/rxjava3/parallel/ParallelFlowableTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/parallel/ParallelFromPublisherTest.java b/src/test/java/io/reactivex/rxjava3/parallel/ParallelFromPublisherTest.java index 981781cd9f..7d4e684bb6 100644 --- a/src/test/java/io/reactivex/rxjava3/parallel/ParallelFromPublisherTest.java +++ b/src/test/java/io/reactivex/rxjava3/parallel/ParallelFromPublisherTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -26,9 +26,10 @@ import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.subscribers.BasicFuseableSubscriber; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueSubscription; import io.reactivex.rxjava3.processors.*; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.testsupport.*; @@ -49,7 +50,7 @@ protected void subscribeActual(Subscriber s) { .parallel(1, 1) .sequential(1) .test(0) - .assertFailure(MissingBackpressureException.class); + .assertFailure(QueueOverflowException.class); } @Test diff --git a/src/test/java/io/reactivex/rxjava3/parallel/ParallelInvalid.java b/src/test/java/io/reactivex/rxjava3/parallel/ParallelInvalid.java index 39e8ac21cf..6b54ca6847 100644 --- a/src/test/java/io/reactivex/rxjava3/parallel/ParallelInvalid.java +++ b/src/test/java/io/reactivex/rxjava3/parallel/ParallelInvalid.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/parallel/ParallelJoinTest.java b/src/test/java/io/reactivex/rxjava3/parallel/ParallelJoinTest.java index 8741eb1168..8ee41cb973 100644 --- a/src/test/java/io/reactivex/rxjava3/parallel/ParallelJoinTest.java +++ b/src/test/java/io/reactivex/rxjava3/parallel/ParallelJoinTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -48,7 +48,7 @@ public int parallelism() { } .sequential(1) .test(0) - .assertFailure(MissingBackpressureException.class); + .assertFailure(QueueOverflowException.class); } @Test @@ -81,7 +81,7 @@ public int parallelism() { .sequential(1) .subscribe(ts); - ts.assertFailure(MissingBackpressureException.class, 1); + ts.assertFailure(QueueOverflowException.class, 1); } @Test @@ -111,7 +111,7 @@ public int parallelism() { .sequentialDelayError(1) .test(0) .requestMore(1) - .assertFailure(MissingBackpressureException.class, 1); + .assertFailure(QueueOverflowException.class, 1); } @Test @@ -148,7 +148,7 @@ public int parallelism() { ts.request(1); - ts.assertFailure(MissingBackpressureException.class, 1, 2); + ts.assertFailure(QueueOverflowException.class, 1, 2); } @Test diff --git a/src/test/java/io/reactivex/rxjava3/parallel/ParallelMapTest.java b/src/test/java/io/reactivex/rxjava3/parallel/ParallelMapTest.java index 5432c10a76..493b74d34e 100644 --- a/src/test/java/io/reactivex/rxjava3/parallel/ParallelMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/parallel/ParallelMapTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -26,8 +26,8 @@ import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.ConditionalSubscriber; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.testsupport.TestHelper; diff --git a/src/test/java/io/reactivex/rxjava3/parallel/ParallelMapTryTest.java b/src/test/java/io/reactivex/rxjava3/parallel/ParallelMapTryTest.java index d56669d755..a6d0de2d92 100644 --- a/src/test/java/io/reactivex/rxjava3/parallel/ParallelMapTryTest.java +++ b/src/test/java/io/reactivex/rxjava3/parallel/ParallelMapTryTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/parallel/ParallelPeekTest.java b/src/test/java/io/reactivex/rxjava3/parallel/ParallelPeekTest.java index b35f0d8a1f..93d72ef9f6 100644 --- a/src/test/java/io/reactivex/rxjava3/parallel/ParallelPeekTest.java +++ b/src/test/java/io/reactivex/rxjava3/parallel/ParallelPeekTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/parallel/ParallelReduceFullTest.java b/src/test/java/io/reactivex/rxjava3/parallel/ParallelReduceFullTest.java index 625fb8a42e..d9a43a247c 100644 --- a/src/test/java/io/reactivex/rxjava3/parallel/ParallelReduceFullTest.java +++ b/src/test/java/io/reactivex/rxjava3/parallel/ParallelReduceFullTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/parallel/ParallelReduceTest.java b/src/test/java/io/reactivex/rxjava3/parallel/ParallelReduceTest.java index 3e906ef01b..9c32f6afc8 100644 --- a/src/test/java/io/reactivex/rxjava3/parallel/ParallelReduceTest.java +++ b/src/test/java/io/reactivex/rxjava3/parallel/ParallelReduceTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/parallel/ParallelRunOnTest.java b/src/test/java/io/reactivex/rxjava3/parallel/ParallelRunOnTest.java index 44ce7960d1..44a860263a 100644 --- a/src/test/java/io/reactivex/rxjava3/parallel/ParallelRunOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/parallel/ParallelRunOnTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -98,7 +98,7 @@ public void subscribe(Subscriber[] subscribers) { .runOn(ImmediateThinScheduler.INSTANCE, 1) .sequential(1) .test(0) - .assertFailure(MissingBackpressureException.class); + .assertFailure(QueueOverflowException.class); } @Test diff --git a/src/test/java/io/reactivex/rxjava3/parallel/ParallelSortedJoinTest.java b/src/test/java/io/reactivex/rxjava3/parallel/ParallelSortedJoinTest.java index 1f3950c112..9ba23c30c2 100644 --- a/src/test/java/io/reactivex/rxjava3/parallel/ParallelSortedJoinTest.java +++ b/src/test/java/io/reactivex/rxjava3/parallel/ParallelSortedJoinTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/plugins/RxJavaPluginsTest.java b/src/test/java/io/reactivex/rxjava3/plugins/RxJavaPluginsTest.java index defc141800..6aa166d118 100644 --- a/src/test/java/io/reactivex/rxjava3/plugins/RxJavaPluginsTest.java +++ b/src/test/java/io/reactivex/rxjava3/plugins/RxJavaPluginsTest.java @@ -1,17 +1,14 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.plugins; @@ -592,6 +589,61 @@ public void onComplete() { .assertComplete(); } + @SuppressWarnings("rawtypes") + @Test + public void parallelFlowableStart() { + try { + RxJavaPlugins.setOnParallelSubscribe(new BiFunction() { + @Override + public Subscriber[] apply(ParallelFlowable f, final Subscriber[] t) { + return new Subscriber[] { new Subscriber() { + + @Override + public void onSubscribe(Subscription s) { + t[0].onSubscribe(s); + } + + @SuppressWarnings("unchecked") + @Override + public void onNext(Object value) { + t[0].onNext((Integer)value - 9); + } + + @Override + public void onError(Throwable e) { + t[0].onError(e); + } + + @Override + public void onComplete() { + t[0].onComplete(); + } + + } + }; + } + }); + + Flowable.range(10, 3) + .parallel(1) + .sequential() + .test() + .assertValues(1, 2, 3) + .assertNoErrors() + .assertComplete(); + } finally { + RxJavaPlugins.reset(); + } + // make sure the reset worked + Flowable.range(10, 3) + .parallel(1) + .sequential() + .test() + .assertValues(10, 11, 12) + .assertNoErrors() + .assertComplete(); + } + @SuppressWarnings("rawtypes") @Test public void singleCreate() { @@ -1176,6 +1228,7 @@ public void onComplete() { } AllSubscriber all = new AllSubscriber(); + Subscriber[] allArray = { all }; assertNull(RxJavaPlugins.onSubscribe(Observable.never(), null)); @@ -1197,6 +1250,10 @@ public void onComplete() { assertSame(all, RxJavaPlugins.onSubscribe(Maybe.never(), all)); + assertNull(RxJavaPlugins.onSubscribe(Flowable.never().parallel(), null)); + + assertSame(allArray, RxJavaPlugins.onSubscribe(Flowable.never().parallel(), allArray)); + final Scheduler s = ImmediateThinScheduler.INSTANCE; Supplier c = new Supplier() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/processors/AsyncProcessorTest.java b/src/test/java/io/reactivex/rxjava3/processors/AsyncProcessorTest.java index 778cf78496..81afc972dc 100644 --- a/src/test/java/io/reactivex/rxjava3/processors/AsyncProcessorTest.java +++ b/src/test/java/io/reactivex/rxjava3/processors/AsyncProcessorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -26,8 +26,8 @@ import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.Consumer; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.subscribers.TestSubscriber; import io.reactivex.rxjava3.testsupport.*; diff --git a/src/test/java/io/reactivex/rxjava3/processors/BehaviorProcessorTest.java b/src/test/java/io/reactivex/rxjava3/processors/BehaviorProcessorTest.java index 0d0acb2796..991a599b82 100644 --- a/src/test/java/io/reactivex/rxjava3/processors/BehaviorProcessorTest.java +++ b/src/test/java/io/reactivex/rxjava3/processors/BehaviorProcessorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/processors/FlowableProcessorTest.java b/src/test/java/io/reactivex/rxjava3/processors/FlowableProcessorTest.java index ae659623e0..1575a5669c 100644 --- a/src/test/java/io/reactivex/rxjava3/processors/FlowableProcessorTest.java +++ b/src/test/java/io/reactivex/rxjava3/processors/FlowableProcessorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/processors/MulticastProcessorTest.java b/src/test/java/io/reactivex/rxjava3/processors/MulticastProcessorTest.java index afa14b8deb..0ac22cf1b2 100644 --- a/src/test/java/io/reactivex/rxjava3/processors/MulticastProcessorTest.java +++ b/src/test/java/io/reactivex/rxjava3/processors/MulticastProcessorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/processors/PublishProcessorTest.java b/src/test/java/io/reactivex/rxjava3/processors/PublishProcessorTest.java index 9741796049..380f644518 100644 --- a/src/test/java/io/reactivex/rxjava3/processors/PublishProcessorTest.java +++ b/src/test/java/io/reactivex/rxjava3/processors/PublishProcessorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/processors/ReplayProcessorBoundedConcurrencyTest.java b/src/test/java/io/reactivex/rxjava3/processors/ReplayProcessorBoundedConcurrencyTest.java index 4590a6dec9..f080ce5e1d 100644 --- a/src/test/java/io/reactivex/rxjava3/processors/ReplayProcessorBoundedConcurrencyTest.java +++ b/src/test/java/io/reactivex/rxjava3/processors/ReplayProcessorBoundedConcurrencyTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/processors/ReplayProcessorConcurrencyTest.java b/src/test/java/io/reactivex/rxjava3/processors/ReplayProcessorConcurrencyTest.java index 3cacc0d67a..3afe66dd25 100644 --- a/src/test/java/io/reactivex/rxjava3/processors/ReplayProcessorConcurrencyTest.java +++ b/src/test/java/io/reactivex/rxjava3/processors/ReplayProcessorConcurrencyTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/processors/ReplayProcessorTest.java b/src/test/java/io/reactivex/rxjava3/processors/ReplayProcessorTest.java index 2febfb0629..35a877911b 100644 --- a/src/test/java/io/reactivex/rxjava3/processors/ReplayProcessorTest.java +++ b/src/test/java/io/reactivex/rxjava3/processors/ReplayProcessorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -1832,4 +1832,69 @@ public void timeAndSizeRemoveCorrectNumberOfOld() { rp.test().assertValuesOnly(4, 5); } -} + + @Test + public void terminationSubscriptionRaceUnbounded() throws Throwable { + for (int i = 1; i <= 10000; i++) { + ReplayProcessor source = ReplayProcessor.create(); + PublishProcessor sink = PublishProcessor.create(); + TestSubscriber subscriber = sink.test(); + Schedulers.computation().scheduleDirect(() -> { + // issue signals to the source in adherence to the reactive streams specification + source.onSubscribe(new BooleanSubscription()); + source.onNext("hello"); + source.onNext("world"); + source.onComplete(); + }); + Schedulers.computation().scheduleDirect(() -> { + // connect the source to the sink in parallel with the signals issued to the source + // note the cast() operator, which is here to detect non-String escapees + source.cast(String.class).subscribe(sink); + }); + subscriber.await().assertValues("hello", "world").assertComplete(); + } + } + + @Test + public void terminationSubscriptionRaceSizeBound() throws Throwable { + for (int i = 1; i <= 10000; i++) { + ReplayProcessor source = ReplayProcessor.createWithSize(20); + PublishProcessor sink = PublishProcessor.create(); + TestSubscriber subscriber = sink.test(); + Schedulers.computation().scheduleDirect(() -> { + // issue signals to the source in adherence to the reactive streams specification + source.onSubscribe(new BooleanSubscription()); + source.onNext("hello"); + source.onNext("world"); + source.onComplete(); + }); + Schedulers.computation().scheduleDirect(() -> { + // connect the source to the sink in parallel with the signals issued to the source + // note the cast() operator, which is here to detect non-String escapees + source.cast(String.class).subscribe(sink); + }); + subscriber.await().assertValues("hello", "world").assertComplete(); + } + } + + @Test + public void terminationSubscriptionRaceTimeBound() throws Throwable { + for (int i = 1; i <= 10000; i++) { + ReplayProcessor source = ReplayProcessor.createWithTime(20, TimeUnit.MINUTES, Schedulers.computation()); + PublishProcessor sink = PublishProcessor.create(); + TestSubscriber subscriber = sink.test(); + Schedulers.computation().scheduleDirect(() -> { + // issue signals to the source in adherence to the reactive streams specification + source.onSubscribe(new BooleanSubscription()); + source.onNext("hello"); + source.onNext("world"); + source.onComplete(); + }); + Schedulers.computation().scheduleDirect(() -> { + // connect the source to the sink in parallel with the signals issued to the source + // note the cast() operator, which is here to detect non-String escapees + source.cast(String.class).subscribe(sink); + }); + subscriber.await().assertValues("hello", "world").assertComplete(); + } + }} diff --git a/src/test/java/io/reactivex/rxjava3/processors/SerializedProcessorTest.java b/src/test/java/io/reactivex/rxjava3/processors/SerializedProcessorTest.java index b2bd9bac19..515b8d1430 100644 --- a/src/test/java/io/reactivex/rxjava3/processors/SerializedProcessorTest.java +++ b/src/test/java/io/reactivex/rxjava3/processors/SerializedProcessorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/processors/UnicastProcessorTest.java b/src/test/java/io/reactivex/rxjava3/processors/UnicastProcessorTest.java index 002d6a17d3..f65cc46a5e 100644 --- a/src/test/java/io/reactivex/rxjava3/processors/UnicastProcessorTest.java +++ b/src/test/java/io/reactivex/rxjava3/processors/UnicastProcessorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -25,9 +25,9 @@ import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.subscribers.TestSubscriber; diff --git a/src/test/java/io/reactivex/rxjava3/schedulers/AbstractSchedulerConcurrencyTests.java b/src/test/java/io/reactivex/rxjava3/schedulers/AbstractSchedulerConcurrencyTests.java index 399a765305..ae7d1b24b0 100644 --- a/src/test/java/io/reactivex/rxjava3/schedulers/AbstractSchedulerConcurrencyTests.java +++ b/src/test/java/io/reactivex/rxjava3/schedulers/AbstractSchedulerConcurrencyTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/schedulers/AbstractSchedulerTests.java b/src/test/java/io/reactivex/rxjava3/schedulers/AbstractSchedulerTests.java index 34d8ac1b39..2419fe557c 100644 --- a/src/test/java/io/reactivex/rxjava3/schedulers/AbstractSchedulerTests.java +++ b/src/test/java/io/reactivex/rxjava3/schedulers/AbstractSchedulerTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -27,6 +27,7 @@ import org.reactivestreams.*; import io.reactivex.rxjava3.core.*; +import io.reactivex.rxjava3.core.Scheduler.Worker; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.disposables.SequentialDisposable; @@ -771,4 +772,51 @@ public void schedulePeriodicallyDirectNullRunnable() { assertEquals("run is null", npe.getMessage()); } } + + void schedulePrint(Function onSchedule) { + CountDownLatch waitForBody = new CountDownLatch(1); + CountDownLatch waitForPrint = new CountDownLatch(1); + + try { + Disposable d = onSchedule.apply(() -> { + waitForBody.countDown(); + try { + waitForPrint.await(); + } catch (InterruptedException ex) { + ex.printStackTrace(); + } + }); + + waitForBody.await(); + + assertNotEquals("", d.toString()); + } catch (Throwable ex) { + throw new AssertionError(ex); + } finally { + waitForPrint.countDown(); + } + } + + @Test + public void scheduleDirectPrint() { + if (getScheduler() instanceof TrampolineScheduler) { + // no concurrency with Trampoline + return; + } + schedulePrint(r -> getScheduler().scheduleDirect(r)); + } + + @Test + public void schedulePrint() { + if (getScheduler() instanceof TrampolineScheduler) { + // no concurrency with Trampoline + return; + } + Worker worker = getScheduler().createWorker(); + try { + schedulePrint(worker::schedule); + } finally { + worker.dispose(); + } + } } diff --git a/src/test/java/io/reactivex/rxjava3/schedulers/CachedThreadSchedulerTest.java b/src/test/java/io/reactivex/rxjava3/schedulers/CachedThreadSchedulerTest.java index 26cec9b53b..b4576ebb53 100644 --- a/src/test/java/io/reactivex/rxjava3/schedulers/CachedThreadSchedulerTest.java +++ b/src/test/java/io/reactivex/rxjava3/schedulers/CachedThreadSchedulerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/schedulers/ComputationSchedulerTests.java b/src/test/java/io/reactivex/rxjava3/schedulers/ComputationSchedulerTests.java index 5f5df8d410..c88415209d 100644 --- a/src/test/java/io/reactivex/rxjava3/schedulers/ComputationSchedulerTests.java +++ b/src/test/java/io/reactivex/rxjava3/schedulers/ComputationSchedulerTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/schedulers/ExecutorSchedulerFairTest.java b/src/test/java/io/reactivex/rxjava3/schedulers/ExecutorSchedulerFairTest.java index 128a3bd5b5..c01f0f9f1f 100644 --- a/src/test/java/io/reactivex/rxjava3/schedulers/ExecutorSchedulerFairTest.java +++ b/src/test/java/io/reactivex/rxjava3/schedulers/ExecutorSchedulerFairTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/schedulers/ExecutorSchedulerInterruptibleTest.java b/src/test/java/io/reactivex/rxjava3/schedulers/ExecutorSchedulerInterruptibleTest.java index e9c953b049..074ac8039a 100644 --- a/src/test/java/io/reactivex/rxjava3/schedulers/ExecutorSchedulerInterruptibleTest.java +++ b/src/test/java/io/reactivex/rxjava3/schedulers/ExecutorSchedulerInterruptibleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -505,4 +505,609 @@ public void run() { worker.dispose(); } } + + @Test + public void interruptibleDirectTaskScheduledExecutor() throws Exception { + ScheduledExecutorService exec = Executors.newScheduledThreadPool(1); + try { + Scheduler scheduler = Schedulers.from(exec, true); + + final AtomicInteger sync = new AtomicInteger(2); + + final AtomicBoolean isInterrupted = new AtomicBoolean(); + + Disposable d = scheduler.scheduleDirect(new Runnable() { + @Override + public void run() { + if (sync.decrementAndGet() != 0) { + while (sync.get() != 0) { } + } + try { + Thread.sleep(1000); + } catch (InterruptedException ex) { + isInterrupted.set(true); + } + } + }); + + if (sync.decrementAndGet() != 0) { + while (sync.get() != 0) { } + } + + Thread.sleep(500); + + d.dispose(); + + int i = 20; + while (i-- > 0 && !isInterrupted.get()) { + Thread.sleep(50); + } + + assertTrue("Interruption did not propagate", isInterrupted.get()); + } finally { + exec.shutdown(); + } + } + + @Test + public void interruptibleWorkerTaskScheduledExecutor() throws Exception { + ScheduledExecutorService exec = Executors.newScheduledThreadPool(1); + try { + Scheduler scheduler = Schedulers.from(exec, true); + + Worker worker = scheduler.createWorker(); + + try { + final AtomicInteger sync = new AtomicInteger(2); + + final AtomicBoolean isInterrupted = new AtomicBoolean(); + + Disposable d = worker.schedule(new Runnable() { + @Override + public void run() { + if (sync.decrementAndGet() != 0) { + while (sync.get() != 0) { } + } + try { + Thread.sleep(1000); + } catch (InterruptedException ex) { + isInterrupted.set(true); + } + } + }); + + if (sync.decrementAndGet() != 0) { + while (sync.get() != 0) { } + } + + Thread.sleep(500); + + d.dispose(); + + int i = 20; + while (i-- > 0 && !isInterrupted.get()) { + Thread.sleep(50); + } + + assertTrue("Interruption did not propagate", isInterrupted.get()); + } finally { + worker.dispose(); + } + } finally { + exec.shutdown(); + } + } + + @Test + public void nonInterruptibleDirectTask() throws Exception { + ExecutorService exec = Executors.newSingleThreadExecutor(); + try { + Scheduler scheduler = Schedulers.from(exec, false); + + final AtomicInteger sync = new AtomicInteger(2); + + final AtomicBoolean isInterrupted = new AtomicBoolean(); + + Disposable d = scheduler.scheduleDirect(new Runnable() { + @Override + public void run() { + if (sync.decrementAndGet() != 0) { + while (sync.get() != 0) { } + } + try { + Thread.sleep(1000); + } catch (InterruptedException ex) { + isInterrupted.set(true); + } + } + }); + + if (sync.decrementAndGet() != 0) { + while (sync.get() != 0) { } + } + + Thread.sleep(500); + + d.dispose(); + + int i = 20; + while (i-- > 0 && !isInterrupted.get()) { + Thread.sleep(50); + } + + assertFalse("Interruption happened", isInterrupted.get()); + } finally { + exec.shutdown(); + } + } + + @Test + public void nonInterruptibleWorkerTask() throws Exception { + ExecutorService exec = Executors.newSingleThreadExecutor(); + try { + Scheduler scheduler = Schedulers.from(exec, false); + + Worker worker = scheduler.createWorker(); + + try { + final AtomicInteger sync = new AtomicInteger(2); + + final AtomicBoolean isInterrupted = new AtomicBoolean(); + + Disposable d = worker.schedule(new Runnable() { + @Override + public void run() { + if (sync.decrementAndGet() != 0) { + while (sync.get() != 0) { } + } + try { + Thread.sleep(1000); + } catch (InterruptedException ex) { + isInterrupted.set(true); + } + } + }); + + if (sync.decrementAndGet() != 0) { + while (sync.get() != 0) { } + } + + Thread.sleep(500); + + d.dispose(); + + int i = 20; + while (i-- > 0 && !isInterrupted.get()) { + Thread.sleep(50); + } + + assertFalse("Interruption happened", isInterrupted.get()); + } finally { + worker.dispose(); + } + } finally { + exec.shutdown(); + } + } + + @Test + public void nonInterruptibleDirectTaskScheduledExecutor() throws Exception { + ScheduledExecutorService exec = Executors.newScheduledThreadPool(1); + try { + Scheduler scheduler = Schedulers.from(exec, false); + + final AtomicInteger sync = new AtomicInteger(2); + + final AtomicBoolean isInterrupted = new AtomicBoolean(); + + Disposable d = scheduler.scheduleDirect(new Runnable() { + @Override + public void run() { + if (sync.decrementAndGet() != 0) { + while (sync.get() != 0) { } + } + try { + Thread.sleep(1000); + } catch (InterruptedException ex) { + isInterrupted.set(true); + } + } + }); + + if (sync.decrementAndGet() != 0) { + while (sync.get() != 0) { } + } + + Thread.sleep(500); + + d.dispose(); + + int i = 20; + while (i-- > 0 && !isInterrupted.get()) { + Thread.sleep(50); + } + + assertFalse("Interruption happened", isInterrupted.get()); + } finally { + exec.shutdown(); + } + } + + @Test + public void nonInterruptibleWorkerTaskScheduledExecutor() throws Exception { + ScheduledExecutorService exec = Executors.newScheduledThreadPool(1); + try { + Scheduler scheduler = Schedulers.from(exec, false); + + Worker worker = scheduler.createWorker(); + + try { + final AtomicInteger sync = new AtomicInteger(2); + + final AtomicBoolean isInterrupted = new AtomicBoolean(); + + Disposable d = worker.schedule(new Runnable() { + @Override + public void run() { + if (sync.decrementAndGet() != 0) { + while (sync.get() != 0) { } + } + try { + Thread.sleep(1000); + } catch (InterruptedException ex) { + isInterrupted.set(true); + } + } + }); + + if (sync.decrementAndGet() != 0) { + while (sync.get() != 0) { } + } + + Thread.sleep(500); + + d.dispose(); + + int i = 20; + while (i-- > 0 && !isInterrupted.get()) { + Thread.sleep(50); + } + + assertFalse("Interruption happened", isInterrupted.get()); + } finally { + worker.dispose(); + } + } finally { + exec.shutdown(); + } + } + + @Test + public void nonInterruptibleDirectTaskTimed() throws Exception { + ExecutorService exec = Executors.newSingleThreadExecutor(); + try { + Scheduler scheduler = Schedulers.from(exec, false); + + final AtomicInteger sync = new AtomicInteger(2); + + final AtomicBoolean isInterrupted = new AtomicBoolean(); + + Disposable d = scheduler.scheduleDirect(new Runnable() { + @Override + public void run() { + if (sync.decrementAndGet() != 0) { + while (sync.get() != 0) { } + } + try { + Thread.sleep(1000); + } catch (InterruptedException ex) { + isInterrupted.set(true); + } + } + }, 1, TimeUnit.MILLISECONDS); + + if (sync.decrementAndGet() != 0) { + while (sync.get() != 0) { } + } + + Thread.sleep(500); + + d.dispose(); + + int i = 20; + while (i-- > 0 && !isInterrupted.get()) { + Thread.sleep(50); + } + + assertFalse("Interruption happened", isInterrupted.get()); + } finally { + exec.shutdown(); + } + } + + @Test + public void nonInterruptibleWorkerTaskTimed() throws Exception { + ExecutorService exec = Executors.newSingleThreadExecutor(); + try { + Scheduler scheduler = Schedulers.from(exec, false); + + Worker worker = scheduler.createWorker(); + + try { + final AtomicInteger sync = new AtomicInteger(2); + + final AtomicBoolean isInterrupted = new AtomicBoolean(); + + Disposable d = worker.schedule(new Runnable() { + @Override + public void run() { + if (sync.decrementAndGet() != 0) { + while (sync.get() != 0) { } + } + try { + Thread.sleep(1000); + } catch (InterruptedException ex) { + isInterrupted.set(true); + } + } + }, 1, TimeUnit.MILLISECONDS); + + if (sync.decrementAndGet() != 0) { + while (sync.get() != 0) { } + } + + Thread.sleep(500); + + d.dispose(); + + int i = 20; + while (i-- > 0 && !isInterrupted.get()) { + Thread.sleep(50); + } + + assertFalse("Interruption happened", isInterrupted.get()); + } finally { + worker.dispose(); + } + } finally { + exec.shutdown(); + } + } + + @Test + public void nonInterruptibleDirectTaskScheduledExecutorTimed() throws Exception { + ScheduledExecutorService exec = Executors.newScheduledThreadPool(1); + try { + Scheduler scheduler = Schedulers.from(exec, false); + + final AtomicInteger sync = new AtomicInteger(2); + + final AtomicBoolean isInterrupted = new AtomicBoolean(); + + Disposable d = scheduler.scheduleDirect(new Runnable() { + @Override + public void run() { + if (sync.decrementAndGet() != 0) { + while (sync.get() != 0) { } + } + try { + Thread.sleep(1000); + } catch (InterruptedException ex) { + isInterrupted.set(true); + } + } + }, 1, TimeUnit.MILLISECONDS); + + if (sync.decrementAndGet() != 0) { + while (sync.get() != 0) { } + } + + Thread.sleep(500); + + d.dispose(); + + int i = 20; + while (i-- > 0 && !isInterrupted.get()) { + Thread.sleep(50); + } + + assertFalse("Interruption happened", isInterrupted.get()); + } finally { + exec.shutdown(); + } + } + + @Test + public void nonInterruptibleWorkerTaskScheduledExecutorTimed() throws Exception { + ScheduledExecutorService exec = Executors.newScheduledThreadPool(1); + try { + Scheduler scheduler = Schedulers.from(exec, false); + + Worker worker = scheduler.createWorker(); + + try { + final AtomicInteger sync = new AtomicInteger(2); + + final AtomicBoolean isInterrupted = new AtomicBoolean(); + + Disposable d = worker.schedule(new Runnable() { + @Override + public void run() { + if (sync.decrementAndGet() != 0) { + while (sync.get() != 0) { } + } + try { + Thread.sleep(1000); + } catch (InterruptedException ex) { + isInterrupted.set(true); + } + } + }, 1, TimeUnit.MILLISECONDS); + + if (sync.decrementAndGet() != 0) { + while (sync.get() != 0) { } + } + + Thread.sleep(500); + + d.dispose(); + + int i = 20; + while (i-- > 0 && !isInterrupted.get()) { + Thread.sleep(50); + } + + assertFalse("Interruption happened", isInterrupted.get()); + } finally { + worker.dispose(); + } + } finally { + exec.shutdown(); + } + } + + public static class TrackInterruptScheduledExecutor extends ScheduledThreadPoolExecutor { + + public final AtomicBoolean interruptReceived = new AtomicBoolean(); + + public TrackInterruptScheduledExecutor() { + super(10); + } + + @Override + public ScheduledFuture schedule(Callable callable, long delay, TimeUnit unit) { + return new TrackingScheduledFuture(super.schedule(callable, delay, unit)); + } + + class TrackingScheduledFuture implements ScheduledFuture { + + ScheduledFuture original; + + TrackingScheduledFuture(ScheduledFuture original) { + this.original = original; + } + + @Override + public long getDelay(TimeUnit unit) { + return original.getDelay(unit); + } + + @Override + public int compareTo(Delayed o) { + return original.compareTo(o); + } + + @Override + public boolean cancel(boolean mayInterruptIfRunning) { + if (mayInterruptIfRunning) { + interruptReceived.set(true); + } + return original.cancel(mayInterruptIfRunning); + } + + @Override + public boolean isCancelled() { + return original.isCancelled(); + } + + @Override + public boolean isDone() { + return original.isDone(); + } + + @Override + public V get() throws InterruptedException, ExecutionException { + return original.get(); + } + + @Override + public V get(long timeout, TimeUnit unit) + throws InterruptedException, ExecutionException, TimeoutException { + return get(timeout, unit); + } + } + } + + @Test + public void noInterruptBeforeRunningDelayedWorker() throws Throwable { + TrackInterruptScheduledExecutor exec = new TrackInterruptScheduledExecutor(); + + try { + Scheduler sch = Schedulers.from(exec, false); + + Worker worker = sch.createWorker(); + + Disposable d = worker.schedule(() -> { }, 1, TimeUnit.SECONDS); + + d.dispose(); + + int i = 150; + + while (i-- > 0) { + assertFalse("Task interrupt detected", exec.interruptReceived.get()); + Thread.sleep(10); + } + + } finally { + exec.shutdownNow(); + } + } + + @Test + public void hasInterruptBeforeRunningDelayedWorker() throws Throwable { + TrackInterruptScheduledExecutor exec = new TrackInterruptScheduledExecutor(); + + try { + Scheduler sch = Schedulers.from(exec, true); + + Worker worker = sch.createWorker(); + + Disposable d = worker.schedule(() -> { }, 1, TimeUnit.SECONDS); + + d.dispose(); + + Thread.sleep(100); + assertTrue("Task interrupt detected", exec.interruptReceived.get()); + + } finally { + exec.shutdownNow(); + } + } + + @Test + public void noInterruptAfterRunningDelayedWorker() throws Throwable { + TrackInterruptScheduledExecutor exec = new TrackInterruptScheduledExecutor(); + + try { + Scheduler sch = Schedulers.from(exec, false); + + Worker worker = sch.createWorker(); + AtomicBoolean taskRun = new AtomicBoolean(); + + Disposable d = worker.schedule(() -> { + taskRun.set(true); + try { + Thread.sleep(1000); + } catch (InterruptedException ex) { + exec.interruptReceived.set(true); + } + }, 100, TimeUnit.MILLISECONDS); + + Thread.sleep(150); + ; + d.dispose(); + + int i = 50; + + while (i-- > 0) { + assertFalse("Task interrupt detected", exec.interruptReceived.get()); + Thread.sleep(10); + } + + assertTrue("Task run at all", taskRun.get()); + + } finally { + exec.shutdownNow(); + } + } } diff --git a/src/test/java/io/reactivex/rxjava3/schedulers/ExecutorSchedulerTest.java b/src/test/java/io/reactivex/rxjava3/schedulers/ExecutorSchedulerTest.java index 9910c03148..bb3e759884 100644 --- a/src/test/java/io/reactivex/rxjava3/schedulers/ExecutorSchedulerTest.java +++ b/src/test/java/io/reactivex/rxjava3/schedulers/ExecutorSchedulerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -93,7 +93,7 @@ public void run() { System.out.println("Wait before second GC"); System.out.println("JDK 6 purge is N log N because it removes and shifts one by one"); - int t = (int)(n * Math.log(n) / 100) + SchedulerPoolFactory.PURGE_PERIOD_SECONDS * 1000; + int t = (int)(n * Math.log(n) / 100) + 1000; int sleepStep = 100; while (t > 0) { System.out.printf(" >> Waiting for purge: %.2f s remaining%n", t / 1000d); diff --git a/src/test/java/io/reactivex/rxjava3/schedulers/FailOnBlockingTest.java b/src/test/java/io/reactivex/rxjava3/schedulers/FailOnBlockingTest.java index d8891ddc0c..7cb4c15e07 100644 --- a/src/test/java/io/reactivex/rxjava3/schedulers/FailOnBlockingTest.java +++ b/src/test/java/io/reactivex/rxjava3/schedulers/FailOnBlockingTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/schedulers/NewThreadSchedulerTest.java b/src/test/java/io/reactivex/rxjava3/schedulers/NewThreadSchedulerTest.java index 1476db8b92..37c7b85f87 100644 --- a/src/test/java/io/reactivex/rxjava3/schedulers/NewThreadSchedulerTest.java +++ b/src/test/java/io/reactivex/rxjava3/schedulers/NewThreadSchedulerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/schedulers/SchedulerLifecycleTest.java b/src/test/java/io/reactivex/rxjava3/schedulers/SchedulerLifecycleTest.java index c378448220..58b51254d8 100644 --- a/src/test/java/io/reactivex/rxjava3/schedulers/SchedulerLifecycleTest.java +++ b/src/test/java/io/reactivex/rxjava3/schedulers/SchedulerLifecycleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/schedulers/SchedulerTest.java b/src/test/java/io/reactivex/rxjava3/schedulers/SchedulerTest.java index d55578d663..a9ec2205a7 100644 --- a/src/test/java/io/reactivex/rxjava3/schedulers/SchedulerTest.java +++ b/src/test/java/io/reactivex/rxjava3/schedulers/SchedulerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/schedulers/SchedulerTestHelper.java b/src/test/java/io/reactivex/rxjava3/schedulers/SchedulerTestHelper.java index 05dda6a058..3c899f262e 100644 --- a/src/test/java/io/reactivex/rxjava3/schedulers/SchedulerTestHelper.java +++ b/src/test/java/io/reactivex/rxjava3/schedulers/SchedulerTestHelper.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -28,6 +28,8 @@ private SchedulerTestHelper() { /** * Verifies that the given Scheduler does not deliver handled errors to its executing Thread's * {@link java.lang.Thread.UncaughtExceptionHandler}. + * + * @param scheduler {@link Scheduler} to verify. */ static void handledErrorIsNotDeliveredToThreadHandler(Scheduler scheduler) throws InterruptedException { Thread.UncaughtExceptionHandler originalHandler = Thread.getDefaultUncaughtExceptionHandler(); diff --git a/src/test/java/io/reactivex/rxjava3/schedulers/SchedulerWorkerTest.java b/src/test/java/io/reactivex/rxjava3/schedulers/SchedulerWorkerTest.java index 87ad3698ad..17b7fa5dd7 100644 --- a/src/test/java/io/reactivex/rxjava3/schedulers/SchedulerWorkerTest.java +++ b/src/test/java/io/reactivex/rxjava3/schedulers/SchedulerWorkerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/schedulers/TestSchedulerTest.java b/src/test/java/io/reactivex/rxjava3/schedulers/TestSchedulerTest.java index 8bcb177053..4c2e776e0d 100644 --- a/src/test/java/io/reactivex/rxjava3/schedulers/TestSchedulerTest.java +++ b/src/test/java/io/reactivex/rxjava3/schedulers/TestSchedulerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -30,6 +30,7 @@ import io.reactivex.rxjava3.functions.Function; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; import io.reactivex.rxjava3.internal.util.ExceptionHelper; +import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.schedulers.TestScheduler.*; public class TestSchedulerTest extends RxJavaTest { @@ -260,4 +261,95 @@ public void constructorTimeSetsTime() { assertEquals(5, ts.now(TimeUnit.SECONDS)); assertEquals(5000, ts.now(TimeUnit.MILLISECONDS)); } + + @Test + public void withOnScheduleHook() { + AtomicInteger run = new AtomicInteger(); + AtomicInteger counter = new AtomicInteger(); + RxJavaPlugins.setScheduleHandler(r -> { + counter.getAndIncrement(); + return r; + }); + try { + Runnable r = () -> run.getAndIncrement(); + TestScheduler ts = new TestScheduler(true); + + ts.createWorker().schedule(r); + ts.createWorker().schedule(r, 1, TimeUnit.SECONDS); + + ts.advanceTimeBy(1, TimeUnit.SECONDS); + + assertEquals(2, run.get()); + assertEquals(2, counter.get()); + + ts = new TestScheduler(); + + ts.createWorker().schedule(r); + ts.createWorker().schedule(r, 1, TimeUnit.SECONDS); + + ts.advanceTimeBy(1, TimeUnit.SECONDS); + + assertEquals(4, run.get()); + assertEquals(2, counter.get()); + } finally { + RxJavaPlugins.setScheduleHandler(null); + } + } + + @Test + public void withOnScheduleHookInitialTime() { + AtomicInteger run = new AtomicInteger(); + AtomicInteger counter = new AtomicInteger(); + RxJavaPlugins.setScheduleHandler(r -> { + counter.getAndIncrement(); + return r; + }); + try { + Runnable r = () -> run.getAndIncrement(); + TestScheduler ts = new TestScheduler(1, TimeUnit.HOURS, true); + + ts.createWorker().schedule(r); + ts.createWorker().schedule(r, 1, TimeUnit.SECONDS); + + ts.advanceTimeBy(1, TimeUnit.SECONDS); + + assertEquals(2, run.get()); + assertEquals(2, counter.get()); + + ts = new TestScheduler(1, TimeUnit.HOURS); + + ts.createWorker().schedule(r); + ts.createWorker().schedule(r, 1, TimeUnit.SECONDS); + + ts.advanceTimeBy(1, TimeUnit.SECONDS); + + assertEquals(4, run.get()); + assertEquals(2, counter.get()); + } finally { + RxJavaPlugins.setScheduleHandler(null); + } + } + + @Test + public void disposeWork() { + AtomicInteger run = new AtomicInteger(); + Runnable r = () -> run.getAndIncrement(); + TestScheduler ts = new TestScheduler(1, TimeUnit.HOURS, true); + + Disposable d = ts.createWorker().schedule(r); + + assertFalse(d.isDisposed()); + + d.dispose(); + + assertTrue(d.isDisposed()); + + d.dispose(); + + assertTrue(d.isDisposed()); + + ts.advanceTimeBy(1, TimeUnit.SECONDS); + + assertEquals(0, run.get()); + } } diff --git a/src/test/java/io/reactivex/rxjava3/schedulers/TimedTest.java b/src/test/java/io/reactivex/rxjava3/schedulers/TimedTest.java index ce117c2fb7..7d82af675e 100644 --- a/src/test/java/io/reactivex/rxjava3/schedulers/TimedTest.java +++ b/src/test/java/io/reactivex/rxjava3/schedulers/TimedTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/schedulers/TrampolineSchedulerTest.java b/src/test/java/io/reactivex/rxjava3/schedulers/TrampolineSchedulerTest.java index b409aa143a..d98c93a435 100644 --- a/src/test/java/io/reactivex/rxjava3/schedulers/TrampolineSchedulerTest.java +++ b/src/test/java/io/reactivex/rxjava3/schedulers/TrampolineSchedulerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/single/SingleCacheTest.java b/src/test/java/io/reactivex/rxjava3/single/SingleCacheTest.java index 1851c15e1f..3fe2da558c 100644 --- a/src/test/java/io/reactivex/rxjava3/single/SingleCacheTest.java +++ b/src/test/java/io/reactivex/rxjava3/single/SingleCacheTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/single/SingleNullTests.java b/src/test/java/io/reactivex/rxjava3/single/SingleNullTests.java index a6133bd720..058ecdc6b0 100644 --- a/src/test/java/io/reactivex/rxjava3/single/SingleNullTests.java +++ b/src/test/java/io/reactivex/rxjava3/single/SingleNullTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/single/SingleRetryTest.java b/src/test/java/io/reactivex/rxjava3/single/SingleRetryTest.java index 2fe5fa9f49..e38322a4ab 100644 --- a/src/test/java/io/reactivex/rxjava3/single/SingleRetryTest.java +++ b/src/test/java/io/reactivex/rxjava3/single/SingleRetryTest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2017-present, RxJava Contributors. +/* + * Copyright (c) 2016-present, RxJava Contributors. * * Licensed 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 diff --git a/src/test/java/io/reactivex/rxjava3/single/SingleSubscribeTest.java b/src/test/java/io/reactivex/rxjava3/single/SingleSubscribeTest.java index 68484d63c1..df363bee83 100644 --- a/src/test/java/io/reactivex/rxjava3/single/SingleSubscribeTest.java +++ b/src/test/java/io/reactivex/rxjava3/single/SingleSubscribeTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/single/SingleTest.java b/src/test/java/io/reactivex/rxjava3/single/SingleTest.java index 1f7cba7e2d..7b51c97471 100644 --- a/src/test/java/io/reactivex/rxjava3/single/SingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/single/SingleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/single/SingleTimerTest.java b/src/test/java/io/reactivex/rxjava3/single/SingleTimerTest.java index c8624b710a..7fefa15467 100644 --- a/src/test/java/io/reactivex/rxjava3/single/SingleTimerTest.java +++ b/src/test/java/io/reactivex/rxjava3/single/SingleTimerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/subjects/AsyncSubjectTest.java b/src/test/java/io/reactivex/rxjava3/subjects/AsyncSubjectTest.java index 17d3a94a62..8228b74b5d 100644 --- a/src/test/java/io/reactivex/rxjava3/subjects/AsyncSubjectTest.java +++ b/src/test/java/io/reactivex/rxjava3/subjects/AsyncSubjectTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -27,8 +27,8 @@ import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.Consumer; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.testsupport.*; public class AsyncSubjectTest extends SubjectTest { diff --git a/src/test/java/io/reactivex/rxjava3/subjects/BehaviorSubjectTest.java b/src/test/java/io/reactivex/rxjava3/subjects/BehaviorSubjectTest.java index 25e239e378..8871ee8e7e 100644 --- a/src/test/java/io/reactivex/rxjava3/subjects/BehaviorSubjectTest.java +++ b/src/test/java/io/reactivex/rxjava3/subjects/BehaviorSubjectTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/subjects/CompletableSubjectTest.java b/src/test/java/io/reactivex/rxjava3/subjects/CompletableSubjectTest.java index 02ac92b064..6b5a7a6085 100644 --- a/src/test/java/io/reactivex/rxjava3/subjects/CompletableSubjectTest.java +++ b/src/test/java/io/reactivex/rxjava3/subjects/CompletableSubjectTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/subjects/MaybeSubjectTest.java b/src/test/java/io/reactivex/rxjava3/subjects/MaybeSubjectTest.java index 31742e10a9..c741f02508 100644 --- a/src/test/java/io/reactivex/rxjava3/subjects/MaybeSubjectTest.java +++ b/src/test/java/io/reactivex/rxjava3/subjects/MaybeSubjectTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/subjects/PublishSubjectTest.java b/src/test/java/io/reactivex/rxjava3/subjects/PublishSubjectTest.java index 9479951609..a4b464c512 100644 --- a/src/test/java/io/reactivex/rxjava3/subjects/PublishSubjectTest.java +++ b/src/test/java/io/reactivex/rxjava3/subjects/PublishSubjectTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/subjects/ReplaySubjectBoundedConcurrencyTest.java b/src/test/java/io/reactivex/rxjava3/subjects/ReplaySubjectBoundedConcurrencyTest.java index 369fcfc59f..419e5c92a9 100644 --- a/src/test/java/io/reactivex/rxjava3/subjects/ReplaySubjectBoundedConcurrencyTest.java +++ b/src/test/java/io/reactivex/rxjava3/subjects/ReplaySubjectBoundedConcurrencyTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/subjects/ReplaySubjectConcurrencyTest.java b/src/test/java/io/reactivex/rxjava3/subjects/ReplaySubjectConcurrencyTest.java index 767553dc59..454b56e515 100644 --- a/src/test/java/io/reactivex/rxjava3/subjects/ReplaySubjectConcurrencyTest.java +++ b/src/test/java/io/reactivex/rxjava3/subjects/ReplaySubjectConcurrencyTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/subjects/ReplaySubjectTest.java b/src/test/java/io/reactivex/rxjava3/subjects/ReplaySubjectTest.java index 3444431824..8417b53081 100644 --- a/src/test/java/io/reactivex/rxjava3/subjects/ReplaySubjectTest.java +++ b/src/test/java/io/reactivex/rxjava3/subjects/ReplaySubjectTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -1378,4 +1378,70 @@ public void timeAndSizeRemoveCorrectNumberOfOld() { rs.test().assertValuesOnly(4, 5); } + + @Test + public void terminationSubscriptionRaceUnbounded() throws Throwable { + for (int i = 1; i <= 10000; i++) { + Subject source = ReplaySubject.create(); + Subject sink = PublishSubject.create(); + TestObserver observer = sink.test(); + Schedulers.computation().scheduleDirect(() -> { + // issue signals to the source in adherence to the reactive streams specification + source.onSubscribe(Disposable.empty()); + source.onNext("hello"); + source.onNext("world"); + source.onComplete(); + }); + Schedulers.computation().scheduleDirect(() -> { + // connect the source to the sink in parallel with the signals issued to the source + // note the cast() operator, which is here to detect non-String escapees + source.cast(String.class).subscribe(sink); + }); + observer.await().assertValues("hello", "world").assertComplete(); + } + } + + @Test + public void terminationSubscriptionRaceSizeBound() throws Throwable { + for (int i = 1; i <= 10000; i++) { + Subject source = ReplaySubject.createWithSize(20); + Subject sink = PublishSubject.create(); + TestObserver observer = sink.test(); + Schedulers.computation().scheduleDirect(() -> { + // issue signals to the source in adherence to the reactive streams specification + source.onSubscribe(Disposable.empty()); + source.onNext("hello"); + source.onNext("world"); + source.onComplete(); + }); + Schedulers.computation().scheduleDirect(() -> { + // connect the source to the sink in parallel with the signals issued to the source + // note the cast() operator, which is here to detect non-String escapees + source.cast(String.class).subscribe(sink); + }); + observer.await().assertValues("hello", "world").assertComplete(); + } + } + + @Test + public void terminationSubscriptionRaceTimeBound() throws Throwable { + for (int i = 1; i <= 10000; i++) { + Subject source = ReplaySubject.createWithTime(20, TimeUnit.MINUTES, Schedulers.computation()); + Subject sink = PublishSubject.create(); + TestObserver observer = sink.test(); + Schedulers.computation().scheduleDirect(() -> { + // issue signals to the source in adherence to the reactive streams specification + source.onSubscribe(Disposable.empty()); + source.onNext("hello"); + source.onNext("world"); + source.onComplete(); + }); + Schedulers.computation().scheduleDirect(() -> { + // connect the source to the sink in parallel with the signals issued to the source + // note the cast() operator, which is here to detect non-String escapees + source.cast(String.class).subscribe(sink); + }); + observer.await().assertValues("hello", "world").assertComplete(); + } + } } diff --git a/src/test/java/io/reactivex/rxjava3/subjects/SerializedSubjectTest.java b/src/test/java/io/reactivex/rxjava3/subjects/SerializedSubjectTest.java index 86589cd25d..18ff503339 100644 --- a/src/test/java/io/reactivex/rxjava3/subjects/SerializedSubjectTest.java +++ b/src/test/java/io/reactivex/rxjava3/subjects/SerializedSubjectTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/subjects/SingleSubjectTest.java b/src/test/java/io/reactivex/rxjava3/subjects/SingleSubjectTest.java index 521fb77fe4..751f0c72d4 100644 --- a/src/test/java/io/reactivex/rxjava3/subjects/SingleSubjectTest.java +++ b/src/test/java/io/reactivex/rxjava3/subjects/SingleSubjectTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/subjects/SubjectTest.java b/src/test/java/io/reactivex/rxjava3/subjects/SubjectTest.java index ab22d10a0c..ce7177a58d 100644 --- a/src/test/java/io/reactivex/rxjava3/subjects/SubjectTest.java +++ b/src/test/java/io/reactivex/rxjava3/subjects/SubjectTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/subjects/UnicastSubjectTest.java b/src/test/java/io/reactivex/rxjava3/subjects/UnicastSubjectTest.java index 0c05dbbf9f..8ae618319b 100644 --- a/src/test/java/io/reactivex/rxjava3/subjects/UnicastSubjectTest.java +++ b/src/test/java/io/reactivex/rxjava3/subjects/UnicastSubjectTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -26,8 +26,8 @@ import io.reactivex.rxjava3.disposables.*; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.testsupport.*; @@ -481,9 +481,7 @@ public void fusedNoConcurrentCleanDueToCancel() { us.onNext(i); } - to - .awaitDone(5, TimeUnit.SECONDS) - ; + to.awaitDone(10, TimeUnit.SECONDS); if (!errors.isEmpty()) { throw new CompositeException(errors); diff --git a/src/test/java/io/reactivex/rxjava3/subscribers/DefaultSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/subscribers/DefaultSubscriberTest.java index 562759247c..b68a6fe695 100644 --- a/src/test/java/io/reactivex/rxjava3/subscribers/DefaultSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/subscribers/DefaultSubscriberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/subscribers/DisposableSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/subscribers/DisposableSubscriberTest.java index b58b231467..6aa5c1ff51 100644 --- a/src/test/java/io/reactivex/rxjava3/subscribers/DisposableSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/subscribers/DisposableSubscriberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/subscribers/ResourceSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/subscribers/ResourceSubscriberTest.java index 5b135a6ed2..6bbc127cda 100644 --- a/src/test/java/io/reactivex/rxjava3/subscribers/ResourceSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/subscribers/ResourceSubscriberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/subscribers/SafeSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/subscribers/SafeSubscriberTest.java index ca61c8565a..cd97fa11a3 100644 --- a/src/test/java/io/reactivex/rxjava3/subscribers/SafeSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/subscribers/SafeSubscriberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/subscribers/SerializedSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/subscribers/SerializedSubscriberTest.java index e4292216d6..2402762d93 100644 --- a/src/test/java/io/reactivex/rxjava3/subscribers/SerializedSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/subscribers/SerializedSubscriberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/subscribers/TestSubscriberTest.java b/src/test/java/io/reactivex/rxjava3/subscribers/TestSubscriberTest.java index 48bb722585..40bdcb95cc 100644 --- a/src/test/java/io/reactivex/rxjava3/subscribers/TestSubscriberTest.java +++ b/src/test/java/io/reactivex/rxjava3/subscribers/TestSubscriberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -22,6 +22,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.junit.Test; +import org.junit.function.ThrowingRunnable; import org.mockito.InOrder; import org.reactivestreams.*; @@ -1391,9 +1392,13 @@ public void assertValuePredicateMatch() { }); } + static void assertThrowsWithMessage(String message, Class clazz, ThrowingRunnable run) { + assertEquals(message, assertThrows(clazz, run).getMessage()); + } + @Test public void assertValuePredicateNoMatch() { - assertThrows("Value not present", AssertionError.class, () -> { + assertThrowsWithMessage("Value 1 (class: Integer) at position 0 did not pass the predicate (latch = 0, values = 1, errors = 0, completions = 1)", AssertionError.class, () -> { TestSubscriber ts = new TestSubscriber<>(); Flowable.just(1).subscribe(ts); @@ -1408,7 +1413,7 @@ public void assertValuePredicateNoMatch() { @Test public void assertValuePredicateMatchButMore() { - assertThrows("Value present but other values as well", AssertionError.class, () -> { + assertThrowsWithMessage("The first value passed the predicate but this consumer received more than one value (latch = 0, values = 2, errors = 0, completions = 1)", AssertionError.class, () -> { TestSubscriber ts = new TestSubscriber<>(); Flowable.just(1, 2).subscribe(ts); @@ -1423,7 +1428,7 @@ public void assertValuePredicateMatchButMore() { @Test public void assertValueAtPredicateEmpty() { - assertThrows("No values", AssertionError.class, () -> { + assertThrowsWithMessage("No values (latch = 0, values = 0, errors = 0, completions = 1)", AssertionError.class, () -> { TestSubscriber ts = new TestSubscriber<>(); Flowable.empty().subscribe(ts); @@ -1451,7 +1456,7 @@ public void assertValueAtPredicateMatch() { @Test public void assertValueAtPredicateNoMatch() { - assertThrows("Value not present", AssertionError.class, () -> { + assertThrowsWithMessage("Value 3 (class: Integer) at position 2 did not pass the predicate (latch = 0, values = 3, errors = 0, completions = 1)", AssertionError.class, () -> { TestSubscriber ts = new TestSubscriber<>(); Flowable.just(1, 2, 3).subscribe(ts); @@ -1466,7 +1471,7 @@ public void assertValueAtPredicateNoMatch() { @Test public void assertValueAtInvalidIndex() { - assertThrows("Invalid index: 2 (latch = 0, values = 2, errors = 0, completions = 1)", AssertionError.class, () -> { + assertThrowsWithMessage("Index 2 is out of range [0, 2) (latch = 0, values = 2, errors = 0, completions = 1)", AssertionError.class, () -> { TestSubscriber ts = new TestSubscriber<>(); Flowable.just(1, 2).subscribe(ts); @@ -1479,6 +1484,43 @@ public void assertValueAtInvalidIndex() { }); } + @Test + public void assertValueAtIndexInvalidIndex() { + assertThrowsWithMessage("Index 2 is out of range [0, 2) (latch = 0, values = 2, errors = 0, completions = 1)", AssertionError.class, () -> { + TestSubscriber ts = new TestSubscriber<>(); + + Flowable.just(1, 2).subscribe(ts); + + ts.assertValueAt(2, 3); + }); + } + + @Test + public void assertValueAtIndexInvalidIndexNegative() { + assertThrowsWithMessage("Index -2 is out of range [0, 2) (latch = 0, values = 2, errors = 0, completions = 1)", AssertionError.class, () -> { + TestSubscriber ts = new TestSubscriber<>(); + + Flowable.just(1, 2).subscribe(ts); + + ts.assertValueAt(-2, 3); + }); + } + + @Test + public void assertValueAtInvalidIndexNegative() { + assertThrowsWithMessage("Index -2 is out of range [0, 2) (latch = 0, values = 2, errors = 0, completions = 1)", AssertionError.class, () -> { + TestSubscriber ts = new TestSubscriber<>(); + + Flowable.just(1, 2).subscribe(ts); + + ts.assertValueAt(-2, new Predicate() { + @Override public boolean test(final Integer o) throws Exception { + return o == 1; + } + }); + }); + } + @Test public void requestMore() { Flowable.range(1, 5) diff --git a/src/test/java/io/reactivex/rxjava3/tck/AllTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/AllTckTest.java index 5d2ce5eed9..4b8060fba9 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/AllTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/AllTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/AmbArrayTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/AmbArrayTckTest.java index 88b24a00ab..1260dd2d58 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/AmbArrayTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/AmbArrayTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/AmbTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/AmbTckTest.java index a0d4a63764..6c687b7461 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/AmbTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/AmbTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/AnyTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/AnyTckTest.java index 5d93dd5462..34e9fe5517 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/AnyTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/AnyTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/AsyncProcessorAsPublisherTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/AsyncProcessorAsPublisherTckTest.java index 87dd4afb33..87a75f0052 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/AsyncProcessorAsPublisherTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/AsyncProcessorAsPublisherTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/BaseTck.java b/src/test/java/io/reactivex/rxjava3/tck/BaseTck.java index 4de830b877..aa42bcc03a 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/BaseTck.java +++ b/src/test/java/io/reactivex/rxjava3/tck/BaseTck.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/BehaviorProcessorAsPublisherTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/BehaviorProcessorAsPublisherTckTest.java index 219a8ab1a2..94c5e15c14 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/BehaviorProcessorAsPublisherTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/BehaviorProcessorAsPublisherTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/BufferBoundaryTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/BufferBoundaryTckTest.java index 18a6fe4a21..cf79b210d6 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/BufferBoundaryTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/BufferBoundaryTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/BufferExactSizeTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/BufferExactSizeTckTest.java index 5af053e052..d4b7a7abf5 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/BufferExactSizeTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/BufferExactSizeTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/CacheTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/CacheTckTest.java index 460fb80e70..ec9c481fdc 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/CacheTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/CacheTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/CollectTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/CollectTckTest.java index fe09c2f061..76c359f327 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/CollectTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/CollectTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/CombineLatestArrayDelayErrorTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/CombineLatestArrayDelayErrorTckTest.java index ec7005ea41..80bccac273 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/CombineLatestArrayDelayErrorTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/CombineLatestArrayDelayErrorTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/CombineLatestArrayTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/CombineLatestArrayTckTest.java index 2cebfe655b..c5a040dc25 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/CombineLatestArrayTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/CombineLatestArrayTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/CombineLatestIterableDelayErrorTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/CombineLatestIterableDelayErrorTckTest.java index 5581b9551e..41883ab6c1 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/CombineLatestIterableDelayErrorTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/CombineLatestIterableDelayErrorTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/CombineLatestIterableTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/CombineLatestIterableTckTest.java index 744d909949..a7b9279a56 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/CombineLatestIterableTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/CombineLatestIterableTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/CompletableAndThenPublisherTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/CompletableAndThenPublisherTckTest.java index 9e9eae893d..22c1d4ceef 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/CompletableAndThenPublisherTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/CompletableAndThenPublisherTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ConcatArrayEagerTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ConcatArrayEagerTckTest.java index 9885f3b939..25afb45060 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ConcatArrayEagerTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ConcatArrayEagerTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ConcatIterableEagerTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ConcatIterableEagerTckTest.java index e365418449..491f211cc2 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ConcatIterableEagerTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ConcatIterableEagerTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ConcatMapIterableTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ConcatMapIterableTckTest.java index 43dcb2cf20..1a5ab46193 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ConcatMapIterableTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ConcatMapIterableTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ConcatMapMaybeTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ConcatMapMaybeTckTest.java index f01d8ec511..5216b6a50f 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ConcatMapMaybeTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ConcatMapMaybeTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ConcatMapSingleTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ConcatMapSingleTckTest.java index 9259f0dcd9..5d41ff6775 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ConcatMapSingleTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ConcatMapSingleTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ConcatMapTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ConcatMapTckTest.java index 7629d88742..83a3774193 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ConcatMapTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ConcatMapTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ConcatPublisherEagerTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ConcatPublisherEagerTckTest.java index 126fe4f01a..194d7e79de 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ConcatPublisherEagerTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ConcatPublisherEagerTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ConcatPublisherTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ConcatPublisherTckTest.java index 4bbfe152f7..ad61abd029 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ConcatPublisherTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ConcatPublisherTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ConcatTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ConcatTckTest.java index 1ad7d79412..c5eb360c73 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ConcatTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ConcatTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ConcatWithCompletableTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ConcatWithCompletableTckTest.java index a1431efbf8..a5734952f5 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ConcatWithCompletableTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ConcatWithCompletableTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ConcatWithMaybeEmptyTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ConcatWithMaybeEmptyTckTest.java index 81611f79e4..e333457b82 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ConcatWithMaybeEmptyTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ConcatWithMaybeEmptyTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ConcatWithMaybeTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ConcatWithMaybeTckTest.java index 08ecaee5ac..b56ac86eac 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ConcatWithMaybeTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ConcatWithMaybeTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ConcatWithSingleTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ConcatWithSingleTckTest.java index 234ebdf419..56746e24fc 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ConcatWithSingleTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ConcatWithSingleTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/CreateTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/CreateTckTest.java index 45a2d86ad7..ff4b0597d8 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/CreateTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/CreateTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/DefaultIfEmptyTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/DefaultIfEmptyTckTest.java index d8692cfc36..c9d9078bf5 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/DefaultIfEmptyTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/DefaultIfEmptyTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/DeferTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/DeferTckTest.java index cb75dbb290..f834c1e637 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/DeferTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/DeferTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/DelaySubscriptionTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/DelaySubscriptionTckTest.java index 28cc3243d7..5db6d0b877 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/DelaySubscriptionTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/DelaySubscriptionTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/DelayTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/DelayTckTest.java index d2d4c08de9..87ccaa37d2 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/DelayTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/DelayTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/DistinctTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/DistinctTckTest.java index 35fe953720..629d96fee6 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/DistinctTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/DistinctTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/DistinctUntilChangedTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/DistinctUntilChangedTckTest.java index 4c08351e46..ba69771a4f 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/DistinctUntilChangedTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/DistinctUntilChangedTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/DoAfterNextTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/DoAfterNextTckTest.java index 1f988ee9f0..3b8fbebecb 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/DoAfterNextTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/DoAfterNextTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/DoFinallyTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/DoFinallyTckTest.java index e59dc8ba7d..029892f440 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/DoFinallyTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/DoFinallyTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/DoOnNextTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/DoOnNextTckTest.java index 418535f8e4..f7e343803b 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/DoOnNextTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/DoOnNextTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ElementAtTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ElementAtTckTest.java index 1563beb090..58e18778d0 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ElementAtTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ElementAtTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/EmptyTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/EmptyTckTest.java index 0b960f51b0..da65d54fe4 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/EmptyTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/EmptyTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/FilterTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/FilterTckTest.java index fc3cf46588..6c975dabfc 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/FilterTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/FilterTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/FirstTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/FirstTckTest.java index 5dac1a42f1..29082117dd 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/FirstTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/FirstTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/FlatMapTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/FlatMapTckTest.java index 39b9afc454..88e937f282 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/FlatMapTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/FlatMapTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/FromArrayTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/FromArrayTckTest.java index d8d88a1e68..84bcb0b70d 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/FromArrayTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/FromArrayTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/FromCallableTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/FromCallableTckTest.java index e235109619..d786060933 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/FromCallableTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/FromCallableTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/FromFutureTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/FromFutureTckTest.java index 7b47ac3192..edff3c277b 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/FromFutureTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/FromFutureTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/FromIterableTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/FromIterableTckTest.java index 0418584039..94dc77c555 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/FromIterableTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/FromIterableTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/FromSupplierTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/FromSupplierTckTest.java index a19028deb8..acbe1df8b0 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/FromSupplierTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/FromSupplierTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/GenerateTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/GenerateTckTest.java index 97cbb4a811..b5c5ef30f6 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/GenerateTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/GenerateTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/GroupByTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/GroupByTckTest.java index 7d5f0503da..ebaedb86ae 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/GroupByTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/GroupByTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/HideTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/HideTckTest.java index 6fa26977c1..62c3e76c4e 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/HideTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/HideTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/IgnoreElementsTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/IgnoreElementsTckTest.java index 6a1848e88a..289e2e90eb 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/IgnoreElementsTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/IgnoreElementsTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/IntervalRangeTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/IntervalRangeTckTest.java index 181823e981..b6c09d3d21 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/IntervalRangeTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/IntervalRangeTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/IntervalTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/IntervalTckTest.java index 05a25f6774..b9a01afc32 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/IntervalTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/IntervalTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/IsEmptyTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/IsEmptyTckTest.java index 73cfb28550..a9ffce0294 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/IsEmptyTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/IsEmptyTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/JustTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/JustTckTest.java index 02805e5125..668b32a31a 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/JustTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/JustTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/LastTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/LastTckTest.java index facdb09c32..eb75e0342a 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/LastTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/LastTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/LimitTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/LimitTckTest.java index 3fe61b627a..08c526af03 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/LimitTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/LimitTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/MapTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/MapTckTest.java index 6c27b381d2..9875c412ac 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/MapTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/MapTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/MaybeFlatMapPublisherTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/MaybeFlatMapPublisherTckTest.java index 7b582b97c5..d23521b8ab 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/MaybeFlatMapPublisherTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/MaybeFlatMapPublisherTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/MergeIterableTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/MergeIterableTckTest.java index 79d781d848..38a105e2be 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/MergeIterableTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/MergeIterableTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/MergePublisherTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/MergePublisherTckTest.java index 71241d03b1..42baefbf64 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/MergePublisherTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/MergePublisherTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/MergeTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/MergeTckTest.java index aaefe13fee..d0280ca83d 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/MergeTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/MergeTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/MergeWithCompletableTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/MergeWithCompletableTckTest.java index 7345c157da..e7cd1a2aac 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/MergeWithCompletableTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/MergeWithCompletableTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/MergeWithMaybeEmptyTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/MergeWithMaybeEmptyTckTest.java index cb7e919577..cd8bec5079 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/MergeWithMaybeEmptyTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/MergeWithMaybeEmptyTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/MergeWithMaybeTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/MergeWithMaybeTckTest.java index d064babcdf..1da618c609 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/MergeWithMaybeTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/MergeWithMaybeTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/MergeWithSingleTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/MergeWithSingleTckTest.java index cf0c894eae..0933253418 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/MergeWithSingleTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/MergeWithSingleTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/MulticastProcessorAsPublisherTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/MulticastProcessorAsPublisherTckTest.java index 0c78050212..b4479181d3 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/MulticastProcessorAsPublisherTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/MulticastProcessorAsPublisherTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/MulticastProcessorRefCountedTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/MulticastProcessorRefCountedTckTest.java index 53b150ef5e..907d3e3f3f 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/MulticastProcessorRefCountedTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/MulticastProcessorRefCountedTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/MulticastProcessorTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/MulticastProcessorTckTest.java index ed6de68012..ac82f963f7 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/MulticastProcessorTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/MulticastProcessorTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ObserveOnTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ObserveOnTckTest.java index 4b897c82be..d6e555be9c 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ObserveOnTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ObserveOnTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/OnBackpressureBufferTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/OnBackpressureBufferTckTest.java index 86839c926f..58053819aa 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/OnBackpressureBufferTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/OnBackpressureBufferTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/OnErrorResumeWithTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/OnErrorResumeWithTckTest.java index d70e27bcf2..4d239c9f4d 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/OnErrorResumeWithTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/OnErrorResumeWithTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/OnErrorReturnItemTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/OnErrorReturnItemTckTest.java index 708fe26829..abd7b28a4f 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/OnErrorReturnItemTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/OnErrorReturnItemTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/PublishProcessorAsPublisherTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/PublishProcessorAsPublisherTckTest.java index 6154fd4b11..8e596b1995 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/PublishProcessorAsPublisherTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/PublishProcessorAsPublisherTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/PublishSelectorTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/PublishSelectorTckTest.java index 85cc653825..f996fabe36 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/PublishSelectorTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/PublishSelectorTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/PublishTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/PublishTckTest.java index 8d436c2a06..b85684d1da 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/PublishTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/PublishTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/RangeTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/RangeTckTest.java index 3cba4e0566..53f3ca180e 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/RangeTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/RangeTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/RebatchRequestsTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/RebatchRequestsTckTest.java index cca0025f76..c08682d237 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/RebatchRequestsTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/RebatchRequestsTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ReduceTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ReduceTckTest.java index 70253dcafb..9495021488 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ReduceTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ReduceTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ReduceWithTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ReduceWithTckTest.java index ba56f602c7..9a4f404982 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ReduceWithTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ReduceWithTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/RefCountProcessor.java b/src/test/java/io/reactivex/rxjava3/tck/RefCountProcessor.java index c65a0bd58f..f7c62cf752 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/RefCountProcessor.java +++ b/src/test/java/io/reactivex/rxjava3/tck/RefCountProcessor.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/RepeatTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/RepeatTckTest.java index 1af7ffa8ff..32f5832afd 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/RepeatTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/RepeatTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ReplayProcessorSizeBoundAsPublisherTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ReplayProcessorSizeBoundAsPublisherTckTest.java index 9608b57358..a32e49c6b9 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ReplayProcessorSizeBoundAsPublisherTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ReplayProcessorSizeBoundAsPublisherTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ReplayProcessorTimeBoundAsPublisherTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ReplayProcessorTimeBoundAsPublisherTckTest.java index 41e5529796..f53df02ae6 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ReplayProcessorTimeBoundAsPublisherTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ReplayProcessorTimeBoundAsPublisherTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ReplayProcessorUnboundedAsPublisherTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ReplayProcessorUnboundedAsPublisherTckTest.java index 3bc7682284..6f286d68de 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ReplayProcessorUnboundedAsPublisherTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ReplayProcessorUnboundedAsPublisherTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ReplaySelectorTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ReplaySelectorTckTest.java index e944e57955..84b1a86d45 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ReplaySelectorTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ReplaySelectorTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ReplayTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ReplayTckTest.java index 4380e95746..f62ffb08f3 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ReplayTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ReplayTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/RetryTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/RetryTckTest.java index d2608c2dce..ba0a0f4b1f 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/RetryTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/RetryTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ScanTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ScanTckTest.java index 231e9a2590..8a43120c02 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ScanTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ScanTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/SequenceEqualTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/SequenceEqualTckTest.java index 6c01635403..a4af22ed7e 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/SequenceEqualTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/SequenceEqualTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ShareTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ShareTckTest.java index 6e6b57e1b5..35c9b08e4b 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ShareTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ShareTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/SingleFlatMapFlowableTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/SingleFlatMapFlowableTckTest.java index 653ad462c1..62565e6470 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/SingleFlatMapFlowableTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/SingleFlatMapFlowableTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/SingleTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/SingleTckTest.java index 10de09fba7..96af86f6bb 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/SingleTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/SingleTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/SkipLastTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/SkipLastTckTest.java index 9583bbe646..953986813f 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/SkipLastTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/SkipLastTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/SkipTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/SkipTckTest.java index fcd248374e..4f29940485 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/SkipTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/SkipTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/SkipUntilTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/SkipUntilTckTest.java index 762ca1256b..976c4983f1 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/SkipUntilTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/SkipUntilTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/SkipWhileTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/SkipWhileTckTest.java index b560bb4694..e4995aedd8 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/SkipWhileTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/SkipWhileTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/SortedTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/SortedTckTest.java index c8132593e2..51ff134a9c 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/SortedTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/SortedTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/SubscribeOnTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/SubscribeOnTckTest.java index c38720d6d0..f4303d5605 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/SubscribeOnTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/SubscribeOnTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/SwitchIfEmptyTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/SwitchIfEmptyTckTest.java index 9ba97747ff..eb792e45f0 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/SwitchIfEmptyTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/SwitchIfEmptyTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/SwitchMapDelayErrorTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/SwitchMapDelayErrorTckTest.java index cb27667aec..d9086e275d 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/SwitchMapDelayErrorTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/SwitchMapDelayErrorTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/SwitchMapTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/SwitchMapTckTest.java index 1d8ec8f800..1d41a6d11b 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/SwitchMapTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/SwitchMapTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/SwitchOnNextTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/SwitchOnNextTckTest.java index d275ca6766..196bf4f825 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/SwitchOnNextTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/SwitchOnNextTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/TakeLastTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/TakeLastTckTest.java index 594db93c9f..c737554363 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/TakeLastTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/TakeLastTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/TakeTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/TakeTckTest.java index 1b2529c914..50fe18caf1 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/TakeTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/TakeTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/TakeUntilTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/TakeUntilTckTest.java index 256c01cc00..9695560615 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/TakeUntilTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/TakeUntilTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/TakeWhileTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/TakeWhileTckTest.java index aa2d32939b..24f6bd4d0d 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/TakeWhileTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/TakeWhileTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/TimeIntervalTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/TimeIntervalTckTest.java index d0c7cd52f4..3daebf143a 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/TimeIntervalTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/TimeIntervalTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/TimeoutTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/TimeoutTckTest.java index 52ad8d01aa..447a60e951 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/TimeoutTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/TimeoutTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/TimerTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/TimerTckTest.java index 5e280bd520..4a6eb00005 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/TimerTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/TimerTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/TimestampTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/TimestampTckTest.java index acdef0b9ee..48d34c8751 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/TimestampTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/TimestampTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ToListTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ToListTckTest.java index 7d7c11bf8c..e9d17f370f 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ToListTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ToListTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ToMapTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ToMapTckTest.java index 8fe4361189..ae27183ca0 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ToMapTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ToMapTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ToMultimapTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ToMultimapTckTest.java index 925f147a7e..c0d65cbd33 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ToMultimapTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ToMultimapTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ToSortedListTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ToSortedListTckTest.java index fed8ec3669..11d1029fc2 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ToSortedListTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ToSortedListTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/UnicastProcessorAsPublisherTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/UnicastProcessorAsPublisherTckTest.java index 142ffbd4a7..a888ce35fa 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/UnicastProcessorAsPublisherTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/UnicastProcessorAsPublisherTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/UnicastProcessorTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/UnicastProcessorTckTest.java index 079c349245..44bcc5a142 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/UnicastProcessorTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/UnicastProcessorTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/UnsubscribeOnTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/UnsubscribeOnTckTest.java index c3a386f387..1ab8398b74 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/UnsubscribeOnTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/UnsubscribeOnTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/UsingTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/UsingTckTest.java index 9c0e41f3d9..03460fdaba 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/UsingTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/UsingTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/WindowBoundaryTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/WindowBoundaryTckTest.java index bee09d0eb5..5b01ad696c 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/WindowBoundaryTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/WindowBoundaryTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/WindowExactSizeTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/WindowExactSizeTckTest.java index 5ee3500379..dae3bf0c45 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/WindowExactSizeTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/WindowExactSizeTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/WithLatestFromTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/WithLatestFromTckTest.java index 3d91048c37..ae7cddb7f9 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/WithLatestFromTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/WithLatestFromTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ZipIterableTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ZipIterableTckTest.java index 8ef456e609..9dae4bcd9a 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ZipIterableTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ZipIterableTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ZipTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ZipTckTest.java index 4c94e97ed7..c9427876d8 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ZipTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ZipTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ZipWithIterableTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ZipWithIterableTckTest.java index 2d9eae43ea..6a4cde43f5 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ZipWithIterableTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ZipWithIterableTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/tck/ZipWithTckTest.java b/src/test/java/io/reactivex/rxjava3/tck/ZipWithTckTest.java index f71dd6b98d..6992605ad8 100644 --- a/src/test/java/io/reactivex/rxjava3/tck/ZipWithTckTest.java +++ b/src/test/java/io/reactivex/rxjava3/tck/ZipWithTckTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/testsupport/BaseTestConsumerEx.java b/src/test/java/io/reactivex/rxjava3/testsupport/BaseTestConsumerEx.java index 8eb1d9f906..47016f1fa5 100644 --- a/src/test/java/io/reactivex/rxjava3/testsupport/BaseTestConsumerEx.java +++ b/src/test/java/io/reactivex/rxjava3/testsupport/BaseTestConsumerEx.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -16,9 +16,10 @@ import java.util.List; import io.reactivex.rxjava3.functions.Predicate; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.internal.util.ExceptionHelper; import io.reactivex.rxjava3.observers.BaseTestConsumer; +import io.reactivex.rxjava3.operators.QueueFuseable; + import java.util.Objects; /** @@ -159,7 +160,8 @@ public final U assertErrorMessage(String message) { Throwable e = errors.get(0); String errorMessage = e.getMessage(); if (!Objects.equals(message, errorMessage)) { - throw fail("Error message differs; exptected: " + message + " but was: " + errorMessage); + throw fail("\nexpected: " + message + "\ngot: " + errorMessage + + "; Error message differs"); } } else { throw fail("Multiple errors"); diff --git a/src/test/java/io/reactivex/rxjava3/testsupport/SuppressUndeliverable.java b/src/test/java/io/reactivex/rxjava3/testsupport/SuppressUndeliverable.java index 448b896ce0..4e701137ab 100644 --- a/src/test/java/io/reactivex/rxjava3/testsupport/SuppressUndeliverable.java +++ b/src/test/java/io/reactivex/rxjava3/testsupport/SuppressUndeliverable.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.testsupport; import java.lang.annotation.*; diff --git a/src/test/java/io/reactivex/rxjava3/testsupport/SuppressUndeliverableRule.java b/src/test/java/io/reactivex/rxjava3/testsupport/SuppressUndeliverableRule.java index fa78a23410..28f6d2f89e 100644 --- a/src/test/java/io/reactivex/rxjava3/testsupport/SuppressUndeliverableRule.java +++ b/src/test/java/io/reactivex/rxjava3/testsupport/SuppressUndeliverableRule.java @@ -1,18 +1,16 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * - * Licensed 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 + * Licensed 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. + * 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 io.reactivex.rxjava3.testsupport; import org.junit.rules.TestRule; diff --git a/src/test/java/io/reactivex/rxjava3/testsupport/TestHelper.java b/src/test/java/io/reactivex/rxjava3/testsupport/TestHelper.java index dfaccd6ac5..d38ad8f998 100644 --- a/src/test/java/io/reactivex/rxjava3/testsupport/TestHelper.java +++ b/src/test/java/io/reactivex/rxjava3/testsupport/TestHelper.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -37,13 +37,17 @@ import io.reactivex.rxjava3.disposables.*; import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.operators.completable.CompletableToFlowable; import io.reactivex.rxjava3.internal.operators.maybe.MaybeToFlowable; import io.reactivex.rxjava3.internal.operators.single.SingleToFlowable; import io.reactivex.rxjava3.internal.subscriptions.*; import io.reactivex.rxjava3.internal.util.ExceptionHelper; import io.reactivex.rxjava3.observers.BaseTestConsumer; +import io.reactivex.rxjava3.operators.ConditionalSubscriber; +import io.reactivex.rxjava3.operators.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueSubscription; +import io.reactivex.rxjava3.operators.SimpleQueue; import io.reactivex.rxjava3.parallel.ParallelFlowable; import io.reactivex.rxjava3.plugins.RxJavaPlugins; import io.reactivex.rxjava3.processors.PublishProcessor; @@ -2436,23 +2440,16 @@ public static void assertCompositeExceptions(TestSubscriberEx ts, Class ts, Object... classes) { + public static void assertCompositeExceptions(TestSubscriberEx ts, Object... classesAndMessages) { ts .assertSubscribed() .assertError(CompositeException.class) .assertNotComplete(); - List list = compositeList(ts.errors().get(0)); - - assertEquals(classes.length, list.size()); - - for (int i = 0; i < classes.length; i += 2) { - assertError(list, i, (Class)classes[i], (String)classes[i + 1]); - } + assertCompositeExceptionListOf(ts.errors().get(0), classesAndMessages); } /** @@ -2481,22 +2478,26 @@ public static void assertCompositeExceptions(TestObserverEx to, Class to, Object... classes) { + public static void assertCompositeExceptions(TestObserverEx to, Object... classesAndMessages) { to .assertSubscribed() .assertError(CompositeException.class) .assertNotComplete(); - List list = compositeList(to.errors().get(0)); + assertCompositeExceptionListOf(to.errors().get(0), classesAndMessages); + } - assertEquals(classes.length, list.size()); + @SuppressWarnings("unchecked") + static void assertCompositeExceptionListOf(Throwable ex, Object... classesAndMessages) { + List list = compositeList(ex); + + assertEquals(classesAndMessages.length, 2 * list.size()); - for (int i = 0; i < classes.length; i += 2) { - assertError(list, i, (Class)classes[i], (String)classes[i + 1]); + for (int i = 0; i < list.size(); i++) { + assertError(list, i, (Class)classesAndMessages[2 * i], (String)classesAndMessages[2 * i + 1]); } } @@ -3018,6 +3019,12 @@ public static void checkInvalidParallelSubscribers(ParallelFlowable sourc } } + /** + * Creates a fuseable Observable that does not emit anything but rejects + * fusion requests. + * @param the element type + * @return the new Observable + */ public static Observable rejectObservableFusion() { return new Observable() { @Override @@ -3066,6 +3073,12 @@ public boolean isDisposed() { }; } + /** + * Creates a fuseable Flowable that does not emit anything but rejects + * fusion requests. + * @param the element type + * @return the new Observable + */ public static Flowable rejectFlowableFusion() { return new Flowable() { @Override @@ -3503,18 +3516,26 @@ public static File findSource(String baseClassName, String parentPackage) throws parentPackage = parentPackage.replace(".", "/"); // System.out.println(path); - int i = path.toLowerCase().indexOf("/rxjava"); - if (i < 0) { - System.out.println("Can't find the base RxJava directory"); - return null; - } - - // find end of any potential postfix to /RxJava - int j = path.indexOf("/", i + 6); + // Locate the src/main/java directory + String p = null; + while (true) { + int idx = path.lastIndexOf("/"); + if (idx < 0) { + break; + } + path = path.substring(0, idx); + String check = path + "/src/main/java"; - String basePackage = path.substring(0, j + 1) + "src/main/java"; + if (new File(check).exists()) { + p = check + "/" + parentPackage + "/" + baseClassName + ".java"; + break; + } + } - String p = basePackage + "/" + parentPackage + "/" + baseClassName + ".java"; + if (p == null) { + System.err.println("Unable to locate the RxJava sources"); + return null; + } File f = new File(p); diff --git a/src/test/java/io/reactivex/rxjava3/testsupport/TestObserverEx.java b/src/test/java/io/reactivex/rxjava3/testsupport/TestObserverEx.java index ff7df2d8b3..f029ce5457 100644 --- a/src/test/java/io/reactivex/rxjava3/testsupport/TestObserverEx.java +++ b/src/test/java/io/reactivex/rxjava3/testsupport/TestObserverEx.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.testsupport; import java.util.concurrent.atomic.AtomicReference; @@ -17,7 +18,8 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; -import io.reactivex.rxjava3.internal.fuseable.*; +import io.reactivex.rxjava3.operators.QueueDisposable; +import io.reactivex.rxjava3.operators.QueueFuseable; /** * An extended test Observer that records events and allows making assertions about them. @@ -252,8 +254,8 @@ public final TestObserverEx assertFusionMode(int mode) { int m = establishedFusionMode; if (m != mode) { if (qd != null) { - throw new AssertionError("Fusion mode different. Expected: " + fusionModeToString(mode) - + ", actual: " + fusionModeToString(m)); + throw new AssertionError("\nexpected: " + fusionModeToString(mode) + + "\ngot: " + fusionModeToString(m) + "; Fusion mode different"); } else { throw fail("Upstream is not fuseable"); } diff --git a/src/test/java/io/reactivex/rxjava3/testsupport/TestObserverExTest.java b/src/test/java/io/reactivex/rxjava3/testsupport/TestObserverExTest.java index 6026501a1d..2296ceb757 100644 --- a/src/test/java/io/reactivex/rxjava3/testsupport/TestObserverExTest.java +++ b/src/test/java/io/reactivex/rxjava3/testsupport/TestObserverExTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -30,9 +30,9 @@ import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.internal.operators.observable.ObservableScalarXMap.ScalarDisposable; import io.reactivex.rxjava3.observers.TestObserver; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.subjects.*; @@ -1274,7 +1274,7 @@ public void assertValueAtIndexMatch() { @Test public void assertValueAtIndexNoMatch() { - assertThrows("expected: b (class: String) but was: c (class: String) (latch = 0, values = 3, errors = 0, completions = 1)", AssertionError.class, () -> { + assertThrows("\nexpected: b (class: String)\ngot: c (class: String) (latch = 0, values = 3, errors = 0, completions = 1)", AssertionError.class, () -> { TestObserverEx to = new TestObserverEx<>(); Observable.just("a", "b", "c").subscribe(to); diff --git a/src/test/java/io/reactivex/rxjava3/testsupport/TestSubscriberEx.java b/src/test/java/io/reactivex/rxjava3/testsupport/TestSubscriberEx.java index 43d4087c3e..c3d9837c2b 100644 --- a/src/test/java/io/reactivex/rxjava3/testsupport/TestSubscriberEx.java +++ b/src/test/java/io/reactivex/rxjava3/testsupport/TestSubscriberEx.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -10,6 +10,7 @@ * 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 io.reactivex.rxjava3.testsupport; import java.util.concurrent.atomic.*; @@ -17,8 +18,9 @@ import org.reactivestreams.*; import io.reactivex.rxjava3.core.FlowableSubscriber; -import io.reactivex.rxjava3.internal.fuseable.*; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; +import io.reactivex.rxjava3.operators.QueueFuseable; +import io.reactivex.rxjava3.operators.QueueSubscription; /** * An extended test subscriber that records events and allows making assertions about them. @@ -315,8 +317,8 @@ public final TestSubscriberEx assertFusionMode(int mode) { int m = establishedFusionMode; if (m != mode) { if (qs != null) { - throw new AssertionError("Fusion mode different. Expected: " + fusionModeToString(mode) - + ", actual: " + fusionModeToString(m)); + throw new AssertionError("\nexpected: " + fusionModeToString(mode) + + "\ngot: " + fusionModeToString(m) + "; Fusion mode different"); } else { throw fail("Upstream is not fuseable"); } diff --git a/src/test/java/io/reactivex/rxjava3/testsupport/TestSubscriberExTest.java b/src/test/java/io/reactivex/rxjava3/testsupport/TestSubscriberExTest.java index 0918c08e11..f3d19f9cc7 100644 --- a/src/test/java/io/reactivex/rxjava3/testsupport/TestSubscriberExTest.java +++ b/src/test/java/io/reactivex/rxjava3/testsupport/TestSubscriberExTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -30,8 +30,8 @@ import io.reactivex.rxjava3.exceptions.*; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; -import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.internal.subscriptions.*; +import io.reactivex.rxjava3.operators.QueueFuseable; import io.reactivex.rxjava3.processors.*; import io.reactivex.rxjava3.schedulers.Schedulers; diff --git a/src/test/java/io/reactivex/rxjava3/testsupport/TimesteppingScheduler.java b/src/test/java/io/reactivex/rxjava3/testsupport/TimesteppingScheduler.java index 2615a3fbe5..06804fa282 100644 --- a/src/test/java/io/reactivex/rxjava3/testsupport/TimesteppingScheduler.java +++ b/src/test/java/io/reactivex/rxjava3/testsupport/TimesteppingScheduler.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/validators/BaseTypeAnnotations.java b/src/test/java/io/reactivex/rxjava3/validators/BaseTypeAnnotations.java index 504232be2e..582df0fa71 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/BaseTypeAnnotations.java +++ b/src/test/java/io/reactivex/rxjava3/validators/BaseTypeAnnotations.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -22,6 +22,7 @@ import io.reactivex.rxjava3.annotations.*; import io.reactivex.rxjava3.core.*; +import io.reactivex.rxjava3.disposables.DisposableContainer; import io.reactivex.rxjava3.flowables.ConnectableFlowable; import io.reactivex.rxjava3.observables.ConnectableObservable; import io.reactivex.rxjava3.parallel.ParallelFlowable; @@ -44,7 +45,8 @@ static void checkCheckReturnValueSupport(Class clazz) { for (Method m : clazz.getMethods()) { if (m.getDeclaringClass() == clazz) { - boolean isSubscribeMethod = "subscribe".equals(m.getName()) && m.getParameterTypes().length == 0; + boolean isSubscribeMethod = "subscribe".equals(m.getName()) && + (m.getParameterTypes().length == 0 || m.getParameterTypes()[m.getParameterCount() - 1] == DisposableContainer.class); boolean isConnectMethod = "connect".equals(m.getName()) && m.getParameterTypes().length == 0; boolean isAnnotationPresent = m.isAnnotationPresent(CheckReturnValue.class); diff --git a/src/test/java/io/reactivex/rxjava3/validators/BaseTypeParser.java b/src/test/java/io/reactivex/rxjava3/validators/BaseTypeParser.java index 39704aba14..528ee6de97 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/BaseTypeParser.java +++ b/src/test/java/io/reactivex/rxjava3/validators/BaseTypeParser.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/validators/CatchThrowIfFatalCheck.java b/src/test/java/io/reactivex/rxjava3/validators/CatchThrowIfFatalCheck.java index 5b78a2da0a..45594fe17b 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/CatchThrowIfFatalCheck.java +++ b/src/test/java/io/reactivex/rxjava3/validators/CatchThrowIfFatalCheck.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/validators/CheckLocalVariablesInTests.java b/src/test/java/io/reactivex/rxjava3/validators/CheckLocalVariablesInTests.java index df6f0a378a..0ec5952f8b 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/CheckLocalVariablesInTests.java +++ b/src/test/java/io/reactivex/rxjava3/validators/CheckLocalVariablesInTests.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/validators/FixLicenseHeaders.java b/src/test/java/io/reactivex/rxjava3/validators/FixLicenseHeaders.java index c5e601d017..5d7223cbd1 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/FixLicenseHeaders.java +++ b/src/test/java/io/reactivex/rxjava3/validators/FixLicenseHeaders.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -26,7 +26,7 @@ public class FixLicenseHeaders { String[] header = { - "/**", + "/*", " * Copyright (c) 2016-present, RxJava Contributors.", " *", " * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in", @@ -88,7 +88,7 @@ public void checkAndUpdateLicenses() throws Exception { in.close(); } - if (!lines.get(0).equals(header[0]) && !lines.get(1).equals(header[1])) { + if (!lines.get(0).equals(header[0]) || !lines.get(1).equals(header[1])) { fail.append("java.lang.RuntimeException: missing header added, refresh and re-run tests!\r\n") .append(" at ") ; diff --git a/src/test/java/io/reactivex/rxjava3/validators/InternalWrongNaming.java b/src/test/java/io/reactivex/rxjava3/validators/InternalWrongNaming.java index a1ad772f05..bbf86c4188 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/InternalWrongNaming.java +++ b/src/test/java/io/reactivex/rxjava3/validators/InternalWrongNaming.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/validators/JavadocCodesAndLinks.java b/src/test/java/io/reactivex/rxjava3/validators/JavadocCodesAndLinks.java index 55cecb6097..698fdf7e83 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/JavadocCodesAndLinks.java +++ b/src/test/java/io/reactivex/rxjava3/validators/JavadocCodesAndLinks.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -65,6 +65,21 @@ public void checkCompositeDisposable() throws Exception { checkSource("CompositeDisposable", "io.reactivex.rxjava3.disposables"); } + @Test + public void checkConnectableFlowable() throws Exception { + checkSource("ConnectableFlowable", "io.reactivex.rxjava3.flowables"); + } + + @Test + public void checkConnectableObservable() throws Exception { + checkSource("ConnectableObservable", "io.reactivex.rxjava3.observables"); + } + + @Test + public void checkSchedulers() throws Exception { + checkSource("Schedulers", "io.reactivex.rxjava3.schedulers"); + } + static void checkSource(String baseClassName, String packageName) throws Exception { File f = TestHelper.findSource(baseClassName, packageName); if (f == null) { @@ -408,7 +423,9 @@ static void blankRange(StringBuilder builder, int start, int end) { "List", "ArrayList", "HashMap", "HashSet", "CharSequence", - "TestSubscriber", "TestObserver", "Class" + "TestSubscriber", "TestObserver", "Class", + + "ThreadFactory", "Runnable", "Executor", "ExecutorService", "Executors", "RejectedExecutionException" ); static final Set ALWAYS_CODE = new HashSet<>(Arrays.asList( diff --git a/src/test/java/io/reactivex/rxjava3/validators/JavadocFindUnescapedAngleBrackets.java b/src/test/java/io/reactivex/rxjava3/validators/JavadocFindUnescapedAngleBrackets.java index 083da2902c..016e1b02a2 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/JavadocFindUnescapedAngleBrackets.java +++ b/src/test/java/io/reactivex/rxjava3/validators/JavadocFindUnescapedAngleBrackets.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -12,6 +12,7 @@ */ package io.reactivex.rxjava3.validators; + import java.io.*; import java.util.*; diff --git a/src/test/java/io/reactivex/rxjava3/validators/JavadocForAnnotations.java b/src/test/java/io/reactivex/rxjava3/validators/JavadocForAnnotations.java index 9a63ea2b0d..1c683783d6 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/JavadocForAnnotations.java +++ b/src/test/java/io/reactivex/rxjava3/validators/JavadocForAnnotations.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -95,7 +95,7 @@ static final void scanFor(StringBuilder sourceCode, String annotation, String in ; int lc = lineNumber(sourceCode, idx); - e.append(" at io.reactivex.").append(baseClassName) + e.append(" at io.reactivex.rxjava3.core.").append(baseClassName) .append(" (").append(baseClassName).append(".java:") .append(lc).append(")").append("\r\n\r\n"); } diff --git a/src/test/java/io/reactivex/rxjava3/validators/JavadocWording.java b/src/test/java/io/reactivex/rxjava3/validators/JavadocWording.java index e22fdd9521..3ab41589a3 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/JavadocWording.java +++ b/src/test/java/io/reactivex/rxjava3/validators/JavadocWording.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -309,6 +309,7 @@ public void flowableDocRefersToFlowableTypes() throws Exception { && !m.signature.contains("Maybe") && !m.signature.contains("MaybeSource") && !m.signature.contains("Disposable") + && !m.signature.contains("void subscribe") ) { CharSequence subSequence = m.javadoc.subSequence(idx - 6, idx + 11); if (idx < 6 || !subSequence.equals("{@link Disposable")) { diff --git a/src/test/java/io/reactivex/rxjava3/validators/MaybeNo2Dot0Since.java b/src/test/java/io/reactivex/rxjava3/validators/MaybeNo2Dot0Since.java index f8b9e63164..b894492894 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/MaybeNo2Dot0Since.java +++ b/src/test/java/io/reactivex/rxjava3/validators/MaybeNo2Dot0Since.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/validators/NewLinesBeforeAnnotation.java b/src/test/java/io/reactivex/rxjava3/validators/NewLinesBeforeAnnotation.java index 36a0297a43..2c27fc6fd4 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/NewLinesBeforeAnnotation.java +++ b/src/test/java/io/reactivex/rxjava3/validators/NewLinesBeforeAnnotation.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/validators/NoAnonymousInnerClassesTest.java b/src/test/java/io/reactivex/rxjava3/validators/NoAnonymousInnerClassesTest.java index 47e5d1dfd6..61db410b5b 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/NoAnonymousInnerClassesTest.java +++ b/src/test/java/io/reactivex/rxjava3/validators/NoAnonymousInnerClassesTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/validators/NonNullMethodTypeArgumentCheck.java b/src/test/java/io/reactivex/rxjava3/validators/NonNullMethodTypeArgumentCheck.java new file mode 100644 index 0000000000..e8c4b81715 --- /dev/null +++ b/src/test/java/io/reactivex/rxjava3/validators/NonNullMethodTypeArgumentCheck.java @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed 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 io.reactivex.rxjava3.validators; + +import static org.junit.Assert.assertEquals; + +import java.io.*; +import java.nio.file.Files; +import java.util.*; + +import org.junit.Test; + +import io.reactivex.rxjava3.core.*; +import io.reactivex.rxjava3.core.Observable; +import io.reactivex.rxjava3.parallel.ParallelFlowable; +import io.reactivex.rxjava3.plugins.RxJavaPlugins; +import io.reactivex.rxjava3.testsupport.TestHelper; + +/** + * Verify static methods and final methods declaring type arguments + * declare {@code @NonNull} for said argument. + * + */ +public class NonNullMethodTypeArgumentCheck { + + static void process(Class clazz) { + + String className = clazz.getSimpleName(); + String parentPackage = clazz.getPackage().getName(); + + StringBuilder result = new StringBuilder(); + int count = 0; + + try { + File f = TestHelper.findSource(className, parentPackage); + + try (BufferedReader in = Files.newBufferedReader(f.toPath())) { + int lineCount = 1; + String line = null; + + while ((line = in.readLine()) != null) { + line = line.trim(); + + if (!line.contains(" to(")) { + if (line.startsWith("public static <") || line.startsWith("public final <")) { + + for (String ta : parseTypeArguments(line)) { + if (!ta.startsWith("@NonNull") && !ta.startsWith("@Nullable")) { + if (!("Maybe".equals(clazz.getSimpleName()) && (line.contains("fromCallable(") || line.contains("fromSupplier(")))) { + result.append("Missing annotation on argument ").append(ta).append("\r\nat ") + .append(parentPackage).append(".").append(className).append(".method(") + .append(className).append(".java:").append(lineCount).append(")\r\n"); + count++; + } + } + } + } + } + lineCount++; + } + } + } catch (Exception ex) { + throw new RuntimeException(ex); + } + + if (count != 0) { + throw new IllegalArgumentException("Found " + count + " cases\r\n" + result.toString()); + } + } + + static List parseTypeArguments(String line) { + List result = new ArrayList<>(); + int offset = line.indexOf("<"); + int c = 1; + int i = offset + 1; + int j = i; + for (; i < line.length(); i++) { + if (line.charAt(i) == '<') { + c++; + } else + if (line.charAt(i) == '>') { + c--; + if (c == 0) { + break; + } + } else + if (line.charAt(i) == ',' && c == 1) { + result.add(line.substring(j, i).trim()); + j = i + 1; + } + } + result.add(line.substring(j, i).trim()); + return result; + } + + @Test + public void parseTypeArguments() { + assertEquals(new ArrayList<>(Arrays.asList("T")), parseTypeArguments("")); + assertEquals(new ArrayList<>(Arrays.asList("T", "U")), parseTypeArguments("")); + assertEquals(new ArrayList<>(Arrays.asList("T", "Flowable")), parseTypeArguments(">")); + assertEquals(new ArrayList<>(Arrays.asList("T", "Flowable")), parseTypeArguments(">")); + } + + @Test + public void flowable() { + process(Flowable.class); + } + + @Test + public void observable() { + process(Observable.class); + } + + @Test + public void maybe() { + process(Maybe.class); + } + + @Test + public void single() { + process(Single.class); + } + + @Test + public void completable() { + process(Completable.class); + } + + @Test + public void parallel() { + process(ParallelFlowable.class); + } + + @Test + public void plugins() { + process(RxJavaPlugins.class); + } +} diff --git a/src/test/java/io/reactivex/rxjava3/validators/OperatorsAreFinal.java b/src/test/java/io/reactivex/rxjava3/validators/OperatorsAreFinal.java index 6343a6e02b..a59e3aefa2 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/OperatorsAreFinal.java +++ b/src/test/java/io/reactivex/rxjava3/validators/OperatorsAreFinal.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/validators/OperatorsUseInterfaces.java b/src/test/java/io/reactivex/rxjava3/validators/OperatorsUseInterfaces.java index a603a589fc..76d4a836f9 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/OperatorsUseInterfaces.java +++ b/src/test/java/io/reactivex/rxjava3/validators/OperatorsUseInterfaces.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/validators/ParamValidationCheckerTest.java b/src/test/java/io/reactivex/rxjava3/validators/ParamValidationCheckerTest.java index 7eff55d15e..c2ca87d4d2 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/ParamValidationCheckerTest.java +++ b/src/test/java/io/reactivex/rxjava3/validators/ParamValidationCheckerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -25,7 +25,7 @@ import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.core.Observable; import io.reactivex.rxjava3.core.Observer; -import io.reactivex.rxjava3.disposables.Disposable; +import io.reactivex.rxjava3.disposables.*; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.functions.*; import io.reactivex.rxjava3.internal.functions.Functions; @@ -149,9 +149,11 @@ public void checkParallelFlowable() { // negative time is considered as zero time addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "debounce", Long.TYPE, TimeUnit.class)); addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "debounce", Long.TYPE, TimeUnit.class, Scheduler.class)); + addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "debounce", Long.TYPE, TimeUnit.class, Scheduler.class, Consumer.class)); // null Action allowed addOverride(new ParamOverride(Flowable.class, 1, ParamMode.ANY, "onBackpressureBuffer", Long.TYPE, Action.class, BackpressureOverflowStrategy.class)); + addOverride(new ParamOverride(Flowable.class, 1, ParamMode.ANY, "onBackpressureBuffer", Long.TYPE, Action.class, BackpressureOverflowStrategy.class, Consumer.class)); // zero repeat is allowed addOverride(new ParamOverride(Flowable.class, 0, ParamMode.NON_NEGATIVE, "repeat", Long.TYPE)); @@ -177,6 +179,7 @@ public void checkParallelFlowable() { // negative time is considered as zero time addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleWithTimeout", Long.TYPE, TimeUnit.class)); addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleWithTimeout", Long.TYPE, TimeUnit.class, Scheduler.class)); + addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleWithTimeout", Long.TYPE, TimeUnit.class, Scheduler.class, Consumer.class)); // negative time is considered as zero time addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "take", Long.TYPE, TimeUnit.class)); @@ -190,6 +193,7 @@ public void checkParallelFlowable() { addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "sample", Long.TYPE, TimeUnit.class, Boolean.TYPE)); addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "sample", Long.TYPE, TimeUnit.class, Scheduler.class)); addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "sample", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE)); + addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "sample", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE, Consumer.class)); // negative time is considered as zero time addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "takeLast", Long.TYPE, TimeUnit.class)); @@ -220,16 +224,19 @@ public void checkParallelFlowable() { // negative time is considered as zero time addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleFirst", Long.TYPE, TimeUnit.class)); addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleFirst", Long.TYPE, TimeUnit.class, Scheduler.class)); + addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleFirst", Long.TYPE, TimeUnit.class, Scheduler.class, Consumer.class)); // negative time is considered as zero time addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleLast", Long.TYPE, TimeUnit.class)); addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleLast", Long.TYPE, TimeUnit.class, Scheduler.class)); + addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleLast", Long.TYPE, TimeUnit.class, Scheduler.class, Consumer.class)); // negative time is considered as zero time addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleLatest", Long.TYPE, TimeUnit.class)); addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleLatest", Long.TYPE, TimeUnit.class, Scheduler.class)); addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleLatest", Long.TYPE, TimeUnit.class, Boolean.TYPE)); addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleLatest", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE)); + addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "throttleLatest", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE, Consumer.class)); // negative buffer time is considered as zero buffer time addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "window", Long.TYPE, TimeUnit.class)); @@ -396,6 +403,7 @@ public void checkParallelFlowable() { // negative time is considered as zero time addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "debounce", Long.TYPE, TimeUnit.class)); addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "debounce", Long.TYPE, TimeUnit.class, Scheduler.class)); + addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "debounce", Long.TYPE, TimeUnit.class, Scheduler.class, Consumer.class)); // zero repeat is allowed addOverride(new ParamOverride(Observable.class, 0, ParamMode.NON_NEGATIVE, "repeat", Long.TYPE)); @@ -421,6 +429,7 @@ public void checkParallelFlowable() { // negative time is considered as zero time addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleWithTimeout", Long.TYPE, TimeUnit.class)); addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleWithTimeout", Long.TYPE, TimeUnit.class, Scheduler.class)); + addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleWithTimeout", Long.TYPE, TimeUnit.class, Scheduler.class, Consumer.class)); // negative time is considered as zero time addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "take", Long.TYPE, TimeUnit.class)); @@ -434,6 +443,7 @@ public void checkParallelFlowable() { addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "sample", Long.TYPE, TimeUnit.class, Boolean.TYPE)); addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "sample", Long.TYPE, TimeUnit.class, Scheduler.class)); addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "sample", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE)); + addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "sample", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE, Consumer.class)); // negative time is considered as zero time addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "takeLast", Long.TYPE, TimeUnit.class)); @@ -464,16 +474,19 @@ public void checkParallelFlowable() { // negative time is considered as zero time addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleFirst", Long.TYPE, TimeUnit.class)); addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleFirst", Long.TYPE, TimeUnit.class, Scheduler.class)); + addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleFirst", Long.TYPE, TimeUnit.class, Scheduler.class, Consumer.class)); // negative time is considered as zero time addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleLast", Long.TYPE, TimeUnit.class)); addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleLast", Long.TYPE, TimeUnit.class, Scheduler.class)); + addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleLast", Long.TYPE, TimeUnit.class, Scheduler.class, Consumer.class)); // negative time is considered as zero time addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleLatest", Long.TYPE, TimeUnit.class)); addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleLatest", Long.TYPE, TimeUnit.class, Scheduler.class)); addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleLatest", Long.TYPE, TimeUnit.class, Boolean.TYPE)); addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleLatest", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE)); + addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "throttleLatest", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE, Consumer.class)); // negative buffer time is considered as zero buffer time addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "window", Long.TYPE, TimeUnit.class)); @@ -560,6 +573,7 @@ public void checkParallelFlowable() { for (Class interfaces : AllFunctionals.class.getInterfaces()) { defaultValues.put(interfaces, af); } + defaultValues.put(Subscriber.class, af); defaultValues.put(TimeUnit.class, TimeUnit.SECONDS); defaultValues.put(Scheduler.class, Schedulers.single()); defaultValues.put(BackpressureStrategy.class, BackpressureStrategy.MISSING); @@ -580,6 +594,8 @@ public void checkParallelFlowable() { defaultValues.put(ParallelFailureHandling.class, ParallelFailureHandling.ERROR); + defaultValues.put(DisposableContainer.class, new CompositeDisposable()); + // JDK 8 types defaultValues.put(Optional.class, Optional.of(1)); @@ -924,7 +940,7 @@ static final class AllFunctionals Function3, Function4, Function5, Function6, Function7, Function8, Function9, FlowableOnSubscribe, ObservableOnSubscribe, SingleOnSubscribe, MaybeOnSubscribe, CompletableOnSubscribe, FlowableTransformer, ObservableTransformer, SingleTransformer, MaybeTransformer, CompletableTransformer, - Subscriber, FlowableSubscriber, Observer, SingleObserver, MaybeObserver, CompletableObserver, + FlowableSubscriber, Observer, SingleObserver, MaybeObserver, CompletableObserver, FlowableOperator, ObservableOperator, SingleOperator, MaybeOperator, CompletableOperator, Comparator, ParallelTransformer { @@ -1209,4 +1225,4 @@ public String toString() { return "NeverCompletable"; } } -} +} \ No newline at end of file diff --git a/src/test/java/io/reactivex/rxjava3/validators/ParamValidationNaming.java b/src/test/java/io/reactivex/rxjava3/validators/ParamValidationNaming.java index 0445bfbe71..1928fbee60 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/ParamValidationNaming.java +++ b/src/test/java/io/reactivex/rxjava3/validators/ParamValidationNaming.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/validators/ParameterNamesInClassesTest.java b/src/test/java/io/reactivex/rxjava3/validators/ParameterNamesInClassesTest.java index 11e376a653..2284e32f6a 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/ParameterNamesInClassesTest.java +++ b/src/test/java/io/reactivex/rxjava3/validators/ParameterNamesInClassesTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/validators/PublicFinalMethods.java b/src/test/java/io/reactivex/rxjava3/validators/PublicFinalMethods.java index f7f59d630d..ad7df44964 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/PublicFinalMethods.java +++ b/src/test/java/io/reactivex/rxjava3/validators/PublicFinalMethods.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/validators/SourceAnnotationCheck.java b/src/test/java/io/reactivex/rxjava3/validators/SourceAnnotationCheck.java index ed1080023f..dfa4aea548 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/SourceAnnotationCheck.java +++ b/src/test/java/io/reactivex/rxjava3/validators/SourceAnnotationCheck.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in @@ -385,7 +385,9 @@ else if (skippingDepth == 0) { for (String typeName : TYPES_REQUIRING_NONNULL_TYPEARG) { String pattern = typeName + ".*"; + if (line.contains(pattern) && !line.matches(patternRegex)) { + errorCount++; errors.append("L") .append(j) @@ -402,6 +404,45 @@ else if (skippingDepth == 0) { ; } } + for (String typeName : TYPES_FORBIDDEN_NONNULL_TYPEARG) { + String patternRegex = ".*" + typeName + "\\<@NonNull (\\? (extends|super) )?" + COMMON_TYPE_ARG_NAMES + "\\>.*"; + + if (line.matches(patternRegex)) { + errorCount++; + errors.append("L") + .append(j) + .append(" : @NonNull type argument should be on the arg declaration ") + .append(typeName) + .append("\r\n") + .append(" at ") + .append(fullClassName) + .append(".method(") + .append(f.getName()) + .append(":") + .append(j + 1) + .append(")\r\n") + ; + } + } + + for (String typeName : TYPES_REQUIRING_NONNULL_TYPEARG_ON_FUNC) { + if (line.matches(".*Function[\\d]?\\<.*, (\\? (extends|super) )?" + typeName + ".*")) { + errorCount++; + errors.append("L") + .append(j) + .append(" : Missing @NonNull type argument annotation on Function argument ") + .append(typeName) + .append("\r\n") + .append(" at ") + .append(fullClassName) + .append(".method(") + .append(f.getName()) + .append(":") + .append(j + 1) + .append(")\r\n") + ; + } + } } if (errorCount != 0) { @@ -445,6 +486,16 @@ else if (skippingDepth == 0) { ); static final List TYPES_REQUIRING_NONNULL_TYPEARG = Arrays.asList( - "Iterable", "Stream", "Publisher", "Subscriber", "Processor" + "Iterable", "Stream", "Publisher", "Processor", "Subscriber", "Optional" ); + static final List TYPES_FORBIDDEN_NONNULL_TYPEARG = Arrays.asList( + "Iterable", "Stream", "Publisher", "Processor", "Subscriber", "Optional" + ); + + static final List TYPES_REQUIRING_NONNULL_TYPEARG_ON_FUNC = Arrays.asList( + "Iterable", "Stream", "Publisher", "Processor", "Subscriber", "Optional", + "Observer", "SingleObserver", "MaybeObserver", "CompletableObserver" + ); + + static final String COMMON_TYPE_ARG_NAMES = "([A-Z][0-9]?|TOpening|TClosing|TLeft|TLeftEnd|TRight|TRightEnd)"; } diff --git a/src/test/java/io/reactivex/rxjava3/validators/TestPrefixInMethodName.java b/src/test/java/io/reactivex/rxjava3/validators/TestPrefixInMethodName.java index 2fb3460a73..7a75611b10 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/TestPrefixInMethodName.java +++ b/src/test/java/io/reactivex/rxjava3/validators/TestPrefixInMethodName.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/validators/TextualAorAn.java b/src/test/java/io/reactivex/rxjava3/validators/TextualAorAn.java index 6aff9cc10e..654b4884b4 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/TextualAorAn.java +++ b/src/test/java/io/reactivex/rxjava3/validators/TextualAorAn.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in diff --git a/src/test/java/io/reactivex/rxjava3/validators/TooManyEmptyNewLines.java b/src/test/java/io/reactivex/rxjava3/validators/TooManyEmptyNewLines.java index 581e78301b..c79c879337 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/TooManyEmptyNewLines.java +++ b/src/test/java/io/reactivex/rxjava3/validators/TooManyEmptyNewLines.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in