简体   繁体   中英

Disable information list in Eclipse on “Refactor” -> “Rename local Variable”

Due to some reason, my variables in Eclipse do not match convention (first letter upper case). It's not possible to change that.

So when I perform a "Refactor" -> "Rename" on a local Variable, a popup-windows appears:

"Rename local Variable" - "This name is discouraged. According to convention, names of local variables should start with a lowercase letter."

I click "Continue" and the action is done. But is there a way to disable this check, because it's very exhausting to always confirm with "Continue".

Example:

public class Foo{
    private String bar;
}
  1. Mark the String bar
  2. "Refactor" -> "Rename" and type "Bar"

I >>hope<< there isn't a way to disable it!!

It is very bad style in Java to declare variables with an uppercase letter as the first letter. Indeed, it worse than just bad style, because the Java language is designed on the assumption that you will obey that convention, and certain things will break if you ignore it. (For instance, you are liable to get bitten by the identifier disambiguation rules if you have a class and variable name that are the same.)


It's not possible to change that.

Rubbish! Of course it is possible!

... and would be a huge mess to fix

It would be straightforward to fix. Just use Eclipse's variable rename, one variable at a time. OK, it could take a long time, and it would be tedious. But it would also be a safe transformation. And then you can run a style checker over your code to make sure you've got all of the instances that need fixing.

But as earlier said, Don't go against naming conventions.

If still you want ,

Go to preferences ---> type "refa" ---> click java ---> Uncheck the "Rename with out dialog" checkbox.

在此处输入图片说明

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