Added check for value parameters number in alternative signatures loading.
This commit is contained in:
+7
@@ -108,6 +108,13 @@ class AlternativeSignatureParsing {
|
||||
JavaDescriptorResolver.ValueParameterDescriptors valueParameterDescriptors,
|
||||
JetNamedFunction altFunDeclaration) throws AlternativeSignatureMismatchException {
|
||||
List<ValueParameterDescriptor> parameterDescriptors = valueParameterDescriptors.descriptors;
|
||||
|
||||
if (parameterDescriptors.size() != altFunDeclaration.getValueParameters().size()) {
|
||||
throw new AlternativeSignatureMismatchException(
|
||||
String.format("Method signature has %d value parameters, but alternative signature has %d",
|
||||
parameterDescriptors.size(), altFunDeclaration.getValueParameters().size()));
|
||||
}
|
||||
|
||||
List<ValueParameterDescriptor> altParamDescriptors = new ArrayList<ValueParameterDescriptor>();
|
||||
for (int i = 0, size = parameterDescriptors.size(); i < size; i++) {
|
||||
ValueParameterDescriptor pd = parameterDescriptors.get(i);
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package test;
|
||||
|
||||
import jet.runtime.typeinfo.KotlinSignature;
|
||||
|
||||
public class WrongValueParametersCount {
|
||||
@KotlinSignature("fun foo(a : Int) : Int")
|
||||
public Integer foo() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
import java.util.*
|
||||
|
||||
public open class WrongValueParametersCount : Object() {
|
||||
public open fun foo() : Int? {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
namespace test
|
||||
|
||||
public open class test.WrongValueParametersCount : java.lang.Object {
|
||||
public final /*constructor*/ fun <init>(): test.WrongValueParametersCount
|
||||
public open fun foo(): jet.Int?
|
||||
}
|
||||
Reference in New Issue
Block a user