class_mult avoided

This commit is contained in:
Sergey Ignatov
2011-11-07 13:18:50 +04:00
parent 58e8aa8fbb
commit c9c153cd72
61 changed files with 119 additions and 51 deletions
@@ -46,8 +46,7 @@ public class JavaToKotlinConverterTest extends LightDaemonAnalyzerTestCase {
else if (javaFile.getParent().endsWith("/method")) actual = methodToSingleLineKotlin(javaCode);
else if (javaFile.getParent().endsWith("/method_mult")) actual = methodToKotlin(javaCode);
else if (javaFile.getParent().endsWith("/class")) actual = classToSingleLineKotlin(javaCode);
else if (javaFile.getParent().endsWith("/class_mult")) actual = classToKotlin(javaCode);
else if (javaFile.getParent().endsWith("/class")) actual = classToKotlin(javaCode);
else if (javaFile.getParent().endsWith("/file")) actual = fileToKotlin(javaCode);
@@ -112,11 +111,15 @@ public class JavaToKotlinConverterTest extends LightDaemonAnalyzerTestCase {
return prettify(result);
}
@NotNull
protected String classToSingleLineKotlin(String text) throws IOException {
return toSingleLine(classToKotlin(text));
protected String methodToSingleLineKotlin(String text) throws IOException {
return toSingleLine(methodToKotlin(text));
}
protected String statementToSingleLineKotlin(String code) throws Exception {
return toSingleLine(statementToKotlin(code));
}
@NotNull
protected String methodToKotlin(String text) throws IOException {
String result = classToKotlin("final class C {" + text + "}")
.replaceAll("class C \\{", "");
@@ -124,10 +127,7 @@ public class JavaToKotlinConverterTest extends LightDaemonAnalyzerTestCase {
return prettify(result);
}
protected String methodToSingleLineKotlin(String text) throws IOException {
return toSingleLine(methodToKotlin(text));
}
@NotNull
protected String statementToKotlin(String text) throws Exception {
String result = methodToKotlin("void main() {" + text + "}");
int pos = result.lastIndexOf("}");
@@ -135,10 +135,7 @@ public class JavaToKotlinConverterTest extends LightDaemonAnalyzerTestCase {
return prettify(result);
}
protected String statementToSingleLineKotlin(String code) throws Exception {
return toSingleLine(statementToKotlin(code));
}
@NotNull
protected String expressionToKotlin(String code) throws Exception {
String result = statementToKotlin("Object o =" + code + "}");
result = result.replaceFirst("var o : Any\\? =", "");
+2 -1
View File
@@ -1 +1,2 @@
open class Test { }
open class Test {
}
+2 -1
View File
@@ -1 +1,2 @@
class A { }
class A {
}
@@ -1 +1,2 @@
class A : Base, I { }
class A : Base, I {
}
@@ -1 +1,2 @@
class A : Base, I0, I1, I2 { }
class A : Base, I0, I1, I2 {
}
+2 -1
View File
@@ -1 +1,2 @@
class Test { }
class Test {
}
+2 -1
View File
@@ -1 +1,2 @@
class Entry<K, V> { }
class Entry<K, V> {
}
+4 -1
View File
@@ -1 +1,4 @@
class A { class B { } }
class A {
class B {
}
}
+6 -1
View File
@@ -1 +1,6 @@
class S { class object { open class Inner { } } }
class S {
class object {
open class Inner {
}
}
}
+2 -1
View File
@@ -1 +1,2 @@
open class Test { }
open class Test {
}
@@ -1 +1,8 @@
class S { class object { var myI : Int = 10 } fun sB() : Boolean { return true } }
class S {
class object {
var myI : Int = 10
}
fun sB() : Boolean {
return true
}
}
+7 -1
View File
@@ -1 +1,7 @@
class S { class object { fun staticF() : Boolean { return true } } }
class S {
class object {
fun staticF() : Boolean {
return true
}
}
}
@@ -1 +1,10 @@
class S { class object { fun sI() : Int { return 1 } } fun sB() : Boolean { return true } }
class S {
class object {
fun sI() : Int {
return 1
}
}
fun sB() : Boolean {
return true
}
}
+2 -1
View File
@@ -1 +1,2 @@
private open class Test { }
private open class Test {
}
+2 -1
View File
@@ -1 +1,2 @@
protected open class Test { }
protected open class Test {
}
+2 -1
View File
@@ -1 +1,2 @@
public open class Test { }
public open class Test {
}
@@ -1 +1,2 @@
class A : Base { }
class A : Base {
}
+10 -1
View File
@@ -1 +1,10 @@
class S { class object { fun sB() : Boolean { return true } fun sI() : Int { return 1 } } }
class S {
class object {
fun sB() : Boolean {
return true
}
fun sI() : Int {
return 1
}
}
}
+2 -1
View File
@@ -1 +1,2 @@
enum A { }
enum A {
}
@@ -1 +1,2 @@
enum A : I { }
enum A : I {
}
@@ -1 +1,2 @@
enum A : I0, I1, I2 { }
enum A : I0, I1, I2 {
}
+2 -1
View File
@@ -1 +1,2 @@
enum Test { }
enum Test {
}
+2 -1
View File
@@ -1 +1,2 @@
private enum Test { }
private enum Test {
}
+2 -1
View File
@@ -1 +1,2 @@
protected enum Test { }
protected enum Test {
}
+2 -1
View File
@@ -1 +1,2 @@
public enum Test { }
public enum Test {
}
+2 -1
View File
@@ -1 +1,2 @@
trait A { }
trait A {
}
@@ -1 +1,2 @@
trait A : I0, I1, I2 { }
trait A : I0, I1, I2 {
}
@@ -1 +1,2 @@
trait A : I { }
trait A : I {
}
@@ -1 +1,2 @@
trait Test { }
trait Test {
}
+2 -1
View File
@@ -1 +1,2 @@
private trait Test { }
private trait Test {
}
@@ -1 +1,2 @@
protected trait Test { }
protected trait Test {
}
+2 -1
View File
@@ -1 +1,2 @@
public trait Test { }
public trait Test {
}
@@ -1 +1,2 @@
class CC<T : INode?, K : Node?> : A where T : Comparable<in T?>?, K : Collection<in K?>? { }
class CC<T : INode?, K : Node?> : A where T : Comparable<in T?>?, K : Collection<in K?>? {
}
@@ -1 +1,2 @@
class C<T : INode?> where T : Comparable<in T?>? { }
class C<T : INode?> where T : Comparable<in T?>? {
}
@@ -1 +1,2 @@
class C<T : INode?> : A where T : Comparable<in T?>? { }
class C<T : INode?> : A where T : Comparable<in T?>? {
}
@@ -1 +1,2 @@
trait CommandHandler<T : Command?> { }
trait CommandHandler<T : Command?> {
}
@@ -1 +1,2 @@
trait CommandHandler<T : INode?, String> { }
trait CommandHandler<T : INode?, String> {
}
@@ -1 +1,2 @@
class Comparable<T> { }
class Comparable<T> {
}
@@ -1 +1,2 @@
trait I<T : INode?, K : Node?> : II where T : Comparable<in T?>?, K : Collection<in K?>? { }
trait I<T : INode?, K : Node?> : II where T : Comparable<in T?>?, K : Collection<in K?>? {
}