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 am Sébastien Dubois. 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 . You can learn more about my projects here.
If you want to follow my work, then become a member.
Ready to get to the next level?
To embark on your Knowledge Management journey, consider investing in resources that will equip you with the tools and strategies you need. Check out the Obsidian Starter Kit and the accompanying video course. It will give you a rock-solid starting point for your note-taking and Knowledge Management efforts.
If you want to take a more holistic approach, then the Knowledge Worker Kit is for you. It covers PKM, but expands into productivity, personal organization, project/task management, and more:
If you are in a hurry, then do not hesitate to book a coaching session with me: