Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update LeakCanary to 2.10 #581

Open
wants to merge 63 commits into
base: main
Choose a base branch
from
Open

Update LeakCanary to 2.10 #581

wants to merge 63 commits into from

Conversation

pyricau
Copy link

@pyricau pyricau commented May 11, 2023

Also added the now required "description" parameter when watching instances.

Before

image (56)

After

image (55)

@CLAassistant
Copy link

CLAassistant commented May 11, 2023

CLA assistant check
All committers have signed the CLA.

@@ -141,7 +141,7 @@ protected constructor(
public open fun detachChild(childRouter: Router<*>) {
val isChildRemoved = children.remove(childRouter)
val interactor = childRouter.interactor
ribRefWatcher.watchDeletedObject(interactor)
ribRefWatcher.watchDeletedObject(interactor, "detached child router ${childRouter.javaClass.name}")
Copy link
Author

@pyricau pyricau May 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made up a description. You might want something different. But it's nice to be able to provide context on what's causing this to be defined as something to be GCed.

@@ -31,24 +29,17 @@ public class SampleApplication extends Application implements HasActivityDelegat
public void onCreate() {
activityDelegate = new SampleActivityDelegate();
super.onCreate();
if (!LeakCanary.isInAnalyzerProcess(this)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was the separate process deprecated?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's optional now. Most apps shouldn't need it as LeakCanary uses a lot less memory, and this complicates the setup.

public open fun watchDeletedObject(objectToWatch: Any?) {
public open fun watchDeletedObject(
objectToWatch: Any?,
description: String
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be an optional param to avoid being a breaking API change for consumers

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done by adding a deprecated overload without the param (that way it signifies clearly that the call should be updated)

@tyvsmith tyvsmith added the Android Android related tickets label May 12, 2023
objectToWatch: Any?,
) {
watchDeletedObject(objectToWatch, "missing description")
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me know if this works for you.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks

Also added the now required "description" parameter when watching instances.

Fixes uber#580
psteiger and others added 21 commits May 16, 2023 18:00
Also, a couple of minor fixes:
- A small warning on `RibActivity` against importing `android.R`.
- Replaces deprecated `String.toLowerCase()` and `String.capitalize()` with the equivalent `String.lowercase()` and `String.replaceFirstChar(Char::titlecase)`.
This allows for a more repeatable, predictable build between different local configurations.
- Define a dispatchers to be used on the now deprecated WorkerBinder/Worker within RibCoroutineConfig
Allow overriding default CoroutineDispatcher for WorkerBinder calls
FranAguilera and others added 30 commits June 22, 2023 15:53
…=all`

Docs state that:

> If you used the @JvmDefault annotation before, you can safely remove it and use one of the new modes. If you already used -Xjvm-default=enable, which generated only the default method implementations, you can now replace it with -Xjvm-default=all.
`List` is not really needed and we restrict the API  unnecessarily: all we need is an `Iterable`.

For keeping binary compatibility, we also keep the overloads taking in a `List`.
* Set view tree owners in RibActivity#onCreate
* Cleanup duplicate setting of view tree owners
* Add more assertions
Add RibCoroutineWorker.bind that receives multiple workers
…cher_to_default

Change default CoroutineContext from empty to default for the RibCoroutineWorker<>Worker conversion
…iver.

`RibCoroutineWorker` is already a functional interface; the purpose of this builder is to allow consumers
to create a `RibCoroutineWorker` with `CoroutineScope` in receiver position. E.g.

- Functional interface:
```
RibCoroutineWorker { scope ->
  scope.launch { ... }
}
```

- This factory method:
```
RibCoroutineWorker {
  launch { ... }
}
```
Also added the now required "description" parameter when watching instances.

Fixes uber#580
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android Android related tickets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants