Enable clang::find_bad_constructs for sdk/android (part 1/2).

This CL removes //build/config/clang:find_bad_constructs from the
suppressed_configs list, which means that clang:find_bad_constructs
is now enabled on these translation units.

Bug: webrtc:9251, webrtc:163, webrtc:9544
Change-Id: I7c211c4ac6b2e095e4c6594fce09fdb487bb1d9e
Reviewed-on: https://webrtc-review.googlesource.com/89600
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24056}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 539c222..d4cd733 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -57,6 +57,7 @@
     "dtmfsenderinterface.h",
     "jsep.cc",
     "jsep.h",
+    "jsepicecandidate.cc",
     "jsepicecandidate.h",
     "jsepsessiondescription.h",
     "mediaconstraintsinterface.cc",
diff --git a/api/jsepicecandidate.cc b/api/jsepicecandidate.cc
new file mode 100644
index 0000000..b9ba2fe
--- /dev/null
+++ b/api/jsepicecandidate.cc
@@ -0,0 +1,83 @@
+/*
+ *  Copyright 2018 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "api/jsepicecandidate.h"
+
+namespace webrtc {
+
+std::string JsepIceCandidate::sdp_mid() const {
+  return sdp_mid_;
+}
+
+int JsepIceCandidate::sdp_mline_index() const {
+  return sdp_mline_index_;
+}
+
+const cricket::Candidate& JsepIceCandidate::candidate() const {
+  return candidate_;
+}
+
+std::string JsepIceCandidate::server_url() const {
+  return candidate_.url();
+}
+
+JsepCandidateCollection::JsepCandidateCollection() = default;
+
+JsepCandidateCollection::JsepCandidateCollection(JsepCandidateCollection&& o)
+    : candidates_(std::move(o.candidates_)) {}
+
+size_t JsepCandidateCollection::count() const {
+  return candidates_.size();
+}
+
+void JsepCandidateCollection::add(JsepIceCandidate* candidate) {
+  candidates_.push_back(candidate);
+}
+
+const IceCandidateInterface* JsepCandidateCollection::at(size_t index) const {
+  return candidates_[index];
+}
+
+JsepCandidateCollection::~JsepCandidateCollection() {
+  for (std::vector<JsepIceCandidate*>::iterator it = candidates_.begin();
+       it != candidates_.end(); ++it) {
+    delete *it;
+  }
+}
+
+bool JsepCandidateCollection::HasCandidate(
+    const IceCandidateInterface* candidate) const {
+  bool ret = false;
+  for (std::vector<JsepIceCandidate*>::const_iterator it = candidates_.begin();
+       it != candidates_.end(); ++it) {
+    if ((*it)->sdp_mid() == candidate->sdp_mid() &&
+        (*it)->sdp_mline_index() == candidate->sdp_mline_index() &&
+        (*it)->candidate().IsEquivalent(candidate->candidate())) {
+      ret = true;
+      break;
+    }
+  }
+  return ret;
+}
+
+size_t JsepCandidateCollection::remove(const cricket::Candidate& candidate) {
+  auto iter = std::find_if(candidates_.begin(), candidates_.end(),
+                           [candidate](JsepIceCandidate* c) {
+                             return candidate.MatchesForRemoval(c->candidate());
+                           });
+  if (iter != candidates_.end()) {
+    delete *iter;
+    candidates_.erase(iter);
+    return 1;
+  }
+  return 0;
+}
+
+}  // namespace webrtc
diff --git a/api/jsepicecandidate.h b/api/jsepicecandidate.h
index 4801a04..50520fe 100644
--- a/api/jsepicecandidate.h
+++ b/api/jsepicecandidate.h
@@ -31,20 +31,20 @@
   JsepIceCandidate(const std::string& sdp_mid,
                    int sdp_mline_index,
                    const cricket::Candidate& candidate);
-  ~JsepIceCandidate();
+  ~JsepIceCandidate() override;
   // |err| may be null.
   bool Initialize(const std::string& sdp, SdpParseError* err);
   void SetCandidate(const cricket::Candidate& candidate) {
     candidate_ = candidate;
   }
 
-  virtual std::string sdp_mid() const { return sdp_mid_; }
-  virtual int sdp_mline_index() const { return sdp_mline_index_; }
-  virtual const cricket::Candidate& candidate() const { return candidate_; }
+  std::string sdp_mid() const override;
+  int sdp_mline_index() const override;
+  const cricket::Candidate& candidate() const override;
 
-  virtual std::string server_url() const { return candidate_.url(); }
+  std::string server_url() const override;
 
-  virtual bool ToString(std::string* out) const;
+  bool ToString(std::string* out) const override;
 
  private:
   std::string sdp_mid_;
@@ -57,23 +57,18 @@
 // Implementation of IceCandidateCollection which stores JsepIceCandidates.
 class JsepCandidateCollection : public IceCandidateCollection {
  public:
-  JsepCandidateCollection() {}
+  JsepCandidateCollection();
   // Move constructor is defined so that a vector of JsepCandidateCollections
   // can be resized.
-  JsepCandidateCollection(JsepCandidateCollection&& o)
-      : candidates_(std::move(o.candidates_)) {}
-  ~JsepCandidateCollection();
-  virtual size_t count() const { return candidates_.size(); }
-  virtual bool HasCandidate(const IceCandidateInterface* candidate) const;
+  JsepCandidateCollection(JsepCandidateCollection&& o);
+  ~JsepCandidateCollection() override;
+  size_t count() const override;
+  bool HasCandidate(const IceCandidateInterface* candidate) const override;
   // Adds and takes ownership of the JsepIceCandidate.
   // TODO(deadbeef): Make this use an std::unique_ptr<>, so ownership logic is
   // more clear.
-  virtual void add(JsepIceCandidate* candidate) {
-    candidates_.push_back(candidate);
-  }
-  virtual const IceCandidateInterface* at(size_t index) const {
-    return candidates_[index];
-  }
+  virtual void add(JsepIceCandidate* candidate);
+  const IceCandidateInterface* at(size_t index) const override;
   // Removes the candidate that has a matching address and protocol.
   //
   // Returns the number of candidates that were removed.
diff --git a/api/rtpparameters.cc b/api/rtpparameters.cc
index 5a873de..62ca3fc 100644
--- a/api/rtpparameters.cc
+++ b/api/rtpparameters.cc
@@ -19,17 +19,18 @@
 
 const double kDefaultBitratePriority = 1.0;
 
-RtcpFeedback::RtcpFeedback() {}
+RtcpFeedback::RtcpFeedback() = default;
 RtcpFeedback::RtcpFeedback(RtcpFeedbackType type) : type(type) {}
 RtcpFeedback::RtcpFeedback(RtcpFeedbackType type,
                            RtcpFeedbackMessageType message_type)
     : type(type), message_type(message_type) {}
-RtcpFeedback::~RtcpFeedback() {}
+RtcpFeedback::RtcpFeedback(const RtcpFeedback& rhs) = default;
+RtcpFeedback::~RtcpFeedback() = default;
 
-RtpCodecCapability::RtpCodecCapability() {}
-RtpCodecCapability::~RtpCodecCapability() {}
+RtpCodecCapability::RtpCodecCapability() = default;
+RtpCodecCapability::~RtpCodecCapability() = default;
 
-RtpHeaderExtensionCapability::RtpHeaderExtensionCapability() {}
+RtpHeaderExtensionCapability::RtpHeaderExtensionCapability() = default;
 RtpHeaderExtensionCapability::RtpHeaderExtensionCapability(
     const std::string& uri)
     : uri(uri) {}
@@ -37,39 +38,46 @@
     const std::string& uri,
     int preferred_id)
     : uri(uri), preferred_id(preferred_id) {}
-RtpHeaderExtensionCapability::~RtpHeaderExtensionCapability() {}
+RtpHeaderExtensionCapability::~RtpHeaderExtensionCapability() = default;
 
-RtpExtension::RtpExtension() {}
+RtpExtension::RtpExtension() = default;
 RtpExtension::RtpExtension(const std::string& uri, int id) : uri(uri), id(id) {}
 RtpExtension::RtpExtension(const std::string& uri, int id, bool encrypt)
     : uri(uri), id(id), encrypt(encrypt) {}
-RtpExtension::~RtpExtension() {}
+RtpExtension::~RtpExtension() = default;
 
-RtpFecParameters::RtpFecParameters() {}
+RtpFecParameters::RtpFecParameters() = default;
 RtpFecParameters::RtpFecParameters(FecMechanism mechanism)
     : mechanism(mechanism) {}
 RtpFecParameters::RtpFecParameters(FecMechanism mechanism, uint32_t ssrc)
     : ssrc(ssrc), mechanism(mechanism) {}
-RtpFecParameters::~RtpFecParameters() {}
+RtpFecParameters::RtpFecParameters(const RtpFecParameters& rhs) = default;
+RtpFecParameters::~RtpFecParameters() = default;
 
-RtpRtxParameters::RtpRtxParameters() {}
+RtpRtxParameters::RtpRtxParameters() = default;
 RtpRtxParameters::RtpRtxParameters(uint32_t ssrc) : ssrc(ssrc) {}
-RtpRtxParameters::~RtpRtxParameters() {}
+RtpRtxParameters::RtpRtxParameters(const RtpRtxParameters& rhs) = default;
+RtpRtxParameters::~RtpRtxParameters() = default;
 
-RtpEncodingParameters::RtpEncodingParameters() {}
-RtpEncodingParameters::~RtpEncodingParameters() {}
+RtpEncodingParameters::RtpEncodingParameters() = default;
+RtpEncodingParameters::RtpEncodingParameters(const RtpEncodingParameters& rhs) =
+    default;
+RtpEncodingParameters::~RtpEncodingParameters() = default;
 
-RtpCodecParameters::RtpCodecParameters() {}
-RtpCodecParameters::~RtpCodecParameters() {}
+RtpCodecParameters::RtpCodecParameters() = default;
+RtpCodecParameters::RtpCodecParameters(const RtpCodecParameters& rhs) = default;
+RtpCodecParameters::~RtpCodecParameters() = default;
 
-RtpCapabilities::RtpCapabilities() {}
-RtpCapabilities::~RtpCapabilities() {}
+RtpCapabilities::RtpCapabilities() = default;
+RtpCapabilities::~RtpCapabilities() = default;
 
-RtcpParameters::RtcpParameters() {}
-RtcpParameters::~RtcpParameters() {}
+RtcpParameters::RtcpParameters() = default;
+RtcpParameters::RtcpParameters(const RtcpParameters& rhs) = default;
+RtcpParameters::~RtcpParameters() = default;
 
-RtpParameters::RtpParameters() {}
-RtpParameters::~RtpParameters() {}
+RtpParameters::RtpParameters() = default;
+RtpParameters::RtpParameters(const RtpParameters& rhs) = default;
+RtpParameters::~RtpParameters() = default;
 
 std::string RtpExtension::ToString() const {
   char buf[256];
diff --git a/api/rtpparameters.h b/api/rtpparameters.h
index b7560f1..9a29c08 100644
--- a/api/rtpparameters.h
+++ b/api/rtpparameters.h
@@ -100,6 +100,7 @@
   RtcpFeedback();
   explicit RtcpFeedback(RtcpFeedbackType type);
   RtcpFeedback(RtcpFeedbackType type, RtcpFeedbackMessageType message_type);
+  RtcpFeedback(const RtcpFeedback&);
   ~RtcpFeedback();
 
   bool operator==(const RtcpFeedback& o) const {
@@ -321,6 +322,7 @@
   RtpFecParameters();
   explicit RtpFecParameters(FecMechanism mechanism);
   RtpFecParameters(FecMechanism mechanism, uint32_t ssrc);
+  RtpFecParameters(const RtpFecParameters&);
   ~RtpFecParameters();
 
   bool operator==(const RtpFecParameters& o) const {
@@ -337,6 +339,7 @@
   // Constructors for convenience.
   RtpRtxParameters();
   explicit RtpRtxParameters(uint32_t ssrc);
+  RtpRtxParameters(const RtpRtxParameters&);
   ~RtpRtxParameters();
 
   bool operator==(const RtpRtxParameters& o) const { return ssrc == o.ssrc; }
@@ -345,6 +348,7 @@
 
 struct RtpEncodingParameters {
   RtpEncodingParameters();
+  RtpEncodingParameters(const RtpEncodingParameters&);
   ~RtpEncodingParameters();
 
   // If unset, a value is chosen by the implementation.
@@ -460,6 +464,7 @@
 
 struct RtpCodecParameters {
   RtpCodecParameters();
+  RtpCodecParameters(const RtpCodecParameters&);
   ~RtpCodecParameters();
 
   // Build MIME "type/subtype" string from |name| and |kind|.
@@ -545,6 +550,7 @@
 
 struct RtcpParameters final {
   RtcpParameters();
+  RtcpParameters(const RtcpParameters&);
   ~RtcpParameters();
 
   // The SSRC to be used in the "SSRC of packet sender" field. If not set, one
@@ -579,6 +585,7 @@
 
 struct RtpParameters {
   RtpParameters();
+  RtpParameters(const RtpParameters&);
   ~RtpParameters();
 
   // Used when calling getParameters/setParameters with a PeerConnection
diff --git a/api/rtptransceiverinterface.cc b/api/rtptransceiverinterface.cc
index 7f94c75..065ac04 100644
--- a/api/rtptransceiverinterface.cc
+++ b/api/rtptransceiverinterface.cc
@@ -14,6 +14,8 @@
 
 RtpTransceiverInit::RtpTransceiverInit() = default;
 
+RtpTransceiverInit::RtpTransceiverInit(const RtpTransceiverInit& rhs) = default;
+
 RtpTransceiverInit::~RtpTransceiverInit() = default;
 
 absl::optional<RtpTransceiverDirection>
diff --git a/api/rtptransceiverinterface.h b/api/rtptransceiverinterface.h
index 025e8e3..4c22957 100644
--- a/api/rtptransceiverinterface.h
+++ b/api/rtptransceiverinterface.h
@@ -35,6 +35,7 @@
 // https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit
 struct RtpTransceiverInit final {
   RtpTransceiverInit();
+  RtpTransceiverInit(const RtpTransceiverInit&);
   ~RtpTransceiverInit();
   // Direction of the RtpTransceiver. See RtpTransceiverInterface::direction().
   RtpTransceiverDirection direction = RtpTransceiverDirection::kSendRecv;
diff --git a/pc/jsepicecandidate.cc b/pc/jsepicecandidate.cc
index 48a1d08..22139c8 100644
--- a/pc/jsepicecandidate.cc
+++ b/pc/jsepicecandidate.cc
@@ -53,39 +53,4 @@
   return !out->empty();
 }
 
-JsepCandidateCollection::~JsepCandidateCollection() {
-  for (std::vector<JsepIceCandidate*>::iterator it = candidates_.begin();
-       it != candidates_.end(); ++it) {
-    delete *it;
-  }
-}
-
-bool JsepCandidateCollection::HasCandidate(
-    const IceCandidateInterface* candidate) const {
-  bool ret = false;
-  for (std::vector<JsepIceCandidate*>::const_iterator it = candidates_.begin();
-       it != candidates_.end(); ++it) {
-    if ((*it)->sdp_mid() == candidate->sdp_mid() &&
-        (*it)->sdp_mline_index() == candidate->sdp_mline_index() &&
-        (*it)->candidate().IsEquivalent(candidate->candidate())) {
-      ret = true;
-      break;
-    }
-  }
-  return ret;
-}
-
-size_t JsepCandidateCollection::remove(const cricket::Candidate& candidate) {
-  auto iter = std::find_if(candidates_.begin(), candidates_.end(),
-                           [candidate](JsepIceCandidate* c) {
-                             return candidate.MatchesForRemoval(c->candidate());
-                           });
-  if (iter != candidates_.end()) {
-    delete *iter;
-    candidates_.erase(iter);
-    return 1;
-  }
-  return 0;
-}
-
 }  // namespace webrtc
diff --git a/pc/mediastreamobserver.h b/pc/mediastreamobserver.h
index 1aed50b..0d55036 100644
--- a/pc/mediastreamobserver.h
+++ b/pc/mediastreamobserver.h
@@ -22,7 +22,7 @@
 class MediaStreamObserver : public ObserverInterface {
  public:
   explicit MediaStreamObserver(MediaStreamInterface* stream);
-  ~MediaStreamObserver();
+  ~MediaStreamObserver() override;
 
   const MediaStreamInterface* stream() const { return stream_; }
 
diff --git a/sdk/android/BUILD.gn b/sdk/android/BUILD.gn
index 760fd7a..e6ad0da 100644
--- a/sdk/android/BUILD.gn
+++ b/sdk/android/BUILD.gn
@@ -584,11 +584,6 @@
     "src/jni/pc/turncustomizer.h",
   ]
 
-  if (is_clang) {
-    # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
-    suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
-  }
-
   deps = [
     ":base_jni",
     ":generated_external_classes_jni",
@@ -1256,11 +1251,6 @@
     "native_api/peerconnection/peerconnectionfactory.h",
   ]
 
-  if (is_clang) {
-    # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
-    suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
-  }
-
   deps = [
     ":base_jni",
     ":peerconnection_jni",
diff --git a/sdk/android/src/jni/pc/datachannel.cc b/sdk/android/src/jni/pc/datachannel.cc
index 717c12a..d07e00e 100644
--- a/sdk/android/src/jni/pc/datachannel.cc
+++ b/sdk/android/src/jni/pc/datachannel.cc
@@ -29,7 +29,7 @@
 class DataChannelObserverJni : public DataChannelObserver {
  public:
   DataChannelObserverJni(JNIEnv* jni, const JavaRef<jobject>& j_observer);
-  virtual ~DataChannelObserverJni() {}
+  ~DataChannelObserverJni() override {}
 
   void OnBufferedAmountChange(uint64_t previous_amount) override;
   void OnStateChange() override;
diff --git a/sdk/android/src/jni/pc/mediaconstraints.cc b/sdk/android/src/jni/pc/mediaconstraints.cc
index 77c6e09..e7a4bb5 100644
--- a/sdk/android/src/jni/pc/mediaconstraints.cc
+++ b/sdk/android/src/jni/pc/mediaconstraints.cc
@@ -44,7 +44,7 @@
         optional_(PopulateConstraintsFromJavaPairList(
             env,
             Java_MediaConstraints_getOptional(env, j_constraints))) {}
-  virtual ~MediaConstraintsJni() = default;
+  ~MediaConstraintsJni() override = default;
 
   // MediaConstraintsInterface.
   const Constraints& GetMandatory() const override { return mandatory_; }
diff --git a/sdk/android/src/jni/pc/mediastream.h b/sdk/android/src/jni/pc/mediastream.h
index 51dfe23..479ab11 100644
--- a/sdk/android/src/jni/pc/mediastream.h
+++ b/sdk/android/src/jni/pc/mediastream.h
@@ -26,7 +26,7 @@
   explicit JavaMediaStream(
       JNIEnv* env,
       rtc::scoped_refptr<MediaStreamInterface> media_stream);
-  ~JavaMediaStream();
+  ~JavaMediaStream() override;
 
   const ScopedJavaGlobalRef<jobject>& j_media_stream() {
     return j_media_stream_;
diff --git a/sdk/android/src/jni/pc/ownedfactoryandthreads.cc b/sdk/android/src/jni/pc/ownedfactoryandthreads.cc
index d6d4202..9987f25 100644
--- a/sdk/android/src/jni/pc/ownedfactoryandthreads.cc
+++ b/sdk/android/src/jni/pc/ownedfactoryandthreads.cc
@@ -20,6 +20,18 @@
   return reinterpret_cast<OwnedFactoryAndThreads*>(j_p)->factory();
 }
 
+OwnedFactoryAndThreads::OwnedFactoryAndThreads(
+    std::unique_ptr<Thread> network_thread,
+    std::unique_ptr<Thread> worker_thread,
+    std::unique_ptr<Thread> signaling_thread,
+    rtc::NetworkMonitorFactory* network_monitor_factory,
+    PeerConnectionFactoryInterface* factory)
+    : network_thread_(std::move(network_thread)),
+      worker_thread_(std::move(worker_thread)),
+      signaling_thread_(std::move(signaling_thread)),
+      network_monitor_factory_(network_monitor_factory),
+      factory_(factory) {}
+
 OwnedFactoryAndThreads::~OwnedFactoryAndThreads() {
   factory_->Release();
   if (network_monitor_factory_ != nullptr) {
diff --git a/sdk/android/src/jni/pc/ownedfactoryandthreads.h b/sdk/android/src/jni/pc/ownedfactoryandthreads.h
index fbaf860..2ea8570 100644
--- a/sdk/android/src/jni/pc/ownedfactoryandthreads.h
+++ b/sdk/android/src/jni/pc/ownedfactoryandthreads.h
@@ -37,12 +37,7 @@
                          std::unique_ptr<Thread> worker_thread,
                          std::unique_ptr<Thread> signaling_thread,
                          rtc::NetworkMonitorFactory* network_monitor_factory,
-                         PeerConnectionFactoryInterface* factory)
-      : network_thread_(std::move(network_thread)),
-        worker_thread_(std::move(worker_thread)),
-        signaling_thread_(std::move(signaling_thread)),
-        network_monitor_factory_(network_monitor_factory),
-        factory_(factory) {}
+                         PeerConnectionFactoryInterface* factory);
 
   ~OwnedFactoryAndThreads();
 
diff --git a/sdk/android/src/jni/pc/peerconnection.cc b/sdk/android/src/jni/pc/peerconnection.cc
index de246a7..31a0689 100644
--- a/sdk/android/src/jni/pc/peerconnection.cc
+++ b/sdk/android/src/jni/pc/peerconnection.cc
@@ -375,6 +375,13 @@
 
 OwnedPeerConnection::OwnedPeerConnection(
     rtc::scoped_refptr<PeerConnectionInterface> peer_connection,
+    std::unique_ptr<PeerConnectionObserver> observer)
+    : OwnedPeerConnection(peer_connection,
+                          std::move(observer),
+                          nullptr /* constraints */) {}
+
+OwnedPeerConnection::OwnedPeerConnection(
+    rtc::scoped_refptr<PeerConnectionInterface> peer_connection,
     std::unique_ptr<PeerConnectionObserver> observer,
     std::unique_ptr<MediaConstraintsInterface> constraints)
     : peer_connection_(peer_connection),
diff --git a/sdk/android/src/jni/pc/peerconnection.h b/sdk/android/src/jni/pc/peerconnection.h
index 669d360..f201667 100644
--- a/sdk/android/src/jni/pc/peerconnection.h
+++ b/sdk/android/src/jni/pc/peerconnection.h
@@ -40,7 +40,7 @@
 class PeerConnectionObserverJni : public PeerConnectionObserver {
  public:
   PeerConnectionObserverJni(JNIEnv* jni, const JavaRef<jobject>& j_observer);
-  virtual ~PeerConnectionObserverJni();
+  ~PeerConnectionObserverJni() override;
 
   // Implementation of PeerConnectionObserver interface, which propagates
   // the callbacks to the Java observer.
@@ -101,10 +101,7 @@
  public:
   OwnedPeerConnection(
       rtc::scoped_refptr<PeerConnectionInterface> peer_connection,
-      std::unique_ptr<PeerConnectionObserver> observer)
-      : OwnedPeerConnection(peer_connection,
-                            std::move(observer),
-                            nullptr /* constraints */) {}
+      std::unique_ptr<PeerConnectionObserver> observer);
   // Deprecated. PC constraints are deprecated.
   OwnedPeerConnection(
       rtc::scoped_refptr<PeerConnectionInterface> peer_connection,
diff --git a/sdk/android/src/jni/pc/rtcstatscollectorcallbackwrapper.cc b/sdk/android/src/jni/pc/rtcstatscollectorcallbackwrapper.cc
index 4ca545da..966d2ef 100644
--- a/sdk/android/src/jni/pc/rtcstatscollectorcallbackwrapper.cc
+++ b/sdk/android/src/jni/pc/rtcstatscollectorcallbackwrapper.cc
@@ -102,7 +102,7 @@
 ScopedJavaLocalRef<jobject> NativeToJavaRtcStats(JNIEnv* env,
                                                  const RTCStats& stats) {
   JavaMapBuilder builder(env);
-  for (const auto& member : stats.Members()) {
+  for (auto* const member : stats.Members()) {
     if (!member->is_defined())
       continue;
     builder.put(NativeToJavaString(env, member->name()),
@@ -131,6 +131,8 @@
     const JavaRef<jobject>& j_callback)
     : j_callback_global_(jni, j_callback) {}
 
+RTCStatsCollectorCallbackWrapper::~RTCStatsCollectorCallbackWrapper() = default;
+
 void RTCStatsCollectorCallbackWrapper::OnStatsDelivered(
     const rtc::scoped_refptr<const RTCStatsReport>& report) {
   JNIEnv* jni = AttachCurrentThreadIfNeeded();
diff --git a/sdk/android/src/jni/pc/rtcstatscollectorcallbackwrapper.h b/sdk/android/src/jni/pc/rtcstatscollectorcallbackwrapper.h
index 7fd7585..a2794ff 100644
--- a/sdk/android/src/jni/pc/rtcstatscollectorcallbackwrapper.h
+++ b/sdk/android/src/jni/pc/rtcstatscollectorcallbackwrapper.h
@@ -26,6 +26,7 @@
  public:
   RTCStatsCollectorCallbackWrapper(JNIEnv* jni,
                                    const JavaRef<jobject>& j_callback);
+  ~RTCStatsCollectorCallbackWrapper() override;
 
   void OnStatsDelivered(
       const rtc::scoped_refptr<const RTCStatsReport>& report) override;
diff --git a/sdk/android/src/jni/pc/sdpobserver.cc b/sdk/android/src/jni/pc/sdpobserver.cc
index 0ac602b..87989ab 100644
--- a/sdk/android/src/jni/pc/sdpobserver.cc
+++ b/sdk/android/src/jni/pc/sdpobserver.cc
@@ -27,6 +27,8 @@
     : j_observer_global_(env, j_observer),
       constraints_(std::move(constraints)) {}
 
+CreateSdpObserverJni::~CreateSdpObserverJni() = default;
+
 void CreateSdpObserverJni::OnSuccess(SessionDescriptionInterface* desc) {
   JNIEnv* env = AttachCurrentThreadIfNeeded();
   Java_SdpObserver_onCreateSuccess(env, j_observer_global_,
@@ -49,6 +51,8 @@
     : j_observer_global_(env, j_observer),
       constraints_(std::move(constraints)) {}
 
+SetSdpObserverJni::~SetSdpObserverJni() = default;
+
 void SetSdpObserverJni::OnSuccess() {
   JNIEnv* env = AttachCurrentThreadIfNeeded();
   Java_SdpObserver_onSetSuccess(env, j_observer_global_);
diff --git a/sdk/android/src/jni/pc/sdpobserver.h b/sdk/android/src/jni/pc/sdpobserver.h
index 552b99d..6673fec 100644
--- a/sdk/android/src/jni/pc/sdpobserver.h
+++ b/sdk/android/src/jni/pc/sdpobserver.h
@@ -26,6 +26,7 @@
   CreateSdpObserverJni(JNIEnv* env,
                        const JavaRef<jobject>& j_observer,
                        std::unique_ptr<MediaConstraintsInterface> constraints);
+  ~CreateSdpObserverJni() override;
 
   MediaConstraintsInterface* constraints() { return constraints_.get(); }
 
@@ -42,6 +43,7 @@
   SetSdpObserverJni(JNIEnv* env,
                     const JavaRef<jobject>& j_observer,
                     std::unique_ptr<MediaConstraintsInterface> constraints);
+  ~SetSdpObserverJni() override;
 
   MediaConstraintsInterface* constraints() { return constraints_.get(); }
 
diff --git a/sdk/android/src/jni/pc/statsobserver.cc b/sdk/android/src/jni/pc/statsobserver.cc
index ef73c9b..f30a34c 100644
--- a/sdk/android/src/jni/pc/statsobserver.cc
+++ b/sdk/android/src/jni/pc/statsobserver.cc
@@ -58,6 +58,8 @@
                                    const JavaRef<jobject>& j_observer)
     : j_observer_global_(jni, j_observer) {}
 
+StatsObserverJni::~StatsObserverJni() = default;
+
 void StatsObserverJni::OnComplete(const StatsReports& reports) {
   JNIEnv* env = AttachCurrentThreadIfNeeded();
   ScopedJavaLocalRef<jobjectArray> j_reports =
diff --git a/sdk/android/src/jni/pc/statsobserver.h b/sdk/android/src/jni/pc/statsobserver.h
index 6ef14ac..d21fb98 100644
--- a/sdk/android/src/jni/pc/statsobserver.h
+++ b/sdk/android/src/jni/pc/statsobserver.h
@@ -22,6 +22,7 @@
 class StatsObserverJni : public StatsObserver {
  public:
   StatsObserverJni(JNIEnv* jni, const JavaRef<jobject>& j_observer);
+  ~StatsObserverJni() override;
 
   void OnComplete(const StatsReports& reports) override;