Dropping package facades:
- clashing JVM signature diagnostics should be reported in stable order - drop tests for clashes vs package facades - introduce box test for class named as old package facade - fix some testData
This commit is contained in:
+11
-2
@@ -24,19 +24,28 @@ import org.jetbrains.kotlin.diagnostics.rendering.Renderers;
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer;
|
||||
import org.jetbrains.kotlin.renderer.Renderer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension {
|
||||
|
||||
private static final Renderer<ConflictingJvmDeclarationsData> CONFLICTING_JVM_DECLARATIONS_DATA = new Renderer<ConflictingJvmDeclarationsData>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public String render(@NotNull ConflictingJvmDeclarationsData data) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
List<String> renderedDescriptors = new ArrayList<String>();
|
||||
for (JvmDeclarationOrigin origin : data.getSignatureOrigins()) {
|
||||
DeclarationDescriptor descriptor = origin.getDescriptor();
|
||||
if (descriptor != null) {
|
||||
sb.append(" ").append(DescriptorRenderer.COMPACT.render(descriptor)).append("\n");
|
||||
renderedDescriptors.add(DescriptorRenderer.Companion.getCOMPACT().render(descriptor));
|
||||
}
|
||||
}
|
||||
Collections.sort(renderedDescriptors);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String renderedDescriptor : renderedDescriptors) {
|
||||
sb.append(" ").append(renderedDescriptor).append("\n");
|
||||
}
|
||||
return ("The following declarations have the same JVM signature (" + data.getSignature().getName() + data.getSignature().getDesc() + "):\n" + sb).trim();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
$TESTDATA_DIR$/classAndFacadeClash.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
@@ -1,10 +0,0 @@
|
||||
package test
|
||||
|
||||
class TestPackage {
|
||||
|
||||
}
|
||||
|
||||
|
||||
fun z () {
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
OK
|
||||
-1
@@ -3,7 +3,6 @@ where advanced options include:
|
||||
-Xno-call-assertions Don't generate not-null assertion after each invocation of method returning not-null
|
||||
-Xno-param-assertions Don't generate not-null assertions on parameters of methods accessible from Java
|
||||
-Xno-optimize Disable optimizations
|
||||
-Xmultifile-package-facadesCompile package facade classes as multifile classes
|
||||
-Xreport-perf Report detailed performance statistics
|
||||
-Xno-inline Disable method inlining
|
||||
-Xrepeat <count> Repeat compilation (for performance analysis)
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
$TESTDATA_DIR$/fileClassAndFacadeClash.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
@@ -1,4 +0,0 @@
|
||||
@file:JvmName("TestPackage")
|
||||
package test
|
||||
|
||||
fun foo() {}
|
||||
@@ -1 +0,0 @@
|
||||
OK
|
||||
+5
-5
@@ -1,26 +1,26 @@
|
||||
compiler/testData/cli/jvm/signatureClash.kt:6:5: error: accidental override: The following declarations have the same JVM signature (getX()I):
|
||||
fun getX(): kotlin.Int
|
||||
fun <get-x>(): kotlin.Int
|
||||
fun getX(): kotlin.Int
|
||||
fun getX() = 1
|
||||
^
|
||||
compiler/testData/cli/jvm/signatureClash.kt:8:5: error: platform declaration clash: The following declarations have the same JVM signature (getA()I):
|
||||
fun getA(): kotlin.Int
|
||||
fun <get-a>(): kotlin.Int
|
||||
fun getA(): kotlin.Int
|
||||
fun getA(): Int = 1
|
||||
^
|
||||
compiler/testData/cli/jvm/signatureClash.kt:9:5: error: platform declaration clash: The following declarations have the same JVM signature (getA()I):
|
||||
fun getA(): kotlin.Int
|
||||
fun <get-a>(): kotlin.Int
|
||||
fun getA(): kotlin.Int
|
||||
val a: Int = 1
|
||||
^
|
||||
compiler/testData/cli/jvm/signatureClash.kt:12:1: error: platform declaration clash: The following declarations have the same JVM signature (getB()I):
|
||||
fun getB(): kotlin.Int
|
||||
fun <get-b>(): kotlin.Int
|
||||
fun getB(): kotlin.Int
|
||||
fun getB(): Int = 1
|
||||
^
|
||||
compiler/testData/cli/jvm/signatureClash.kt:13:1: error: platform declaration clash: The following declarations have the same JVM signature (getB()I):
|
||||
fun getB(): kotlin.Int
|
||||
fun <get-b>(): kotlin.Int
|
||||
fun getB(): kotlin.Int
|
||||
val b: Int = 1
|
||||
^
|
||||
compiler/testData/cli/jvm/signatureClash.kt:19:7: error: platform declaration clash: The following declarations have the same JVM signature (getTr()I):
|
||||
|
||||
+10
-10
@@ -3,29 +3,29 @@ compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:15:5: error: accide
|
||||
fun foo(): kotlin.Unit
|
||||
private fun foo() {}
|
||||
^
|
||||
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:18:9: error: accidental override: The following declarations have the same JVM signature (access$getBar$p(LDerived;)I):
|
||||
fun `access$getBar$p`(d: Derived): kotlin.Int
|
||||
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:18:9: error: accidental override: The following declarations have the same JVM signature (access$getBar$1(LDerived;)I):
|
||||
fun <get-bar>(): kotlin.Int
|
||||
fun `access$getBar$1`(d: Derived): kotlin.Int
|
||||
get
|
||||
^
|
||||
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:19:9: error: accidental override: The following declarations have the same JVM signature (access$setBar$p(LDerived;I)V):
|
||||
fun `access$setBar$p`(d: Derived, i: kotlin.Int): kotlin.Unit
|
||||
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:19:9: error: accidental override: The following declarations have the same JVM signature (access$setBar$1(LDerived;I)V):
|
||||
fun <set-bar>(<set-?>: kotlin.Int): kotlin.Unit
|
||||
fun `access$setBar$1`(d: Derived, i: kotlin.Int): kotlin.Unit
|
||||
set
|
||||
^
|
||||
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:21:5: error: accidental override: The following declarations have the same JVM signature (access$getBaz$p(LDerived;)I):
|
||||
fun `access$getBaz$p`(d: Derived): kotlin.Int
|
||||
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:21:5: error: accidental override: The following declarations have the same JVM signature (access$getBaz$2(LDerived;)I):
|
||||
fun <get-baz>(): kotlin.Int
|
||||
fun `access$getBaz$2`(d: Derived): kotlin.Int
|
||||
private var baz = 1
|
||||
^
|
||||
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:23:5: error: accidental override: The following declarations have the same JVM signature (access$getBoo$p(LDerived;)I):
|
||||
fun `access$getBoo$p`(d: Derived): kotlin.Int
|
||||
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:23:5: error: accidental override: The following declarations have the same JVM signature (access$getBoo$3(LDerived;)I):
|
||||
fun <get-boo>(): kotlin.Int
|
||||
fun `access$getBoo$3`(d: Derived): kotlin.Int
|
||||
private val boo = 1
|
||||
^
|
||||
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:27:9: error: accidental override: The following declarations have the same JVM signature (access$setBar1$p(LDerived;I)V):
|
||||
fun `access$setBar1$p`(d: Derived, i: kotlin.Int): kotlin.Unit
|
||||
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:27:9: error: accidental override: The following declarations have the same JVM signature (access$setBar1$4(LDerived;I)V):
|
||||
fun <set-bar1>(<set-?>: kotlin.Int): kotlin.Unit
|
||||
fun `access$setBar1$4`(d: Derived, i: kotlin.Int): kotlin.Unit
|
||||
set
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
@@ -0,0 +1,7 @@
|
||||
package test
|
||||
|
||||
class TestPackage {
|
||||
val OK = "OK"
|
||||
}
|
||||
|
||||
fun box(): String = TestPackage().OK
|
||||
@@ -37,12 +37,6 @@ public class KotlincExecutableTestGenerated extends AbstractKotlincExecutableTes
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/cli/jvm"), Pattern.compile("^(.+)\\.args$"), false);
|
||||
}
|
||||
|
||||
@TestMetadata("classAndFacadeClash.args")
|
||||
public void testClassAndFacadeClash() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/jvm/classAndFacadeClash.args");
|
||||
doJvmTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("classAndFileClassClash.args")
|
||||
public void testClassAndFileClassClash() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/jvm/classAndFileClassClash.args");
|
||||
@@ -109,12 +103,6 @@ public class KotlincExecutableTestGenerated extends AbstractKotlincExecutableTes
|
||||
doJvmTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fileClassAndFacadeClash.args")
|
||||
public void testFileClassAndFacadeClash() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/jvm/fileClassAndFacadeClash.args");
|
||||
doJvmTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fileClassAndMultifileClassClash.args")
|
||||
public void testFileClassAndMultifileClassClash() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/jvm/fileClassAndMultifileClassClash.args");
|
||||
|
||||
+6
@@ -1036,6 +1036,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("classNamedAsOldPackageFacade.kt")
|
||||
public void testClassNamedAsOldPackageFacade() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/classNamedAsOldPackageFacade.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("classObject.kt")
|
||||
public void testClassObject() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/classObject.kt");
|
||||
|
||||
-2
@@ -2,5 +2,3 @@ p org.test 0
|
||||
d 0/InheritedTopLevelKt
|
||||
a org.jetbrains.annotations.NotNull 0
|
||||
m 0 0/InheritedTopLevelKt getTopLevelProperty
|
||||
d 0/TestPackage
|
||||
m 0 0/TestPackage getTopLevelProperty
|
||||
|
||||
Reference in New Issue
Block a user