-
Enhancement
-
Resolution: Unresolved
-
P4
-
11, 17, 21
-
None
JRSUIUtils.java structurally does things weirdly. The utility class mostly passes parameters from functions to other functions. The indirection makes things harder to understand the eventual purpose.
Take AquaInternalFrameBorderMetrics.java. It has a static boolean that caches a call to shouldUseLegacyBorderMetrics(), which returns isSnowLeopardOrBelow, itself a cached call to isMacOSXSnowLeopardOrBelow(), which is what finally calls currentMacOSXVersionMatchesGivenVersionRange(). When looking at the code, it takes time to unravel the path it takes. Instead of that, a public static final boolean can expose the cached value and, in doing so, exposes the meaning behind the check.
In AquaLookAndFeel.java, the value of TabbedPaneUI is calculated using JRSUIUtils.TabbedPane.shouldUseTabbedPaneContrastUI(), but that could mean any reason for why "AquaTabbedPaneContrastUI" may be the value as opposed to "AquaTabbedPaneUI". Replacing it with JRSUIUtils.isSnowLeopardOrBelow reveals that it actually has to do with the OS version being, well, Snow Leopard or below.
These change makes understanding the code easier and quicker. Also more optimized.
Take AquaInternalFrameBorderMetrics.java. It has a static boolean that caches a call to shouldUseLegacyBorderMetrics(), which returns isSnowLeopardOrBelow, itself a cached call to isMacOSXSnowLeopardOrBelow(), which is what finally calls currentMacOSXVersionMatchesGivenVersionRange(). When looking at the code, it takes time to unravel the path it takes. Instead of that, a public static final boolean can expose the cached value and, in doing so, exposes the meaning behind the check.
In AquaLookAndFeel.java, the value of TabbedPaneUI is calculated using JRSUIUtils.TabbedPane.shouldUseTabbedPaneContrastUI(), but that could mean any reason for why "AquaTabbedPaneContrastUI" may be the value as opposed to "AquaTabbedPaneUI". Replacing it with JRSUIUtils.isSnowLeopardOrBelow reveals that it actually has to do with the OS version being, well, Snow Leopard or below.
These change makes understanding the code easier and quicker. Also more optimized.
- links to
-
Review openjdk/jdk/10326