Skip to content

Commit

Permalink
Removed IntelliJ annotations from core Java lib
Browse files Browse the repository at this point in the history
The problem is that the Kotlin runtime *also* includes these,
so if we include them as well then you end up with duplicate
class definition issues. In the interest of releasing and
keeping the library up-to-date, I'm removing them (for now).

Discussion: https://discuss.kotlinlang.org/t/org-jetbrains-annotations-notnull-problem-with-android-build/629
  • Loading branch information
dlew committed Aug 24, 2016
1 parent 3d70921 commit fbf96a7
Show file tree
Hide file tree
Showing 17 changed files with 24 additions and 58 deletions.
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ ext {
navi = 'com.trello:navi:0.2.0'
kotlinStdlib = "org.jetbrains.kotlin:kotlin-stdlib:$verKotlin"
appCompat = 'com.android.support:appcompat-v7:23.3.0'
jetbrainsAnnotations = 'org.jetbrains:annotations-java5:15.0'
junit = 'junit:junit:4.12'
robolectric = 'org.robolectric:robolectric:3.0'
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GROUP=com.trello
VERSION_NAME=0.6.1-SNAPSHOT
VERSION_CODE=8
VERSION_NAME=0.7.0-SNAPSHOT
VERSION_CODE=9

POM_URL=https://github.com/trello/RxLifecycle
POM_SCM_URL=https://github.com/trello/RxLifecycle
Expand Down
2 changes: 0 additions & 2 deletions rxlifecycle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ repositories {
dependencies {
compile rootProject.ext.rxJava

compileOnly rootProject.ext.jetbrainsAnnotations

testCompile rootProject.ext.junit
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.trello.rxlifecycle;

import org.jetbrains.annotations.NotNull;
import rx.Observable;

/**
Expand All @@ -13,7 +12,6 @@ public interface LifecycleProvider<E> {
/**
* @return a sequence of lifecycle events
*/
@NotNull
Observable<E> lifecycle();

/**
Expand All @@ -24,8 +22,7 @@ public interface LifecycleProvider<E> {
* @param event the event that triggers unsubscription
* @return a reusable {@link Observable.Transformer} which unsubscribes when the event triggers.
*/
@NotNull
<T> LifecycleTransformer<T> bindUntilEvent(@NotNull E event);
<T> LifecycleTransformer<T> bindUntilEvent(E event);

/**
* Binds a source until the next reasonable event occurs.
Expand All @@ -34,6 +31,5 @@ public interface LifecycleProvider<E> {
*
* @return a reusable {@link Observable.Transformer} which unsubscribes at the correct time.
*/
@NotNull
<T> LifecycleTransformer<T> bindToLifecycle();
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.trello.rxlifecycle;

import org.jetbrains.annotations.NotNull;
import rx.Completable;
import rx.Observable;
import rx.Single;
Expand All @@ -18,7 +17,6 @@ public interface LifecycleTransformer<T> extends Observable.Transformer<T, T> {
*
* If interrupted by the lifecycle, this stream throws onError({@link java.util.concurrent.CancellationException}).
*/
@NotNull
// Implementation note: We use a different generic to cover some insane case in Java 8 inference.
// See more here: https://github.com/trello/RxLifecycle/issues/126
<U> Single.Transformer<U, U> forSingle();
Expand All @@ -28,7 +26,6 @@ public interface LifecycleTransformer<T> extends Observable.Transformer<T, T> {
*
* If interrupted by the lifecycle, this stream throws onError({@link java.util.concurrent.CancellationException}).
*/
@NotNull
Completable.CompletableTransformer forCompletable();

}
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package com.trello.rxlifecycle;

import org.jetbrains.annotations.Nullable;

/**
* This is an exception that can be thrown to indicate that the caller has attempted to bind to a lifecycle outside
* of its allowable window.
*/
public class OutsideLifecycleException extends IllegalStateException {

public OutsideLifecycleException(@Nullable String detailMessage) {
public OutsideLifecycleException(String detailMessage) {
super(detailMessage);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

package com.trello.rxlifecycle;

import org.jetbrains.annotations.NotNull;
import rx.Observable;
import rx.functions.Func1;

Expand All @@ -38,9 +37,8 @@ private RxLifecycle() {
* @param event the event which should conclude notifications from the source
* @return a reusable {@link Observable.Transformer} that unsubscribes the source at the specified event
*/
@NotNull
public static <T, R> LifecycleTransformer<T> bindUntilEvent(@NotNull final Observable<R> lifecycle,
@NotNull final R event) {
public static <T, R> LifecycleTransformer<T> bindUntilEvent(final Observable<R> lifecycle,
final R event) {
checkNotNull(lifecycle, "lifecycle == null");
checkNotNull(event, "event == null");

Expand All @@ -60,8 +58,7 @@ public static <T, R> LifecycleTransformer<T> bindUntilEvent(@NotNull final Obser
* @param lifecycle the lifecycle sequence
* @return a reusable {@link Observable.Transformer} that unsubscribes the source whenever the lifecycle emits
*/
@NotNull
public static <T, R> LifecycleTransformer<T> bind(@NotNull final Observable<R> lifecycle) {
public static <T, R> LifecycleTransformer<T> bind(final Observable<R> lifecycle) {
checkNotNull(lifecycle, "lifecycle == null");

return new UntilLifecycleObservableTransformer<>(lifecycle);
Expand All @@ -81,9 +78,8 @@ public static <T, R> LifecycleTransformer<T> bind(@NotNull final Observable<R> l
* @param correspondingEvents a function which tells the source when to unsubscribe
* @return a reusable {@link Observable.Transformer} that unsubscribes the source during the Fragment lifecycle
*/
@NotNull
public static <T, R> LifecycleTransformer<T> bind(@NotNull Observable<R> lifecycle,
@NotNull final Func1<R, R> correspondingEvents) {
public static <T, R> LifecycleTransformer<T> bind(Observable<R> lifecycle,
final Func1<R, R> correspondingEvents) {
checkNotNull(lifecycle, "lifecycle == null");
checkNotNull(correspondingEvents, "correspondingEvents == null");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package com.trello.rxlifecycle;

import org.jetbrains.annotations.NotNull;
import rx.Observable;
import rx.functions.Func1;
import rx.functions.Func2;

final class TakeUntilGenerator {

@NotNull
static <T> Observable<T> takeUntilEvent(@NotNull final Observable<T> lifecycle, @NotNull final T event) {
static <T> Observable<T> takeUntilEvent(final Observable<T> lifecycle, final T event) {
return lifecycle.takeFirst(new Func1<T, Boolean>() {
@Override
public Boolean call(T lifecycleEvent) {
Expand All @@ -17,9 +15,8 @@ public Boolean call(T lifecycleEvent) {
});
}

@NotNull
static <T> Observable<Boolean> takeUntilCorrespondingEvent(@NotNull final Observable<T> lifecycle,
@NotNull final Func1<T, T> correspondingEvents) {
static <T> Observable<Boolean> takeUntilCorrespondingEvent(final Observable<T> lifecycle,
final Func1<T, T> correspondingEvents) {
return Observable.combineLatest(
lifecycle.take(1).map(correspondingEvents),
lifecycle.skip(1),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.trello.rxlifecycle;

import org.jetbrains.annotations.NotNull;
import rx.Completable;
import rx.Observable;
import rx.functions.Func1;
Expand All @@ -18,8 +17,8 @@ final class UntilCorrespondingEventCompletableTransformer<T> implements Completa
final Observable<T> sharedLifecycle;
final Func1<T, T> correspondingEvents;

public UntilCorrespondingEventCompletableTransformer(@NotNull Observable<T> sharedLifecycle,
@NotNull Func1<T, T> correspondingEvents) {
public UntilCorrespondingEventCompletableTransformer(Observable<T> sharedLifecycle,
Func1<T, T> correspondingEvents) {
this.sharedLifecycle = sharedLifecycle;
this.correspondingEvents = correspondingEvents;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.trello.rxlifecycle;

import org.jetbrains.annotations.NotNull;
import rx.Completable;
import rx.Observable;
import rx.Single;
Expand All @@ -19,8 +18,8 @@ final class UntilCorrespondingEventObservableTransformer<T, R> implements Lifecy
final Observable<R> sharedLifecycle;
final Func1<R, R> correspondingEvents;

public UntilCorrespondingEventObservableTransformer(@NotNull Observable<R> sharedLifecycle,
@NotNull Func1<R, R> correspondingEvents) {
public UntilCorrespondingEventObservableTransformer(Observable<R> sharedLifecycle,
Func1<R, R> correspondingEvents) {
this.sharedLifecycle = sharedLifecycle;
this.correspondingEvents = correspondingEvents;
}
Expand All @@ -30,13 +29,11 @@ public Observable<T> call(Observable<T> source) {
return source.takeUntil(takeUntilCorrespondingEvent(sharedLifecycle, correspondingEvents));
}

@NotNull
@Override
public Single.Transformer<T, T> forSingle() {
return new UntilCorrespondingEventSingleTransformer<>(sharedLifecycle, correspondingEvents);
}

@NotNull
@Override
public Completable.CompletableTransformer forCompletable() {
return new UntilCorrespondingEventCompletableTransformer<>(sharedLifecycle, correspondingEvents);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.trello.rxlifecycle;

import org.jetbrains.annotations.NotNull;
import rx.Observable;
import rx.Single;
import rx.functions.Func1;
Expand All @@ -18,8 +17,8 @@ final class UntilCorrespondingEventSingleTransformer<T, R> implements Single.Tra
final Observable<R> sharedLifecycle;
final Func1<R, R> correspondingEvents;

public UntilCorrespondingEventSingleTransformer(@NotNull Observable<R> sharedLifecycle,
@NotNull Func1<R, R> correspondingEvents) {
public UntilCorrespondingEventSingleTransformer(Observable<R> sharedLifecycle,
Func1<R, R> correspondingEvents) {
this.sharedLifecycle = sharedLifecycle;
this.correspondingEvents = correspondingEvents;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.trello.rxlifecycle;

import org.jetbrains.annotations.NotNull;
import rx.Completable;
import rx.Observable;

Expand All @@ -14,7 +13,7 @@ final class UntilEventCompletableTransformer<T> implements Completable.Completab
final Observable<T> lifecycle;
final T event;

public UntilEventCompletableTransformer(@NotNull Observable<T> lifecycle, @NotNull T event) {
public UntilEventCompletableTransformer(Observable<T> lifecycle, T event) {
this.lifecycle = lifecycle;
this.event = event;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.trello.rxlifecycle;

import org.jetbrains.annotations.NotNull;
import rx.Completable;
import rx.Observable;
import rx.Single;
Expand All @@ -15,7 +14,7 @@ final class UntilEventObservableTransformer<T, R> implements LifecycleTransforme
final Observable<R> lifecycle;
final R event;

public UntilEventObservableTransformer(@NotNull Observable<R> lifecycle, @NotNull R event) {
public UntilEventObservableTransformer(Observable<R> lifecycle, R event) {
this.lifecycle = lifecycle;
this.event = event;
}
Expand All @@ -25,13 +24,11 @@ public Observable<T> call(Observable<T> source) {
return source.takeUntil(takeUntilEvent(lifecycle, event));
}

@NotNull
@Override
public Single.Transformer<T, T> forSingle() {
return new UntilEventSingleTransformer<>(lifecycle, event);
}

@NotNull
@Override
public Completable.CompletableTransformer forCompletable() {
return new UntilEventCompletableTransformer<>(lifecycle, event);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.trello.rxlifecycle;

import org.jetbrains.annotations.NotNull;
import rx.Observable;
import rx.Single;

Expand All @@ -14,7 +13,7 @@ final class UntilEventSingleTransformer<T, R> implements Single.Transformer<T, T
final Observable<R> lifecycle;
final R event;

public UntilEventSingleTransformer(@NotNull Observable<R> lifecycle, @NotNull R event) {
public UntilEventSingleTransformer(Observable<R> lifecycle, R event) {
this.lifecycle = lifecycle;
this.event = event;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.trello.rxlifecycle;

import org.jetbrains.annotations.NotNull;
import rx.Completable;
import rx.Observable;

Expand All @@ -11,7 +10,7 @@ final class UntilLifecycleCompletableTransformer<T> implements Completable.Compl

final Observable<T> lifecycle;

public UntilLifecycleCompletableTransformer(@NotNull Observable<T> lifecycle) {
public UntilLifecycleCompletableTransformer(Observable<T> lifecycle) {
this.lifecycle = lifecycle;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.trello.rxlifecycle;

import org.jetbrains.annotations.NotNull;
import rx.Completable;
import rx.Observable;
import rx.Single;
Expand All @@ -12,7 +11,7 @@ final class UntilLifecycleObservableTransformer<T, R> implements LifecycleTransf

final Observable<R> lifecycle;

public UntilLifecycleObservableTransformer(@NotNull Observable<R> lifecycle) {
public UntilLifecycleObservableTransformer(Observable<R> lifecycle) {
this.lifecycle = lifecycle;
}

Expand All @@ -21,13 +20,11 @@ public Observable<T> call(Observable<T> source) {
return source.takeUntil(lifecycle);
}

@NotNull
@Override
public Single.Transformer<T, T> forSingle() {
return new UntilLifecycleSingleTransformer<>(lifecycle);
}

@NotNull
@Override
public Completable.CompletableTransformer forCompletable() {
return new UntilLifecycleCompletableTransformer<>(lifecycle);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.trello.rxlifecycle;

import org.jetbrains.annotations.NotNull;
import rx.Observable;
import rx.Single;

Expand All @@ -11,7 +10,7 @@ final class UntilLifecycleSingleTransformer<T, R> implements Single.Transformer<

final Observable<R> lifecycle;

public UntilLifecycleSingleTransformer(@NotNull Observable<R> lifecycle) {
public UntilLifecycleSingleTransformer(Observable<R> lifecycle) {
this.lifecycle = lifecycle;
}

Expand Down

0 comments on commit fbf96a7

Please sign in to comment.