diff --git a/java/java-impl/src/com/intellij/psi/formatter/java/JavaSpacePropertyProcessor.java b/java/java-impl/src/com/intellij/psi/formatter/java/JavaSpacePropertyProcessor.java index af8bc3b8c957..aa63481ea2e5 100644 --- a/java/java-impl/src/com/intellij/psi/formatter/java/JavaSpacePropertyProcessor.java +++ b/java/java-impl/src/com/intellij/psi/formatter/java/JavaSpacePropertyProcessor.java @@ -1317,6 +1317,9 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor { else if (myType1 == JavaElementType.MODULE_REFERENCE || myType2 == JavaElementType.MODULE_REFERENCE) { createSpaceInCode(true); } + else if (myType1 == JavaElementType.MODIFIER_LIST) { + processModifierList(); + } } @Override diff --git a/java/java-impl/src/com/intellij/psi/formatter/java/wrap/impl/JavaChildWrapArranger.java b/java/java-impl/src/com/intellij/psi/formatter/java/wrap/impl/JavaChildWrapArranger.java index fac67e86efe6..018fcc5b6889 100644 --- a/java/java-impl/src/com/intellij/psi/formatter/java/wrap/impl/JavaChildWrapArranger.java +++ b/java/java-impl/src/com/intellij/psi/formatter/java/wrap/impl/JavaChildWrapArranger.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.formatter.java.wrap.impl; import com.intellij.formatting.Wrap; @@ -326,6 +312,10 @@ public class JavaChildWrapArranger { return settings.VARIABLE_ANNOTATION_WRAP; } + if (nodeType == JavaElementType.MODULE) { + return settings.CLASS_ANNOTATION_WRAP; + } + return CommonCodeStyleSettings.DO_NOT_WRAP; } } \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/suppressModuleInfoInspections/module-info.after.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/suppressModuleInfoInspections/module-info.after.java index 1c0114abf73c..8e0bf20b7df2 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/suppressModuleInfoInspections/module-info.after.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/suppressModuleInfoInspections/module-info.after.java @@ -1,6 +1,7 @@ /** * {@linkplain nothing} */ -@SuppressWarnings("JavadocReference") module com.suppress.test.test.test { +@SuppressWarnings("JavadocReference") +module com.suppress.test.test.test { } \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/java/psi/formatter/java/JavaModuleFormatterTest.kt b/java/java-tests/testSrc/com/intellij/java/psi/formatter/java/JavaModuleFormatterTest.kt index 035013ac2c72..034a6e0a3ffa 100644 --- a/java/java-tests/testSrc/com/intellij/java/psi/formatter/java/JavaModuleFormatterTest.kt +++ b/java/java-tests/testSrc/com/intellij/java/psi/formatter/java/JavaModuleFormatterTest.kt @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.java.psi.formatter.java import com.intellij.openapi.roots.LanguageLevelProjectExtension @@ -47,5 +33,6 @@ class JavaModuleFormatterTest : AbstractJavaFormatterTest() { fun testAnnotatedModule() { doTextTest("@Deprecated\nmodule m { }", "@Deprecated\nmodule m {\n}") + doTextTest("@Deprecated(forRemoval = true) module m { }", "@Deprecated(forRemoval = true)\nmodule m {\n}") } } \ No newline at end of file