TeamAmaze / TeamAmaze/AmazeFileManager

Enhance readablity by making objects that could live longer than it's activity their own name

Open
#2,864 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Task (low)
Dominant language
Kotlin
Stars
6.4k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
1

Description

When dealing with AsyncTasks or Task<V, Callable<V>> never create it anonimously:

new AsyncTask<Void, Void, Float>() {
    //...
};

as it may cause the programmer to easily forget that all variables used and an instance of this are strongly referenced for the life of the anonymous object. That could cause unforeseen leaks.

A mitigation is having each object be instantiated from a subclass:

new MakeThingTask(...);

This is more explicit in its "aquisition" of strong references to the parameters passed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by searching the Android project for anonymous AsyncTask and Task<V, Callable> usages. Determine which objects need named subclasses to make their strong references explicit, and consider the work complete when the affected usages follow that pattern without introducing the described leak risk.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.