简体   繁体   中英

Eclipse java refactoring to change private method to public method

I forgot to add the public access modifier to my abstract methods of a super class - I'm assuming that the quickest way to fix this would be through some refactoring-type-thing but I can't figure out how.

My question is thus then: Does Eclipse have a way to change the access modifier of a method such that classes that implement it will be affected? And how do I use it if it exists?

Thank you!

Right click on the method refactor -> change method signiture change access modifier to public. I suggest doing this on the parent class method.

You can also open this config alt + shift + c keys if you are using default keys.

As a side note, when you dont specify any access modifier it will be package friendly. Also abstract methods can not be private.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM