CommonCodeStyleSettings (@NotNull CodeStyleSettings rootSettings) { KotlinCommonCodeStyleSettings commonSettings = new KotlinCommonCodeStyleSettings(); copyPublicFields(this, commonSettings); try { Method setRootSettingsMethod = CommonCodeStyleSettings.class.getDeclaredMethod("setRootSettings", CodeStyleSettings.class); setRootSettingsMethod.setAccessible(true); setRootSettingsMethod.invoke(commonSettings, rootSettings); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw new IllegalStateException(e); } commonSettings.setForceArrangeMenuAvailable(isForceArrangeMenuAvailable()); IndentOptions indentOptions = getIndentOptions(); if (indentOptions != null) { IndentOptions targetIndentOptions = commonSettings.initIndentOptions(); targetIndentOptions.copyFrom(indentOptions); } ArrangementSettings arrangementSettings = getArrangementSettings(); if (arrangementSettings != null) { commonSettings.setArrangementSettings(arrangementSettings.clone()); } try { Method setRootSettingsMethod = ArraysKt.singleOrNull( CommonCodeStyleSettings.class.getDeclaredMethods(), method -> "setSoftMargins".equals(method.getName())); if (setRootSettingsMethod != null) { // Method was introduced in 173 setRootSettingsMethod.setAccessible(true); setRootSettingsMethod.invoke(commonSettings, getSoftMargins()); } } catch (IllegalAccessException | InvocationTargetException e) { throw new IllegalStateException(e); } return commonSettings; }