Kirby Kirby - 1 year ago 83
Java Question

intellij have introduce constant be private not public

In Intellij IDEA 11.1.2, when using the refactor shortcut to Introduce a Constant, it always makes public static final constant, whereas I generally prefer to default to private.
In older versions of Intellij, I'm pretty sure that I had the option of setting private as the default.
Does anyone know if there still exists an option to default to private for the Introduce Constant refactor option rather than having to afterwards go to the declaration and edit the public to private?

Answer Source

I had the same problem and solved it (idea 12).

To introduce private constants by default do the following:

  • Disable in-place mode (File -> Settings -> Editor -> uncheck "Enable in-place mode")
  • Try to introduce something (You will see a refactor dialog). Select "private" in that dialog
  • Enable in-place mode
  • Enjoy private constants
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download