Tests fixed after default nullability for type arguments changed to NotNull

This commit is contained in:
Andrey Breslav
2012-12-07 21:42:48 +04:00
parent d4d713050a
commit 947ab99f53
8 changed files with 27 additions and 19 deletions
@@ -7,6 +7,6 @@ public abstract trait test.TwoSuperclassesInconsistentGenericTypes : java.lang.O
} }
public open class test.TwoSuperclassesInconsistentGenericTypes.Sub : test.TwoSuperclassesInconsistentGenericTypes, test.TwoSuperclassesInconsistentGenericTypes.Other { public open class test.TwoSuperclassesInconsistentGenericTypes.Sub : test.TwoSuperclassesInconsistentGenericTypes, test.TwoSuperclassesInconsistentGenericTypes.Other {
public final /*constructor*/ fun <init>(): test.TwoSuperclassesInconsistentGenericTypes.Sub public final /*constructor*/ fun <init>(): test.TwoSuperclassesInconsistentGenericTypes.Sub
public open override /*2*/ fun foo(): jet.MutableList<jet.String?> public open override /*2*/ fun foo(): jet.MutableList<jet.String>
} }
} }
@@ -14,6 +14,7 @@ public interface TwoSuperclassesVarargAndNot {
} }
public interface Super2 { public interface Super2 {
@KotlinSignature("fun foo(s : Array<out String?>?)")
void foo(String[] s); void foo(String[] s);
} }
@@ -2,23 +2,23 @@ namespace test
public abstract trait test.SubclassWithRawType : java.lang.Object { public abstract trait test.SubclassWithRawType : java.lang.Object {
public abstract trait test.SubclassWithRawType.Sub : test.SubclassWithRawType.Super { public abstract trait test.SubclassWithRawType.Sub : test.SubclassWithRawType.Super {
public abstract override /*1*/ fun array1(): jet.Array<jet.List<jet.String?>?>? public abstract override /*1*/ fun array1(): jet.Array<jet.List<jet.String?>>?
public abstract override /*1*/ fun array2(): jet.Array<jet.List<jet.Any?>?>? public abstract override /*1*/ fun array2(): jet.Array<jet.List<jet.Any>>?
public abstract override /*1*/ fun boundWildcard1(): jet.MutableList<out jet.List<jet.String?>?>? public abstract override /*1*/ fun boundWildcard1(): jet.MutableList<out jet.List<jet.String?>?>?
public abstract override /*1*/ fun boundWildcard2(): jet.MutableList<in jet.List<jet.Any?>?>? public abstract override /*1*/ fun boundWildcard2(): jet.MutableList<in jet.List<jet.Any>?>?
public abstract override /*1*/ fun simple1(): jet.MutableList<out jet.String?>? public abstract override /*1*/ fun simple1(): jet.MutableList<out jet.String?>?
public abstract override /*1*/ fun simple2(): jet.MutableList<out jet.List<jet.String?>?>? public abstract override /*1*/ fun simple2(): jet.MutableList<out jet.List<jet.String>?>?
public abstract override /*1*/ fun simple3(): jet.MutableList<out jet.Any?>? public abstract override /*1*/ fun simple3(): jet.MutableList<out jet.Any>?
public abstract override /*1*/ fun wildcard(): jet.MutableList<out jet.Any?>? public abstract override /*1*/ fun wildcard(): jet.MutableList<out jet.Any?>?
} }
public abstract trait test.SubclassWithRawType.Super : java.lang.Object { public abstract trait test.SubclassWithRawType.Super : java.lang.Object {
public abstract fun array1(): jet.Array<jet.List<jet.Any?>?>? public abstract fun array1(): jet.Array<jet.List<jet.Any?>>?
public abstract fun array2(): jet.Array<jet.List<jet.String?>?>? public abstract fun array2(): jet.Array<jet.List<jet.String>>?
public abstract fun boundWildcard1(): jet.MutableList<out jet.List<jet.Any?>?>? public abstract fun boundWildcard1(): jet.MutableList<out jet.List<jet.Any?>?>?
public abstract fun boundWildcard2(): jet.MutableList<in jet.List<jet.String?>?>? public abstract fun boundWildcard2(): jet.MutableList<in jet.List<jet.String>?>?
public abstract fun simple1(): jet.MutableList<out jet.Any?>? public abstract fun simple1(): jet.MutableList<out jet.Any?>?
public abstract fun simple2(): jet.MutableList<out jet.Any?>? public abstract fun simple2(): jet.MutableList<out jet.Any?>?
public abstract fun simple3(): jet.MutableList<jet.String?>? public abstract fun simple3(): jet.MutableList<jet.String>?
public abstract fun wildcard(): jet.MutableList<out jet.Any?>? public abstract fun wildcard(): jet.MutableList<out jet.Any?>?
} }
} }
@@ -50,6 +50,14 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
Pair<NamespaceDescriptor, BindingContext> nsbAndBindingContext = compileJavaAndLoadTestNamespaceAndBindingContextFromBinary( Pair<NamespaceDescriptor, BindingContext> nsbAndBindingContext = compileJavaAndLoadTestNamespaceAndBindingContextFromBinary(
Arrays.asList(javaFile, ExpectedLoadErrorsUtil.ANNOTATION_SOURCE_FILE), Arrays.asList(javaFile, ExpectedLoadErrorsUtil.ANNOTATION_SOURCE_FILE),
tmpdir, myTestRootDisposable, ConfigurationKind.JDK_AND_ANNOTATIONS); tmpdir, myTestRootDisposable, ConfigurationKind.JDK_AND_ANNOTATIONS);
checkLoadedNamespaces(txtFile, nsa, nsbAndBindingContext);
}
public static void checkLoadedNamespaces(
File txtFile,
NamespaceDescriptor nsa,
Pair<NamespaceDescriptor, BindingContext> nsbAndBindingContext
) {
NamespaceDescriptor nsb = nsbAndBindingContext.first; NamespaceDescriptor nsb = nsbAndBindingContext.first;
boolean fail = false; boolean fail = false;
@@ -107,7 +107,7 @@ public class AnnotationJavaDescriptorResolverTest extends AbstractJavaResolverDe
actualCompileTimeConstant = getCompileTimeConstant(annotation2, annotationTypeName2, "value"); actualCompileTimeConstant = getCompileTimeConstant(annotation2, annotationTypeName2, "value");
assert actualCompileTimeConstant instanceof AnnotationValue; assert actualCompileTimeConstant instanceof AnnotationValue;
checkAnnotationCompileTimeConstant((AnnotationValue) actualCompileTimeConstant, "value", checkAnnotationCompileTimeConstant((AnnotationValue) actualCompileTimeConstant, "value",
DEFAULT_PACKAGE + ".MyAnnotation2", "jet.Array<jet.String?>?", "[\"test\", \"test2\"]"); DEFAULT_PACKAGE + ".MyAnnotation2", "jet.Array<jet.String>?", "[\"test\", \"test2\"]");
String annotationTypeName3 = DEFAULT_PACKAGE + ".MyAnnotationWithParam3"; String annotationTypeName3 = DEFAULT_PACKAGE + ".MyAnnotationWithParam3";
AnnotationDescriptor annotation3 = getAnnotationInClassByType("C", annotationTypeName3); AnnotationDescriptor annotation3 = getAnnotationInClassByType("C", annotationTypeName3);
@@ -163,7 +163,7 @@ public class AnnotationJavaDescriptorResolverTest extends AbstractJavaResolverDe
CompileTimeConstant<?> actualCompileTimeConstant = getCompileTimeConstant(annotation, annotationTypeName, "value"); CompileTimeConstant<?> actualCompileTimeConstant = getCompileTimeConstant(annotation, annotationTypeName, "value");
assert actualCompileTimeConstant instanceof ArrayValue; assert actualCompileTimeConstant instanceof ArrayValue;
checkArrayCompileTimeConstant((ArrayValue) actualCompileTimeConstant, "jet.Array<java.lang.annotation.ElementType?>?", checkArrayCompileTimeConstant((ArrayValue) actualCompileTimeConstant, "jet.Array<java.lang.annotation.ElementType>?",
"java.lang.annotation.ElementType", values); "java.lang.annotation.ElementType", values);
} }
@@ -176,7 +176,7 @@ public class AnnotationJavaDescriptorResolverTest extends AbstractJavaResolverDe
CompileTimeConstant<?> actualCompileTimeConstant = getCompileTimeConstant(annotation, annotationTypeName, "value"); CompileTimeConstant<?> actualCompileTimeConstant = getCompileTimeConstant(annotation, annotationTypeName, "value");
assert actualCompileTimeConstant instanceof ArrayValue; assert actualCompileTimeConstant instanceof ArrayValue;
checkArrayCompileTimeConstant((ArrayValue) actualCompileTimeConstant, "jet.Array<jet.String?>?", "jet.String", values); checkArrayCompileTimeConstant((ArrayValue) actualCompileTimeConstant, "jet.Array<jet.String>?", "jet.String", values);
} }
public void testAnnotationWithEmptyArrayInParam() throws IOException { public void testAnnotationWithEmptyArrayInParam() throws IOException {
@@ -189,7 +189,7 @@ public class AnnotationJavaDescriptorResolverTest extends AbstractJavaResolverDe
CompileTimeConstant<?> actualCompileTimeConstant = getCompileTimeConstant(annotation, annotationTypeName, "value"); CompileTimeConstant<?> actualCompileTimeConstant = getCompileTimeConstant(annotation, annotationTypeName, "value");
assert actualCompileTimeConstant instanceof ArrayValue; assert actualCompileTimeConstant instanceof ArrayValue;
checkArrayCompileTimeConstant((ArrayValue) actualCompileTimeConstant, "jet.Array<jet.String?>?", "jet.String", values); checkArrayCompileTimeConstant((ArrayValue) actualCompileTimeConstant, "jet.Array<jet.String>?", "jet.String", values);
} }
private static void compareJetTypeWithClass(@NotNull JetType actualType, @NotNull String expectedType) { private static void compareJetTypeWithClass(@NotNull JetType actualType, @NotNull String expectedType) {
@@ -40,7 +40,6 @@ import org.jetbrains.jet.lang.resolve.TopDownAnalysisParameters;
import org.jetbrains.jet.lang.resolve.java.DescriptorSearchRule; import org.jetbrains.jet.lang.resolve.java.DescriptorSearchRule;
import org.jetbrains.jet.lang.resolve.java.JavaDescriptorResolver; import org.jetbrains.jet.lang.resolve.java.JavaDescriptorResolver;
import org.jetbrains.jet.lang.resolve.lazy.KotlinTestWithEnvironment; import org.jetbrains.jet.lang.resolve.lazy.KotlinTestWithEnvironment;
import org.jetbrains.jet.lang.resolve.lazy.LazyResolveTestUtil;
import org.jetbrains.jet.lang.resolve.name.Name; import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.test.util.NamespaceComparator; import org.jetbrains.jet.test.util.NamespaceComparator;
@@ -80,10 +79,10 @@ public final class LoadJavaCustomTest extends KotlinTestWithEnvironment {
Pair<NamespaceDescriptor, BindingContext> javaNamespaceAndBindingContext Pair<NamespaceDescriptor, BindingContext> javaNamespaceAndBindingContext
= compileJavaAndLoadTestNamespaceAndBindingContextFromBinary(files, tmpDir, getTestRootDisposable(), = compileJavaAndLoadTestNamespaceAndBindingContextFromBinary(files, tmpDir, getTestRootDisposable(),
ConfigurationKind.JDK_ONLY); ConfigurationKind.JDK_ONLY);
NamespaceDescriptor javaNamespace = javaNamespaceAndBindingContext.first; NamespaceDescriptor javaNamespace = javaNamespaceAndBindingContext.first;
//NOTE: comparing namespace to file (hack) //NOTE: comparing namespace to file (hack)
NamespaceComparator.compareNamespaces(javaNamespace, javaNamespace, NamespaceComparator.DONT_INCLUDE_METHODS_OF_OBJECT, expected); AbstractLoadJavaTest.checkLoadedNamespaces(expected, javaNamespace, javaNamespaceAndBindingContext);
ExpectedLoadErrorsUtil.checkForLoadErrors(javaNamespace, javaNamespaceAndBindingContext.second);
} }
public void testPackageLocalVisibility() throws Exception { public void testPackageLocalVisibility() throws Exception {
@@ -2,7 +2,7 @@ import foo.Intf
class Impl(): Intf { class Impl(): Intf {
public override fun fooBar(i: Int, s: Array<out String?>?, foo: Any?) { public override fun fooBar(i: Int, s: Array<out String>?, foo: Any?) {
throw UnsupportedOperationException() throw UnsupportedOperationException()
} }
} }
@@ -2,7 +2,7 @@ import foo.A
class C : A() { class C : A() {
public override fun getAnswer(array: Array<out String?>?, number: Int, value: Any?): Int { public override fun getAnswer(array: Array<out String>?, number: Int, value: Any?): Int {
return super<A>.getAnswer(array, number, value) return super<A>.getAnswer(array, number, value)
} }
} }