diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn index 61b92f67e3..2ab391e6b8 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -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", + ] } } diff --git a/rtc_base/java/src/org/webrtc/ThreadUtils.java b/rtc_base/java/src/org/webrtc/ThreadUtils.java index 3cc80d39ca..a403870906 100644 --- a/rtc_base/java/src/org/webrtc/ThreadUtils.java +++ b/rtc_base/java/src/org/webrtc/ThreadUtils.java @@ -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) { diff --git a/tools_webrtc/libs/generate_licenses.py b/tools_webrtc/libs/generate_licenses.py index 03df3936ca..884628bcb8 100755 --- a/tools_webrtc/libs/generate_licenses.py +++ b/tools_webrtc/libs/generate_licenses.py @@ -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): diff --git a/webrtc.gni b/webrtc.gni index f2a196ed61..f91aa01579 100644 --- a/webrtc.gni +++ b/webrtc.gni @@ -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 }