Commit ef2efc5
Fix testLoggerLeak by replacing Kotlin SAM lambda with anonymous object (#1977)
Summary:
Pull Request resolved: #1977
Yoga test is failing after migration from java to kotlin due to the `testLoggerLeak` failing. The test creates a no-op `YogaLogger`, sets+unsets it on a config, drops all references, then asserts that a `WeakReference` to the logger gets cleared by GC. The Kotlin SAM lambda form (`YogaLogger { level, message -> }`) ends up with an implicit `this$0` capture of the enclosing test instance, so the logger never becomes weakly reachable and the test fails after 50 GC attempts.
Fix:
Replacing the SAM lambda with an explicit anonymous object expression to match what the Java version was doing.
Reviewed By: cortinico
Differential Revision: D108765169
fbshipit-source-id: 1f6ca4351f3f92bab27b522e5fb57b82fee0e9951 parent b7ff95d commit ef2efc5
1 file changed
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
59 | 63 | | |
60 | 64 | | |
61 | 65 | | |
| |||
0 commit comments