Extraneous get in static imports for constants, e.g. getCONSTANT instead of just CONSTANT

For a Grails project, is there a way to tell Intellij to not add "get" before a constant name when it generates static imports?

For instance, when I choose "Add static import" from the suggested fixes drop-down, IDEA generates this:

import static com.abc.Test.getCONSTANT

instead of this:

import static com.abc.Test.CONSTANT


Kind regards,
Boris
0
1 comment

You might need to reformat the code for the changes to take effect on existing code. You can do this by selecting the code you want to reformat and then using the "Reformat Code" action (usually found in the context menu or under the Code menu). Once you've adjusted the settings, IntelliJ IDEA should generate static imports without the "get" prefix for constants as you desired. Pay by Plate Keep in mind that the exact steps and settings might vary slightly depending on the version of IntelliJ IDEA you're using, but the general approach remains the same.

0

Please sign in to leave a comment.