Do not include $DefaultImpls inner classes in public API when they do not contain any public members (i.e. used only as a container to hold synthetic methods with annotations for properties or typealiases)
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cases.interfaces
|
||||
|
||||
public interface EmptyImpls {
|
||||
@SinceKotlin("1.1")
|
||||
val property: String
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cases.interfaces
|
||||
|
||||
public interface BaseWithImpl {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
public interface DerivedWithImpl : BaseWithImpl {
|
||||
override fun foo(): Int {
|
||||
return super.foo() + 1
|
||||
}
|
||||
}
|
||||
|
||||
public interface DerivedWithoutImpl : BaseWithImpl
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
public abstract interface class cases/interfaces/BaseWithImpl {
|
||||
public abstract fun foo ()I
|
||||
}
|
||||
|
||||
public final class cases/interfaces/BaseWithImpl$DefaultImpls {
|
||||
public static fun foo (Lcases/interfaces/BaseWithImpl;)I
|
||||
}
|
||||
|
||||
public abstract interface class cases/interfaces/DerivedWithImpl : cases/interfaces/BaseWithImpl {
|
||||
public abstract fun foo ()I
|
||||
}
|
||||
|
||||
public final class cases/interfaces/DerivedWithImpl$DefaultImpls {
|
||||
public static fun foo (Lcases/interfaces/DerivedWithImpl;)I
|
||||
}
|
||||
|
||||
public abstract interface class cases/interfaces/DerivedWithoutImpl : cases/interfaces/BaseWithImpl {
|
||||
}
|
||||
|
||||
public final class cases/interfaces/DerivedWithoutImpl$DefaultImpls {
|
||||
public static fun foo (Lcases/interfaces/DerivedWithoutImpl;)I
|
||||
}
|
||||
|
||||
public abstract interface class cases/interfaces/EmptyImpls {
|
||||
public abstract fun getProperty ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
+2
@@ -20,6 +20,8 @@ class CasesPublicAPITest {
|
||||
|
||||
@Test fun inline() { snapshotAPIAndCompare(testName.methodName) }
|
||||
|
||||
@Test fun interfaces() { snapshotAPIAndCompare(testName.methodName) }
|
||||
|
||||
@Test fun internal() { snapshotAPIAndCompare(testName.methodName) }
|
||||
|
||||
@Test fun java() { snapshotAPIAndCompare(testName.methodName) }
|
||||
|
||||
Reference in New Issue
Block a user