aboutsummaryrefslogtreecommitdiff
path: root/test-utils/testData/api/resolveJavaType.kt
blob: b732b270f9714f3c7defbf42f1f84c5ded92464c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*
 * Copyright 2020 Google LLC
 * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// TEST PROCESSOR: ResolveJavaTypeProcessor
// EXPECTED:
// C<*kotlin.Any?>
// C.<init>.X?
// C<*kotlin.Any?>
// kotlin.Int
// kotlin.String?
// kotlin.collections.MutableSet<*kotlin.Any?>?
// kotlin.Unit
// kotlin.IntArray?
// C.T?
// C.PFun.P?
// kotlin.collections.MutableList<out kotlin.collections.MutableSet<kotlin.Double?>?>?
// kotlin.collections.MutableList<in kotlin.collections.MutableList<out kotlin.Double?>?>?
// Bar?
// kotlin.Array<Bar?>?
// Foo<Base.T?, Base.Inner.P?>?
// Bar<Base.Inner.P?, Base.T?>?
// kotlin.collections.MutableList<Base.T?>?
// kotlin.Unit
// Base.T?
// kotlin.Unit
// kotlin.Array<Base.T?>?
// kotlin.Unit
// kotlin.Array<Base.T?>?
// kotlin.Unit
// kotlin.collections.MutableList<Base.T?>?
// kotlin.Unit
// Base.T?
// kotlin.Unit
// kotlin.Array<Base.T?>?
// kotlin.Unit
// kotlin.Array<Base.T?>?
// kotlin.Unit
// Base<Another.T?, Another.T?>?
// kotlin.Int
// kotlin.Int
// JavaEnum
// kotlin.Unit
// kotlin.Array<JavaEnum?>?
// kotlin.String?
// JavaEnum?
// END
// FILE: a.kt
annotation class Test
@Test
class Foo<P>: C<P>() {

}

class Bar

// FILE: C.java
import java.util.List;
import java.util.Set;

public class C<T> {
    public C() {}
    // to reproduce the case where type reference is owned by a constructor
    public <X> C(X x) {}
    public int intFun() {}

    public String strFun() {}

    public void wildcardParam(Set<?> param1) {}

    public int[] intArrayFun() {}

    public T TFoo() {}

    public <P> P PFun() {}

    public List<? extends Set<Double>> extendsSetFun() {}

    public List<? super List<? extends Double>> extendsListTFun() {}

    public Bar BarFun() {}

    public Bar[] BarArryFun() {}
}

// FILE: Base.java
import java.util.List;

class Foo<T1,T2> {}
class Bar<T1, T2> {}

class Base<T,P> {
    void genericT(List<T> t){};
    void singleT(T t){};
    void varargT(T... t){};
    void arrayT(T[] t){};

    class Inner<P> {
        void genericT(List<T> t){};
        void singleT(T t){};
        void varargT(T... t){};
        void arrayT(T[] t){};
        Foo<T, P> foo;
        Bar<P, T> bar;
    }
}

class Another<T> {
    Base<T, T> base;
}

public enum JavaEnum {
    VAL1(1),
    VAL2(2);

    private int x;

    JavaEnum(int x) {
        this.x = x;
    }
    void enumMethod() {}
}