Skip to content

Commit e5d3b0e

Browse files
jschneiderakarnokd
authored andcommitted
add nullable annotation to simple queue (fixes #5053) (#5054)
1 parent 8720828 commit e5d3b0e

File tree

55 files changed

+131
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+131
-0
lines changed

src/main/java/io/reactivex/internal/disposables/EmptyDisposable.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
package io.reactivex.internal.disposables;
1515

1616
import io.reactivex.*;
17+
import io.reactivex.annotations.Nullable;
1718
import io.reactivex.internal.fuseable.QueueDisposable;
1819

1920
/**
@@ -93,6 +94,7 @@ public boolean offer(Object v1, Object v2) {
9394
throw new UnsupportedOperationException("Should not be called!");
9495
}
9596

97+
@Nullable
9698
@Override
9799
public Object poll() throws Exception {
98100
return null; // always empty

src/main/java/io/reactivex/internal/fuseable/SimplePlainQueue.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@
1313

1414
package io.reactivex.internal.fuseable;
1515

16+
import io.reactivex.annotations.Nullable;
17+
1618
/**
1719
* Override of the SimpleQueue interface with no throws Exception on poll.
1820
*
1921
* @param <T> the value type to enqueue and dequeue, not null
2022
*/
2123
public interface SimplePlainQueue<T> extends SimpleQueue<T> {
2224

25+
@Nullable
2326
@Override
2427
T poll();
2528
}

src/main/java/io/reactivex/internal/fuseable/SimpleQueue.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
package io.reactivex.internal.fuseable;
1515

16+
import io.reactivex.annotations.Nullable;
17+
1618
/**
1719
* A minimalist queue interface without the method bloat of java.util.Collection and java.util.Queue.
1820
*
@@ -24,6 +26,10 @@ public interface SimpleQueue<T> {
2426

2527
boolean offer(T v1, T v2);
2628

29+
/**
30+
* @return null to indicate an empty queue
31+
*/
32+
@Nullable
2733
T poll() throws Exception;
2834

2935
boolean isEmpty();

src/main/java/io/reactivex/internal/observers/DeferredScalarDisposable.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
package io.reactivex.internal.observers;
1515

1616
import io.reactivex.Observer;
17+
import io.reactivex.annotations.Nullable;
1718
import io.reactivex.plugins.RxJavaPlugins;
1819

1920
/**
@@ -110,6 +111,7 @@ public final void complete() {
110111
actual.onComplete();
111112
}
112113

114+
@Nullable
113115
@Override
114116
public final T poll() throws Exception {
115117
if (get() == FUSED_READY) {

src/main/java/io/reactivex/internal/operators/flowable/FlowableCombineLatest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import java.util.Iterator;
1717
import java.util.concurrent.atomic.*;
1818

19+
import io.reactivex.annotations.Nullable;
1920
import org.reactivestreams.*;
2021

2122
import io.reactivex.Flowable;
@@ -466,6 +467,7 @@ public int requestFusion(int requestedMode) {
466467
return m;
467468
}
468469

470+
@Nullable
469471
@SuppressWarnings("unchecked")
470472
@Override
471473
public R poll() throws Exception {

src/main/java/io/reactivex/internal/operators/flowable/FlowableDistinct.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import java.util.Collection;
1717
import java.util.concurrent.Callable;
1818

19+
import io.reactivex.annotations.Nullable;
1920
import org.reactivestreams.*;
2021

2122
import io.reactivex.exceptions.Exceptions;
@@ -117,6 +118,7 @@ public int requestFusion(int mode) {
117118
return transitiveBoundaryFusion(mode);
118119
}
119120

121+
@Nullable
120122
@Override
121123
public T poll() throws Exception {
122124
for (;;) {

src/main/java/io/reactivex/internal/operators/flowable/FlowableDistinctUntilChanged.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
package io.reactivex.internal.operators.flowable;
1515

16+
import io.reactivex.annotations.Nullable;
1617
import org.reactivestreams.*;
1718

1819
import io.reactivex.functions.*;
@@ -106,6 +107,7 @@ public int requestFusion(int mode) {
106107
return transitiveBoundaryFusion(mode);
107108
}
108109

110+
@Nullable
109111
@Override
110112
public T poll() throws Exception {
111113
for (;;) {
@@ -195,6 +197,7 @@ public int requestFusion(int mode) {
195197
return transitiveBoundaryFusion(mode);
196198
}
197199

200+
@Nullable
198201
@Override
199202
public T poll() throws Exception {
200203
for (;;) {

src/main/java/io/reactivex/internal/operators/flowable/FlowableDoAfterNext.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
package io.reactivex.internal.operators.flowable;
1515

16+
import io.reactivex.annotations.Nullable;
1617
import org.reactivestreams.*;
1718

1819
import io.reactivex.annotations.Experimental;
@@ -74,6 +75,7 @@ public int requestFusion(int mode) {
7475
return transitiveBoundaryFusion(mode);
7576
}
7677

78+
@Nullable
7779
@Override
7880
public T poll() throws Exception {
7981
T v = qs.poll();
@@ -122,6 +124,7 @@ public int requestFusion(int mode) {
122124
return transitiveBoundaryFusion(mode);
123125
}
124126

127+
@Nullable
125128
@Override
126129
public T poll() throws Exception {
127130
T v = qs.poll();

src/main/java/io/reactivex/internal/operators/flowable/FlowableDoFinally.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
package io.reactivex.internal.operators.flowable;
1515

16+
import io.reactivex.annotations.Nullable;
1617
import org.reactivestreams.*;
1718

1819
import io.reactivex.annotations.Experimental;
@@ -130,6 +131,7 @@ public boolean isEmpty() {
130131
return qs.isEmpty();
131132
}
132133

134+
@Nullable
133135
@Override
134136
public T poll() throws Exception {
135137
T v = qs.poll();
@@ -239,6 +241,7 @@ public boolean isEmpty() {
239241
return qs.isEmpty();
240242
}
241243

244+
@Nullable
242245
@Override
243246
public T poll() throws Exception {
244247
T v = qs.poll();

src/main/java/io/reactivex/internal/operators/flowable/FlowableDoOnEach.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
package io.reactivex.internal.operators.flowable;
1515

16+
import io.reactivex.annotations.Nullable;
1617
import org.reactivestreams.*;
1718

1819
import io.reactivex.exceptions.*;
@@ -144,6 +145,7 @@ public int requestFusion(int mode) {
144145
return transitiveBoundaryFusion(mode);
145146
}
146147

148+
@Nullable
147149
@Override
148150
public T poll() throws Exception {
149151
T v = qs.poll();
@@ -276,6 +278,7 @@ public int requestFusion(int mode) {
276278
return transitiveBoundaryFusion(mode);
277279
}
278280

281+
@Nullable
279282
@Override
280283
public T poll() throws Exception {
281284
T v = qs.poll();

0 commit comments

Comments
 (0)