Skip to content

Commit

Permalink
increase visibility to remove synthetic methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jrodbx committed Jan 6, 2016
1 parent 2714152 commit 1b3efb4
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public final class AndroidHeapDumper implements HeapDumper {

private static final String HEAPDUMP_FILE = "suspected_leak_heapdump.hprof";

private final Context context;
private final LeakDirectoryProvider leakDirectoryProvider;
final Context context;
final LeakDirectoryProvider leakDirectoryProvider;
private final Handler mainHandler;

public AndroidHeapDumper(Context context, LeakDirectoryProvider leakDirectoryProvider) {
Expand Down Expand Up @@ -109,7 +109,7 @@ public void cleanup() {
});
}

private File getHeapDumpFile() {
File getHeapDumpFile() {
return new File(leakDirectoryProvider.leakDirectory(), HEAPDUMP_FILE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public final class AndroidWatchExecutor implements Executor {

static final String LEAK_CANARY_THREAD_NAME = "LeakCanary-Heap-Dump";
private final Handler mainHandler;
private final Handler backgroundHandler;
private final long delayMillis;
final Handler backgroundHandler;
final long delayMillis;

public AndroidWatchExecutor(int delayMillis) {
mainHandler = new Handler(Looper.getMainLooper());
Expand All @@ -57,7 +57,7 @@ private boolean isOnMainThread() {
return Looper.getMainLooper().getThread() == Thread.currentThread();
}

private void executeDelayedAfterIdleUnsafe(final Runnable runnable) {
void executeDelayedAfterIdleUnsafe(final Runnable runnable) {
// This needs to be called from the main thread.
Looper.myQueue().addIdleHandler(new MessageQueue.IdleHandler() {
@Override public boolean queueIdle() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public interface Logger {
}

private static class DefaultLogger implements Logger {
DefaultLogger() { }

@Override public void d(String message, Object... args) {
String formatted = String.format(message, args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static void setLeakDirectoryProvider(LeakDirectoryProvider leakDirectoryP
DisplayLeakActivity.leakDirectoryProvider = leakDirectoryProvider;
}

private static File getLeakDirectory(Context context) {
static File getLeakDirectory(Context context) {
LeakDirectoryProvider leakDirectoryProvider = DisplayLeakActivity.leakDirectoryProvider;
if (leakDirectoryProvider != null) {
return leakDirectoryProvider.leakDirectory();
Expand All @@ -95,8 +95,8 @@ private static File getLeakDirectory(Context context) {
}

// null until it's been first loaded.
private List<Leak> leaks;
private String visibleLeakRefKey;
List<Leak> leaks;
String visibleLeakRefKey;

private ListView listView;
private TextView failureView;
Expand Down Expand Up @@ -197,7 +197,7 @@ private static File getLeakDirectory(Context context) {
}
}

private void shareLeak() {
void shareLeak() {
Leak visibleLeak = getVisibleLeak();
String leakInfo = leakInfo(this, visibleLeak.heapDump, visibleLeak.result, true);
Intent intent = new Intent(Intent.ACTION_SEND);
Expand All @@ -206,7 +206,7 @@ private void shareLeak() {
startActivity(Intent.createChooser(intent, getString(R.string.leak_canary_share_with)));
}

private void shareHeapDump() {
void shareHeapDump() {
Leak visibleLeak = getVisibleLeak();
File heapDumpFile = visibleLeak.heapDump.heapDumpFile;
heapDumpFile.setReadable(true, false);
Expand All @@ -216,7 +216,7 @@ private void shareHeapDump() {
startActivity(Intent.createChooser(intent, getString(R.string.leak_canary_share_with)));
}

private void updateUi() {
void updateUi() {
if (leaks == null) {
setTitle("Loading leaks...");
return;
Expand Down Expand Up @@ -328,7 +328,7 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
}
}

private Leak getVisibleLeak() {
Leak getVisibleLeak() {
if (leaks == null) {
return null;
}
Expand Down Expand Up @@ -418,7 +418,7 @@ static void forgetActivity() {
inFlight.clear();
}

private DisplayLeakActivity activityOrNull;
DisplayLeakActivity activityOrNull;
private final File leakDirectory;
private final Handler mainHandler;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class MainActivity extends Activity {
});
}

private void startAsyncTask() {
void startAsyncTask() {
// This async task is an anonymous class and therefore has a hidden reference to the outer
// class MainActivity. If the activity gets destroyed before the task finishes (e.g. rotation),
// the activity instance will leak.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public final class ExcludedRefs implements Serializable {
public final Map<String, Boolean> threadNames;
public final Map<String, Boolean> classNames;

private ExcludedRefs(Map<String, Map<String, Boolean>> fieldNameByClassName,
Map<String, Map<String, Boolean>> staticFieldNameByClassName,
Map<String, Boolean> threadNames, Map<String, Boolean> classNames) {
ExcludedRefs(Map<String, Map<String, Boolean>> fieldNameByClassName,
Map<String, Map<String, Boolean>> staticFieldNameByClassName,
Map<String, Boolean> threadNames, Map<String, Boolean> classNames) {
// Copy + unmodifiable.
this.fieldNameByClassName = unmodifiableMap(new LinkedHashMap<>(fieldNameByClassName));
this.staticFieldNameByClassName =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static class TestListener implements HeapDump.Listener {
@SuppressWarnings("FieldCanBeLocal") Object ref;

static class TestExecutor implements Executor {
private Runnable command;
Runnable command;

@Override public void execute(Runnable command) {
this.command = command;
Expand Down

0 comments on commit 1b3efb4

Please sign in to comment.