On Wed, 24 Mar 2021 17:51:44 GMT, Alexander Zvegintsev <azveg...@openjdk.org> wrote:
>> SonarCloud reports the potential issue with >> MetalHighContrastTheme.getControlHighlight where `controlHighlight ` field >> is not used and the getControlHighlight() uses secondary field. >> public ColorUIResource getControlHighlight() { >> // This was super.getSecondary3(); >> return secondary2; >> } >> Removed the unused field. > > src/java.desktop/share/classes/javax/swing/plaf/metal/MetalHighContrastTheme.java > line 55: > >> 53: 255, 255, 255); >> 54: private static final ColorUIResource controlHighlight = new >> 55: ColorUIResource(102, 102, 102); > > I didn't check it on Windows(AFAICS it is used for Windows only), but I've > done a quick check how it looks on Linux with both colors. > > Using `controlHighlight` in `getControlHighlight()`: >  > > Using `secondary2` in `getControlHighlight()`: >  > > And it seems that the option with unused `controlHighlight` color is more > fits the definition of high contrast. > > Have you checked why its usage was removed? As far I see in the history of this file, it was `secondary2` that was used from beginning, so I kept it and removed the unused. ------------- PR: https://git.openjdk.java.net/jdk/pull/3149