ErrorProne: fix base/UnnecessaryParentheses

This commit is contained in:
mkpaz 2023-02-09 14:50:07 +04:00
parent ba9bfc654b
commit 4a0a673bff
2 changed files with 45 additions and 21 deletions

@ -283,7 +283,7 @@ public class InlineDatePickerSkin extends BehaviorSkinBase<InlineDatePicker, Inl
final double left = snapSpaceX(getInsets().getLeft());
final double right = snapSpaceX(getInsets().getRight());
final double contentWidth = width - left - right - hGaps;
return ((snapSizeX(contentWidth / nCols)) * nCols) + left + right + hGaps;
return (snapSizeX(contentWidth / nCols) * nCols) + left + right + hGaps;
}
@Override

@ -173,6 +173,7 @@ public class Popover extends PopupControl {
* Returns the value of the content property
*
* @return the content node
*
* @see #contentNodeProperty()
*/
public final Node getContentNode() {
@ -183,6 +184,7 @@ public class Popover extends PopupControl {
* Sets the value of the content property.
*
* @param content the new content node value
*
* @see #contentNodeProperty()
*/
public final void setContentNode(Node content) {
@ -239,10 +241,10 @@ public class Popover extends PopupControl {
* given owner. If the arrow points up then the popover will be placed
* below the given owner node.
*
* @param owner the owner of the popover
* @param owner the owner of the popover
* @param offset if negative specifies the distance to the owner node or when
* positive specifies the number of pixels that the arrow will
* overlap with the owner node (positive values are recommended)
* positive specifies the number of pixels that the arrow will
* overlap with the owner node (positive values are recommended)
*/
public final void show(Node owner, double offset) {
requireNonNull(owner);
@ -301,8 +303,8 @@ public class Popover extends PopupControl {
* of the arrow of the popover and not the location of the window.
*
* @param owner the owning node
* @param x the x coordinate for the popover arrow tip
* @param y the y coordinate for the popover arrow tip
* @param x the x coordinate for the popover arrow tip
* @param y the y coordinate for the popover arrow tip
*/
@Override
public final void show(Node owner, double x, double y) {
@ -314,11 +316,11 @@ public class Popover extends PopupControl {
* the given owner node. The x and y coordinate will be the target location
* of the arrow of the popover and not the location of the window.
*
* @param owner the owning node
* @param x the x coordinate for the popover arrow tip
* @param y the y coordinate for the popover arrow tip
* @param owner the owning node
* @param x the x coordinate for the popover arrow tip
* @param y the y coordinate for the popover arrow tip
* @param fadeInDuration the time it takes for the popover to be fully visible.
* This duration takes precedence over the fade-in property without setting.
* This duration takes precedence over the fade-in property without setting.
*/
public final void show(Node owner, double x, double y, Duration fadeInDuration) {
/*
@ -422,7 +424,7 @@ public class Popover extends PopupControl {
* Hides the popover by quickly changing its opacity to 0.
*
* @param fadeOutDuration the duration of the fade transition that is being used to
* change the opacity of the popover
* change the opacity of the popover
*/
public final void hide(Duration fadeOutDuration) {
if (fadeOutDuration == null) {
@ -487,17 +489,14 @@ public class Popover extends PopupControl {
double prefContentHeight = getContentNode().prefHeight(-1);
return switch (getArrowLocation()) {
case LEFT_TOP, RIGHT_TOP -> (
case LEFT_TOP, RIGHT_TOP -> getCornerRadius() + getArrowIndent() + getArrowSize();
case LEFT_CENTER, RIGHT_CENTER -> Math.max(
prefContentHeight, 2 * (getCornerRadius() + getArrowIndent() + getArrowSize())
) / 2;
case LEFT_BOTTOM, RIGHT_BOTTOM -> Math.max(
prefContentHeight - getCornerRadius() - getArrowIndent() - getArrowSize(),
getCornerRadius() + getArrowIndent() + getArrowSize()
);
case LEFT_CENTER, RIGHT_CENTER -> (
Math.max(prefContentHeight, 2 * (getCornerRadius() + getArrowIndent() + getArrowSize())) / 2
);
case LEFT_BOTTOM, RIGHT_BOTTOM -> (
Math.max(prefContentHeight - getCornerRadius() - getArrowIndent() - getArrowSize(),
getCornerRadius() + getArrowIndent() + getArrowSize()
)
);
default -> 0;
};
}
@ -526,6 +525,7 @@ public class Popover extends PopupControl {
* Sets the value of the headerAlwaysVisible property.
*
* @param visible if true, then the header is visible even while attached
*
* @see #headerAlwaysVisibleProperty()
*/
public final void setHeaderAlwaysVisible(boolean visible) {
@ -536,6 +536,7 @@ public class Popover extends PopupControl {
* Returns the value of the detachable property.
*
* @return true if the header is visible even while attached
*
* @see #headerAlwaysVisibleProperty()
*/
public final boolean isHeaderAlwaysVisible() {
@ -555,6 +556,7 @@ public class Popover extends PopupControl {
* Sets the value of the closeButtonEnabled property.
*
* @param enabled if false, the popover will not be closeable by the header's close button
*
* @see #closeButtonEnabledProperty()
*/
public final void setCloseButtonEnabled(boolean enabled) {
@ -565,6 +567,7 @@ public class Popover extends PopupControl {
* Returns the value of the closeButtonEnabled property.
*
* @return true if the header's close button is enabled
*
* @see #closeButtonEnabledProperty()
*/
public final boolean isCloseButtonEnabled() {
@ -584,6 +587,7 @@ public class Popover extends PopupControl {
* Sets the value of the detachable property.
*
* @param detachable if true then the user can detach / tear off the popover
*
* @see #detachableProperty()
*/
public final void setDetachable(boolean detachable) {
@ -594,6 +598,7 @@ public class Popover extends PopupControl {
* Returns the value of the detachable property.
*
* @return true if the user is allowed to detach / tear off the popover
*
* @see #detachableProperty()
*/
public final boolean isDetachable() {
@ -617,7 +622,8 @@ public class Popover extends PopupControl {
* Sets the value of the detached property.
*
* @param detached if true the popover will change its appearance to "detached"
* mode
* mode
*
* @see #detachedProperty()
*/
public final void setDetached(boolean detached) {
@ -628,6 +634,7 @@ public class Popover extends PopupControl {
* Returns the value of the detached property.
*
* @return true if the popover is currently detached.
*
* @see #detachedProperty()
*/
public final boolean isDetached() {
@ -649,6 +656,7 @@ public class Popover extends PopupControl {
* Returns the value of the arrow size property.
*
* @return the arrow size property value
*
* @see #arrowSizeProperty()
*/
public final double getArrowSize() {
@ -659,6 +667,7 @@ public class Popover extends PopupControl {
* Sets the value of the arrow size property.
*
* @param size the new value of the arrow size property
*
* @see #arrowSizeProperty()
*/
public final void setArrowSize(double size) {
@ -681,6 +690,7 @@ public class Popover extends PopupControl {
* Returns the value of the arrow indent property.
*
* @return the arrow indent value
*
* @see #arrowIndentProperty()
*/
public final double getArrowIndent() {
@ -691,6 +701,7 @@ public class Popover extends PopupControl {
* Sets the value of the arrow indent property.
*
* @param size the arrow indent value
*
* @see #arrowIndentProperty()
*/
public final void setArrowIndent(double size) {
@ -712,6 +723,7 @@ public class Popover extends PopupControl {
* Returns the value of the corner radius property.
*
* @return the corner radius
*
* @see #cornerRadiusProperty()
*/
public final double getCornerRadius() {
@ -722,6 +734,7 @@ public class Popover extends PopupControl {
* Sets the value of the corner radius property.
*
* @param radius the corner radius
*
* @see #cornerRadiusProperty()
*/
public final void setCornerRadius(double radius) {
@ -743,6 +756,7 @@ public class Popover extends PopupControl {
* Returns the value of the title property.
*
* @return the detached title
*
* @see #titleProperty()
*/
public final String getTitle() {
@ -753,6 +767,7 @@ public class Popover extends PopupControl {
* Sets the value of the title property.
*
* @param title the title to use when detached
*
* @see #titleProperty()
*/
public final void setTitle(String title) {
@ -769,6 +784,7 @@ public class Popover extends PopupControl {
* location of the arrow if auto fix is enabled.
*
* @return the arrow location property
*
* @see #setAutoFix(boolean)
*/
public final ObjectProperty<ArrowLocation> arrowLocationProperty() {
@ -779,6 +795,7 @@ public class Popover extends PopupControl {
* Sets the value of the arrow location property.
*
* @param location the requested location
*
* @see #arrowLocationProperty()
*/
public final void setArrowLocation(ArrowLocation location) {
@ -789,6 +806,7 @@ public class Popover extends PopupControl {
* Returns the value of the arrow location property.
*
* @return the preferred arrow location
*
* @see #arrowLocationProperty()
*/
public final ArrowLocation getArrowLocation() {
@ -835,6 +853,7 @@ public class Popover extends PopupControl {
* Returns the value of the fade-in duration property.
*
* @return the fade-in duration
*
* @see #fadeInDurationProperty()
*/
public final Duration getFadeInDuration() {
@ -846,6 +865,7 @@ public class Popover extends PopupControl {
* Popover.show(..).
*
* @param duration the requested fade-in duration
*
* @see #fadeInDurationProperty()
*/
public final void setFadeInDuration(Duration duration) {
@ -856,6 +876,7 @@ public class Popover extends PopupControl {
* Returns the value of the fade-out duration property.
*
* @return the fade-out duration
*
* @see #fadeOutDurationProperty()
*/
public final Duration getFadeOutDuration() {
@ -866,6 +887,7 @@ public class Popover extends PopupControl {
* Sets the value of the fade-out duration property.
*
* @param duration the requested fade-out duration
*
* @see #fadeOutDurationProperty()
*/
public final void setFadeOutDuration(Duration duration) {
@ -886,6 +908,7 @@ public class Popover extends PopupControl {
* Returns the value of the "animated" property.
*
* @return true if the Popover will be shown and hidden with a short fade animation
*
* @see #animatedProperty()
*/
public final boolean isAnimated() {
@ -896,6 +919,7 @@ public class Popover extends PopupControl {
* Sets the value of the "animated" property.
*
* @param animated if true the Popover will be shown and hidden with a short fade animation
*
* @see #animatedProperty()
*/
public final void setAnimated(boolean animated) {