tests: apply official code style
#KT-38632 Fixed
This commit is contained in:
+11
-1
@@ -1,6 +1,16 @@
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
annotation class Ann(val i: Int = 1, val i2: IntArray = [1], val i3: IntArray = [1], val klass: KClass<*> = A::class, val klass2: Array<KClass<*>> = [A::class], val klass3: Array<KClass<*>> = [A::class], val ann: Inner = Inner(), val ann2: Array<Inner> = [Inner()], val ann3: Array<Inner> = [Inner(), Inner()])
|
||||
annotation class Ann(
|
||||
val i: Int = 1,
|
||||
val i2: IntArray = [1],
|
||||
val i3: IntArray = [1],
|
||||
val klass: KClass<*> = A::class,
|
||||
val klass2: Array<KClass<*>> = [A::class],
|
||||
val klass3: Array<KClass<*>> = [A::class],
|
||||
val ann: Inner = Inner(),
|
||||
val ann2: Array<Inner> = [Inner()],
|
||||
val ann3: Array<Inner> = [Inner(), Inner()]
|
||||
)
|
||||
|
||||
class A
|
||||
annotation class Inner
|
||||
|
||||
+4
-2
@@ -2,5 +2,7 @@ internal annotation class A
|
||||
|
||||
internal annotation class B
|
||||
|
||||
class U(@param:A @field:B
|
||||
var i: Int)
|
||||
class U(
|
||||
@param:A @field:B
|
||||
var i: Int
|
||||
)
|
||||
@@ -1,5 +1,7 @@
|
||||
internal annotation class Anon(val stringArray: Array<String>, val intArray: IntArray, // string
|
||||
val string: String)
|
||||
internal annotation class Anon(
|
||||
val stringArray: Array<String>, val intArray: IntArray, // string
|
||||
val string: String
|
||||
)
|
||||
|
||||
@Anon(string = "a", stringArray = ["a", "b"], intArray = [1, 2])
|
||||
@Target(AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FIELD)
|
||||
|
||||
+2
-1
@@ -1 +1,2 @@
|
||||
/*pre*/ 5 /*operand '5'*/ shl /*left shift*/ 16 /*operand '16'*/ or /*or*/ (1 /*operand '1'*/ shr /*right shift*/ 8 /*operand '8'*/) or /*or*/ 0 /*operand '0'*/ /*post comment*/
|
||||
/*pre*/
|
||||
5 /*operand '5'*/ shl /*left shift*/ 16 /*operand '16'*/ or /*or*/ (1 /*operand '1'*/ shr /*right shift*/ 8 /*operand '8'*/) or /*or*/ 0 /*operand '0'*/ /*post comment*/
|
||||
@@ -1 +1,2 @@
|
||||
val constrArgTypes = arrayOf<Class<*>>(Array<String>::class.java, String::class.java, Int::class.java, Double::class.java)
|
||||
val constrArgTypes =
|
||||
arrayOf<Class<*>>(Array<String>::class.java, String::class.java, Int::class.java, Double::class.java)
|
||||
@@ -6,10 +6,10 @@ object Test {
|
||||
println()// Comment
|
||||
|
||||
Test
|
||||
// Comment1
|
||||
.foo()
|
||||
// Comment2
|
||||
.indexOf("s")
|
||||
// Comment1
|
||||
.foo()
|
||||
// Comment2
|
||||
.indexOf("s")
|
||||
}
|
||||
|
||||
fun foo(): String {
|
||||
|
||||
@@ -12,7 +12,7 @@ internal class A// this is a primary constructor
|
||||
// end of secondary constructor 1 body
|
||||
|
||||
internal class B// this constructor will disappear
|
||||
(private val x: Int) // end of constructor body
|
||||
(private val x: Int) // end of constructor body
|
||||
{
|
||||
|
||||
fun foo() {}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
internal class C(private val p1: Int /* parameter p1 */ // field p1
|
||||
,
|
||||
/**
|
||||
* Field myP2
|
||||
*/
|
||||
private val myP2: Int, /* Field p3 */ var p3: Int)
|
||||
internal class C(
|
||||
private val p1: Int /* parameter p1 */ // field p1
|
||||
,
|
||||
/**
|
||||
* Field myP2
|
||||
*/
|
||||
private val myP2: Int, /* Field p3 */ var p3: Int
|
||||
)
|
||||
|
||||
@@ -33,9 +33,9 @@ internal class CustomerBuilder {
|
||||
object User {
|
||||
fun main() {
|
||||
val customer = CustomerBuilder()
|
||||
.WithFirstName("Homer")
|
||||
.WithLastName("Simpson")
|
||||
.Build()
|
||||
.WithFirstName("Homer")
|
||||
.WithLastName("Simpson")
|
||||
.Build()
|
||||
println(customer.firstName)
|
||||
println(customer.lastName)
|
||||
}
|
||||
|
||||
+5
-1
@@ -1 +1,5 @@
|
||||
internal class C(@Deprecated("") private val p1: Int, @Deprecated("") private val myP2: Int, @Deprecated("") var p3: Int)
|
||||
internal class C(
|
||||
@Deprecated("") private val p1: Int,
|
||||
@Deprecated("") private val myP2: Int,
|
||||
@Deprecated("") var p3: Int
|
||||
)
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
internal class C1(arg1: Int,
|
||||
arg2: Int,
|
||||
arg3: Int) {
|
||||
internal class C1(
|
||||
arg1: Int,
|
||||
arg2: Int,
|
||||
arg3: Int
|
||||
) {
|
||||
|
||||
constructor(x: Int,
|
||||
y: Int) : this(x, x + y, 0) {
|
||||
constructor(
|
||||
x: Int,
|
||||
y: Int
|
||||
) : this(x, x + y, 0) {
|
||||
}
|
||||
}
|
||||
|
||||
internal class C2(private val arg1: Int,
|
||||
private val arg2: Int,
|
||||
arg3: Int)
|
||||
internal class C2(
|
||||
private val arg1: Int,
|
||||
private val arg2: Int,
|
||||
arg3: Int
|
||||
)
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
internal class A(// comment for field2 getter
|
||||
// comment for field2 setter
|
||||
var field2: Int // comment for field2
|
||||
// comment for field2 setter
|
||||
var field2: Int // comment for field2
|
||||
) {
|
||||
// Comment for field1
|
||||
// Comment for field1 getter
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
internal annotation class TestAnnotation
|
||||
|
||||
class Test(@param:TestAnnotation @field:TestAnnotation
|
||||
@get:TestAnnotation
|
||||
@set:TestAnnotation
|
||||
var arg: String?)
|
||||
class Test(
|
||||
@param:TestAnnotation @field:TestAnnotation
|
||||
@get:TestAnnotation
|
||||
@set:TestAnnotation
|
||||
var arg: String?
|
||||
)
|
||||
|
||||
+8
-6
@@ -1,7 +1,9 @@
|
||||
@Deprecated("Ph'nglui mglw'nafh\n" +
|
||||
" Cthulhu R'lyeh wgah'nagl fhtagn.\n" +
|
||||
" 'In His House at R'lyeh\n" +
|
||||
" Dead Cthulhu waits dreaming,\n" +
|
||||
" yet He shall rise and His kingdom\n" +
|
||||
" shall cover the Earth.'")
|
||||
@Deprecated(
|
||||
"Ph'nglui mglw'nafh\n" +
|
||||
" Cthulhu R'lyeh wgah'nagl fhtagn.\n" +
|
||||
" 'In His House at R'lyeh\n" +
|
||||
" Dead Cthulhu waits dreaming,\n" +
|
||||
" yet He shall rise and His kingdom\n" +
|
||||
" shall cover the Earth.'"
|
||||
)
|
||||
class TestDeprecatedInJavadocWithMultilineMessage
|
||||
@@ -2,7 +2,9 @@ internal enum class Color : Runnable {
|
||||
WHITE, BLACK, RED, YELLOW, BLUE;
|
||||
|
||||
override fun run() {
|
||||
println("name()=" + name +
|
||||
", toString()=" + toString())
|
||||
println(
|
||||
"name()=" + name +
|
||||
", toString()=" + toString()
|
||||
)
|
||||
}
|
||||
}
|
||||
+19
-1
@@ -23,7 +23,25 @@ internal enum class EE {
|
||||
}
|
||||
|
||||
internal class X {
|
||||
fun foo(i1: I?, i2: I?, s1: String, s2: String, c1: C, c2: C, i: Int, o1: O, o2: O, e1: E, e2: E, bb1: BB, bb2: BB, arr1: IntArray, arr2: IntArray, ee1: EE?, ee2: EE) {
|
||||
fun foo(
|
||||
i1: I?,
|
||||
i2: I?,
|
||||
s1: String,
|
||||
s2: String,
|
||||
c1: C,
|
||||
c2: C,
|
||||
i: Int,
|
||||
o1: O,
|
||||
o2: O,
|
||||
e1: E,
|
||||
e2: E,
|
||||
bb1: BB,
|
||||
bb2: BB,
|
||||
arr1: IntArray,
|
||||
arr2: IntArray,
|
||||
ee1: EE?,
|
||||
ee2: EE
|
||||
) {
|
||||
if (i1 === i2) return
|
||||
if (s1 === s2) return
|
||||
if (c1 == c2) return
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ class C {
|
||||
internal fun foo() {
|
||||
val builder = StringBuilder()
|
||||
builder.append(1)
|
||||
.append(2).append(3)
|
||||
.append(4)
|
||||
.append(2).append(3)
|
||||
.append(4)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,10 @@ internal class F {
|
||||
fun f1(p1: Int, p2: Int, p3: Int, p4: Int, vararg p5: Int) {}
|
||||
|
||||
fun f2(array: IntArray) {
|
||||
f1(1, 2,
|
||||
3, 4,
|
||||
*array
|
||||
f1(
|
||||
1, 2,
|
||||
3, 4,
|
||||
*array
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
interface Aaa {
|
||||
fun foo(
|
||||
e1: String,
|
||||
e2: String
|
||||
e1: String,
|
||||
e2: String
|
||||
)
|
||||
}
|
||||
@@ -2,17 +2,20 @@ internal class C {
|
||||
fun foo1(p1: Int, p2: Int) {}
|
||||
|
||||
fun foo2(
|
||||
p1: Int,
|
||||
p2: Int) {
|
||||
p1: Int,
|
||||
p2: Int
|
||||
) {
|
||||
}
|
||||
|
||||
fun foo3(p1: Int,
|
||||
p2: Int) {
|
||||
fun foo3(
|
||||
p1: Int,
|
||||
p2: Int
|
||||
) {
|
||||
}
|
||||
|
||||
fun foo4(
|
||||
p1: Int, p2: Int,
|
||||
p3: Int, p4: Int
|
||||
p1: Int, p2: Int,
|
||||
p3: Int, p4: Int
|
||||
) {
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,34 @@
|
||||
class Exponent {
|
||||
private val doubles = doubleArrayOf(5e5, +5e5, -5e5, 5e+5, 5e-5, 5E5, +5E5, -5E5, 5E+5, 5E-5, 2.5e5, +2.5e5, -2.5e5, 2.5e+5, 2.5e-5, 2.5E5, +2.5E5, -2.5E5, 2.5E+5, 2.5E-5, 5e5, 5e5, 5e5, 5e5, 5e-6, 7e+8, 9e-1, 2e+3, 4e5, 6e7)
|
||||
private val doubles = doubleArrayOf(
|
||||
5e5,
|
||||
+5e5,
|
||||
-5e5,
|
||||
5e+5,
|
||||
5e-5,
|
||||
5E5,
|
||||
+5E5,
|
||||
-5E5,
|
||||
5E+5,
|
||||
5E-5,
|
||||
2.5e5,
|
||||
+2.5e5,
|
||||
-2.5e5,
|
||||
2.5e+5,
|
||||
2.5e-5,
|
||||
2.5E5,
|
||||
+2.5E5,
|
||||
-2.5E5,
|
||||
2.5E+5,
|
||||
2.5E-5,
|
||||
5e5,
|
||||
5e5,
|
||||
5e5,
|
||||
5e5,
|
||||
5e-6,
|
||||
7e+8,
|
||||
9e-1,
|
||||
2e+3,
|
||||
4e5,
|
||||
6e7
|
||||
)
|
||||
}
|
||||
@@ -1,3 +1,32 @@
|
||||
class Exponent {
|
||||
private val floats = floatArrayOf(5e5f, +5e5f, -5e5f, 5e+5f, 5e-5f, 5E5f, +5E5f, -5E5f, 5E+5f, 5E-5f, 2.5e5f, +2.5e5f, -2.5e5f, 2.5e+5f, 2.5e-5f, 2.5E5f, +2.5E5f, -2.5E5f, 2.5E+5f, 2.5E-5f, 5e5f, 5e5f, 5e-6f, 7e+8f, 9e-1f, 2e+3f, 4e5f, 6e7f)
|
||||
private val floats = floatArrayOf(
|
||||
5e5f,
|
||||
+5e5f,
|
||||
-5e5f,
|
||||
5e+5f,
|
||||
5e-5f,
|
||||
5E5f,
|
||||
+5E5f,
|
||||
-5E5f,
|
||||
5E+5f,
|
||||
5E-5f,
|
||||
2.5e5f,
|
||||
+2.5e5f,
|
||||
-2.5e5f,
|
||||
2.5e+5f,
|
||||
2.5e-5f,
|
||||
2.5E5f,
|
||||
+2.5E5f,
|
||||
-2.5E5f,
|
||||
2.5E+5f,
|
||||
2.5E-5f,
|
||||
5e5f,
|
||||
5e5f,
|
||||
5e-6f,
|
||||
7e+8f,
|
||||
9e-1f,
|
||||
2e+3f,
|
||||
4e5f,
|
||||
6e7f
|
||||
)
|
||||
}
|
||||
@@ -69,19 +69,19 @@ internal class A {
|
||||
val s = "test string"
|
||||
s == "test"
|
||||
s.equals(
|
||||
"tesT", ignoreCase = true
|
||||
"tesT", ignoreCase = true
|
||||
)
|
||||
s.compareTo("Test", ignoreCase = true)
|
||||
s.regionMatches(
|
||||
0,
|
||||
"TE",
|
||||
0,
|
||||
2, ignoreCase = true
|
||||
0,
|
||||
"TE",
|
||||
0,
|
||||
2, ignoreCase = true
|
||||
)
|
||||
s.regionMatches(0, "st", 1, 2)
|
||||
s.matches("\\w+".toRegex())
|
||||
s.replace("\\w+".toRegex(), "---")
|
||||
.replaceFirst("([s-t])".toRegex(), "A$1")
|
||||
.replaceFirst("([s-t])".toRegex(), "A$1")
|
||||
useSplit(s.split("\\s+".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray())
|
||||
useSplit(s.split("\\s+".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray())
|
||||
useSplit(s.split("\\s+".toRegex()).toTypedArray())
|
||||
@@ -109,9 +109,9 @@ internal class A {
|
||||
Any().toString()
|
||||
|
||||
String.format(
|
||||
Locale.FRENCH,
|
||||
"Je ne mange pas %d jours",
|
||||
6
|
||||
Locale.FRENCH,
|
||||
"Je ne mange pas %d jours",
|
||||
6
|
||||
)
|
||||
String.format("Operation completed with %s", "success")
|
||||
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
import java.util.*
|
||||
|
||||
internal class A<T> {
|
||||
fun foo(nonMutableCollection: Collection<String>,
|
||||
mutableCollection: MutableCollection<String>,
|
||||
mutableSet: MutableSet<T>,
|
||||
mutableMap: MutableMap<String, T>) {
|
||||
fun foo(
|
||||
nonMutableCollection: Collection<String>,
|
||||
mutableCollection: MutableCollection<String>,
|
||||
mutableSet: MutableSet<T>,
|
||||
mutableMap: MutableMap<String, T>
|
||||
) {
|
||||
mutableCollection.addAll(nonMutableCollection)
|
||||
mutableSet.add(mutableMap.remove("a"))
|
||||
}
|
||||
|
||||
@@ -4,7 +4,10 @@ import kotlinApi.KotlinClass
|
||||
|
||||
abstract class C(field: Int) : KotlinClass(field) {
|
||||
|
||||
override fun foo(mutableCollection: MutableCollection<String>, nullableCollection: Collection<Int>?): MutableList<Any> {
|
||||
override fun foo(
|
||||
mutableCollection: MutableCollection<String>,
|
||||
nullableCollection: Collection<Int>?
|
||||
): MutableList<Any> {
|
||||
return super.foo(mutableCollection, nullableCollection)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@ internal class C(p1: Int, p2: Int, p3: Int)
|
||||
|
||||
internal class User {
|
||||
fun foo() {
|
||||
C(1,
|
||||
2,
|
||||
3)
|
||||
C(
|
||||
1,
|
||||
2,
|
||||
3
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user