nopen icon indicating copy to clipboard operation
nopen copied to clipboard

non final methods check

Open marandaneto opened this issue 5 years ago • 2 comments

hey @JakeWharton first of all thanks for the great work.

I'd love to see nopen also checking non-final methods when they should be. I believe it makes sense to be within this lib, but this is you to say.

The idea is pretty much similar to @Open, but for methods. A method should be final (when possible) or annotated.

I've made a Draft PR (more like a POC), #8 and happy to chat about. If you are willing to bring this in and accept a PR, I'd gladly work on it.

Thanks a lot :)

marandaneto avatar Apr 07 '20 22:04 marandaneto

So this would require that any public or protected function in an @Open class was annotated or marked final?

JakeWharton avatar Apr 13 '20 13:04 JakeWharton

yes, I'd like to double-check on compile-time that I'm not making an accidental overriding. on the same line as Item 19 of Effective Java, I believe a method should explicitly be marked as overridable/open or be final. This is a very handy check on compile-time when you ship a public API as a standalone library (binary).

marandaneto avatar Apr 13 '20 18:04 marandaneto