Skip to content

Commit

Permalink
Suppress SparseArray lint warning in Mojo RouterImpl
Browse files Browse the repository at this point in the history
org.chromium.mojo.bindings.RouterImpl uses a HashMap<Long, MessageReceiver> to store the callbacks for all Mojo method calls.

Lint complains that this causes unnecessary garbage collection thrashing due to boxing/unboxing of the long map keys, and instead recommends to use an android.util.LongSparseArray.

But LongSparseArray is probably not suitable either, since the documentation says it's "not intended to be appropriate for data structures that may contain large numbers of items".

This patch suppresses the warning for now.

BUG=600699

Review URL: https://codereview.chromium.org/1850793002

Cr-Commit-Position: refs/heads/master@{#385201}
  • Loading branch information
johnmellor authored and Commit bot committed Apr 5, 2016
1 parent f03d2c6 commit 4d8bdcd
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

package org.chromium.mojo.bindings;

import android.annotation.SuppressLint;

import org.chromium.mojo.system.AsyncWaiter;
import org.chromium.mojo.system.Core;
import org.chromium.mojo.system.MessagePipeHandle;
Expand All @@ -15,6 +17,7 @@
/**
* Implementation of {@link Router}.
*/
@SuppressLint("UseSparseArrays") // https://crbug.com/600699
public class RouterImpl implements Router {

/**
Expand Down

0 comments on commit 4d8bdcd

Please sign in to comment.