Skip to content

Commit 0920f23

Browse files
committed
Added final keyword and private constructor to private/utility classes.
1 parent 2635f52 commit 0920f23

25 files changed

+59
-25
lines changed

src/main/java/rx/Notification.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
* @see <a href="http://msdn.microsoft.com/en-us/library/hh229462.aspx">the Microsoft Rx equivalent</a>
2222
*/
23-
public class Notification<T> {
23+
public final class Notification<T> {
2424

2525
private final Kind kind;
2626
private final Throwable throwable;

src/main/java/rx/exceptions/Exceptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/**
2222
* @warn javadoc class description missing
2323
*/
24-
public class Exceptions {
24+
public final class Exceptions {
2525
private Exceptions() {
2626

2727
}

src/main/java/rx/exceptions/OnErrorThrowable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* recover more information from an {@code OnErrorThrowable} than is found in a typical {@code Throwable}, such
2222
* as the item the {@code Observable} was trying to emit at the time the error was encountered.
2323
*/
24-
public class OnErrorThrowable extends RuntimeException {
24+
public final class OnErrorThrowable extends RuntimeException {
2525

2626
private static final long serialVersionUID = -569558213262703934L;
2727

src/main/java/rx/functions/Functions.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
*/
1616
package rx.functions;
1717

18-
public class Functions {
18+
public final class Functions {
19+
private Functions() {
20+
throw new IllegalStateException("No instances!");
21+
}
1922

2023
/**
2124
* Converts a {@link Func0} to a {@link FuncN} to allow heterogeneous handling of functions with different

src/main/java/rx/internal/operators/BlockingOperatorMostRecent.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
* <img width="640" src="https://github.com/ReactiveX/RxJava/wiki/images/rx-operators/B.mostRecent.png" alt="">
3030
*/
3131
public final class BlockingOperatorMostRecent {
32-
32+
private BlockingOperatorMostRecent() {
33+
throw new IllegalStateException("No instances!");
34+
}
3335
/**
3436
* Returns an {@code Iterable} that always returns the item most recently emitted by the {@code Observable}.
3537
*
@@ -58,7 +60,7 @@ public Iterator<T> iterator() {
5860
};
5961
}
6062

61-
private static class MostRecentObserver<T> extends Subscriber<T> {
63+
private static final class MostRecentObserver<T> extends Subscriber<T> {
6264
final NotificationLite<T> nl = NotificationLite.instance();
6365
volatile Object value;
6466

src/main/java/rx/internal/operators/BlockingOperatorNext.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
* <img width="640" src="https://github.com/ReactiveX/RxJava/wiki/images/rx-operators/B.next.png" alt="">
3434
*/
3535
public final class BlockingOperatorNext {
36+
private BlockingOperatorNext() {
37+
throw new IllegalStateException("No instances!");
38+
}
3639

3740
/**
3841
* Returns an {@code Iterable} that blocks until the {@code Observable} emits another item, then returns

src/main/java/rx/internal/operators/BlockingOperatorToFuture.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@
3535
* The toFuture operation throws an exception if the Observable emits more than one item. If the
3636
* Observable may emit more than item, use <code>toList().toFuture()</code>.
3737
*/
38-
public class BlockingOperatorToFuture {
39-
38+
public final class BlockingOperatorToFuture {
39+
private BlockingOperatorToFuture() {
40+
throw new IllegalStateException("No instances!");
41+
}
4042
/**
4143
* Returns a Future that expects a single item from the observable.
4244
*

src/main/java/rx/internal/operators/BlockingOperatorToIterator.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@
3434
*
3535
* @see <a href="https://github.com/ReactiveX/RxJava/issues/50">Issue #50</a>
3636
*/
37-
public class BlockingOperatorToIterator {
37+
public final class BlockingOperatorToIterator {
38+
private BlockingOperatorToIterator() {
39+
throw new IllegalStateException("No instances!");
40+
}
3841

3942
/**
4043
* Returns an iterator that iterates all values of the observable.

src/main/java/rx/internal/operators/BufferUntilSubscriber.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
* @param <T>
5050
* the type of the items to be buffered
5151
*/
52-
public class BufferUntilSubscriber<T> extends Subject<T, T> {
52+
public final class BufferUntilSubscriber<T> extends Subject<T, T> {
5353

5454
@SuppressWarnings("rawtypes")
5555
private final static Observer EMPTY_OBSERVER = new EmptyObserver();

src/main/java/rx/internal/operators/OnSubscribeToObservableFuture.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@
3434
* This is blocking so the {@code Subscription} returned when calling
3535
* {@code Observable.unsafeSubscribe(Observer)} does nothing.
3636
*/
37-
public class OnSubscribeToObservableFuture {
37+
public final class OnSubscribeToObservableFuture {
38+
private OnSubscribeToObservableFuture() {
39+
throw new IllegalStateException("No instances!");
40+
}
41+
3842
/* package accessible for unit tests */static class ToObservableFuture<T> implements OnSubscribe<T> {
3943
private final Future<? extends T> that;
4044
private final long time;

0 commit comments

Comments
 (0)