From fd1bbc17925ef94f358acbe7bbf4aba84d3de9e2 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Mon, 11 Sep 2017 16:46:45 +0100 Subject: [PATCH] [Xamarin.Android.Build.Tasks] Ignore the StaticFieldLeak Lint warning Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=58340 Lint added a new warning which checks for static fields on Java classes. Unfortunately we need to use a static in our MonoPackageManager.java classes because we need to keep track of the Application instance. So we should ignre this particlar warning. --- src/Xamarin.Android.Build.Tasks/Tasks/Lint.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/Lint.cs b/src/Xamarin.Android.Build.Tasks/Tasks/Lint.cs index 58567803304..5a7789dd69d 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/Lint.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/Lint.cs @@ -166,6 +166,12 @@ public override bool Execute () // that means for EVERYTHING! Which will be a HUGE amount of warnings for a large project if (string.IsNullOrEmpty (DisabledIssues) || !DisabledIssues.Contains ("UnusedResources")) DisabledIssues = "UnusedResources" + (!string.IsNullOrEmpty(DisabledIssues) ? ","+DisabledIssues : ""); + + // We need to hard code this test as disabled in because Lint will issue a warning + // for the MonoPackageManager.java since we have to use a static to keep track of the + // application instance. + if (string.IsNullOrEmpty (DisabledIssues) || !DisabledIssues.Contains ("StaticFieldLeak")) + DisabledIssues = "StaticFieldLeak" + (!string.IsNullOrEmpty (DisabledIssues) ? "," + DisabledIssues : ""); Log.LogDebugMessage ("Lint Task"); Log.LogDebugMessage (" TargetDirectory: {0}", TargetDirectory);