File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
rxjava-core/src/main/java/rx/internal/operators Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,22 @@ public void onStart() {
5555 public void onCompleted () {
5656 try {
5757 completed = true ;
58- o .onNext (Collections .unmodifiableList (list ));
58+ /*
59+ * Ideally this should just return Collections.unmodifiableList(list) and not copy it,
60+ * but, it ends up being a breaking change if we make that modification.
61+ *
62+ * Here is an example of is being done with these lists that breaks if we make it immutable:
63+ *
64+ * Caused by: java.lang.UnsupportedOperationException
65+ * at java.util.Collections$UnmodifiableList$1.set(Collections.java:1244)
66+ * at java.util.Collections.sort(Collections.java:221)
67+ * ...
68+ * Caused by: rx.exceptions.OnErrorThrowable$OnNextValue: OnError while emitting onNext value: UnmodifiableList.class
69+ * at rx.exceptions.OnErrorThrowable.addValueAsLastCause(OnErrorThrowable.java:98)
70+ * at rx.internal.operators.OperatorMap$1.onNext(OperatorMap.java:56)
71+ * ... 419 more
72+ */
73+ o .onNext (new ArrayList <T >(list ));
5974 o .onCompleted ();
6075 } catch (Throwable e ) {
6176 onError (e );
You can’t perform that action at this time.
0 commit comments