Find Usages: Support of secondary constructors and delegation calls

This commit is contained in:
Alexey Sedunov
2015-03-19 21:08:52 +03:00
parent 312a1db273
commit d19e6337a3
28 changed files with 342 additions and 27 deletions
@@ -0,0 +1,7 @@
// PSI_ELEMENT: com.intellij.psi.PsiMethod
// OPTIONS: usages
public class J {
public <caret>J(int i) {
}
}
@@ -0,0 +1,13 @@
class A: J {
constructor(): super(1) {
}
}
class B: J(1) {
}
fun test() {
J(2)
}
@@ -0,0 +1,3 @@
New instance creation (12: 5) J(2)
Supertype (7: 10) class B: J(1) {
Unclassified usage (2: 20) constructor(): super(1) {
@@ -0,0 +1,7 @@
// PSI_ELEMENT: com.intellij.psi.PsiMethod
// OPTIONS: usages
public class J {
public <caret>J() {
}
}
@@ -0,0 +1,17 @@
class A: J {
constructor(i: Int): super() {
}
constructor() {
}
}
class B: J() {
}
fun test() {
J()
}
@@ -0,0 +1,4 @@
New instance creation (16: 5) J()
Supertype (11: 10) class B: J() {
Unclassified usage (2: 26) constructor(i: Int): super() {
Unclassified usage (6: 19) constructor() {
@@ -0,0 +1,12 @@
// PSI_ELEMENT: com.intellij.psi.PsiMethod
// FIND_BY_REF
// OPTIONS: usages
public class JJ extends B {
public JJ(int i) {
super("");
}
void test() {
new <caret>B("");
}
}
@@ -0,0 +1,23 @@
open class B {
constructor(): this("") {
}
constructor(s: String) {
}
}
open class A : B {
constructor(a: Int) : super("") {
}
}
class C : B("") {
}
fun test() {
B("")
}
@@ -0,0 +1,6 @@
New instance creation (10: 13) new B("");
New instance creation (22: 5) B("")
Supertype (17: 11) class C : B("") {
Unclassified usage (12: 27) constructor(a: Int) : super("") {
Unclassified usage (2: 20) constructor(): this("") {
Unclassified usage (6: 9) super("");
@@ -0,0 +1,12 @@
// PSI_ELEMENT: com.intellij.psi.PsiMethod
// FIND_BY_REF
// OPTIONS: usages
public class JJ extends B {
public JJ(int i) {
<caret>super("");
}
void test() {
new B("");
}
}
@@ -0,0 +1,23 @@
open class B {
constructor(): this("") {
}
constructor(s: String) {
}
}
open class A : B {
constructor(a: Int) : super("") {
}
}
class C : B("") {
}
fun test() {
B("")
}
@@ -0,0 +1,6 @@
New instance creation (10: 13) new B("");
New instance creation (22: 5) B("")
Supertype (17: 11) class C : B("") {
Unclassified usage (12: 27) constructor(a: Int) : super("") {
Unclassified usage (2: 20) constructor(): this("") {
Unclassified usage (6: 9) super("");
@@ -3,6 +3,10 @@
package server
open class <caret>Server {
constructor(name: String): this() {
}
companion object {
val NAME = "Server"
}
@@ -25,6 +25,16 @@ object ClientObject: Server() {
}
class Client2: Server {
constructor(name: String) {
}
constructor(): super() {
}
}
fun Client.bar(s: Server) {
foo(s)
}
@@ -1,2 +1,5 @@
Supertype (24: 22) object ClientObject: Server() {
Supertype (5: 15) class Client: Server() {
Supertype (5: 15) class Client: Server() {
Unclassified usage (29: 31) constructor(name: String) {
Unclassified usage (33: 20) constructor(): super() {
Unclassified usage (6: 32) constructor(name: String): this() {
@@ -1,6 +1,5 @@
Unclassified usage (12: 17) public void setFoo(String s) {
Unclassified usage (13: 9) set(value: String) {
Unclassified usage (25: 18) override var foo: String = ""
Unclassified usage (25: 18) override var foo: String = ""
Unclassified usage (7: 19) public String getFoo() {
Unclassified usage (9: 9) get() {
Unclassified usage (9: 9) get() {
@@ -1,8 +1,6 @@
Unclassified usage (11: 9) set(value: String) {
Unclassified usage (12: 17) public void setFoo(String s) {
Unclassified usage (23: 18) override var foo: String = ""
Unclassified usage (23: 18) override var foo: String = ""
Unclassified usage (26: 30) open class E<T>(override var foo: T): A<T>(foo)
Unclassified usage (26: 30) open class E<T>(override var foo: T): A<T>(foo)
Unclassified usage (7: 19) public String getFoo() {
Unclassified usage (7: 9) get() {
Unclassified usage (7: 9) get() {
@@ -0,0 +1,29 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.JetSecondaryConstructor
// OPTIONS: usages
open class B {
<caret>constructor() {
}
constructor(a: Int): this() {
}
}
class A : B {
constructor(a: Int) : super() {
}
constructor() {
}
}
class C : B() {
}
fun test() {
B()
}
@@ -0,0 +1,13 @@
public class J extends B {
public J(int i) {
super();
}
public J() {
}
void test() {
new B();
}
}
@@ -0,0 +1,8 @@
New instance creation (11: 13) new B();
New instance creation (28: 5) B()
Supertype (23: 11) class C : B() {
Unclassified usage (14: 27) constructor(a: Int) : super() {
Unclassified usage (18: 19) constructor() {
Unclassified usage (3: 9) super();
Unclassified usage (6: 12) public J() {
Unclassified usage (8: 26) constructor(a: Int): this() {
@@ -0,0 +1,25 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.JetSecondaryConstructor
// OPTIONS: usages
open class B {
constructor(): this("") {
}
<caret>constructor(s: String) {
}
}
open class A : B {
constructor(a: Int) : super("") {
}
}
class C: B("") {
}
fun test() {
B("")
}
@@ -0,0 +1,9 @@
public class JJ extends B {
public JJ(int i) {
super("");
}
void test() {
new B("");
}
}
@@ -0,0 +1,6 @@
New instance creation (24: 5) B("")
New instance creation (7: 13) new B("");
Supertype (19: 10) class C: B("") {
Unclassified usage (14: 27) constructor(a: Int) : super("") {
Unclassified usage (3: 9) super("");
Unclassified usage (4: 20) constructor(): this("") {