Remove ResourceLeakDetector.ENABLED / Replace ResourceLeakDetector.is/setDisabled() with is/setEnabled()

- Related: #1612
Remove an unnecessary empty line
[#1637] Check for null parameters
Fix compile error
Simplify the validation logic proposed in 25f96b164498988439c38baf6ff4c57763464824
Merge remote-tracking branch upstream/$:{upbranch}