androidx icon indicating copy to clipboard operation
androidx copied to clipboard

Change Dialog 's getWindow() to NonNull

Open liu-wanshun opened this issue 1 year ago • 3 comments

Proposed Changes

  • getWindow() is NonNull ,mWindowis initialized during construction and has not been modified since then.

Testing

Test: override getWindow() in subclass of dialog,no problem.

liu-wanshun avatar Dec 20 '24 02:12 liu-wanshun

The place to fix this, if it indeed is worth changing, would be in the framework, not some arbitrary subclass. But keep in mind that the nullability of these methods models the entire history of behavior–not just the current behavior.

JakeWharton avatar Dec 20 '24 03:12 JakeWharton

The place to fix this, if it indeed is worth changing, would be in the framework, not some arbitrary subclass. But keep in mind that the nullability of these methods models the entire history of behavior–not just the current behavior.

@JakeWharton yes,this problem originates from framework, but it is impossible to be null. image

liu-wanshun avatar Dec 20 '24 03:12 liu-wanshun

I also submitted a patch for framework. https://android-review.googlesource.com/c/platform/frameworks/base/+/3428320

liu-wanshun avatar Dec 20 '24 03:12 liu-wanshun