Introduce Nullable annotation.

Just adds the annotation to base_java for now to check that this does
not break any downstream targets.

Bug: webrtc:8881
Change-Id: I9425020e36be5e52447cec592a4474a9eb09b5bd
Reviewed-on: https://webrtc-review.googlesource.com/51960
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22526}
This commit is contained in:
Sami Kalliomäki
2018-03-20 16:32:49 +01:00
committed by Commit Bot
parent 7531a761d3
commit e7fac68c97
4 changed files with 23 additions and 3 deletions

View File

@ -1380,5 +1380,15 @@ if (is_android) {
"java/src/org/webrtc/Size.java",
"java/src/org/webrtc/ThreadUtils.java",
]
javac_args = [
"-Xep:ParameterNotNullable:ERROR",
"-Xep:FieldMissingNullable:ERROR",
"-Xep:ReturnMissingNullable:ERROR",
]
deps = [
"//third_party/jsr-305:jsr_305_javalib",
]
}
}

View File

@ -16,13 +16,14 @@ import android.os.SystemClock;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
public class ThreadUtils {
/**
* Utility class to be used for checking that a method is called on the correct thread.
*/
public static class ThreadChecker {
private Thread thread = Thread.currentThread();
@Nullable private Thread thread = Thread.currentThread();
public void checkIsOnValidThread() {
if (thread == null) {

View File

@ -24,6 +24,7 @@ import subprocess
LIB_TO_LICENSES_DICT = {
'android_tools': ['third_party/android_tools/LICENSE'],
'auto': ['third_party/auto/src/LICENSE.txt'],
'bazel': ['third_party/bazel/LICENSE'],
'boringssl': ['third_party/boringssl/src/LICENSE'],
'errorprone': ['third_party/errorprone/LICENSE'],
'expat': ['third_party/expat/files/COPYING'],
@ -31,6 +32,7 @@ LIB_TO_LICENSES_DICT = {
'guava': ['third_party/guava/LICENSE'],
'ijar': ['third_party/ijar/LICENSE'],
'jsoncpp': ['third_party/jsoncpp/LICENSE'],
'jsr-305': ['third_party/jsr-305/src/ri/LICENSE'],
'libc++': ['buildtools/third_party/libc++/trunk/LICENSE.TXT'],
'libc++abi': ['buildtools/third_party/libc++abi/trunk/LICENSE.TXT'],
'libevent': ['base/third_party/libevent/LICENSE'],
@ -54,7 +56,7 @@ CHECKOUT_ROOT = os.path.abspath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir))
sys.path.append(os.path.join(CHECKOUT_ROOT, 'build'))
import find_depot_tools
THIRD_PARTY_LIB_REGEX = r'^.*/third_party/([\w+]+).*$'
THIRD_PARTY_LIB_REGEX = r'^.*/third_party/([\w\-+]+).*$'
class LicenseBuilder(object):

View File

@ -496,8 +496,15 @@ if (is_android) {
"visibility",
])
javac_args = []
# Treat warnings as errors.
javac_args = [ "-Werror" ]
javac_args += [ "-Werror" ]
# Add any arguments defined by the invoker.
if (defined(invoker.javac_args)) {
javac_args += invoker.javac_args
}
no_build_hooks = true
}