KT-7291 Copy/paste of java declaration with preceding comment omitted does not convert it to Kotlin propertly

#KT-7291 Fixed
This commit is contained in:
Valentin Kipyatkov
2015-04-09 15:21:56 +03:00
parent bfadd489a3
commit 498f24b98b
18 changed files with 304 additions and 21 deletions
@@ -0,0 +1,6 @@
package to
public class JavaClass : Runnable {
override fun run() {
}
}
@@ -0,0 +1,10 @@
/**
* Doc comment for JavaClass
*/
<selection>public class JavaClass implements Runnable{
@Override
public void run() {
}
}
</selection>
@@ -0,0 +1,3 @@
package to
private val field = 1
@@ -0,0 +1,3 @@
public class JavaClass {
<selection>private int field = 1;</selection> // comment for field
}
@@ -0,0 +1,3 @@
package to
volatile var field = 1
@@ -0,0 +1,3 @@
public class JavaClass {
public <selection>volatile int field = 1</selection>;
}
@@ -0,0 +1,9 @@
package to
public object JavaClass {
public fun main(args: Array<String>) {
println("Hello, world!")
}
}
fun main(args: Array<String>) = JavaClass.main(args)
@@ -0,0 +1,10 @@
// this test should cause the whole file to be converted at once (with non-selected text stripped) and the main function to be generated
package helloWorld;
// sample class
<selection>public class JavaClass {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}
</selection>
@@ -0,0 +1,3 @@
package to
fun foo(p: Int)
@@ -0,0 +1,5 @@
class A {
public <selection>void foo(int p)</selection> {
System.out.println("foo");
}
}
@@ -0,0 +1,5 @@
package to
public fun foo(): String {
return ""
}
@@ -0,0 +1,6 @@
public class JavaClass {
@Deprecated
<selection> public String foo() {
return "";
}
</selection>}
@@ -0,0 +1,6 @@
package to
SomeAnnotation
public fun foo(): String {
return ""
}
@@ -0,0 +1,7 @@
public class JavaClass {
@Deprecated
<selection> @SomeAnnotation
public String foo() {
return "";
}
</selection>}