Properly generate inner classes when compiling source for inline

KT-19175: Compiler generates different bytecode when classes are compiled separately or together

 #KT-19175 Fixed

Original commit: ff676c050f
This commit is contained in:
Mikhael Bogdanov
2017-07-26 13:32:46 +02:00
parent 5747e1505a
commit 45628a15fb
6 changed files with 42 additions and 0 deletions
@@ -1466,6 +1466,12 @@ public class ExperimentalIncrementalJpsTestGenerated extends AbstractExperimenta
doTest(fileName);
}
@TestMetadata("innerClassNotGeneratedWhenRebuilding")
public void testInnerClassNotGeneratedWhenRebuilding() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("jps-plugin/testData/incremental/classHierarchyAffected/innerClassNotGeneratedWhenRebuilding/");
doTest(fileName);
}
@TestMetadata("jvmNameChanged")
public void testJvmNameChanged() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("jps-plugin/testData/incremental/classHierarchyAffected/jvmNameChanged/");
@@ -0,0 +1,10 @@
abstract class Introspector<M : Model>(protected val model: Model) {
protected abstract inner class Retriever(protected val transaction: Any) {
protected var model: Model = this@Introspector.model
}
protected abstract inner class SchemaRetriever(transaction: Any): Retriever(transaction) {
protected inline fun inSchema(crossinline modifier: (Any) -> Unit) =
model.modify { schema -> modifier.invoke(schema) }
}
}
@@ -0,0 +1,12 @@
class IntrospectorImpl(model: ModuleImpl) : Introspector<ModuleImpl>(model) {
private inner class SchemaRetriever(transaction: Any) : Introspector<ModuleImpl>.SchemaRetriever(transaction) {
internal fun retrieve() {
inSchema { schema -> println(schema) }
}
}
}
class ModuleImpl : Model {
override fun modify(modifier: ModelModifier) {}
}
@@ -0,0 +1,4 @@
public interface Model {
void modify(ModelModifier modifier);
}
@@ -0,0 +1,3 @@
public interface ModelModifier {
void perform(Object element);
}
@@ -0,0 +1,7 @@
================ Step #1 =================
Compiling files:
src/IntrospectorImpl.kt
End of files
Exit code: OK
------------------------------------------