Disable removing private/synthetic/local classes temporarily

This commit is contained in:
Alexey Tsvetkov
2018-12-11 16:56:00 +03:00
parent 96f3c67b3b
commit 09dbf427ee
19 changed files with 41 additions and 163 deletions
@@ -78,7 +78,11 @@ class JvmAbiAnalysisHandlerExtension(
outputs.add(AbiOutput(file, outputFile.sourceFiles, outputFile.asByteArray()))
}
removeUnneededClasses(outputs)
// private/local/synthetic class removal is temporarily turned off, because the implementation
// was not correct: it was not taking into account that private/local classes could be used
// from inline functions
// todo: implement correct removal
//removeUnneededClasses(outputs)
val messageCollector = compilerConfiguration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)
?: PrintingMessageCollector(System.err, MessageRenderer.PLAIN_FULL_PATHS, false)
@@ -94,6 +98,8 @@ class JvmAbiAnalysisHandlerExtension(
/**
* Removes private or local classes from outputs
*/
// todo: fix usage (see analysisCompleted)
@Suppress("unused")
private fun removeUnneededClasses(outputs: Iterable<AbiOutput>) {
// maps internal names of classes: class -> inner classes
val innerClasses = HashMap<String, Collection<String>>()
@@ -29,11 +29,6 @@ public class CompareJvmAbiTestGenerated extends AbstractCompareJvmAbiTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("plugins/jvm-abi-gen/testData/compare"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, false);
}
@TestMetadata("anonymousClass")
public void testAnonymousClass() throws Exception {
runTest("plugins/jvm-abi-gen/testData/compare/anonymousClass/");
}
@TestMetadata("classFlags")
public void testClassFlags() throws Exception {
runTest("plugins/jvm-abi-gen/testData/compare/classFlags/");
@@ -64,41 +59,16 @@ public class CompareJvmAbiTestGenerated extends AbstractCompareJvmAbiTest {
runTest("plugins/jvm-abi-gen/testData/compare/inlineFunctionBody/");
}
@TestMetadata("innerClasses")
public void testInnerClasses() throws Exception {
runTest("plugins/jvm-abi-gen/testData/compare/innerClasses/");
}
@TestMetadata("lambda")
public void testLambda() throws Exception {
runTest("plugins/jvm-abi-gen/testData/compare/lambda/");
}
@TestMetadata("localClass")
public void testLocalClass() throws Exception {
runTest("plugins/jvm-abi-gen/testData/compare/localClass/");
}
@TestMetadata("parameterName")
public void testParameterName() throws Exception {
runTest("plugins/jvm-abi-gen/testData/compare/parameterName/");
}
@TestMetadata("privateClass")
public void testPrivateClass() throws Exception {
runTest("plugins/jvm-abi-gen/testData/compare/privateClass/");
}
@TestMetadata("privateTypealias")
public void testPrivateTypealias() throws Exception {
runTest("plugins/jvm-abi-gen/testData/compare/privateTypealias/");
}
@TestMetadata("propertyReference")
public void testPropertyReference() throws Exception {
runTest("plugins/jvm-abi-gen/testData/compare/propertyReference/");
}
@TestMetadata("returnType")
public void testReturnType() throws Exception {
runTest("plugins/jvm-abi-gen/testData/compare/returnType/");
@@ -1,14 +0,0 @@
package test
interface Interface {
fun foo(): Int
}
class InterfaceImpl : Interface {
override fun foo(): Int = 0
}
fun getInterface(): Interface =
object : Interface {
override fun foo(): Int = 0
}
@@ -1,12 +0,0 @@
package test
interface Interface {
fun foo(): Int
}
class InterfaceImpl : Interface {
override fun foo(): Int = 0
}
fun getInterface(): Interface =
InterfaceImpl()
@@ -1,31 +0,0 @@
package test
class A {
private inner class AInner {
inner class AInnerInner {}
fun aInnerMethod() {
class AInnerMethodLocal
val aInnerMethodLambda: (Int) -> Int = { it * it }
}
}
private class ANested {
inner class ANestedInner {}
class ANestedNested
object ANestedObject
fun aNestedMethod() {
class ANestedMethodLocal
val aNestedMethodLambda: (Int) -> Int = { it * it }
}
}
}
private class B {
inner class BInnerClass
class BNestedClass
object BObject {}
}
@@ -1,3 +0,0 @@
package test
class A
@@ -1,8 +0,0 @@
package test
class Class {
fun method(): Int {
val square: (Int) -> Int = { it * it }
return square(2)
}
}
@@ -1,6 +0,0 @@
package test
fun function(): Int {
val square: (Int) -> Int = { it * it }
return square(2)
}
@@ -1,7 +0,0 @@
package test
class Class {
fun method(): Int {
return 0
}
}
@@ -1,5 +0,0 @@
package test
fun function(): Int {
return 0
}
@@ -1,7 +0,0 @@
package test
class Class {
fun method() {
class MethodLocalClass
}
}
@@ -1,5 +0,0 @@
package test
fun function() {
class FunctionLocalClass
}
@@ -1,6 +0,0 @@
package test
class Class {
fun method() {
}
}
@@ -1,4 +0,0 @@
package test
fun function() {
}
@@ -1,5 +0,0 @@
package test
class PublicClass
internal class InternalClass
private class PrivateClass
@@ -1,4 +0,0 @@
package test
class PublicClass
internal class InternalClass
@@ -1,7 +0,0 @@
package test
class Class {
val property: Int = 0
}
fun getProp(c: Class) = Class::property.get(c)
@@ -1,7 +0,0 @@
package test
class Class {
val property: Int = 0
}
fun getProp(c: Class) = c.property
+34 -1
View File
@@ -17,9 +17,42 @@ public class test/BaseClass {
public method getBaseClassPublicVal(): int
}
@kotlin.Metadata
public final class test/Class$NestedInnerClass$NestedNestedInnerClass {
inner class test/Class$NestedInnerClass
inner class test/Class$NestedInnerClass$NestedNestedInnerClass
public method <init>(): void
}
@kotlin.Metadata
final class test/Class$NestedInnerClass {
inner class test/Class$NestedInnerClass
inner class test/Class$NestedInnerClass$NestedNestedInnerClass
public method <init>(): void
}
@kotlin.Metadata
final class test/Class$classPublicMethod$publicMethodLambda$1 {
public final static field INSTANCE: test.Class$classPublicMethod$publicMethodLambda$1
inner class test/Class$classPublicMethod$publicMethodLambda$1
method <init>(): void
public final method invoke(p0: int): int
public synthetic method invoke(p0: java.lang.Object): java.lang.Object
}
@kotlin.Metadata
public final class test/Class$classPublicMethod$publicMethodLocalClass {
inner class test/Class$classPublicMethod$publicMethodLocalClass
public method <init>(): void
public final method getX(): int
}
@kotlin.Metadata
public final class test/Class {
inner class test/Class$NestedInnerClass
inner class test/Class$classPublicMethod$publicMethodLambda$1
inner class test/Class$classPublicMethod$publicMethodLocalClass
public method <init>(): void
public final method classPublicMethod(): void
}
@kotlin.Metadata
public interface test/Interface
public interface test/Interface
@kotlin.Metadata
final class test/PrivateClass {
public method <init>(): void
}