From 6b1e9a6327da42e2b1fa6702deb269e79ac0f9ad Mon Sep 17 00:00:00 2001 From: sgjesse Date: Tue, 4 May 2021 02:27:01 -0700 Subject: [PATCH] Turn DesugaredLibraryMismatchDiagnostic into a warning Some build setups cause the DesugaredLibraryMismatchDiagnostic error. However, the builds are equivalent with classic desugar builds, which do not have this type of test. RELNOTES: None PiperOrigin-RevId: 371871743 --- .../com/google/devtools/build/android/r8/Desugar.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/tools/android/java/com/google/devtools/build/android/r8/Desugar.java b/src/tools/android/java/com/google/devtools/build/android/r8/Desugar.java index 0e66cf96bb005f..726b109783221d 100644 --- a/src/tools/android/java/com/google/devtools/build/android/r8/Desugar.java +++ b/src/tools/android/java/com/google/devtools/build/android/r8/Desugar.java @@ -25,7 +25,9 @@ import com.android.tools.r8.D8Command; import com.android.tools.r8.Diagnostic; import com.android.tools.r8.DiagnosticsHandler; +import com.android.tools.r8.DiagnosticsLevel; import com.android.tools.r8.StringResource; +import com.android.tools.r8.errors.DesugaredLibraryMismatchDiagnostic; import com.android.tools.r8.errors.InterfaceDesugarMissingTypeDiagnostic; import com.google.common.collect.ImmutableList; import com.google.devtools.build.android.Converters.ExistingPathConverter; @@ -424,6 +426,14 @@ public void warning(Diagnostic warning) { } DiagnosticsHandler.super.warning(warning); } + + @Override + public DiagnosticsLevel modifyDiagnosticsLevel(DiagnosticsLevel level, Diagnostic diagnostic) { + if (diagnostic instanceof DesugaredLibraryMismatchDiagnostic) { + return DiagnosticsLevel.WARNING; + } + return level; + } } private void desugar(