Added prohibiting adding of nullability in alternative signatures.
This commit is contained in:
+5
@@ -49,6 +49,11 @@ class AlternativeSignatureParsing {
|
||||
@Override
|
||||
public JetType visitNullableType(JetNullableType nullableType, Void data) {
|
||||
try {
|
||||
if (!autoType.isNullable()) {
|
||||
throw new AlternativeSignatureMismatchException(String.format(
|
||||
"Auto type '%s' is not-null, while type in alternative signature is nullable: '%s'",
|
||||
DescriptorRenderer.TEXT.renderType(autoType), nullableType.getText()));
|
||||
}
|
||||
return TypeUtils.makeNullable(computeAlternativeTypeFromAnnotation(nullableType.getInnerType(), autoType));
|
||||
}
|
||||
catch (AlternativeSignatureMismatchException e) {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package test;
|
||||
|
||||
import jet.runtime.typeinfo.KotlinSignature;
|
||||
|
||||
public class AddingNullability {
|
||||
@KotlinSignature("fun foo() : Int?")
|
||||
public int foo() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
import java.util.*
|
||||
|
||||
public open class AddingNullability : Object() {
|
||||
public open fun foo() : Int {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace test
|
||||
|
||||
public open class test.AddingNullability : java.lang.Object {
|
||||
public final /*constructor*/ fun <init>(): test.AddingNullability
|
||||
public open fun foo(): jet.Int
|
||||
}
|
||||
Reference in New Issue
Block a user