Include containing declaration name in message for JVM signature clashes

#KT-9359 Fixed
This commit is contained in:
Dmitry Petrov
2017-05-24 17:36:08 +03:00
parent d850f01c39
commit 17eab2865d
5 changed files with 14 additions and 18 deletions
@@ -40,7 +40,7 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension {
StringBuilder sb = new StringBuilder();
for (DeclarationDescriptor descriptor : renderedDescriptors) {
sb.append(" ").append(Renderers.COMPACT.render(descriptor, renderingContext)).append("\n");
sb.append(" ").append(Renderers.WITHOUT_MODIFIERS.render(descriptor, renderingContext)).append("\n");
}
return ("The following declarations have the same JVM signature (" + data.getSignature().getName() + data.getSignature().getDesc() + "):\n" + sb).trim();
};
@@ -69,10 +69,6 @@ object IdeRenderers {
HTML_RENDER_TYPE.render(member.returnType!!, context)
}
@JvmField val HTML_COMPACT_WITH_MODIFIERS = DescriptorRenderer.HTML.withOptions {
withDefinedIn = false
}.asRenderer()
@JvmField val HTML_CONFLICTING_JVM_DECLARATIONS_DATA = Renderer {
data: ConflictingJvmDeclarationsData ->
@@ -80,7 +76,7 @@ object IdeRenderers {
.mapNotNull { it.descriptor }
.sortedWith(MemberComparator.INSTANCE)
val context = RenderingContext.of(descriptors)
val conflicts = descriptors.joinToString("") { "<li>" + HTML_COMPACT_WITH_MODIFIERS.render(it, context) + "</li>\n" }
val conflicts = descriptors.joinToString("") { "<li>" + HTML.render(it, context) + "</li>\n" }
"The following declarations have the same JVM signature (<code>${data.signature.name}${data.signature.desc}</code>):<br/>\n<ul>\n$conflicts</ul>"
}
@@ -4,9 +4,9 @@ class String
interface I {
<error descr="[CONFLICTING_JVM_DECLARATIONS] Platform declaration clash: The following declarations have the same JVM signature (foo(Ljava/util/List;)V):
fun foo(l: List<a.b.String>): Unit
fun foo(l: List<kotlin.String>): Unit">fun foo(l: List<String>)</error>
fun foo(l: List<a.b.String>): Unit defined in a.b.I
fun foo(l: List<kotlin.String>): Unit defined in a.b.I">fun foo(l: List<String>)</error>
<error descr="[CONFLICTING_JVM_DECLARATIONS] Platform declaration clash: The following declarations have the same JVM signature (foo(Ljava/util/List;)V):
fun foo(l: List<a.b.String>): Unit
fun foo(l: List<kotlin.String>): Unit">fun foo(l: List<kotlin.String>)</error>
fun foo(l: List<a.b.String>): Unit defined in a.b.I
fun foo(l: List<kotlin.String>): Unit defined in a.b.I">fun foo(l: List<kotlin.String>)</error>
}
@@ -4,8 +4,8 @@
package test
<error descr="[CONFLICTING_JVM_DECLARATIONS] Platform declaration clash: The following declarations have the same JVM signature (getX()I):
fun <get-x>(): Int
fun getX(): Int">val x</error> = 1
fun <get-x>(): Int defined in test
fun getX(): Int defined in test">val x</error> = 1
<error descr="[CONFLICTING_JVM_DECLARATIONS] Platform declaration clash: The following declarations have the same JVM signature (getX()I):
fun <get-x>(): Int
fun getX(): Int">fun getX()</error> = 1
fun <get-x>(): Int defined in test
fun getX(): Int defined in test">fun getX()</error> = 1
@@ -1,8 +1,8 @@
interface T {
<error descr="[CONFLICTING_JVM_DECLARATIONS] Platform declaration clash: The following declarations have the same JVM signature (foo(Ljava/util/List;)V):
fun foo(l: List<Int>): Unit
fun foo(l: List<String>): Unit">fun foo(l: List<String>)</error> {}
fun foo(l: List<Int>): Unit defined in T
fun foo(l: List<String>): Unit defined in T">fun foo(l: List<String>)</error> {}
<error descr="[CONFLICTING_JVM_DECLARATIONS] Platform declaration clash: The following declarations have the same JVM signature (foo(Ljava/util/List;)V):
fun foo(l: List<Int>): Unit
fun foo(l: List<String>): Unit">fun foo(l: List<Int>)</error> {}
fun foo(l: List<Int>): Unit defined in T
fun foo(l: List<String>): Unit defined in T">fun foo(l: List<Int>)</error> {}
}