Generate Secondary Constructor: Fix test data loading. Add test with non-generic Java superclass
This commit is contained in:
committed by
Alexey Sedunov
parent
3c07bc3df7
commit
07259fa090
@@ -1,9 +1,9 @@
|
|||||||
public class Base<X, Y> {
|
public class Base {
|
||||||
public Base(X x) {
|
public Base(int n) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Base(X x, Y y) {
|
public Base(int a, int b) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
// ACTION_CLASS: org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateSecondaryConstructorAction
|
// ACTION_CLASS: org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateSecondaryConstructorAction
|
||||||
class Foo<U> : Base<U, Int> {<caret>
|
class Foo : Base {<caret>
|
||||||
val x = 1
|
val x = 1
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
|
|||||||
+3
-3
@@ -1,10 +1,10 @@
|
|||||||
// ACTION_CLASS: org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateSecondaryConstructorAction
|
// ACTION_CLASS: org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateSecondaryConstructorAction
|
||||||
class Foo<U> : Base<U, Int> {
|
class Foo : Base {
|
||||||
val x = 1
|
val x = 1
|
||||||
|
|
||||||
<caret>constructor(x: U) : super(x)
|
<caret>constructor(n: Int) : super(n)
|
||||||
|
|
||||||
constructor(x: U, y: Int?) : super(x, y)
|
constructor(a: Int, b: Int) : super(a, b)
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
|
|
||||||
|
|||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
public class Base<X, Y> {
|
||||||
|
public Base(X x) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Base(X x, Y y) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
// ACTION_CLASS: org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateSecondaryConstructorAction
|
||||||
|
class Foo<U> : Base<U, Int> {<caret>
|
||||||
|
val x = 1
|
||||||
|
|
||||||
|
fun foo() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
// ACTION_CLASS: org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateSecondaryConstructorAction
|
||||||
|
class Foo<U> : Base<U, Int> {
|
||||||
|
val x = 1
|
||||||
|
|
||||||
|
<caret>constructor(x: U) : super(x)
|
||||||
|
|
||||||
|
constructor(x: U, y: Int?) : super(x, y)
|
||||||
|
|
||||||
|
fun foo() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -56,7 +56,7 @@ abstract class AbstractCodeInsightActionTest : JetLightCodeInsightFixtureTestCas
|
|||||||
|
|
||||||
val mainFile = File(path)
|
val mainFile = File(path)
|
||||||
val mainFileName = mainFile.name
|
val mainFileName = mainFile.name
|
||||||
val fileNameBase = mainFile.nameWithoutExtension
|
val fileNameBase = mainFile.nameWithoutExtension + "."
|
||||||
val rootDir = mainFile.parentFile
|
val rootDir = mainFile.parentFile
|
||||||
rootDir
|
rootDir
|
||||||
.list { file, name ->
|
.list { file, name ->
|
||||||
|
|||||||
+6
@@ -53,6 +53,12 @@ public class CodeInsightActionTestGenerated extends AbstractCodeInsightActionTes
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("javaSupersWithGenerics.kt")
|
||||||
|
public void testJavaSupersWithGenerics() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/codeInsight/generate/secondaryConstructors/javaSupersWithGenerics.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("properties.kt")
|
@TestMetadata("properties.kt")
|
||||||
public void testProperties() throws Exception {
|
public void testProperties() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/codeInsight/generate/secondaryConstructors/properties.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/codeInsight/generate/secondaryConstructors/properties.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user