file level @Override intention
Is there a way to automatically apply the "add @Override" intention to all overridden methods in a file, instead of needing to request it for each overridden method individually?
I realize this defeats the purpose of this annotation, but I'm on a large project that recently migrated to JDK 1.5, so I need to do this to start using this annotation.
Cheers,
11011011
请先登录再写评论。
Use the "Missing @Override annotation" inspection. It has a quickfix, which you can use to annotate all of the methods in a given file, or indeed in the project as a whole.
--Dave Griffith
I've used that quickfix for a single method, but how do I use it for all methods in a given file?
Cheers,
11011011
Either
1) do "Analyze/Inspect Code..." and select the current file as the scope. You may wish to create a simple inspection profile only containing that inspection if you wish to run it on an entire project
or
2) trigger the quickfix somewhere with atl-enter, right-arrow, and select "Run inspection on...".
--Dave Griffith
Thanks! #1 worked for me (after creating a simple profile).
(By the way, I couldn't figure out how to do #2. Alt-enter only popped up a quickfix menu when the cursor was at a location relevant to that quickfix. Elsewhere, alt-enter did nothing.)
Cheers,
11011011
Right, it only works if you're already fixing one instance, giving you an option to fix all the other similar instances. Kind of surprising, but really handy.
--Dave Griffith