-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More nullability annotation work (#70)
* More nullability annotation work This is a followup to #69, and improves it in two main ways: - This adds it to subpackages as well, which I missed in the first pass. - Switches to a custom `PackageNonNull` annotation instead, which expands the checks to also include return types, fields, local vars, etc. It's pretty broad right now but we could reduce scope if need be. This is pulled into a separate artifact for re-use, but still only applied as compileOnly. * Clean up qualifiers * Tweak name * Don't export artifact Not necessary, we'll make this a separate project later * CLASS retention instead of runtime
- Loading branch information
Showing
9 changed files
with
122 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
autodispose-android/src/main/java/com/uber/autodispose/android/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (c) 2017. Uber Technologies | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* Android components for AutoDispose. | ||
*/ | ||
@com.uber.autodispose.internal.EverythingNonNullByDefault | ||
package com.uber.autodispose.android; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
AutoDispose-provided | ||
==================== | ||
|
||
This module solely exists to separate out `@PackageNonnull` to allow for it to be a `compileOnly` | ||
dependency of the other projects. This allows it to be useful still for static analysis, while not | ||
imposing the jsr305 artifact as a full compile dependency on the consumer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (C) 2017. Uber Technologies | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
buildscript { | ||
repositories { | ||
jcenter() | ||
maven { url deps.build.repositories.plugins } | ||
} | ||
dependencies { | ||
classpath deps.build.gradlePlugins.errorProne | ||
} | ||
} | ||
|
||
apply plugin: 'java-library' | ||
apply plugin: 'net.ltgt.errorprone' | ||
|
||
sourceCompatibility = "1.7" | ||
targetCompatibility = "1.7" | ||
|
||
test { | ||
testLogging.showStandardStreams = true | ||
} | ||
|
||
dependencies { | ||
compileOnly deps.misc.errorProneAnnotations | ||
compile deps.misc.jsr305 | ||
|
||
errorprone deps.build.errorProne | ||
} |
25 changes: 25 additions & 0 deletions
25
...pose-provided/src/main/java/com/uber/autodispose/internal/EverythingNonNullByDefault.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.uber.autodispose.internal; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import javax.annotation.Nonnull; | ||
import javax.annotation.meta.TypeQualifierDefault; | ||
|
||
/** | ||
* This annotation can be applied to a package, class or method to indicate that the class fields, | ||
* method return types and parameters in that element are not null by default unless: | ||
* - The method overrides a method in a superclass (in which case the annotation of the | ||
* corresponding parameter in the superclass applies). | ||
* - There is a default parameter annotation applied to a more tightly nested element. | ||
*/ | ||
@Documented | ||
@Nonnull | ||
@TypeQualifierDefault({ | ||
ElementType.FIELD, | ||
ElementType.METHOD, | ||
ElementType.PARAMETER | ||
}) | ||
@Retention(RetentionPolicy.CLASS) | ||
public @interface EverythingNonNullByDefault { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
autodispose/src/main/java/com/uber/autodispose/observers/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (c) 2017. Uber Technologies | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* These are Observers AutoDispose uses when scoping an observable. They are exposed as a public API | ||
* to allow for consumers to watch for them if they want, such as in RxJava plugins. | ||
*/ | ||
@com.uber.autodispose.internal.EverythingNonNullByDefault | ||
package com.uber.autodispose.observers; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters