Kotlin "also" Function Strange Warning In Android Studio
There is two presumably identical snippets: // Verbose version val typedArray = context.obtainStyledAttributes(attrs, styleable) block(typedArray) typedArray.recycle() // One-line
Solution 1:
This is a bit of a guess, but I believe it's because the static analysis tool can't guarantee that the TypedArray returned by also() is the same instance as the one returned by obtainedStyledAttributes(). It sees that a TypedArray is obtained but can't guarantee that it is recycled, so it issues the warning.
I would hesitate to call this a bug (or "flaw") in the linter, but it does mean that the warning can be ignored in this case.
Post a Comment for "Kotlin "also" Function Strange Warning In Android Studio"