New J2K: make initial generating code formatting better
This commit is contained in:
+10
-15
@@ -2,12 +2,11 @@
|
||||
/*
|
||||
This is a block comment
|
||||
*/
|
||||
/*doc comment of class*/
|
||||
//one line comment of class
|
||||
/*doc comment of class*/ //one line comment of class
|
||||
//another one
|
||||
/*another doc*/
|
||||
internal class C { // This is a class comment
|
||||
|
||||
internal class C {
|
||||
// This is a class comment
|
||||
/**
|
||||
* This is a field doc comment.
|
||||
*/
|
||||
@@ -26,34 +25,30 @@ internal class C { // This is a class comment
|
||||
var j = 0
|
||||
|
||||
//double c style
|
||||
//comment before function
|
||||
//comment before function
|
||||
fun f2() {}
|
||||
|
||||
//double c style
|
||||
//comment before field
|
||||
//comment before field
|
||||
var k = 0
|
||||
|
||||
//combination
|
||||
/** of
|
||||
*/
|
||||
//
|
||||
//
|
||||
/**
|
||||
* different
|
||||
*/
|
||||
//comments
|
||||
//comments
|
||||
fun f3() {}
|
||||
|
||||
//combination
|
||||
/** of
|
||||
*/
|
||||
//
|
||||
//
|
||||
/**
|
||||
* different
|
||||
*/
|
||||
//comments
|
||||
//comments
|
||||
var l = 0
|
||||
/*two*/
|
||||
/*comments*/
|
||||
/*line*/
|
||||
/*two*/ /*comments*/ /*line*/
|
||||
var z = 0
|
||||
}
|
||||
+1
-2
@@ -2,7 +2,6 @@ package demo
|
||||
|
||||
internal object Test {
|
||||
fun bar(a: Int) {
|
||||
if (a < 0)
|
||||
throw RuntimeException("a = $a")
|
||||
if (a < 0) throw RuntimeException("a = $a")
|
||||
}
|
||||
}
|
||||
+2
-4
@@ -7,14 +7,12 @@ internal class Test {
|
||||
val c = 2
|
||||
val d = 4
|
||||
val y = (a // polyadic expression case
|
||||
|
||||
+ b // x2
|
||||
|
||||
+ c // x3
|
||||
|
||||
+ d) // x4
|
||||
val z = (a // binary expression case
|
||||
+ b) // x4
|
||||
val j = b + c
|
||||
val j = b +
|
||||
c
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
import java.awt.image.AreaAveragingScaleFilter
|
||||
import java.awt.image.ImageConsumer
|
||||
|
||||
class TestInterfaceStaticFieldReference(width: Int, height: Int) :
|
||||
AreaAveragingScaleFilter(width, height) {
|
||||
class TestInterfaceStaticFieldReference(width: Int, height: Int) : AreaAveragingScaleFilter(width, height) {
|
||||
fun test() {
|
||||
println(ImageConsumer.TOPDOWNLEFTRIGHT)
|
||||
}
|
||||
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
class ClassC<T>
|
||||
|
||||
object Test {
|
||||
@JvmStatic
|
||||
fun main(args: Array<String>) {
|
||||
var a: ClassC<*>
|
||||
}
|
||||
}
|
||||
}
|
||||
-1
@@ -2,7 +2,6 @@ package demo
|
||||
|
||||
internal class Test {
|
||||
fun putInt(i: Int) {}
|
||||
|
||||
fun test() {
|
||||
val b: Byte = 10
|
||||
putInt(b.toInt())
|
||||
|
||||
-1
@@ -1,7 +1,6 @@
|
||||
package demo
|
||||
|
||||
internal class Test(i: Int) {
|
||||
|
||||
fun test() {
|
||||
val b: Byte = 10
|
||||
Test(b.toInt())
|
||||
|
||||
+1
-2
@@ -21,6 +21,5 @@ internal object FileRead {
|
||||
} catch (e: Exception) {
|
||||
System.err.println("Error: " + e.message)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
-1
@@ -9,7 +9,6 @@ internal object One {
|
||||
}
|
||||
|
||||
internal class IntContainer(i: Int)
|
||||
|
||||
internal class Test {
|
||||
fun putInt(i: Int) {}
|
||||
fun test() {
|
||||
|
||||
+1
-2
@@ -13,7 +13,6 @@ object Test {
|
||||
val result = true
|
||||
return if (parent.isDirectory) {
|
||||
true
|
||||
} else
|
||||
false
|
||||
} else false
|
||||
}
|
||||
}
|
||||
-1
@@ -8,7 +8,6 @@ internal class Test {
|
||||
println(true or false)
|
||||
println(true xor false)
|
||||
println(!true)
|
||||
|
||||
println(true && false)
|
||||
println(true || false)
|
||||
}
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@ class Language(protected var code: String) : Serializable {
|
||||
override fun toString(): String {
|
||||
return code
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal open class Base {
|
||||
@@ -20,4 +21,4 @@ internal class Child : Base() {
|
||||
override fun toString(): String {
|
||||
return "Child"
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -12,4 +12,5 @@ class Language(protected var code: String) : Serializable {
|
||||
var SWEDISH = Language("sv")
|
||||
private const val serialVersionUID = -2442762969929206780L
|
||||
}
|
||||
|
||||
}
|
||||
-1
@@ -1,6 +1,5 @@
|
||||
internal class Test {
|
||||
fun putInt(i: Int) {}
|
||||
|
||||
fun test() {
|
||||
val b: Byte = 10
|
||||
putInt(b.toInt())
|
||||
|
||||
+1
-4
@@ -5,10 +5,7 @@ internal class Test {
|
||||
val s1 = ""
|
||||
val s2 = ""
|
||||
val s3 = ""
|
||||
if (s1.isEmpty() && s2.isEmpty())
|
||||
return "OK"
|
||||
|
||||
if (s1.isEmpty() && s2.isEmpty()) return "OK"
|
||||
return if (s1.isEmpty() && s2.isEmpty() && s3.isEmpty()) "OOOK" else ""
|
||||
|
||||
}
|
||||
}
|
||||
+4
-15
@@ -1,40 +1,29 @@
|
||||
internal class Test {
|
||||
fun printNumbers() {
|
||||
for (i1 in 0..0)
|
||||
println(i1)
|
||||
|
||||
for (i1 in 0..0) println(i1)
|
||||
val b: Byte = 1
|
||||
for (i2 in 0 until b)
|
||||
println(i2)
|
||||
|
||||
for (i2 in 0 until b) println(i2)
|
||||
val s: Short = 1
|
||||
for (i3 in 0 until s)
|
||||
println(i3)
|
||||
|
||||
for (i3 in 0 until s) println(i3)
|
||||
val l = 1L
|
||||
for (i4 in 0 until l)
|
||||
println(i4)
|
||||
|
||||
for (i4 in 0 until l) println(i4)
|
||||
val d = 1.0
|
||||
var i5 = 0
|
||||
while (i5 < d) {
|
||||
println(i5)
|
||||
i5++
|
||||
}
|
||||
|
||||
val f = 1.0f
|
||||
var i6 = 0
|
||||
while (i6 < f) {
|
||||
println(i6)
|
||||
i6++
|
||||
}
|
||||
|
||||
val c = 1.toChar()
|
||||
var i7 = 0
|
||||
while (i7 < c.toInt()) {
|
||||
println(i7)
|
||||
i7++
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
-15
@@ -7,7 +7,6 @@ internal class A {
|
||||
val d = 1.0
|
||||
val f = 1.0f
|
||||
val c = 1.toChar()
|
||||
|
||||
t(i == i)
|
||||
t(i == b.toInt())
|
||||
t(i == s.toInt())
|
||||
@@ -15,7 +14,6 @@ internal class A {
|
||||
t(i.toDouble() == d)
|
||||
t(i.toFloat() == f)
|
||||
t(i == c.toInt())
|
||||
|
||||
t(b.toInt() == i)
|
||||
t(b == b)
|
||||
t(b.toShort() == s)
|
||||
@@ -23,7 +21,6 @@ internal class A {
|
||||
t(b.toDouble() == d)
|
||||
t(b.toFloat() == f)
|
||||
t(b == c.toByte())
|
||||
|
||||
t(s.toInt() == i)
|
||||
t(s == b.toShort())
|
||||
t(s == s)
|
||||
@@ -31,7 +28,6 @@ internal class A {
|
||||
t(s.toDouble() == d)
|
||||
t(s.toFloat() == f)
|
||||
t(s == c.toShort())
|
||||
|
||||
t(l == i.toLong())
|
||||
t(l == b.toLong())
|
||||
t(l == s.toLong())
|
||||
@@ -39,7 +35,6 @@ internal class A {
|
||||
t(l.toDouble() == d)
|
||||
t(l.toFloat() == f)
|
||||
t(l == c.toLong())
|
||||
|
||||
t(d == i.toDouble())
|
||||
t(d == b.toDouble())
|
||||
t(d == s.toDouble())
|
||||
@@ -47,7 +42,6 @@ internal class A {
|
||||
t(d == d)
|
||||
t(d == f.toDouble())
|
||||
t(d == c.toDouble())
|
||||
|
||||
t(f == i.toFloat())
|
||||
t(f == b.toFloat())
|
||||
t(f == s.toFloat())
|
||||
@@ -55,7 +49,6 @@ internal class A {
|
||||
t(f.toDouble() == d)
|
||||
t(f == f)
|
||||
t(f == c.toFloat())
|
||||
|
||||
t(c.toInt() == i)
|
||||
t(c.toByte() == b)
|
||||
t(c.toShort() == s)
|
||||
@@ -63,7 +56,6 @@ internal class A {
|
||||
t(c.toDouble() == d)
|
||||
t(c.toFloat() == f)
|
||||
t(c == c)
|
||||
|
||||
t(i.toDouble() != d)
|
||||
}
|
||||
|
||||
@@ -75,7 +67,6 @@ internal class A {
|
||||
val d = 1.0
|
||||
val f = 1.0f
|
||||
val c = 1.toChar()
|
||||
|
||||
t(i > i)
|
||||
t(i > b)
|
||||
t(i > s)
|
||||
@@ -83,7 +74,6 @@ internal class A {
|
||||
t(i > d)
|
||||
t(i > f)
|
||||
t(i > c.toInt())
|
||||
|
||||
t(b > i)
|
||||
t(b > b)
|
||||
t(b > s)
|
||||
@@ -91,7 +81,6 @@ internal class A {
|
||||
t(b > d)
|
||||
t(b > f)
|
||||
t(b > c.toByte())
|
||||
|
||||
t(s > i)
|
||||
t(s > b)
|
||||
t(s > s)
|
||||
@@ -99,7 +88,6 @@ internal class A {
|
||||
t(s > d)
|
||||
t(s > f)
|
||||
t(s > c.toShort())
|
||||
|
||||
t(l > i)
|
||||
t(l > b)
|
||||
t(l > s)
|
||||
@@ -107,7 +95,6 @@ internal class A {
|
||||
t(l > d)
|
||||
t(l > f)
|
||||
t(l > c.toLong())
|
||||
|
||||
t(d > i)
|
||||
t(d > b)
|
||||
t(d > s)
|
||||
@@ -115,7 +102,6 @@ internal class A {
|
||||
t(d > d)
|
||||
t(d > f)
|
||||
t(d > c.toDouble())
|
||||
|
||||
t(f > i)
|
||||
t(f > b)
|
||||
t(f > s)
|
||||
@@ -123,7 +109,6 @@ internal class A {
|
||||
t(f > d)
|
||||
t(f > f)
|
||||
t(f > c.toFloat())
|
||||
|
||||
t(c.toInt() > i)
|
||||
t(c.toByte() > b)
|
||||
t(c.toShort() > s)
|
||||
|
||||
@@ -2,22 +2,18 @@ internal class Test {
|
||||
fun operationsWithChar() {
|
||||
val c = 1.toChar()
|
||||
val i = 1
|
||||
|
||||
b(i > c.toInt())
|
||||
b(i >= c.toInt())
|
||||
b(i < c.toInt())
|
||||
b(i <= c.toInt())
|
||||
|
||||
b(c.toInt() > i)
|
||||
b(c.toInt() >= i)
|
||||
b(c.toInt() < i)
|
||||
b(c.toInt() <= i)
|
||||
|
||||
b(c.toInt() == i)
|
||||
b(c.toInt() != i)
|
||||
b(i == c.toInt())
|
||||
b(i != c.toInt())
|
||||
|
||||
i(i + c.toInt())
|
||||
i(i - c.toInt())
|
||||
i(i / c.toInt())
|
||||
@@ -27,7 +23,6 @@ internal class Test {
|
||||
i(i and c.toInt())
|
||||
i(i shl c.toInt())
|
||||
i(i shr c.toInt())
|
||||
|
||||
i(c.toInt() + i)
|
||||
i(c.toInt() - i)
|
||||
i(c.toInt() / i)
|
||||
|
||||
Reference in New Issue
Block a user