int (final @NotNull PopupFactory factory) { try { if (!ClientId.isCurrentlyUnderLocalId()) { final Field field = PopupFactory.class.getDeclaredField("HEAVY_WEIGHT_POPUP"); field.setAccessible(true); return (Integer)field.get(null); } final Method method = PopupFactory.class.getDeclaredMethod("getPopupType"); method.setAccessible(true); final Object result = method.invoke(factory); return result instanceof Integer ? (Integer) result : -1; } catch (Throwable e) { LOG.error(e); } return -1; }