Added checking for function name in alternative signature.
This commit is contained in:
+7
@@ -22,6 +22,7 @@ import com.intellij.psi.PsiErrorElement;
|
||||
import com.intellij.psi.PsiSubstitutor;
|
||||
import com.intellij.psi.PsiType;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ComparatorUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
@@ -304,5 +305,11 @@ class AlternativeSignatureParsing {
|
||||
syntaxErrors.size(), errorOffset, syntaxErrorDescription);
|
||||
throw new AlternativeSignatureMismatchException(errorText);
|
||||
}
|
||||
|
||||
if (!ComparatorUtil.equalsNullable(method.getName(), altFunDeclaration.getName())) {
|
||||
throw new AlternativeSignatureMismatchException(String.format(
|
||||
"Function names mismatch, original: %s, alternative: %s",
|
||||
method.getName(), altFunDeclaration.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package test;
|
||||
|
||||
import jet.runtime.typeinfo.KotlinSignature;
|
||||
|
||||
public class WrongMethodName {
|
||||
@KotlinSignature("fun bar() : String")
|
||||
public String foo() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package test
|
||||
|
||||
import java.util.*
|
||||
|
||||
public open class WrongMethodName : Object() {
|
||||
public open fun foo() : String? = ""
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace test
|
||||
|
||||
public open class test.WrongMethodName : java.lang.Object {
|
||||
public final /*constructor*/ fun <init>(): test.WrongMethodName
|
||||
public open fun foo(): jet.String?
|
||||
}
|
||||
Reference in New Issue
Block a user