Can you use CppFileTypes.C_SOURCE + CPP_SOURCE? That means packing an additional dependency into bazel_tools which makes the binary bigger. I copied those values to Constants.CC_EXTENSIONS and use it here to check if the file is a cc file.
Include coverage results for cc binaries called from sh_test in the Bazel coverage output file
Currently Bazel only outputs coverage results for java binaries called within a sh_test.
src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShTestRule.java src/main/java/com/google/devtools/build/lib/bazel/rules/sh/ShBinary.java
src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShTestRule.java src/main/java/com/google/devtools/build/lib/bazel/rules/sh/ShBinary.java
src/test/shell/bazel/bazel_coverage_test.sh tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator/Constants.java tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator/Coverage.java tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator/Main.java tools/test/CoverageOutputGenerator/javatests/com/google/devtools/coverageoutputgenerator/CoverageTest.java
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShTestRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShTestRule.java
index 45f5203c76f1e8..c969e4578e22a3 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShTestRule.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShTestRule.java
@@ -40,7 +40,14 @@ public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment envi
         attr("$lcov_merger", LABEL)
             .value(
                 Label.parseAbsoluteUnchecked(
-                    "@bazel_tools//tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator:Main")));
+                    "@bazel_tools//tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator:Main")))
+        // Add the script as an attribute in order for sh_test to output code coverage results for
+        // code covered by CC binaries invocations.
+        .add(
+            attr("$collect_cc_coverage", LABEL)
+                .cfg(HostTransition.INSTANCE)
+                .singleArtifact()
+                .value(environment.getToolsLabel("//tools/test:collect_cc_coverage")));
     return builder.build();
   }
 
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/ShBinary.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/ShBinary.java
index 894cb16e2099e1..7da47f292a8f38 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/ShBinary.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/ShBinary.java
@@ -14,8 +14,10 @@
 package com.google.devtools.build.lib.bazel.rules.sh;
 
 import com.google.common.collect.ImmutableList;
+import com.google.devtools.build.lib.actions.ActionAnalysisMetadata;
 import com.google.devtools.build.lib.actions.Artifact;
 import com.google.devtools.build.lib.actions.MutableActionGraph.ActionConflictException;
+import com.google.devtools.build.lib.analysis.AnalysisEnvironment;
 import com.google.devtools.build.lib.analysis.ConfiguredTarget;
 import com.google.devtools.build.lib.analysis.RuleConfiguredTargetBuilder;
 import com.google.devtools.build.lib.analysis.RuleConfiguredTargetFactory;
@@ -30,9 +32,12 @@
 import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget.Mode;
 import com.google.devtools.build.lib.analysis.test.InstrumentedFilesCollector;
 import com.google.devtools.build.lib.analysis.test.InstrumentedFilesCollector.InstrumentationSpec;
+import com.google.devtools.build.lib.analysis.test.InstrumentedFilesCollector.LocalMetadataCollector;
 import com.google.devtools.build.lib.analysis.test.InstrumentedFilesProvider;
 import com.google.devtools.build.lib.collect.nestedset.NestedSet;
 import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
+import com.google.devtools.build.lib.rules.cpp.CppCompileAction;
+import com.google.devtools.build.lib.rules.cpp.CppFileTypes;
 import com.google.devtools.build.lib.util.FileTypeSet;
 import com.google.devtools.build.lib.util.OS;
 import com.google.devtools.build.lib.vfs.PathFragment;
@@ -96,12 +101,33 @@ public ConfiguredTarget create(RuleContext ruleContext)
             InstrumentedFilesProvider.class,
             InstrumentedFilesCollector.collect(
                 ruleContext,
-                new InstrumentationSpec(FileTypeSet.NO_FILE),
-                InstrumentedFilesCollector.NO_METADATA_COLLECTOR,
+                new InstrumentationSpec(FileTypeSet.ANY_FILE,"srcs", "deps", "data"),
+                CC_METADATA_COLLECTOR,
                 filesToBuild))
         .build();
   }
 
+  // Collects coverage metadata (.gcno files) for the artifacts that are generated by C++ rules.
+  private static final LocalMetadataCollector CC_METADATA_COLLECTOR =
+      new LocalMetadataCollector() {
+        @Override
+        public void collectMetadataArtifacts(
+            Iterable<Artifact> artifacts,
+            AnalysisEnvironment analysisEnvironment,
+            NestedSetBuilder<Artifact> metadataFilesBuilder) {
+          for (Artifact artifact : artifacts) {
+            ActionAnalysisMetadata action = analysisEnvironment.getLocalGeneratingAction(artifact);
+            if (action instanceof CppCompileAction) {
+              addOutputs(metadataFilesBuilder, action, CppFileTypes.COVERAGE_NOTES);
+            } else if (action != null) {
+              // Recurse on inputs.
+              collectMetadataArtifacts(
+                  action.getInputs(), analysisEnvironment, metadataFilesBuilder);
+            }
+          }
+        }
+      };
+
   private static boolean isWindowsExecutable(Artifact artifact) {
     return artifact.getExtension().equals("exe")
         || artifact.getExtension().equals("cmd")

diff --git a/src/test/shell/bazel/bazel_coverage_test.sh b/src/test/shell/bazel/bazel_coverage_test.sh
index a725d214aec057..fa8bf021bc9b8c 100755
--- a/src/test/shell/bazel/bazel_coverage_test.sh
+++ b/src/test/shell/bazel/bazel_coverage_test.sh
@@ -77,7 +77,7 @@ function assert_coverage_result() {
     local expected_coverage_no_newlines="$( echo "$expected_coverage" | tr '\n' ',' )"
     local output_file_no_newlines="$( cat "$output_file" | tr '\n' ',' )"
 
-    ( echo $output_file_no_newlines | grep  $expected_coverage_no_newlines ) \
+    ( echo "$output_file_no_newlines" | grep -F "$expected_coverage_no_newlines" ) \
         || fail "Expected coverage result
 <$expected_coverage>
 was not found in actual coverage report:
@@ -625,4 +625,418 @@ EOF
   cmp result.dat "$coverage_file_path" || fail "Coverage output file is different than the expected file"
 }
 
+function test_sh_test_coverage_cc_binary() {
+  local -r gcov_location=$(which gcov)
+  if [[ ! -x ${gcov_location:-/usr/bin/gcov} ]]; then
+    echo "gcov not installed. Skipping test."
+    return
+  fi
+
+  "$gcov_location" -version | grep "LLVM" && \
+      echo "gcov LLVM version not supported. Skipping test." && return
+   # gcov -v | grep "gcov" outputs a line that looks like this:
+   # gcov (Debian 7.3.0-5) 7.3.0
+   local gcov_version="$(gcov -v | grep "gcov" | cut -d " " -f 4 | cut -d "." -f 1)"
+    [ "$gcov_version" -lt 7 ] \
+        && echo "gcov version before 7.0 is not supported. Skipping test." \
+        && return
+
+  ########### Setup source files and BUILD file ###########
+  cat <<EOF > BUILD
+sh_test(
+    name = "hello-sh",
+    srcs = ["hello-test.sh"],
+    data = ["//examples/cpp:hello-world"]
+)
+EOF
+  cat <<EOF > hello-test.sh
+#!/bin/bash
+
+examples/cpp/hello-world
+EOF
+  chmod +x hello-test.sh
+
+  mkdir -p examples/cpp
+
+  cat <<EOF > examples/cpp/BUILD
+package(default_visibility = ["//visibility:public"])
+
+cc_binary(
+    name = "hello-world",
+    srcs = ["hello-world.cc"],
+    deps = [":hello-lib"],
+)
+
+cc_library(
+    name = "hello-lib",
+    srcs = ["hello-lib.cc"],
+    hdrs = ["hello-lib.h"]
+)
+EOF
+
+  cat <<EOF > examples/cpp/hello-world.cc
+#include "examples/cpp/hello-lib.h"
+
+#include <string>
+
+using hello::HelloLib;
+using std::string;
+
+int main(int argc, char** argv) {
+  HelloLib lib("Hello");
+  string thing = "world";
+  if (argc > 1) {
+    thing = argv[1];
+  }
+  lib.greet(thing);
+  return 0;
+}
+EOF
+
+  cat <<EOF > examples/cpp/hello-lib.h
+#ifndef EXAMPLES_CPP_HELLO_LIB_H_
+#define EXAMPLES_CPP_HELLO_LIB_H_
+
+#include <string>
+#include <memory>
+
+namespace hello {
+
+class HelloLib {
+ public:
+  explicit HelloLib(const std::string &greeting);
+
+  void greet(const std::string &thing);
+
+ private:
+  std::auto_ptr<const std::string> greeting_;
+};
+
+}  // namespace hello
+
+#endif  // EXAMPLES_CPP_HELLO_LIB_H_
+EOF
+
+  cat <<EOF > examples/cpp/hello-lib.cc
+#include "examples/cpp/hello-lib.h"
+
+#include <iostream>
+
+using std::cout;
+using std::endl;
+using std::string;
+
+namespace hello {
+
+HelloLib::HelloLib(const string& greeting) : greeting_(new string(greeting)) {
+}
+
+void HelloLib::greet(const string& thing) {
+  cout << *greeting_ << " " << thing << endl;
+}
+
+}  // namespace hello
+EOF
+
+  ########### Run bazel coverage ###########
+  bazel coverage --experimental_cc_coverage --test_output=all \
+      //:hello-sh &>$TEST_log || fail "Coverage for //:orange-sh failed"
+
+  ########### Assert coverage results. ###########
+  local coverage_file_path="$( get_coverage_file_path_from_test_log )"
+  local expected_result_hello_lib="SF:examples/cpp/hello-lib.cc
+FN:18,_GLOBAL__sub_I_hello_lib.cc
+FN:18,_Z41__static_initialization_and_destruction_0ii
+FN:14,_ZN5hello8HelloLib5greetERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
+FN:11,_ZN5hello8HelloLibC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
+FNDA:1,_GLOBAL__sub_I_hello_lib.cc
+FNDA:1,_Z41__static_initialization_and_destruction_0ii
+FNDA:1,_ZN5hello8HelloLib5greetERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
+FNDA:1,_ZN5hello8HelloLibC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
+FNF:4
+FNH:4
+BA:11,2
+BA:18,2
+BRF:2
+BRH:2
+DA:11,1
+DA:12,1
+DA:14,1
+DA:15,1
+DA:16,1
+DA:18,3
+LH:6
+LF:6
+end_of_record"
+  assert_coverage_result "$expected_result_hello_lib" "$coverage_file_path"
+
+  local coverage_result_hello_lib_header="SF:examples/cpp/hello-world.cc
+FN:8,main
+FNDA:1,main
+FNF:1
+FNH:1
+BA:9,2
+BA:10,2
+BA:11,2
+BA:12,0
+BA:14,2
+BRF:5
+BRH:4
+DA:8,1
+DA:9,2
+DA:10,2
+DA:11,1
+DA:12,0
+DA:14,1
+DA:15,1
+LH:6
+LF:7
+end_of_record"
+  assert_coverage_result "$coverage_result_hello_lib_header" "$coverage_file_path"
+}
+
+function test_sh_test_coverage_cc_binary_and_java_binary() {
+local -r gcov_location=$(which gcov)
+  if [[ ! -x ${gcov_location:-/usr/bin/gcov} ]]; then
+    echo "gcov not installed. Skipping test."
+    return
+  fi
+
+  "$gcov_location" -version | grep "LLVM" && \
+      echo "gcov LLVM version not supported. Skipping test." && return
+   # gcov -v | grep "gcov" outputs a line that looks like this:
+   # gcov (Debian 7.3.0-5) 7.3.0
+   local gcov_version="$(gcov -v | grep "gcov" | cut -d " " -f 4 | cut -d "." -f 1)"
+    [ "$gcov_version" -lt 7 ] \
+        && echo "gcov version before 7.0 is not supported. Skipping test." \
+        && return
+
+  ########### Setup source files and BUILD file ###########
+  cat <<EOF > BUILD
+sh_test(
+    name = "hello-sh",
+    srcs = ["hello-test.sh"],
+    data = [
+      "//examples/cpp:hello-world",
+      "//java/com/google/orange:orange-bin"
+    ]
+)
+EOF
+  cat <<EOF > hello-test.sh
+#!/bin/bash
+
+examples/cpp/hello-world
+java/com/google/orange/orange-bin
+EOF
+  chmod +x hello-test.sh
+
+  mkdir -p examples/cpp
+
+  cat <<EOF > examples/cpp/BUILD
+package(default_visibility = ["//visibility:public"])
+
+cc_binary(
+    name = "hello-world",
+    srcs = ["hello-world.cc"],
+    deps = [":hello-lib"],
+)
+
+cc_library(
+    name = "hello-lib",
+    srcs = ["hello-lib.cc"],
+    hdrs = ["hello-lib.h"]
+)
+EOF
+
+  cat <<EOF > examples/cpp/hello-world.cc
+#include "examples/cpp/hello-lib.h"
+
+#include <string>
+
+using hello::HelloLib;
+using std::string;
+
+int main(int argc, char** argv) {
+  HelloLib lib("Hello");
+  string thing = "world";
+  if (argc > 1) {
+    thing = argv[1];
+  }
+  lib.greet(thing);
+  return 0;
+}
+EOF
+
+  cat <<EOF > examples/cpp/hello-lib.h
+#ifndef EXAMPLES_CPP_HELLO_LIB_H_
+#define EXAMPLES_CPP_HELLO_LIB_H_
+
+#include <string>
+#include <memory>
+
+namespace hello {
+
+class HelloLib {
+ public:
+  explicit HelloLib(const std::string &greeting);
+
+  void greet(const std::string &thing);
+
+ private:
+  std::auto_ptr<const std::string> greeting_;
+};
+
+}  // namespace hello
+
+#endif  // EXAMPLES_CPP_HELLO_LIB_H_
+EOF
+
+  cat <<EOF > examples/cpp/hello-lib.cc
+#include "examples/cpp/hello-lib.h"
+
+#include <iostream>
+
+using std::cout;
+using std::endl;
+using std::string;
+
+namespace hello {
+
+HelloLib::HelloLib(const string& greeting) : greeting_(new string(greeting)) {
+}
+
+void HelloLib::greet(const string& thing) {
+  cout << *greeting_ << " " << thing << endl;
+}
+
+}  // namespace hello
+EOF
+
+  ########### Setup Java sources ###########
+  mkdir -p java/com/google/orange
+
+  cat <<EOF > java/com/google/orange/BUILD
+package(default_visibility = ["//visibility:public"])
+java_binary(
+    name = "orange-bin",
+    srcs = ["orangeBin.java"],
+    main_class = "com.google.orange.orangeBin",
+    deps = [":orange-lib"],
+)
+java_library(
+    name = "orange-lib",
+    srcs = ["orangeLib.java"],
+)
+EOF
+
+  cat <<EOF > java/com/google/orange/orangeLib.java
+package com.google.orange;
+public class orangeLib {
+  public void print() {
+    System.out.println("orange prints a message!");
+  }
+}
+EOF
+
+  cat <<EOF > java/com/google/orange/orangeBin.java
+package com.google.orange;
+public class orangeBin {
+  public static void main(String[] args) {
+    orangeLib orange = new orangeLib();
+    orange.print();
+  }
+}
+EOF
+
+  ########### Run bazel coverage ###########
+  bazel coverage --experimental_cc_coverage --test_output=all \
+      //:hello-sh &>$TEST_log || fail "Coverage for //:orange-sh failed"
+
+  ########### Assert coverage results. ###########
+  local coverage_file_path="$( get_coverage_file_path_from_test_log )"
+  local expected_result_hello_lib="SF:examples/cpp/hello-lib.cc
+FN:18,_GLOBAL__sub_I_hello_lib.cc
+FN:18,_Z41__static_initialization_and_destruction_0ii
+FN:14,_ZN5hello8HelloLib5greetERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
+FN:11,_ZN5hello8HelloLibC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
+FNDA:1,_GLOBAL__sub_I_hello_lib.cc
+FNDA:1,_Z41__static_initialization_and_destruction_0ii
+FNDA:1,_ZN5hello8HelloLib5greetERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
+FNDA:1,_ZN5hello8HelloLibC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
+FNF:4
+FNH:4
+BA:11,2
+BA:18,2
+BRF:2
+BRH:2
+DA:11,1
+DA:12,1
+DA:14,1
+DA:15,1
+DA:16,1
+DA:18,3
+LH:6
+LF:6
+end_of_record"
+  assert_coverage_result "$expected_result_hello_lib" "$coverage_file_path"
+
+  local coverage_result_hello_lib_header="SF:examples/cpp/hello-world.cc
+FN:8,main
+FNDA:1,main
+FNF:1
+FNH:1
+BA:9,2
+BA:10,2
+BA:11,2
+BA:12,0
+BA:14,2
+BRF:5
+BRH:4
+DA:8,1
+DA:9,2
+DA:10,2
+DA:11,1
+DA:12,0
+DA:14,1
+DA:15,1
+LH:6
+LF:7
+end_of_record"
+  assert_coverage_result "$coverage_result_hello_lib_header" "$coverage_file_path"
+
+
+  ############# Assert Java code coverage results
+
+  local coverage_result_orange_bin="SF:com/google/orange/orangeBin.java
+FN:2,com/google/orange/orangeBin::<init> ()V
+FN:4,com/google/orange/orangeBin::main ([Ljava/lang/String;)V
+FNDA:0,com/google/orange/orangeBin::<init> ()V
+FNDA:1,com/google/orange/orangeBin::main ([Ljava/lang/String;)V
+FNF:2
+FNH:1
+DA:2,0
+DA:4,4
+DA:5,2
+DA:6,1
+LH:3
+LF:4
+end_of_record"
+  assert_coverage_result "$coverage_result_orange_bin" "$coverage_file_path"
+
+  local coverage_result_orange_lib="SF:com/google/orange/orangeLib.java
+FN:2,com/google/orange/orangeLib::<init> ()V
+FN:4,com/google/orange/orangeLib::print ()V
+FNDA:1,com/google/orange/orangeLib::<init> ()V
+FNDA:1,com/google/orange/orangeLib::print ()V
+FNF:2
+FNH:2
+DA:2,3
+DA:4,3
+DA:5,1
+LH:3
+LF:3
+end_of_record"
+  assert_coverage_result "$coverage_result_orange_lib" "$coverage_file_path"
+}
+
 run_suite "test tests"
diff --git a/tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator/Constants.java b/tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator/Constants.java
index 13adcc6a5581d9..728fb37f8ecbdc 100644
--- a/tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator/Constants.java
+++ b/tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator/Constants.java
@@ -14,6 +14,8 @@
 
 package com.google.devtools.coverageoutputgenerator;
 
+import com.google.common.collect.ImmutableList;
+
 /**
  * Stores markers used by the lcov tracefile and gcov intermediate format file. See <a
  * href="http://ltp.sourceforge.net/coverage/lcov/geninfo.1.php">lcov documentation</a> and the flag
@@ -48,4 +50,6 @@ class Constants {
   static final String GCOV_BRANCH_NOTEXEC = "notexec";
   static final String GCOV_BRANCH_NOTTAKEN = "taken";
   static final String GCOV_BRANCH_TAKEN = "nottaken";
+  static final ImmutableList<String> CC_EXTENSIONS = ImmutableList.of(
+      ".cc", ".cpp", ".cxx", ".c++", ".C", ".c", ".h", ".hh", ".hpp", ".ipp", ".hxx", ".inc");
 }
diff --git a/tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator/Coverage.java b/tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator/Coverage.java
index 484e9870f6c1da..f24290ac8f1305 100644
--- a/tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator/Coverage.java
+++ b/tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator/Coverage.java
@@ -14,6 +14,8 @@
 
 package com.google.devtools.coverageoutputgenerator;
 
+import static com.google.devtools.coverageoutputgenerator.Constants.CC_EXTENSIONS;
+
 import java.util.Collection;
 import java.util.List;
 import java.util.Set;
@@ -48,13 +50,13 @@ static Coverage merge(Coverage c1, Coverage c2) {
   }
 
   /**
-   * Returns {@link Coverage} only for the given source filenames, filtering out everything else in
-   * the given coverage.
+   * Returns {@link Coverage} only for the given CC source filenames, filtering out every other CC
+   * sources the given coverage. Other type of source files (e.g. Java) will not be filtered out.
    *
    * @param coverage The initial coverage.
    * @param sourcesToKeep The filenames of the sources to keep from the initial coverage.
    */
-  static Coverage getOnlyTheseSources(Coverage coverage, Set<String> sourcesToKeep) {
+  static Coverage getOnlyTheseCcSources(Coverage coverage, Set<String> sourcesToKeep) {
     if (coverage == null || sourcesToKeep == null) {
       throw new IllegalArgumentException("Coverage and sourcesToKeep should not be null.");
     }
@@ -66,13 +68,23 @@ static Coverage getOnlyTheseSources(Coverage coverage, Set<String> sourcesToKeep
     }
     Coverage finalCoverage = new Coverage();
     for (SourceFileCoverage source : coverage.getAllSourceFiles()) {
-      if (sourcesToKeep.contains(source.sourceFileName())) {
+      if (!isCcSourceFile(source.sourceFileName())
+          || sourcesToKeep.contains(source.sourceFileName())) {
         finalCoverage.add(source);
       }
     }
     return finalCoverage;
   }
 
+  private static boolean isCcSourceFile(String filename) {
+    for (String ccExtension : CC_EXTENSIONS) {
+      if (filename.endsWith(ccExtension)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
   static Coverage filterOutMatchingSources(Coverage coverage, List<String> regexes)
       throws IllegalArgumentException {
     if (coverage == null || regexes == null) {
diff --git a/tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator/Main.java b/tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator/Main.java
index 897732374d7b59..019943c8997746 100644
--- a/tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator/Main.java
+++ b/tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator/Main.java
@@ -112,7 +112,7 @@ public static void main(String[] args) {
       Set<String> ccSources = getCcSourcesFromSourceFileManifest(flags.sourceFileManifest());
       if (!ccSources.isEmpty()) {
         // Only filter out coverage if there were C++ sources found in the coverage manifest.
-        coverage = Coverage.getOnlyTheseSources(coverage, ccSources);
+        coverage = Coverage.getOnlyTheseCcSources(coverage, ccSources);
       }
     }
 
diff --git a/tools/test/CoverageOutputGenerator/javatests/com/google/devtools/coverageoutputgenerator/CoverageTest.java b/tools/test/CoverageOutputGenerator/javatests/com/google/devtools/coverageoutputgenerator/CoverageTest.java
index 00d4a178f652e6..5e8e9599ffbd69 100644
--- a/tools/test/CoverageOutputGenerator/javatests/com/google/devtools/coverageoutputgenerator/CoverageTest.java
+++ b/tools/test/CoverageOutputGenerator/javatests/com/google/devtools/coverageoutputgenerator/CoverageTest.java
@@ -191,18 +191,18 @@ public void testGetOnlyTheseSources() {
 
     assertThat(
             getSourceFileNames(
-                Coverage.getOnlyTheseSources(coverage, sourcesToKeep).getAllSourceFiles()))
+                Coverage.getOnlyTheseCcSources(coverage, sourcesToKeep).getAllSourceFiles()))
         .containsExactly("source/common/protobuf/utility.cc", "source/common/grpc/common.cc");
   }
 
   @Test(expected = IllegalArgumentException.class)
   public void testGetOnlyTheseSourcesNullCoverage() {
-    Coverage.getOnlyTheseSources(null, new HashSet<>());
+    Coverage.getOnlyTheseCcSources(null, new HashSet<>());
   }
 
   @Test(expected = IllegalArgumentException.class)
   public void testGetOnlyTheseSourcesNullSources() {
-    Coverage.getOnlyTheseSources(new Coverage(), null);
+    Coverage.getOnlyTheseCcSources(new Coverage(), null);
   }
 
   @Test
@@ -213,7 +213,7 @@ public void testGetOnlyTheseSourcesEmptySources() {
     coverage.add(new SourceFileCoverage("source/server/options.cc"));
     coverage.add(new SourceFileCoverage("source/server/manager.cc"));
 
-    assertThat(Coverage.getOnlyTheseSources(coverage, new HashSet<>()).getAllSourceFiles())
+    assertThat(Coverage.getOnlyTheseCcSources(coverage, new HashSet<>()).getAllSourceFiles())
         .isEmpty();
   }
 }
