Inspectopedia 2025.2 Help

Unused publisher

Reports unused Publisher instances.

To use an operator (a method of Mono/Flux/Flowable object that returns a Mono/Flux/Flowable) that produces a new Publisher instance, you must subscribe to the created Publisher via subscribe().

Using a factory (for example, Mono.just()) without subscribing to the returned Publisher, creates an object that is never used and is treated as unnecessary memory allocation.

For example, Mono.just(1, 2, 3).map(i -> i + 3) won't be executed unless you subscribe to this Publisher, or unless you produce a new Publisher by applying operators and subscribe to it.

Example:

Unused Flux instance:

Flux.just(1, 2, 3);

A Flux instance used by consumer:

Flux.just(1, 2, 3).subscribe(System.out::println);

Calls to methods annotated with Error Prone's or AssertJ's @CanIgnoreReturnValue annotation are not reported.

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

ReactiveStreamsUnusedPublisher
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Reactive Streams | Common

New in 2019.3

Suppressing Inspection

You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:

//noinspection ReactiveStreamsUnusedPublisher

More detailed instructions as well as other ways and options that you have can be found in the product documentation:

Inspection Details

By default bundled with:

IntelliJ IDEA 2025.2, Qodana for JVM 2025.2,

Last modified: 18 September 2025