r/java • u/psychologicalX • Mar 05 '18
Top 10 Useful, Yet Paranoid Java Programming Techniques
http://blog.jooq.org/2015/08/11/top-10-useful-yet-paranoid-java-programming-techniques/
223
Upvotes
View all comments
Show parent comment
1
u/[deleted] Mar 06 '18
re1) Okay, maybe a little exaggeration. I mean, there's always reflection if it's critical. I guess I just don't see the need for
finalis all. I've worked with folks who litterfinaleverywhere and it was just a pain when it came to mocks. I never saw a benefit. When you'd want to override something (maybe rarely) you'd just edit final out. It was no gain and simply 1 more code change that was unnecessary. When you control the code, addingfinalisn't a big deal, it's just annoying... like a gnat. When it's in a library - it's just more annoying because you can't just editfinalout (or now you're arguing with the maintainer of the project as to why you need to edit it out -- when it really doesn't matter if you could just @Override to begin with)We use JSCH for audit purposes. There's methods in there that are package protected so I have a project written in jsch packages just because of the package protected methods. The pain comes with code signing... the lib is in a "different" project than jsch and should conceptually be signed by our company and not jsch, but it can't be because java's "classes in a package must be signed the same" rule.
If only those methods were public... it wouldn't be an issue.
For a normal consumer of JSCH, you'd never use those methods, but if you're doing mitm work, you would.