Browse Source

Compatibility: Fix errorprone warnings

pull/270/head
weisj 3 years ago
parent
commit
e2ae7812d3
No known key found for this signature in database
GPG Key ID: 31124CB75461DA2A
  1. 6
      compatibility/src/main/java/com/github/weisj/darklaf/compatibility/SwingUtil.java
  2. 37
      compatibility/src/main/java/com/intellij/util/ui/MenuItemLayoutHelper.java
  3. 1
      compatibility/src/main/java/com/intellij/util/ui/StringUIClientPropertyKey.java
  4. 2
      compatibility/src/main/java/com/intellij/util/ui/UIUtilities.java

6
compatibility/src/main/java/com/github/weisj/darklaf/compatibility/SwingUtil.java

@ -103,7 +103,8 @@ public final class SwingUtil {
if (swingInteropAvailable) {
try {
grabMethod.get().invokeExact(toolkit, window);
} catch (Throwable ignored) {
} catch (Throwable e) {
throw new RuntimeException(e);
}
} else {
if (toolkit instanceof sun.awt.SunToolkit) {
@ -116,7 +117,8 @@ public final class SwingUtil {
if (swingInteropAvailable) {
try {
ungrabMethod.get().invokeExact(toolkit, window);
} catch (Throwable ignored) {
} catch (Throwable e) {
throw new RuntimeException(e);
}
} else {
if (toolkit instanceof sun.awt.SunToolkit) {

37
compatibility/src/main/java/com/intellij/util/ui/MenuItemLayoutHelper.java

@ -373,6 +373,7 @@ public class MenuItemLayoutHelper implements com.github.weisj.darklaf.compatibil
}
}
@Override
public LayoutResult layoutMenuItem() {
LayoutResult lr = this.createLayoutResult();
this.prepareForLayout(lr);
@ -631,7 +632,7 @@ public class MenuItemLayoutHelper implements com.github.weisj.darklaf.compatibil
public static JComponent getMenuItemParent(JMenuItem menuItem) {
Container parent = menuItem.getParent();
return !(parent instanceof JComponent) || menuItem instanceof JMenu && ((JMenu) menuItem).isTopLevelMenu()
return !(parent instanceof JComponent) || (menuItem instanceof JMenu && ((JMenu) menuItem).isTopLevelMenu())
? null
: (JComponent) parent;
}
@ -665,6 +666,7 @@ public class MenuItemLayoutHelper implements com.github.weisj.darklaf.compatibil
return maxValue;
}
@Override
public JMenuItem getMenuItem() {
return this.mi;
}
@ -681,30 +683,37 @@ public class MenuItemLayoutHelper implements com.github.weisj.darklaf.compatibil
return this.accFont;
}
@Override
public FontMetrics getFontMetrics() {
return this.fm;
}
@Override
public FontMetrics getAccFontMetrics() {
return this.accFm;
}
@Override
public Icon getIcon() {
return this.icon;
}
@Override
public Icon getCheckIcon() {
return this.checkIcon;
}
@Override
public Icon getArrowIcon() {
return this.arrowIcon;
}
@Override
public String getText() {
return this.text;
}
@Override
public String getAccText() {
return this.accText;
}
@ -713,6 +722,7 @@ public class MenuItemLayoutHelper implements com.github.weisj.darklaf.compatibil
return this.isColumnLayout;
}
@Override
public boolean useCheckAndArrow() {
return this.useCheckAndArrow;
}
@ -721,10 +731,12 @@ public class MenuItemLayoutHelper implements com.github.weisj.darklaf.compatibil
return this.isLeftToRight;
}
@Override
public boolean isTopLevelMenu() {
return this.isTopLevelMenu;
}
@Override
public View getHtmlView() {
return this.htmlView;
}
@ -745,46 +757,57 @@ public class MenuItemLayoutHelper implements com.github.weisj.darklaf.compatibil
return this.horizontalTextPosition;
}
@Override
public int getGap() {
return this.gap;
}
@Override
public int getLeadingGap() {
return this.leadingGap;
}
@Override
public int getAfterCheckIconGap() {
return this.afterCheckIconGap;
}
@Override
public int getMinTextOffset() {
return this.minTextOffset;
}
@Override
public Rectangle getViewRect() {
return this.viewRect;
}
@Override
public RectSize getIconSize() {
return this.iconSize;
}
@Override
public RectSize getTextSize() {
return this.textSize;
}
@Override
public RectSize getAccSize() {
return this.accSize;
}
@Override
public RectSize getCheckSize() {
return this.checkSize;
}
@Override
public RectSize getArrowSize() {
return this.arrowSize;
}
@Override
public RectSize getLabelSize() {
return this.labelSize;
}
@ -936,26 +959,32 @@ public class MenuItemLayoutHelper implements com.github.weisj.darklaf.compatibil
this.maxWidth = maxWidth;
}
@Override
public int getWidth() {
return this.width;
}
@Override
public int getHeight() {
return this.height;
}
@Override
public int getOrigWidth() {
return this.origWidth;
}
@Override
public int getMaxWidth() {
return this.maxWidth;
}
@Override
public void setWidth(int width) {
this.width = width;
}
@Override
public void setHeight(int height) {
this.height = height;
}
@ -968,6 +997,7 @@ public class MenuItemLayoutHelper implements com.github.weisj.darklaf.compatibil
this.maxWidth = maxWidth;
}
@Override
public String toString() {
return "[w=" + this.width + ",h=" + this.height + ",ow=" + this.origWidth + ",mw=" + this.maxWidth + "]";
}
@ -1039,6 +1069,7 @@ public class MenuItemLayoutHelper implements com.github.weisj.darklaf.compatibil
this.labelRect = labelRect;
}
@Override
public Rectangle getIconRect() {
return this.iconRect;
}
@ -1047,6 +1078,7 @@ public class MenuItemLayoutHelper implements com.github.weisj.darklaf.compatibil
this.iconRect = iconRect;
}
@Override
public Rectangle getTextRect() {
return this.textRect;
}
@ -1055,6 +1087,7 @@ public class MenuItemLayoutHelper implements com.github.weisj.darklaf.compatibil
this.textRect = textRect;
}
@Override
public Rectangle getAccRect() {
return this.accRect;
}
@ -1063,6 +1096,7 @@ public class MenuItemLayoutHelper implements com.github.weisj.darklaf.compatibil
this.accRect = accRect;
}
@Override
public Rectangle getCheckRect() {
return this.checkRect;
}
@ -1071,6 +1105,7 @@ public class MenuItemLayoutHelper implements com.github.weisj.darklaf.compatibil
this.checkRect = checkRect;
}
@Override
public Rectangle getArrowRect() {
return this.arrowRect;
}

1
compatibility/src/main/java/com/intellij/util/ui/StringUIClientPropertyKey.java

@ -34,6 +34,7 @@ public class StringUIClientPropertyKey implements UIClientPropertyKey {
this.key = key;
}
@Override
public String toString() {
return this.key;
}

2
compatibility/src/main/java/com/intellij/util/ui/UIUtilities.java

@ -445,6 +445,7 @@ public class UIUtilities {
return lsb;
}
@Override
public boolean equals(Object entry) {
if (entry == this) {
return true;
@ -456,6 +457,7 @@ public class UIUtilities {
}
}
@Override
public int hashCode() {
int result = 17;
if (this.font != null) {

Loading…
Cancel
Save