Create from usage: Support generation of Java methods from usages in Kotlin code
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
// "Create extension function 'foo'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
fun test(): Int {
|
||||
return A().foo()
|
||||
}
|
||||
|
||||
fun A.foo(): Int {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create extension function 'foo'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
fun test(): Int {
|
||||
return A().<caret>foo()
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class A {
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Create extension function 'foo'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
fun test(): Int? {
|
||||
return A().foo(1, "2")
|
||||
}
|
||||
|
||||
fun A.foo(i: Int, s: String): Int? {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create extension function 'foo'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
fun test(): Int? {
|
||||
return A().<caret>foo(1, "2")
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class A {
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Create function 'foo'" "false"
|
||||
// ACTION: Convert to expression body
|
||||
// ACTION: Create extension function 'foo'
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
fun test(): Int {
|
||||
return A().<caret>foo()
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class A {
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
interface A {
|
||||
|
||||
@Nullable
|
||||
<T, U> U foo(U u, T t);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Create function 'foo'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
fun test(a: A): Int? {
|
||||
return a.foo<String, Int>(1, "2")
|
||||
}
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create function 'foo'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
fun test(a: A): Int? {
|
||||
return a.<caret>foo<String, Int>(1, "2")
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
interface A {
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
class A {
|
||||
|
||||
@Nullable
|
||||
public Integer foo(int i, @NotNull String s) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
// "Create extension function 'foo'" "true"
|
||||
// "Create function 'foo'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
fun test(): Int {
|
||||
fun test(): Int? {
|
||||
return A().foo(1, "2")
|
||||
}
|
||||
|
||||
fun A.foo(i: Int, s: String): Int {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
// "Create extension function 'foo'" "true"
|
||||
// "Create function 'foo'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
fun test(): Int {
|
||||
fun test(): Int? {
|
||||
return A().<caret>foo(1, "2")
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
|
||||
public <T, U> U foo(U u, T t) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create function 'foo'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
fun test(): Int {
|
||||
return A().foo<String, Int>(1, "2")
|
||||
}
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create function 'foo'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
fun test(): Int {
|
||||
return A().<caret>foo<String, Int>(1, "2")
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class A {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user