mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Correctly apply annotation wrap before modifier keyword
#KT-20314 Fixed GitOrigin-RevId: cf2069ad483f4ac31a3741b1879fb0103ee8a761
This commit is contained in:
committed by
intellij-monorepo-bot
parent
119562251d
commit
35b2304011
+8
-1
@@ -792,7 +792,14 @@ private fun getWrappingStrategyForItemList(wrapType: Int, itemTypes: TokenSet, w
|
||||
val itemWrap = Wrap.createWrap(wrapType, wrapFirstElement)
|
||||
return object : WrappingStrategy {
|
||||
override fun getWrap(childElement: ASTNode): Wrap? {
|
||||
return if (childElement.elementType in itemTypes) itemWrap else null
|
||||
val thisType = childElement.elementType
|
||||
val prevType = getPrevWithoutWhitespace(childElement)?.elementType
|
||||
return if (thisType in itemTypes || prevType in itemTypes &&
|
||||
thisType != KtTokens.EOL_COMMENT && prevType != KtTokens.EOL_COMMENT
|
||||
)
|
||||
itemWrap
|
||||
else
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
package to
|
||||
|
||||
@Volatile internal var field = 1
|
||||
@Volatile
|
||||
internal var field = 1
|
||||
@@ -1,4 +1,8 @@
|
||||
@Deprecated("Foo")
|
||||
@Deprecated("Bar")
|
||||
class Foo {
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Foo")
|
||||
public class Q {
|
||||
}
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
@Deprecated("Foo") @Deprecated("Bar") class Foo {
|
||||
}
|
||||
|
||||
@Deprecated("Foo") public class Q {
|
||||
}
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
annotation class Small(val i: Int, val s: String)
|
||||
|
||||
@Sma<caret>ll(1, "2") private fun test1() {
|
||||
@Small(1, "2")
|
||||
private fun test1() {
|
||||
|
||||
}
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
annotation class Small(val i: Int, val s: String)
|
||||
|
||||
@Small(<caret>1, "2") private fun test1() {
|
||||
@Small(1, "2")
|
||||
private fun test1() {
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
// "Add annotation target" "true"
|
||||
|
||||
@Target(AnnotationTarget.TYPE) annotation class Foo
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class Foo
|
||||
|
||||
class Test {
|
||||
fun foo(): @Foo Int = 1
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// "Add annotation target" "true"
|
||||
|
||||
@Target(AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION) annotation class Foo
|
||||
@Target(AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
|
||||
annotation class Foo
|
||||
|
||||
@Foo
|
||||
class Test {
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
// "Make 'A' open" "true"
|
||||
@Deprecated("") open class A() {
|
||||
@Deprecated("")
|
||||
open class A() {
|
||||
open fun foo() {}
|
||||
}
|
||||
|
||||
+4
-2
@@ -3,11 +3,13 @@ annotation class Concat
|
||||
|
||||
abstract class A {
|
||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||
@Concat abstract var extraction: Int
|
||||
@Concat
|
||||
abstract var extraction: Int
|
||||
}
|
||||
|
||||
// SIBLING:
|
||||
class Abstraction : A() {
|
||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||
@Concat override var extraction = 0
|
||||
@Concat
|
||||
override var extraction = 0
|
||||
}
|
||||
+4
-2
@@ -2,10 +2,12 @@ annotation class Concat
|
||||
|
||||
abstract class A {
|
||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||
@Concat abstract var extraction: Int
|
||||
@Concat
|
||||
abstract var extraction: Int
|
||||
}
|
||||
|
||||
class Abstraction : A() {
|
||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||
@Concat override var extraction = 0
|
||||
@Concat
|
||||
override var extraction = 0
|
||||
}
|
||||
@@ -13,7 +13,8 @@ import javaApi.*
|
||||
@Anon8(classes = arrayOf(String::class, StringBuilder::class))
|
||||
internal class C {
|
||||
@Anon5(1)
|
||||
@Deprecated("") private val field1 = 0
|
||||
@Deprecated("")
|
||||
private val field1 = 0
|
||||
|
||||
@Anon5(1)
|
||||
private val field2 = 0
|
||||
|
||||
+7
-2
@@ -7,6 +7,11 @@ class WithModifiersOnAccessors {
|
||||
@get:Strictfp
|
||||
var strict = 0.0
|
||||
|
||||
@Synchronized private fun methSync() {}
|
||||
@Strictfp protected fun methStrict() {}
|
||||
@Synchronized
|
||||
private fun methSync() {
|
||||
}
|
||||
|
||||
@Strictfp
|
||||
protected fun methStrict() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user