uber / uber/RIBs

[Android][Question] Tutorial 2 memory leak inner class question

Open
#377 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Android
Dominant language
Kotlin
Stars
7.9k
Forks
914
PR merge metrics
No merged PRs in 30d

Description

I'm at the beginning of tutorial 2, seeing a strange non-static inner class:

@RibInteractor
public class RootInteractor extends Interactor<RootInteractor.RootPresenter, RootRouter> {
    //...
    class LoggedOutListener implements LoggedOutInteractor.Listener {
    @Override
    public void login(String userName) {
      // Switch to logged in. Let’s just ignore userName for now.
      getRouter().detachLoggedOut();
      getRouter().attachLoggedIn();
    }
  }
}

Also, the login listener is referenced by a very strange syntax in RootBuilder: rootInteractor.new LoggedOutListener()
What is that?

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 with tutorial 2's RootInteractor and RootBuilder references shown in the issue. Review the non-static LoggedOutListener declaration and the rootInteractor.new LoggedOutListener() usage, including the reported memory-leak concern. Done means providing a clear explanation of both constructs and their lifecycle implications.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
documentation, mobile-dev
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.