Disabling @KotlinSignature checks in PLATFORM_TYPES mode
This commit is contained in:
+2
@@ -28,6 +28,7 @@ import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.TypeParameterDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.ValueParameterDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.java.JavaPackage;
|
||||
import org.jetbrains.jet.lang.resolve.java.resolver.DescriptorResolverUtils;
|
||||
import org.jetbrains.jet.lang.resolve.java.resolver.ExternalAnnotationResolver;
|
||||
import org.jetbrains.jet.lang.resolve.java.structure.JavaMember;
|
||||
@@ -119,6 +120,7 @@ public class AlternativeMethodSignatureData extends ElementAlternativeSignatureD
|
||||
@NotNull List<TypeParameterDescriptor> methodTypeParameters,
|
||||
@Nullable JetType returnType
|
||||
) {
|
||||
if (JavaPackage.getPLATFORM_TYPES()) return;
|
||||
TypeSubstitutor substitutor = DescriptorResolverUtils.createSubstitutorForTypeParameters(originalToAltTypeParameters);
|
||||
|
||||
for (ValueParameterDescriptor parameter : valueParameters) {
|
||||
|
||||
+4
-1
@@ -26,6 +26,7 @@ import org.jetbrains.jet.lang.descriptors.impl.TypeParameterDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.TypeResolver;
|
||||
import org.jetbrains.jet.lang.resolve.java.JavaPackage;
|
||||
import org.jetbrains.jet.lang.resolve.java.mapping.JavaToKotlinClassMap;
|
||||
import org.jetbrains.jet.lang.resolve.java.mapping.KotlinToJavaTypesMap;
|
||||
import org.jetbrains.jet.lang.resolve.java.resolver.TypeUsage;
|
||||
@@ -133,6 +134,8 @@ public class TypeTransformingVisitor extends JetVisitor<JetType, Void> {
|
||||
List<TypeProjection> arguments = originalType.getArguments();
|
||||
|
||||
if (arguments.size() != type.getTypeArgumentsAsTypes().size()) {
|
||||
if (JavaPackage.getPLATFORM_TYPES()) return originalType;
|
||||
|
||||
throw new AlternativeSignatureMismatchException("'%s' type in method signature has %d type arguments, while '%s' in alternative signature has %d of them",
|
||||
DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(originalType), arguments.size(), type.getText(),
|
||||
type.getTypeArgumentsAsTypes().size());
|
||||
@@ -185,7 +188,7 @@ public class TypeTransformingVisitor extends JetVisitor<JetType, Void> {
|
||||
if (type instanceof JetUserType) {
|
||||
JetTypeProjection typeProjection = ((JetUserType) type).getTypeArguments().get(i);
|
||||
altProjectionKind = TypeResolver.resolveProjectionKind(typeProjection.getProjectionKind());
|
||||
if (altProjectionKind != projectionKind && projectionKind != Variance.INVARIANT) {
|
||||
if (altProjectionKind != projectionKind && projectionKind != Variance.INVARIANT && !JavaPackage.getPLATFORM_TYPES()) {
|
||||
throw new AlternativeSignatureMismatchException("Projection kind mismatch, actual: %s, in alternative signature: %s",
|
||||
projectionKind, altProjectionKind);
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import jet.runtime.typeinfo.KotlinSignature;
|
||||
import org.jetbrains.jet.jvm.compiler.annotation.ExpectLoadError;
|
||||
|
||||
public class WrongProjectionKind {
|
||||
@ExpectLoadError("Projection kind mismatch, actual: out, in alternative signature: ")
|
||||
//@ExpectLoadError("Projection kind mismatch, actual: out, in alternative signature: ")
|
||||
@KotlinSignature("fun copy(a : Array<out Number>, b : Array<Number>) : MutableList<Number>")
|
||||
public List<Number> copy(Number[] from, Number[] to) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import jet.runtime.typeinfo.KotlinSignature;
|
||||
import org.jetbrains.jet.jvm.compiler.annotation.ExpectLoadError;
|
||||
|
||||
public class WrongReturnTypeStructure {
|
||||
@ExpectLoadError("'kotlin.String?' type in method signature has 0 type arguments, while 'String<Int>' in alternative signature has 1 of them")
|
||||
//@ExpectLoadError("'kotlin.String?' type in method signature has 0 type arguments, while 'String<Int>' in alternative signature has 1 of them")
|
||||
@KotlinSignature("fun foo(a : String, b : List<Map.Entry<String?, String>?>) : String<Int>?")
|
||||
public String foo(String a, List<Map.Entry<String, String>> b) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
+1
-1
@@ -2,5 +2,5 @@ package test
|
||||
|
||||
public open class WrongReturnTypeStructure {
|
||||
public constructor WrongReturnTypeStructure()
|
||||
public open fun foo(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.(Mutable)List<kotlin.(Mutable)Map.(Mutable)Entry<kotlin.String!, kotlin.String!>!>!): kotlin.String!
|
||||
public open fun foo(/*0*/ a: kotlin.String!, /*1*/ b: kotlin.(Mutable)List<kotlin.(Mutable)Map.(Mutable)Entry<kotlin.String!, kotlin.String!>!>!): kotlin.String!
|
||||
}
|
||||
+1
-1
@@ -6,7 +6,7 @@ import jet.runtime.typeinfo.KotlinSignature;
|
||||
import org.jetbrains.jet.jvm.compiler.annotation.ExpectLoadError;
|
||||
|
||||
public class WrongTypeParameterBoundStructure1 {
|
||||
@ExpectLoadError("'java.lang.Runnable?' type in method signature has 0 type arguments, while 'Runnable<Int>' in alternative signature has 1 of them")
|
||||
//@ExpectLoadError("'java.lang.Runnable?' type in method signature has 0 type arguments, while 'Runnable<Int>' in alternative signature has 1 of them")
|
||||
@KotlinSignature("fun <A, B : Runnable<Int>> foo(a : A, b : List<B>) where B : List<Cloneable>")
|
||||
public <A, B extends Runnable & List<Cloneable>> void foo(A a, List<? extends B> b) {
|
||||
}
|
||||
|
||||
+1
-1
@@ -2,5 +2,5 @@ package test
|
||||
|
||||
public open class WrongTypeParameterBoundStructure1 {
|
||||
public constructor WrongTypeParameterBoundStructure1()
|
||||
public open fun </*0*/ A, /*1*/ B : java.lang.Runnable!> foo(/*0*/ p0: A!, /*1*/ p1: (kotlin.MutableList<out B!>..kotlin.List<B!>?)): kotlin.Unit where B : kotlin.(Mutable)List<kotlin.Cloneable!>!
|
||||
public open fun </*0*/ A, /*1*/ B : java.lang.Runnable!> foo(/*0*/ a: A!, /*1*/ b: (kotlin.MutableList<out B!>..kotlin.List<B!>?)): kotlin.Unit where B : kotlin.(Mutable)List<kotlin.Cloneable!>!
|
||||
}
|
||||
+1
-1
@@ -6,7 +6,7 @@ import jet.runtime.typeinfo.KotlinSignature;
|
||||
import org.jetbrains.jet.jvm.compiler.annotation.ExpectLoadError;
|
||||
|
||||
public class WrongTypeParameterBoundStructure2 {
|
||||
@ExpectLoadError("'kotlin.List<kotlin.Cloneable>?' type in method signature has 1 type arguments, while 'List' in alternative signature has 0 of them")
|
||||
//@ExpectLoadError("'kotlin.List<kotlin.Cloneable>?' type in method signature has 1 type arguments, while 'List' in alternative signature has 0 of them")
|
||||
@KotlinSignature("fun <A, B : Runnable> foo(a : A, b : List<B>) where B : List")
|
||||
public <A, B extends Runnable & List<Cloneable>> void foo(A a, List<? extends B> b) {
|
||||
}
|
||||
|
||||
+1
-1
@@ -2,5 +2,5 @@ package test
|
||||
|
||||
public open class WrongTypeParameterBoundStructure2 {
|
||||
public constructor WrongTypeParameterBoundStructure2()
|
||||
public open fun </*0*/ A, /*1*/ B : java.lang.Runnable!> foo(/*0*/ p0: A!, /*1*/ p1: (kotlin.MutableList<out B!>..kotlin.List<B!>?)): kotlin.Unit where B : kotlin.(Mutable)List<kotlin.Cloneable!>!
|
||||
public open fun </*0*/ A, /*1*/ B : java.lang.Runnable!> foo(/*0*/ a: A!, /*1*/ b: (kotlin.MutableList<out B!>..kotlin.List<B!>?)): kotlin.Unit where B : kotlin.(Mutable)List<kotlin.Cloneable!>!
|
||||
}
|
||||
+1
-1
@@ -5,7 +5,7 @@ import jet.runtime.typeinfo.KotlinSignature;
|
||||
import org.jetbrains.jet.jvm.compiler.annotation.ExpectLoadError;
|
||||
|
||||
public class WrongValueParameterStructure1 {
|
||||
@ExpectLoadError("'kotlin.String?' type in method signature has 0 type arguments, while 'String<Int?>' in alternative signature has 1 of them")
|
||||
//@ExpectLoadError("'kotlin.String?' type in method signature has 0 type arguments, while 'String<Int?>' in alternative signature has 1 of them")
|
||||
@KotlinSignature("fun foo(a : String<Int?>, b : List<Map.Entry<String?, String>?>) : String")
|
||||
public String foo(String a, List<Map.Entry<String, String>> b) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
+1
-1
@@ -2,5 +2,5 @@ package test
|
||||
|
||||
public open class WrongValueParameterStructure1 {
|
||||
public constructor WrongValueParameterStructure1()
|
||||
public open fun foo(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.(Mutable)List<kotlin.(Mutable)Map.(Mutable)Entry<kotlin.String!, kotlin.String!>!>!): kotlin.String!
|
||||
public open fun foo(/*0*/ a: kotlin.String!, /*1*/ b: kotlin.(Mutable)List<kotlin.(Mutable)Map.(Mutable)Entry<kotlin.String!, kotlin.String!>!>!): kotlin.String!
|
||||
}
|
||||
+1
-1
@@ -5,7 +5,7 @@ import jet.runtime.typeinfo.KotlinSignature;
|
||||
import org.jetbrains.jet.jvm.compiler.annotation.ExpectLoadError;
|
||||
|
||||
public class WrongValueParameterStructure2 {
|
||||
@ExpectLoadError("'kotlin.Map.Entry<kotlin.String, kotlin.String>' type in method signature has 2 type arguments, while 'Map.Entry<String?>' in alternative signature has 1 of them")
|
||||
//@ExpectLoadError("'kotlin.Map.Entry<kotlin.String, kotlin.String>' type in method signature has 2 type arguments, while 'Map.Entry<String?>' in alternative signature has 1 of them")
|
||||
@KotlinSignature("fun foo(a : String, b : List<Map.Entry<String?>?>) : String")
|
||||
public String foo(String a, List<Map.Entry<String, String>> b) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
+1
-1
@@ -2,5 +2,5 @@ package test
|
||||
|
||||
public open class WrongValueParameterStructure2 {
|
||||
public constructor WrongValueParameterStructure2()
|
||||
public open fun foo(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.(Mutable)List<kotlin.(Mutable)Map.(Mutable)Entry<kotlin.String!, kotlin.String!>!>!): kotlin.String!
|
||||
public open fun foo(/*0*/ a: kotlin.String!, /*1*/ b: kotlin.(Mutable)List<kotlin.(Mutable)Map.(Mutable)Entry<kotlin.String!, kotlin.String!>!>!): kotlin.String!
|
||||
}
|
||||
+1
-1
@@ -15,7 +15,7 @@ public interface ChangeProjectionKind1 {
|
||||
}
|
||||
|
||||
public interface Sub extends Super {
|
||||
@ExpectLoadError("Projection kind mismatch, actual: in, in alternative signature: ")
|
||||
//@ExpectLoadError("Projection kind mismatch, actual: in, in alternative signature: ")
|
||||
@KotlinSignature("fun foo(p: MutableList<String>)")
|
||||
void foo(List<String> p);
|
||||
}
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ public interface ChangeProjectionKind2 {
|
||||
}
|
||||
|
||||
public interface Sub extends Super {
|
||||
@ExpectLoadError("Parameter type changed for method which overrides another: MutableList<in String>, was: MutableList<String>")
|
||||
//@ExpectLoadError("Parameter type changed for method which overrides another: MutableList<in String>, was: MutableList<String>")
|
||||
@KotlinSignature("fun foo(p: MutableList<in String>)")
|
||||
void foo(List<String> p);
|
||||
}
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ public interface MutableToReadOnly {
|
||||
}
|
||||
|
||||
public interface Sub extends Super {
|
||||
@ExpectLoadError("Parameter type changed for method which overrides another: List<String>, was: MutableList<String>")
|
||||
//@ExpectLoadError("Parameter type changed for method which overrides another: List<String>, was: MutableList<String>")
|
||||
@KotlinSignature("fun foo(p: List<String>)")
|
||||
void foo(List<String> p);
|
||||
}
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ public interface NotNullToNullable {
|
||||
}
|
||||
|
||||
public interface Sub extends Super {
|
||||
@ExpectLoadError("Auto type 'kotlin.String' is not-null, while type in alternative signature is nullable: 'String?'")
|
||||
//@ExpectLoadError("Auto type 'kotlin.String' is not-null, while type in alternative signature is nullable: 'String?'")
|
||||
@KotlinSignature("fun foo(p: String?)")
|
||||
void foo(String p);
|
||||
}
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ public interface NullableToNotNull {
|
||||
}
|
||||
|
||||
public interface Sub extends Super {
|
||||
@ExpectLoadError("In superclass type is nullable: [String?], in subclass it is not: String")
|
||||
//@ExpectLoadError("In superclass type is nullable: [String?], in subclass it is not: String")
|
||||
void foo(@NotNull String p);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ public interface NullableToNotNullKotlinSignature {
|
||||
}
|
||||
|
||||
public interface Sub extends Super {
|
||||
@ExpectLoadError("Parameter type changed for method which overrides another: String, was: String?")
|
||||
//@ExpectLoadError("Parameter type changed for method which overrides another: String, was: String?")
|
||||
@KotlinSignature("fun foo(p: String)")
|
||||
void foo(String p);
|
||||
}
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ public interface ReadOnlyToMutable {
|
||||
}
|
||||
|
||||
public interface Sub extends Super {
|
||||
@ExpectLoadError("Parameter type changed for method which overrides another: MutableList<String>, was: List<String>")
|
||||
//@ExpectLoadError("Parameter type changed for method which overrides another: MutableList<String>, was: List<String>")
|
||||
@KotlinSignature("fun foo(p: MutableList<String>)")
|
||||
void foo(List<String> p);
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ public interface AddNullabilityJavaSubtype {
|
||||
}
|
||||
|
||||
public interface Sub extends Super {
|
||||
@ExpectLoadError("Auto type 'kotlin.String' is not-null, while type in alternative signature is nullable: 'String?'")
|
||||
//@ExpectLoadError("Auto type 'kotlin.String' is not-null, while type in alternative signature is nullable: 'String?'")
|
||||
@KotlinSignature("fun foo(): String?")
|
||||
String foo();
|
||||
}
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ public interface AddNullabilitySameGenericType1 {
|
||||
}
|
||||
|
||||
public interface Sub extends Super {
|
||||
@ExpectLoadError("Return type is changed to not subtype for method which overrides another: MutableList<String?>, was: MutableList<String>")
|
||||
//@ExpectLoadError("Return type is changed to not subtype for method which overrides another: MutableList<String?>, was: MutableList<String>")
|
||||
@KotlinSignature("fun foo(): MutableList<String?>")
|
||||
List<String> foo();
|
||||
}
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ public interface AddNullabilitySameGenericType2 {
|
||||
}
|
||||
|
||||
public interface Sub extends Super {
|
||||
@ExpectLoadError("Auto type 'kotlin.MutableList<kotlin.String>' is not-null, while type in alternative signature is nullable: 'MutableList<String>?'")
|
||||
//@ExpectLoadError("Auto type 'kotlin.MutableList<kotlin.String>' is not-null, while type in alternative signature is nullable: 'MutableList<String>?'")
|
||||
@KotlinSignature("fun foo(): MutableList<String>?")
|
||||
List<String> foo();
|
||||
}
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ public interface AddNullabilitySameJavaType {
|
||||
}
|
||||
|
||||
public interface Sub extends Super {
|
||||
@ExpectLoadError("Auto type 'kotlin.CharSequence' is not-null, while type in alternative signature is nullable: 'CharSequence?'")
|
||||
//@ExpectLoadError("Auto type 'kotlin.CharSequence' is not-null, while type in alternative signature is nullable: 'CharSequence?'")
|
||||
@KotlinSignature("fun foo(): CharSequence?")
|
||||
CharSequence foo();
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ public interface CantMakeImmutableInSubclass {
|
||||
}
|
||||
|
||||
public interface Sub extends Super {
|
||||
@ExpectLoadError("Return type is changed to not subtype for method which overrides another: List<String>, was: MutableList<String>")
|
||||
//@ExpectLoadError("Return type is changed to not subtype for method which overrides another: List<String>, was: MutableList<String>")
|
||||
@KotlinSignature("fun foo(): List<String>")
|
||||
List<String> foo();
|
||||
}
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ public interface TwoSuperclassesConflictingProjectionKinds {
|
||||
}
|
||||
|
||||
public interface Sub extends Super1, Super2 {
|
||||
@ExpectLoadError("Incompatible projection kinds in type arguments of super methods' return types: [CharSequence, out CharSequence]")
|
||||
//@ExpectLoadError("Incompatible projection kinds in type arguments of super methods' return types: [CharSequence, out CharSequence]")
|
||||
public Collection<CharSequence> foo();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,13 +12,10 @@ public interface ArraysInSubtypes {
|
||||
}
|
||||
|
||||
interface Sub<T> extends Super {
|
||||
@ExpectLoadError("Return type is not a subtype of overridden method. To fix it, add annotation with Kotlin signature to super method with type Array<CharSequence>? replaced with Array<out CharSequence>? in return type")
|
||||
String[] array();
|
||||
|
||||
@ExpectLoadError("Return type is not a subtype of overridden method. To fix it, add annotation with Kotlin signature to super method with type Array<CharSequence>? replaced with Array<out CharSequence>? in return type")
|
||||
List<? extends String[]> listOfArray();
|
||||
|
||||
@ExpectLoadError("Return type is not a subtype of overridden method. To fix it, add annotation with Kotlin signature to super method with type Array<Any>? replaced with Array<out Any>? in return type")
|
||||
T[] objArray();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -16,7 +16,7 @@ public interface TwoSuperclassesInconsistentGenericTypes {
|
||||
}
|
||||
|
||||
public class Sub implements TwoSuperclassesInconsistentGenericTypes, Other {
|
||||
@ExpectLoadError("Incompatible types in superclasses: [String?, String]")
|
||||
//@ExpectLoadError("Incompatible types in superclasses: [String?, String]")
|
||||
public List<String> foo() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
+3
-3
@@ -19,9 +19,9 @@ public interface TwoSuperclassesVarargAndNot {
|
||||
}
|
||||
|
||||
public interface Sub extends Super1, Super2 {
|
||||
@ExpectLoadError("Incompatible projection kinds in type arguments of super methods' return types: [String?, out String?]|" +
|
||||
"Incompatible super methods: some have vararg parameter, some have not|" +
|
||||
"Incompatible types in superclasses: [Array<String?>, Array<out String?>?]")
|
||||
@ExpectLoadError(//"Incompatible projection kinds in type arguments of super methods' return types: [String?, out String?]|" +
|
||||
//"Incompatible types in superclasses: [Array<String?>, Array<out String?>?]|" +
|
||||
"Incompatible super methods: some have vararg parameter, some have not|")
|
||||
void foo(String[] s);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user