Skip to content

Commit 20bd1b1

Browse files
dellis1972jonpryor
authored andcommitted
[Xamarin.Android.Build.Tasks] Ignore StaticFieldLeak Lint warning (#840)
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.
1 parent 343fe1e commit 20bd1b1

File tree

1 file changed

+6
-0
lines changed
  • src/Xamarin.Android.Build.Tasks/Tasks

1 file changed

+6
-0
lines changed

src/Xamarin.Android.Build.Tasks/Tasks/Lint.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@ public override bool Execute ()
166166
// that means for EVERYTHING! Which will be a HUGE amount of warnings for a large project
167167
if (string.IsNullOrEmpty (DisabledIssues) || !DisabledIssues.Contains ("UnusedResources"))
168168
DisabledIssues = "UnusedResources" + (!string.IsNullOrEmpty(DisabledIssues) ? ","+DisabledIssues : "");
169+
170+
// We need to hard code this test as disabled in because Lint will issue a warning
171+
// for the MonoPackageManager.java since we have to use a static to keep track of the
172+
// application instance.
173+
if (string.IsNullOrEmpty (DisabledIssues) || !DisabledIssues.Contains ("StaticFieldLeak"))
174+
DisabledIssues = "StaticFieldLeak" + (!string.IsNullOrEmpty (DisabledIssues) ? "," + DisabledIssues : "");
169175

170176
Log.LogDebugMessage ("Lint Task");
171177
Log.LogDebugMessage (" TargetDirectory: {0}", TargetDirectory);

0 commit comments

Comments
 (0)