From c0b772a89611d3a34c20ade5fed571c62db6633e Mon Sep 17 00:00:00 2001 From: Yan Zhulanow Date: Thu, 1 Dec 2016 15:09:44 +0300 Subject: [PATCH] Kapt3: Fix signature clash (return type is different) for non-generic methods --- .../jetbrains/kotlin/kapt3/javac/KaptJavaLog.kt | 3 ++- ...assFileToSourceStubConverterTestGenerated.java | 6 ++++++ .../converter/methodPropertySignatureClash.kt | 7 +++++++ .../converter/methodPropertySignatureClash.txt | 15 +++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 plugins/kapt3/testData/converter/methodPropertySignatureClash.txt diff --git a/plugins/kapt3/src/org/jetbrains/kotlin/kapt3/javac/KaptJavaLog.kt b/plugins/kapt3/src/org/jetbrains/kotlin/kapt3/javac/KaptJavaLog.kt index 212b6f0d805..93f8736402c 100644 --- a/plugins/kapt3/src/org/jetbrains/kotlin/kapt3/javac/KaptJavaLog.kt +++ b/plugins/kapt3/src/org/jetbrains/kotlin/kapt3/javac/KaptJavaLog.kt @@ -34,7 +34,8 @@ class KaptJavaLog(context: Context?) : Log(context) { "compiler.err.name.clash.same.erasure", "compiler.err.name.clash.same.erasure.no.override", "compiler.err.name.clash.same.erasure.no.override.1", - "compiler.err.name.clash.same.erasure.no.hide") + "compiler.err.name.clash.same.erasure.no.hide", + "compiler.err.already.defined") internal fun preRegister(context: Context) { context.put(Log.logKey, Context.Factory(::KaptJavaLog)) diff --git a/plugins/kapt3/test/org/jetbrains/kotlin/kapt3/test/ClassFileToSourceStubConverterTestGenerated.java b/plugins/kapt3/test/org/jetbrains/kotlin/kapt3/test/ClassFileToSourceStubConverterTestGenerated.java index b2045033b72..1b3f66e25b6 100644 --- a/plugins/kapt3/test/org/jetbrains/kotlin/kapt3/test/ClassFileToSourceStubConverterTestGenerated.java +++ b/plugins/kapt3/test/org/jetbrains/kotlin/kapt3/test/ClassFileToSourceStubConverterTestGenerated.java @@ -138,6 +138,12 @@ public class ClassFileToSourceStubConverterTestGenerated extends AbstractClassFi doTest(fileName); } + @TestMetadata("methodPropertySignatureClash.kt") + public void testMethodPropertySignatureClash() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("plugins/kapt3/testData/converter/methodPropertySignatureClash.kt"); + doTest(fileName); + } + @TestMetadata("modifiers.kt") public void testModifiers() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("plugins/kapt3/testData/converter/modifiers.kt"); diff --git a/plugins/kapt3/testData/converter/methodPropertySignatureClash.kt b/plugins/kapt3/testData/converter/methodPropertySignatureClash.kt index e69de29bb2d..97155ed4b0b 100644 --- a/plugins/kapt3/testData/converter/methodPropertySignatureClash.kt +++ b/plugins/kapt3/testData/converter/methodPropertySignatureClash.kt @@ -0,0 +1,7 @@ +class CrashMe { + val resources = 1 + + fun getResources(): String { + return "" + } +} \ No newline at end of file diff --git a/plugins/kapt3/testData/converter/methodPropertySignatureClash.txt b/plugins/kapt3/testData/converter/methodPropertySignatureClash.txt new file mode 100644 index 00000000000..aceaa66b7e9 --- /dev/null +++ b/plugins/kapt3/testData/converter/methodPropertySignatureClash.txt @@ -0,0 +1,15 @@ +public final class CrashMe { + private final int resources = 1; + + public final int getResources() { + return 0; + } + + public final java.lang.String getResources() { + return null; + } + + public CrashMe() { + super(); + } +}