Create from usage: Support generation of nested Java classes from usages in Kotlin code
This commit is contained in:
+8
@@ -0,0 +1,8 @@
|
||||
class J {
|
||||
|
||||
public static @interface bar {
|
||||
String s();
|
||||
|
||||
int i();
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Create annotation 'bar'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
// ERROR: Unresolved reference: bar
|
||||
|
||||
[foo(1, "2", J.bar("3", 4))] fun test() {
|
||||
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create annotation 'bar'" "true"
|
||||
// ERROR: Unresolved reference: foo
|
||||
// ERROR: Unresolved reference: bar
|
||||
|
||||
[foo(1, "2", J.<caret>bar("3", 4))] fun test() {
|
||||
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class J {
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class J {
|
||||
|
||||
public static class Foo {
|
||||
public Foo(int abc, @NotNull A ghi, @NotNull String def) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
class A(val n: Int)
|
||||
|
||||
fun test() = J.Foo(abc = 1, ghi = A(2), def = "s")
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
class A(val n: Int)
|
||||
|
||||
fun test() = J.<caret>Foo(abc = 1, ghi = A(2), def = "s")
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class J {
|
||||
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create class 'Foo'" "false"
|
||||
// ACTION: Create function 'Foo'
|
||||
// ACTION: Convert to block body
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
fun test(): A = <caret>Foo(2, "2")
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
final class A {
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class J<T> {
|
||||
public J(T n) {
|
||||
|
||||
}
|
||||
|
||||
public class Foo<U> {
|
||||
public Foo(U u) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
fun test<U>(u: U) {
|
||||
val a = J(u).Foo(u)
|
||||
}
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
fun test<U>(u: U) {
|
||||
val a = J(u).<caret>Foo(u)
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class J<T> {
|
||||
public J(T n) {
|
||||
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// "Create class 'Foo'" "false"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
fun test() = J.<caret>Foo(2, "2")
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class J {
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class J {
|
||||
|
||||
public static class Foo {
|
||||
public Foo(int i) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
fun test() {
|
||||
val a = J.Foo(2)
|
||||
}
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
fun test() {
|
||||
val a = J.<caret>Foo(2)
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class J {
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class J {
|
||||
|
||||
public class Foo {
|
||||
public Foo(int i) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
fun test() {
|
||||
val a = J().Foo(2)
|
||||
}
|
||||
|
||||
+3
-6
@@ -1,9 +1,6 @@
|
||||
// "Create class 'Foo'" "false"
|
||||
// ACTION: Create extension function 'Foo'
|
||||
// ACTION: Create function 'Foo'
|
||||
// ACTION: Convert to expression body
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
fun test(): Int {
|
||||
return A().<caret>Foo(1, "2")
|
||||
fun test() {
|
||||
val a = J().<caret>Foo(2)
|
||||
}
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
class A {
|
||||
class J {
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import kotlin.properties.ReadOnlyProperty;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class J {
|
||||
|
||||
public static class Foo<T> implements ReadOnlyProperty<A<T>, B> {
|
||||
public Foo(T t, @NotNull String s) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// WITH_RUNTIME
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
open class B
|
||||
|
||||
class A<T>(val t: T) {
|
||||
val x: B by J.Foo(t, "")
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// WITH_RUNTIME
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
open class B
|
||||
|
||||
class A<T>(val t: T) {
|
||||
val x: B by J.<caret>Foo(t, "")
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class J {
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class J {
|
||||
|
||||
public static class Foo extends A {
|
||||
public Foo(int i, @NotNull String s) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
open class A
|
||||
|
||||
fun test(): A = J.Foo(2, "2")
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
open class A
|
||||
|
||||
fun test(): A = J.<caret>Foo(2, "2")
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class J {
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class J {
|
||||
|
||||
public static class Foo extends A {
|
||||
public Foo(int i, @NotNull String s) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
open class A(val n: Int)
|
||||
|
||||
fun test(): A = J.Foo(2, "2")
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
open class A(val n: Int)
|
||||
|
||||
fun test(): A = J.<caret>Foo(2, "2")
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class J {
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class J {
|
||||
|
||||
public static class Foo implements T {
|
||||
public Foo(int i, @NotNull String s) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
trait T
|
||||
|
||||
fun test(): T = J.Foo(2, "2")
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
trait T
|
||||
|
||||
fun test(): T = J.<caret>Foo(2, "2")
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class J {
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class B<T> {
|
||||
final T t = null;
|
||||
|
||||
public static class Foo<U, V> {
|
||||
public Foo(U u, V v) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
class A<T>(val b: B<T>) {
|
||||
fun test() = B.Foo<Int, String>(2, "2")
|
||||
}
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
class A<T>(val b: B<T>) {
|
||||
fun test() = B.<caret>Foo<Int, String>(2, "2")
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class B<T> {
|
||||
final T t = null;
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class B<T> {
|
||||
final T t = null;
|
||||
|
||||
public class Foo<U, V> {
|
||||
public Foo(U u, V v) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
class A<T>(val b: B<T>) {
|
||||
fun test() = b.Foo<Int, String>(2, "2")
|
||||
}
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
class A<T>(val b: B<T>) {
|
||||
fun test() = b.<caret>Foo<Int, String>(2, "2")
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class B<T> {
|
||||
final T t = null;
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class B<T> {
|
||||
final T t = null;
|
||||
|
||||
public class Foo<U> {
|
||||
public Foo(int i, U u) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
class A<T>(val b: B<T>) {
|
||||
fun test() = b.Foo<String>(2, "2")
|
||||
}
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
class A<T>(val b: B<T>) {
|
||||
fun test() = b.<caret>Foo<String>(2, "2")
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class B<T> {
|
||||
final T t = null;
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class B<T> {
|
||||
final T t = null;
|
||||
|
||||
public class Foo<U, V, W> {
|
||||
public Foo(V v, W w) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
class A<T>(val b: B<T>) {
|
||||
fun test() = b.Foo<T, Int, String>(2, "2")
|
||||
}
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
class A<T>(val b: B<T>) {
|
||||
fun test() = b.<caret>Foo<T, Int, String>(2, "2")
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class B<T> {
|
||||
final T t = null;
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class B<T> {
|
||||
final T t = null;
|
||||
|
||||
public static class Foo<U> {
|
||||
public Foo(int i, U u) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
class A<T>(val b: B<T>) {
|
||||
fun test() = B.Foo<String>(2, "2")
|
||||
}
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: Foo
|
||||
|
||||
class A<T>(val b: B<T>) {
|
||||
fun test() = B.<caret>Foo<String>(2, "2")
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class B<T> {
|
||||
final T t = null;
|
||||
}
|
||||
Reference in New Issue
Block a user