Searching for final methods in a Java project

Efficient way to find final methods in a Java project

Quick tip of the day: searching for final methods in a Java project.

Recently at work, I had to find all final methods in a codebase.

The following regular expression helped me out:

(public|protected|private|static|\\s) (final) +\[\\w\\<\\>\\\[\\\]\]+\\s+(\\w+) \*\\(\[^\\)\]\*\\) \*(\\{?|\[^;\])

For the curious among you, I needed to do this because of an issue where some Spring bean mysteriously had null properties. The issue was caused by the fact that we had final methods in some beans that CGLib did not like (i.e., could not proxy).

That's it for today! ✨

About Sébastien

I'm Sébastien Dubois, and I'm on a mission to help knowledge workers escape information overload. After 20+ years in IT and seeing too many brilliant minds drowning in digital chaos, I've decided to help people build systems that actually work. Through the Knowii Community, my courses, products & services and my Website, I share practical and battle-tested systems. You can follow me on X 🐦 and on BlueSky 🦋.


I am an author, founder, and coach. I write books and articles about Knowledge Work, Personal Knowledge Management, Note-taking, Lifelong Learning, Personal Organization, and Zen Productivity. I also craft lovely digital products.



If you want to follow my work, then become a member and join our community.


Ready to get to the next level?

If you're tired of information overwhelm and ready to build a reliable knowledge system:


Subscribe to the Newsletter 💌