I have many classes (B0, B1, B2... B#) all extending class A
After initially overriding a function of A and implementing it in all of the B classes. I realise I could have been smarter and implemented it in class A, and now wish to move the function up into it.
Is there a simply way in which I can either remove all the the overrides from the B classes?
You could try a find/replace with a regex:
find - @Override\s*modifier\s*returntype\s*methodname\s*\(.*\)\{.*\}
replace - (blank)
(In my regex, replace modifier
with public
/ private
/ protected
, replace returntype
with the return type, and replace methodname
with the method name.)
Depending on what version of Eclipse you have, you can right-click on the class(es) and go to Refactor => Pull Up. I tried it in Juno.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.