'Introduce Constant' intention with negative numbers
The 'Introduce Constant' intention doesn't highlight the '-' in front of negative numeric literals, so when actioned, it converts only the digits to a constant name prefixed with '-'. You can't fix this by highlighting the whole number before actioning it, as it still ignores the '-'.
The 'Introduce Constant' refactoring, on the other hand, correctly refactors according to the selection text includes the '-' or not.
The code generated by the intention will function correctly at runtime, but is misleading in that the constant declaration is of a positive number, not the negative intended.
请先登录再写评论。
That is the 'Introduce Constant' quick fix of the 'Magic number'
inspection, right? Could you please submit a JIRA request about this issue?
Bas
Dave Lorde wrote:
Jira #5257 has been submitted for this problem.
Dave Lorde wrote:
Thank you.