Skip to content

Add @Nullable annotations to Processors #5925

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main/java/io/reactivex/processors/AsyncProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public boolean hasComplete() {
}

@Override
@Nullable
public Throwable getThrowable() {
return subscribers.get() == TERMINATED ? error : null;
}
Expand Down Expand Up @@ -244,6 +245,7 @@ public boolean hasValue() {
* <p>The method is thread-safe.
* @return a single value the Subject currently has or null if no such value exists
*/
@Nullable
public T getValue() {
return subscribers.get() == TERMINATED ? value : null;
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/io/reactivex/processors/BehaviorProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ public boolean hasSubscribers() {
}

@Override
@Nullable
public Throwable getThrowable() {
Object o = value.get();
if (NotificationLite.isError(o)) {
Expand All @@ -361,6 +362,7 @@ public Throwable getThrowable() {
* <p>The method is thread-safe.
* @return a single value the BehaviorProcessor currently has or null if no such value exists
*/
@Nullable
public T getValue() {
Object o = value.get();
if (NotificationLite.isComplete(o) || NotificationLite.isError(o)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ public boolean hasSubscribers() {
}

@Override
@Nullable
public Throwable getThrowable() {
if (subscribers.get() == TERMINATED) {
return error;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/io/reactivex/processors/ReplayProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ public boolean hasSubscribers() {
}

@Override
@Nullable
public Throwable getThrowable() {
ReplayBuffer<T> b = buffer;
if (b.isDone()) {
Expand Down Expand Up @@ -510,6 +511,7 @@ interface ReplayBuffer<T> {

int size();

@Nullable
T getValue();

T[] getValues(T[] array);
Expand Down Expand Up @@ -598,6 +600,7 @@ public void trimHead() {
}

@Override
@Nullable
public T getValue() {
int s = size;
if (s == 0) {
Expand Down Expand Up @@ -1091,6 +1094,7 @@ public void complete() {
}

@Override
@Nullable
public T getValue() {
TimedNode<T> h = head;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

package io.reactivex.processors;

import io.reactivex.annotations.Nullable;
import org.reactivestreams.*;

import io.reactivex.internal.util.*;
Expand Down Expand Up @@ -187,6 +188,7 @@ public boolean hasThrowable() {
}

@Override
@Nullable
public Throwable getThrowable() {
return actual.getThrowable();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ public boolean hasSubscribers() {
}

@Override
@Nullable
public Throwable getThrowable() {
if (done) {
return error;
Expand Down