@Override
        public Popup getPopup(JPopupMenu popup, int x, int y) {
          PopupFactory factory = PopupFactory.getSharedInstance();
          int oldType = -1;
          boolean isRoundBorder = WindowRoundedCornersManager.isAvailable();
          if (isRoundBorder) {
            oldType = PopupUtil.getPopupType(factory);
            if (oldType == 2) {
              oldType = -1;
            } else {
              PopupUtil.setPopupType(factory, 2);
            }
          }
          Popup p = super.getPopup(popup, x, y);
          if (oldType >= 0) {
            PopupUtil.setPopupType(factory, oldType);
          }
          if (isRoundBorder) {
            Window window = ComponentUtil.getWindow(popup);
            if (window != null) {
              if ((SystemInfoRt.isMac && UIUtil.isUnderDarcula()) || SystemInfoRt.isWindows) {
                WindowRoundedCornersManager.setRoundedCorners(window, JBUI.CurrentTheme.Popup.borderColor(true));
                popup.setBorder(null);
              }
              else {
                WindowRoundedCornersManager.setRoundedCorners(window);
              }
            }
          }
          return p;
        }
@Override
        public Popup getPopup(JPopupMenu popup, int x, int y)