error-prone icon indicating copy to clipboard operation
error-prone copied to clipboard

FieldCanBeLocal static field incorrectly patched

Open delanym opened this issue 2 years ago • 2 comments

Where private static String logFileNameBase; is only used locally, the patch replaces Logger.logFileNameBase = Logger.logFolderName + name; with String Logger.logFileNameBase = Logger.logFolderName + name; when it should be String logFileNameBase = Logger.logFolderName + name;

delanym avatar Mar 10 '23 10:03 delanym

I'm wondering if this is actually an incorrect patch. Shouldn't the UnnecessarilyFullyQualified check remove the Logger. prefix here if it is not required to have?

From a quick skim of the implementation it seems like only this. is being stripped.

rickie avatar Mar 16 '23 10:03 rickie

@rickie no. Its not being "fully" qualified. Some devs want their static constants/methods qualified rather than imported directly with a static import.

delanym avatar Mar 22 '23 07:03 delanym