[CHERRY PICKED FROM IJ] [testdata] Replace test IncrementalJvmJpsTestGenerated.WithJava.JavaUsedInKotlin.testMixedInheritance with new one

Replace test because JPS recompile inherited classes only in case of existence of direct use (like override or direct call of parent methods).
Tested cases:
*Add new abstract method when derived class does not abstract
*Add and remove method, when such method is present in derived class
*Change return type/access modifier

GitOrigin-RevId: 767e58ba3d3e4069838c717666329b43f1b8e936
Original commit: https://github.com/JetBrains/intellij-community/commit/d738c61aaefe95acd8130066f53f8d8bcadfa977
This commit is contained in:
Aleksei.Cherepanov
2021-10-29 13:07:48 +03:00
committed by Space
parent aa1700f3e7
commit 411a0ecc38
19 changed files with 153 additions and 50 deletions
@@ -0,0 +1,3 @@
abstract public class BaseClass {
}
@@ -0,0 +1,4 @@
// add abstract method, when derived class is not abstract
abstract public class BaseClass {
abstract void myAbs();
}
@@ -0,0 +1,3 @@
// fix
public class BaseClass {
}
@@ -0,0 +1,6 @@
// add method to Base, that does not clash with derived
public class BaseClass {
void doSmthAnother() {
System.out.println(":)");
}
}
@@ -0,0 +1,7 @@
// add method to Base, that CLASH with derived
public class BaseClass {
void doSmthAnother() {
System.out.println(":)");
}
void doSmth() {}
}
@@ -0,0 +1,6 @@
// fix clash
public class BaseClass {
void doSmthAnother() {
System.out.println(":)");
}
}
@@ -0,0 +1,6 @@
// change return type
public class BaseClass {
String doSmthAnother() {
return ":)";
}
}
@@ -1,3 +0,0 @@
open class BaseClass {
fun foo() {}
}
@@ -1,3 +0,0 @@
open class BaseClass {
fun foo(): String = "OK"
}
@@ -1,2 +0,0 @@
public class DerivedClass1 extends BaseClass {
}
@@ -0,0 +1,3 @@
open class DerivedClass1 : BaseClass() {
fun doSmth() {}
}
@@ -0,0 +1,6 @@
open class DerivedClass1 : BaseClass() {
fun doSmth() {}
override fun doSmthAnother() {
println(":))")
}
}
@@ -1,2 +0,0 @@
class DerivedClass2 : DerivedClass1() {
}
@@ -2,33 +2,124 @@
Cleaning output files:
out/production/module/BaseClass.class
out/production/module/META-INF/module.kotlin_module
End of files
Compiling files:
src/BaseClass.kt
End of files
Marked as dirty by Kotlin:
src/usage1.kt
src/usage2.kt
src/usage3.kt
Exit code: ADDITIONAL_PASS_REQUIRED
Exit code: NOTHING_DONE
------------------------------------------
Compiling files:
src/BaseClass.java
End of files
Cleaning output files:
out/production/module/DerivedClass1.class
out/production/module/DerivedClass2.class
out/production/module/META-INF/module.kotlin_module
out/production/module/Usage1Kt.class
out/production/module/Usage2Kt.class
out/production/module/Usage3Kt.class
End of files
Compiling files:
src/DerivedClass2.kt
src/usage1.kt
src/usage2.kt
src/usage3.kt
src/DerivedClass1.kt
End of files
Exit code: ABORT
------------------------------------------
COMPILATION FAILED
Class 'DerivedClass1' is not abstract and does not implement abstract base class member public/*package*/ abstract fun myAbs(): Unit defined in BaseClass
================ Step #2 =================
Cleaning output files:
out/production/module/BaseClass.class
End of files
Compiling files:
src/DerivedClass1.kt
End of files
Exit code: OK
------------------------------------------
Compiling files:
src/DerivedClass1.java
src/BaseClass.java
End of files
================ Step #3 =================
Cleaning output files:
out/production/module/BaseClass.class
End of files
Exit code: NOTHING_DONE
------------------------------------------
Compiling files:
src/BaseClass.java
End of files
================ Step #4 =================
Cleaning output files:
out/production/module/BaseClass.class
End of files
Exit code: NOTHING_DONE
------------------------------------------
Compiling files:
src/BaseClass.java
End of files
Cleaning output files:
out/production/module/DerivedClass1.class
out/production/module/META-INF/module.kotlin_module
End of files
Compiling files:
src/DerivedClass1.kt
End of files
Exit code: ABORT
------------------------------------------
COMPILATION FAILED
'doSmth' hides member of supertype 'BaseClass' and needs 'override' modifier
================ Step #5 =================
Cleaning output files:
out/production/module/BaseClass.class
End of files
Compiling files:
src/DerivedClass1.kt
End of files
Exit code: OK
------------------------------------------
Compiling files:
src/BaseClass.java
End of files
Cleaning output files:
out/production/module/DerivedClass1.class
out/production/module/META-INF/module.kotlin_module
End of files
Compiling files:
src/DerivedClass1.kt
End of files
Exit code: OK
------------------------------------------
================ Step #6 =================
Cleaning output files:
out/production/module/DerivedClass1.class
out/production/module/META-INF/module.kotlin_module
End of files
Compiling files:
src/DerivedClass1.kt
End of files
Exit code: OK
------------------------------------------
================ Step #7 =================
Cleaning output files:
out/production/module/BaseClass.class
End of files
Exit code: NOTHING_DONE
------------------------------------------
Compiling files:
src/BaseClass.java
End of files
Cleaning output files:
out/production/module/DerivedClass1.class
out/production/module/META-INF/module.kotlin_module
End of files
Compiling files:
src/DerivedClass1.kt
End of files
Exit code: ABORT
------------------------------------------
COMPILATION FAILED
Return type of 'doSmthAnother' is not a subtype of the return type of the overridden member 'public/*package*/ open fun doSmthAnother(): String! defined in BaseClass'
@@ -1,10 +0,0 @@
================ Step #1 =================
Compiling files:
src/BaseClass.kt
src/usage1.kt
src/usage2.kt
src/usage3.kt
End of files
Exit code: OK
@@ -1,3 +0,0 @@
fun main4() {
DerivedClass2().hashCode()
}
@@ -1,3 +0,0 @@
fun main1() {
BaseClass().foo()
}
@@ -1,3 +0,0 @@
fun main2() {
DerivedClass1().foo()
}
@@ -1,3 +0,0 @@
fun main3() {
DerivedClass2().foo()
}