Drop package facades: update compiler tests.

This commit is contained in:
Dmitry Petrov
2015-10-14 14:17:43 +03:00
parent 3502c393fc
commit e7fb7483c5
89 changed files with 167 additions and 192 deletions
@@ -1,9 +1,4 @@
/**
* @deprecated
*/
@java.lang.Deprecated
public final class _DefaultPackage {
@kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "NullableUnitReturnKt")
public final class NullableUnitReturnKt {
@org.jetbrains.annotations.Nullable
public static final kotlin.Unit foo() { /* compiled code */ }
}
@@ -1,3 +1,3 @@
// _DefaultPackage
// NullableUnitReturnKt
fun foo(): Unit? = null
@@ -1,8 +1,3 @@
/**
* @deprecated
*/
@java.lang.Deprecated
public final class _DefaultPackage {
@kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "UnitParameterKt")
public final class UnitParameterKt {
public static final void foo(@org.jetbrains.annotations.NotNull kotlin.Unit s) { /* compiled code */ }
}
@@ -1,3 +1,3 @@
// _DefaultPackage
// UnitParameterKt
fun foo(s: Unit) {}
@@ -1,8 +1,3 @@
/**
* @deprecated
*/
@java.lang.Deprecated
public final class _DefaultPackage {
@kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "VoidReturnKt")
public static final void foo(@org.jetbrains.annotations.NotNull java.lang.String g) { /* compiled code */ }
public final class VoidReturnKt {
public static final void foo(@org.jetbrains.annotations.NotNull java.lang.String s) { /* compiled code */ }
}
@@ -1,3 +1,3 @@
// _DefaultPackage
// VoidReturnKt
fun foo(g: String) {}
@@ -1,81 +1,72 @@
/**
* @deprecated
*/
@java.lang.Deprecated
public final class _DefaultPackage {
@kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "_DefaultPackageKt")
public final class _DefaultPackageKt {
@org.jetbrains.annotations.Nullable
static final java.lang.String nullableVal = "";
@org.jetbrains.annotations.Nullable
static java.lang.String nullableVar;
@org.jetbrains.annotations.NotNull
static final java.lang.String notNullVal = "";
@org.jetbrains.annotations.NotNull
static java.lang.String notNullVar;
@org.jetbrains.annotations.NotNull
static final java.lang.String privateNn = "";
@org.jetbrains.annotations.Nullable
static final java.lang.String privateN = "";
@org.jetbrains.annotations.NotNull
public static final java.lang.String notNull(@org.jetbrains.annotations.NotNull java.lang.String a) { /* compiled code */ }
@org.jetbrains.annotations.Nullable
public static final java.lang.String nullable(@org.jetbrains.annotations.Nullable java.lang.String a) { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public static final java.lang.String notNullWithNN() { /* compiled code */ }
@org.jetbrains.annotations.Nullable
@org.jetbrains.annotations.NotNull
public static final java.lang.String notNullWithN() { /* compiled code */ }
@org.jetbrains.annotations.Nullable
public static final java.lang.String nullableWithN() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
@org.jetbrains.annotations.Nullable
public static final java.lang.String nullableWithNN() { /* compiled code */ }
@org.jetbrains.annotations.Nullable
public static final java.lang.String getNullableVal() { /* compiled code */ }
@org.jetbrains.annotations.Nullable
public static final java.lang.String getNullableVar() { /* compiled code */ }
public static final void setNullableVar(@org.jetbrains.annotations.Nullable java.lang.String p) { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public static final java.lang.String getNotNullVal() { /* compiled code */ }
@kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "_DefaultPackageKt")
@org.jetbrains.annotations.NotNull
public static final java.lang.String getNotNullVar() { /* compiled code */ }
public static final void setNotNullVar(@org.jetbrains.annotations.NotNull java.lang.String p) { /* compiled code */ }
@org.jetbrains.annotations.Nullable
@org.jetbrains.annotations.NotNull
public static final java.lang.String getNotNullValWithGet() { /* compiled code */ }
@kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "_DefaultPackageKt")
@org.jetbrains.annotations.NotNull
public static final java.lang.String getNotNullVar() { /* compiled code */ }
@kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "_DefaultPackageKt")
public static final void setNotNullVar(@org.jetbrains.annotations.NotNull java.lang.String p) { /* compiled code */ }
@kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "_DefaultPackageKt")
@org.jetbrains.annotations.Nullable
@org.jetbrains.annotations.NotNull
public static final java.lang.String getNotNullVarWithGetSet() { /* compiled code */ }
@kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "_DefaultPackageKt")
@org.jetbrains.annotations.Nullable
public static final void setNotNullVarWithGetSet(@org.jetbrains.annotations.NotNull java.lang.String v) { /* compiled code */ }
@kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "_DefaultPackageKt")
@org.jetbrains.annotations.Nullable
public static final java.lang.String getNullableVal() { /* compiled code */ }
@kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "_DefaultPackageKt")
@org.jetbrains.annotations.NotNull
@org.jetbrains.annotations.Nullable
public static final java.lang.String getNullableValWithGet() { /* compiled code */ }
@kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "_DefaultPackageKt")
@org.jetbrains.annotations.Nullable
public static final java.lang.String getNullableVar() { /* compiled code */ }
@kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "_DefaultPackageKt")
public static final void setNullableVar(@org.jetbrains.annotations.Nullable java.lang.String p) { /* compiled code */ }
@kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "_DefaultPackageKt")
@org.jetbrains.annotations.NotNull
@org.jetbrains.annotations.Nullable
public static final java.lang.String getNullableVarWithGetSet() { /* compiled code */ }
@kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "_DefaultPackageKt")
@org.jetbrains.annotations.NotNull
public static final void setNullableVarWithGetSet(@org.jetbrains.annotations.Nullable java.lang.String v) { /* compiled code */ }
@kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "_DefaultPackageKt")
@org.jetbrains.annotations.NotNull
public static final java.lang.String notNull(@org.jetbrains.annotations.NotNull java.lang.String a) { /* compiled code */ }
static final java.lang.String getPrivateNn() { /* compiled code */ }
@kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "_DefaultPackageKt")
@org.jetbrains.annotations.Nullable
@org.jetbrains.annotations.NotNull
public static final java.lang.String notNullWithN() { /* compiled code */ }
@kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "_DefaultPackageKt")
@org.jetbrains.annotations.NotNull
public static final java.lang.String notNullWithNN() { /* compiled code */ }
@kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "_DefaultPackageKt")
@org.jetbrains.annotations.Nullable
public static final java.lang.String nullable(@org.jetbrains.annotations.Nullable java.lang.String a) { /* compiled code */ }
@kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "_DefaultPackageKt")
@org.jetbrains.annotations.Nullable
public static final java.lang.String nullableWithN() { /* compiled code */ }
@kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "_DefaultPackageKt")
@org.jetbrains.annotations.NotNull
@org.jetbrains.annotations.Nullable
public static final java.lang.String nullableWithNN() { /* compiled code */ }
}
@@ -1,4 +1,4 @@
// _DefaultPackage
// _DefaultPackageKt
import org.jetbrains.annotations.NotNull
import org.jetbrains.annotations.Nullable
+1 -4
View File
@@ -1,4 +1 @@
compiler/testData/cli/jvm/classAndFacadeClash.kt:3:1: error: duplicate JVM class name 'test/TestPackage' generated from: package-fragment test, TestPackage
class TestPackage {
^
COMPILATION_ERROR
OK
+1 -4
View File
@@ -1,4 +1 @@
compiler/testData/cli/jvm/fileClassAndFacadeClash.kt:1:1: error: duplicate JVM class name 'test/TestPackage' generated from: package-fragment test, package-fragment test
@file:JvmName("TestPackage")
^
COMPILATION_ERROR
OK
+2 -2
View File
@@ -14,13 +14,13 @@ compiler/testData/cli/jvm/signatureClash.kt:9:5: error: platform declaration cla
val a: Int = 1
^
compiler/testData/cli/jvm/signatureClash.kt:12:1: error: platform declaration clash: The following declarations have the same JVM signature (getB()I):
fun <get-b>(): kotlin.Int
fun getB(): kotlin.Int
fun <get-b>(): kotlin.Int
fun getB(): Int = 1
^
compiler/testData/cli/jvm/signatureClash.kt:13:1: error: platform declaration clash: The following declarations have the same JVM signature (getB()I):
fun <get-b>(): kotlin.Int
fun getB(): kotlin.Int
fun <get-b>(): kotlin.Int
val b: Int = 1
^
compiler/testData/cli/jvm/signatureClash.kt:19:7: error: platform declaration clash: The following declarations have the same JVM signature (getTr()I):
@@ -3,7 +3,7 @@ package test;
public class StarProjection {
void foo(K<?> k) {
k.foo(null);
TestPackage.bar(null);
StarProjectionKt.bar(null);
new Sub().foo(null);
}
}
+1 -1
View File
@@ -2,6 +2,6 @@ package test;
class Any {
{
Object r = TestPackage.anyany(new Object(), null);
Object r = AnyKt.anyany(new Object(), null);
}
}
@@ -4,6 +4,6 @@ package test;
class ArrayOfIntArray {
{
int[][] a = new int[0][];
int[][] r = TestPackage.ohMy(a);
int[][] r = ArrayOfIntArrayKt.ohMy(a);
}
}
@@ -4,6 +4,6 @@ package test;
class ArrayOfIntArray {
{
Integer[][] a = new Integer[0][];
Integer[][] r = TestPackage.ohMy(a, null);
Integer[][] r = ArrayOfIntegerArrayKt.ohMy(a, null);
}
}
@@ -2,8 +2,8 @@ package test;
class GenericArray {
{
TestPackage.noParam("");
ExtensionsKt.noParam("");
TestPackage.param("", "");
ExtensionsKt.param("", "");
}
}
@@ -2,6 +2,6 @@ package test;
class GenericArray {
public static void ggff() {
String[] s = TestPackage.ffgg(new String[0]);
String[] s = GenericArrayKt.ffgg(new String[0]);
}
}
@@ -3,6 +3,6 @@ package test;
class Hello {
public static void xx() {
String s = TestPackage.f();
String s = HelloKt.f();
}
}
+1 -1
View File
@@ -3,6 +3,6 @@ package test;
class Int {
{
int r = TestPackage.lll(1);
int r = IntKt.lll(1);
}
}
@@ -3,6 +3,6 @@ package test;
class IntArray {
{
int[] r = TestPackage.doNothing(new int[0], null);
int[] r = IntArrayKt.doNothing(new int[0], null);
}
}
@@ -3,6 +3,6 @@ package test;
class IntWithDefault {
{
int r = TestPackage.www(1);
int r = IntWithDefaultKt.www(1);
}
}
@@ -3,6 +3,6 @@ package test;
class IntArray {
{
Integer[] r = TestPackage.doNothing(new Integer[0], null);
Integer[] r = IntegerArrayKt.doNothing(new Integer[0], null);
}
}
@@ -7,7 +7,7 @@ class ListOfInt {
public static void hhh() {
List<Integer> list = new ArrayList<Integer>();
List<Integer> r = TestPackage.ggg(list);
List<Integer> r = ListOfIntKt.ggg(list);
}
}
@@ -6,6 +6,6 @@ import java.util.ArrayList;
class ListString {
public static void gg() {
List<String> list = new ArrayList<String>();
TestPackage.ff(list);
ListOfStringKt.ff(list);
}
}
@@ -7,7 +7,7 @@ class ListOfT {
public static void check() {
List<String> list = new ArrayList<String>();
List<String> r = TestPackage.listOfT(list);
List<String> r = ListOfTKt.listOfT(list);
}
}
@@ -8,6 +8,6 @@ class MapOfKString {
public static void gfgdgfg() {
Map<BigDecimal, String> map = new HashMap<BigDecimal, String>();
Map<BigDecimal, String> r = TestPackage.fff(map);
Map<BigDecimal, String> r = MapOfKStringKt.fff(map);
}
}
@@ -8,6 +8,6 @@ class MapOfKString {
public static void gfgdgfg() {
Map<String, Integer> map = new HashMap<String, Integer>();
Map<String, Integer> r = TestPackage.fff(map);
Map<String, Integer> r = MapOfStringIntQKt.fff(map);
}
}
@@ -4,6 +4,6 @@ class Question {
// id2 is to prevent java type parameter type inference
static <T> T id2(T p) { return p; }
{
java.util.List<? extends String> s = id2(TestPackage.id(null));
java.util.List<? extends String> s = id2(QExtendsListStringKt.id(null));
}
}
@@ -4,6 +4,6 @@ class Question {
// id2 is to prevent java type parameter type inference
static <T> T id2(T p) { return p; }
{
String s = id2(TestPackage.id(null));
String s = id2(QExtendsStringKt.id(null));
}
}
@@ -6,6 +6,6 @@ import java.util.ArrayList;
class Vararg {
{
List<String> list = new ArrayList<String>();
List<String> r = TestPackage.gg(list, 3, 4, 5, 6);
List<String> r = VarargKt.gg(list, 3, 4, 5, 6);
}
}
@@ -2,6 +2,6 @@ package test;
class Void {
{
TestPackage.f();
VoidKt.f();
}
}
@@ -2,6 +2,6 @@ package test;
public class PlatformName {
public static void main(String[] args) {
TestPackage.bar();
PlatformNameKt.bar();
}
}
@@ -13,12 +13,12 @@ class JavaClass {
catch (E1 e) {}
try {
TestPackage.one(1);
DefaultArgsKt.one(1);
}
catch (E1 e) {}
try {
TestPackage.one();
DefaultArgsKt.one();
}
catch (E1 e) {}
}
@@ -2,15 +2,15 @@ package test;
class JavaClass {
void testMethod() {
TestPackage.none();
TopLevelKt.none();
try {
TestPackage.one();
TopLevelKt.one();
}
catch (E1 e) {}
try {
TestPackage.two();
TopLevelKt.two();
}
catch (E1 e) {}
catch (E2 e) {}
@@ -2,9 +2,9 @@ package test;
class GenericArray {
{
TestPackage.getVal_("");
ExtensionsKt.getVal_("");
TestPackage.getVar_("");
TestPackage.setVar_("", "");
ExtensionsKt.getVar_("");
ExtensionsKt.setVar_("", "");
}
}
@@ -2,6 +2,6 @@ package test;
class GenericProperty {
void foo() {
java.util.Map<String, Integer> o = TestPackage.getTest(new java.util.HashMap<Integer, String>());
java.util.Map<String, Integer> o = GenericPropertyKt.getTest(new java.util.HashMap<Integer, String>());
}
}
@@ -2,7 +2,7 @@ package test;
public class PlatformName {
public static void main(String[] args) {
int x = TestPackage.vget();
TestPackage.vset(0);
int x = PlatformNameKt.vget();
PlatformNameKt.vset(0);
}
}
@@ -1,5 +1,5 @@
// FILE: a.kt
<!CONFLICTING_JVM_DECLARATIONS!>val x<!> = 1
val x = 1
// FILE: b.kt
<!CONFLICTING_JVM_DECLARATIONS!>fun getX()<!> = 1
fun getX() = 1
+1 -1
View File
@@ -4,7 +4,7 @@
<target name="build">
<kotlinc src="${test.data}/hello.kt" output="${temp}/hello.jar"/>
<java classname="hello.HelloPackage" fork="true">
<java classname="hello.HelloKt" fork="true">
<classpath>
<pathelement location="${temp}/hello.jar"/>
<pathelement location="${kotlin.runtime.jar}"/>
@@ -4,7 +4,7 @@
<target name="build">
<kotlinc src="${test.data}/hello.kt" output="${temp}/hello.jar"/>
<java classname="hello.HelloPackage" fork="true">
<java classname="hello.HelloKt" fork="true">
<classpath>
<pathelement location="${temp}/hello.jar"/>
<pathelement location="${kotlin.runtime.jar}"/>
+1 -1
View File
@@ -4,7 +4,7 @@
<target name="build">
<kotlinc src="${test.data}/hello.kt" output="${temp}/hello.jar" modulename="test"/>
<java classname="hello.HelloPackage" fork="true">
<java classname="hello.HelloKt" fork="true">
<classpath>
<pathelement location="${temp}/hello.jar"/>
<pathelement location="${kotlin.runtime.jar}"/>
@@ -4,7 +4,7 @@
<target name="build">
<kotlinc src="${test.data}/hello.kt" output="${temp}/hello.jar"/>
<java classname="hello.HelloPackage" fork="true">
<java classname="hello.HelloKt" fork="true">
<classpath>
<pathelement location="${temp}/hello.jar"/>
<pathelement location="${kotlin.runtime.jar}"/>
@@ -10,7 +10,7 @@
<fileset dir="${temp}/classes"/>
</jar>
<java classname="hello.HelloPackage" fork="true">
<java classname="hello.HelloKt" fork="true">
<classpath>
<pathelement location="${temp}/hello.jar"/>
<pathelement location="${kotlin.runtime.jar}"/>
+1 -1
View File
@@ -1,5 +1,5 @@
fun never(): Array<java.lang.CharSequence> = throw Exception()
// method: _DefaultPackage::never
// method: ArrayOfCharSequenceKt::never
// jvm signature: ()[Ljava/lang/CharSequence;
// generic signature: null
+1 -1
View File
@@ -1,5 +1,5 @@
fun never(): Array<Int> = throw Exception()
// method: _DefaultPackage::never
// method: ArrayOfIntKt::never
// jvm signature: ()[Ljava/lang/Integer;
// generic signature: null
+1 -1
View File
@@ -1,5 +1,5 @@
fun cc(): Comparable<java.lang.CharSequence>? = null
// method: _DefaultPackage::cc
// method: ComparableKt::cc
// jvm signature: ()Ljava/lang/Comparable;
// generic signature: ()Ljava/lang/Comparable<Ljava/lang/CharSequence;>;
+1 -1
View File
@@ -1,5 +1,5 @@
fun key(): Int = throw Exception()
// method: _DefaultPackage::key
// method: IntKt::key
// jvm signature: ()I
// generic signature: null
+1 -1
View File
@@ -1,5 +1,5 @@
fun never(): IntArray = throw Exception()
// method: _DefaultPackage::never
// method: IntArrayKt::never
// jvm signature: ()[I
// generic signature: null
+1 -1
View File
@@ -1,5 +1,5 @@
fun sometimes(): Int? = null
// method: _DefaultPackage::sometimes
// method: IntQKt::sometimes
// jvm signature: ()Ljava/lang/Integer;
// generic signature: null
+1 -1
View File
@@ -1,6 +1,6 @@
fun foo(p: List<CharSequence>) = 1
// method: _DefaultPackage::foo
// method: ListOfCharSequenceKt::foo
// jvm signature: (Ljava/util/List;)I
// generic signature: (Ljava/util/List<+Ljava/lang/CharSequence;>;)I
+1 -1
View File
@@ -1,6 +1,6 @@
fun listOfStar(): List<*> = throw Exception()
// method: _DefaultPackage::listOfStar
// method: ListOfStarKt::listOfStar
// jvm signature: ()Ljava/util/List;
// generic signature: ()Ljava/util/List<*>;
+1 -1
View File
@@ -1,5 +1,5 @@
fun getEntry(): Map.Entry<Int, String>? = null
// method: _DefaultPackage::getEntry
// method: MapEntryKt::getEntry
// jvm signature: ()Ljava/util/Map$Entry;
// generic signature: ()Ljava/util/Map$Entry<Ljava/lang/Integer;Ljava/lang/String;>;
+1 -1
View File
@@ -1,5 +1,5 @@
fun getEntry(): MutableMap.MutableEntry<Int, String>? = null
// method: _DefaultPackage::getEntry
// method: MutableMapEntryKt::getEntry
// jvm signature: ()Ljava/util/Map$Entry;
// generic signature: ()Ljava/util/Map$Entry<Ljava/lang/Integer;Ljava/lang/String;>;
+1 -1
View File
@@ -1,5 +1,5 @@
fun foo() = 1
// method: _DefaultPackage::foo
// method: NonGenericKt::foo
// jvm signature: ()I
// generic signature: null
@@ -2,6 +2,6 @@ class C<T : C<T>>
fun bar(c: C<*>): C<*> = null!!
// method: _DefaultPackage::bar
// method: StarProjectionOutsideClassKt::bar
// jvm signature: (LC;)LC;
// generic signature: (LC<*>;)LC<*>;
+1 -1
View File
@@ -1,5 +1,5 @@
fun foo(vararg tail: java.lang.CharSequence) = 1
// method: _DefaultPackage::foo
// method: VarargCharSequenceKt::foo
// jvm signature: ([Ljava/lang/CharSequence;)I
// generic signature: null
+1 -1
View File
@@ -1,5 +1,5 @@
fun <P> foo(vararg tail: P) = 1
// method: _DefaultPackage::foo
// method: VarargGenericKt::foo
// jvm signature: ([Ljava/lang/Object;)I
// generic signature: <P:Ljava/lang/Object;>([TP;)I
@@ -4,6 +4,6 @@ class X
fun f(m: M<X, X>): M<X, X> = throw Exception()
// method: _DefaultPackage::f
// method: FunctionTwoTypeParametersKt::f
// jvm signature: (LM;)LM;
// generic signature: (LM<-LX;+LX;>;)LM<LX;LX;>;
@@ -2,6 +2,6 @@ class In<in T>
fun f(p: In<String>) {}
// method: _DefaultPackage::f
// method: InInInPositionKt::f
// jvm signature: (LIn;)V
// generic signature: (LIn<-Ljava/lang/String;>;)V
@@ -2,6 +2,6 @@ class In<in T>
fun f(): In<String> = throw Exception()
// method: _DefaultPackage::f
// method: InInOutPositionKt::f
// jvm signature: ()LIn;
// generic signature: ()LIn<Ljava/lang/String;>;
@@ -3,6 +3,6 @@ class X
fun f(p: In<In<X>>) {}
// method: _DefaultPackage::f
// method: InOfInInInPositionKt::f
// jvm signature: (LIn;)V
// generic signature: (LIn<-LIn<-LX;>;>;)V
@@ -3,6 +3,6 @@ class X
fun f(): In<In<X>> = throw Exception()
// method: _DefaultPackage::f
// method: InOfInInOutPositionKt::f
// jvm signature: ()LIn;
// generic signature: ()LIn<LIn<-LX;>;>;
@@ -4,6 +4,6 @@ class X
fun f(p: In<Out<X>>) {}
// method: _DefaultPackage::f
// method: InOfOutInInPositionKt::f
// jvm signature: (LIn;)V
// generic signature: (LIn<-LOut<+LX;>;>;)V
@@ -4,6 +4,6 @@ class X
fun f(): In<Out<X>> = throw Exception()
// method: _DefaultPackage::f
// method: InOfOutInOutPositionKt::f
// jvm signature: ()LIn;
// generic signature: ()LIn<LOut<+LX;>;>;
@@ -1,5 +1,5 @@
fun f(p: List<String>) {}
// method: _DefaultPackage::f
// method: OutInInPositionKt::f
// jvm signature: (Ljava/util/List;)V
// generic signature: (Ljava/util/List<+Ljava/lang/String;>;)V
@@ -1,5 +1,5 @@
fun f(): List<String> = throw Exception()
// method: _DefaultPackage::f
// method: OutInOutPositionKt::f
// jvm signature: ()Ljava/util/List;
// generic signature: ()Ljava/util/List<Ljava/lang/String;>;
@@ -4,6 +4,6 @@ class X
fun f(p: Out<In<X>>) {}
// method: _DefaultPackage::f
// method: OutOfInInInPositionKt::f
// jvm signature: (LOut;)V
// generic signature: (LOut<+LIn<-LX;>;>;)V
@@ -4,6 +4,6 @@ class X
fun f(): Out<In<X>> = throw Exception()
// method: _DefaultPackage::f
// method: OutOfInInOutPositionKt::f
// jvm signature: ()LOut;
// generic signature: ()LOut<LIn<-LX;>;>;
@@ -3,6 +3,6 @@ class X
fun f(p: Out<Out<X>>) {}
// method: _DefaultPackage::f
// method: OutOfOutInInPositionKt::f
// jvm signature: (LOut;)V
// generic signature: (LOut<+LOut<+LX;>;>;)V
@@ -13,6 +13,6 @@ class X
// thus removing the wildcard would be restricting the use of the return value of the method, and we don't want do this.
fun f(): Out<Out<X>> = throw Exception()
// method: _DefaultPackage::f
// method: OutOfOutInOutPositionKt::f
// jvm signature: ()LOut;
// generic signature: ()LOut<LOut<+LX;>;>;
@@ -3,6 +3,6 @@ class X
val p: M<X> = throw Exception()
// method: _DefaultPackage::getP
// method: PropertyGetterInKt::getP
// jvm signature: ()LM;
// generic signature: ()LM<LX;>;
@@ -3,6 +3,6 @@ class X
val p: M<X> = throw Exception()
// method: _DefaultPackage::getP
// method: PropertyGetterOutKt::getP
// jvm signature: ()LM;
// generic signature: ()LM<LX;>;
@@ -3,6 +3,6 @@ class X
val p: M<X, X> = throw Exception()
// method: _DefaultPackage::getP
// method: PropertyGetterTwoParamsKt::getP
// jvm signature: ()LM;
// generic signature: ()LM<LX;LX;>;
@@ -3,6 +3,6 @@ class X
var p: M<X> = throw Exception()
// method: _DefaultPackage::setP
// method: PropertySetterInKt::setP
// jvm signature: (LM;)V
// generic signature: (LM<-LX;>;)V
@@ -3,6 +3,6 @@ class X
var p: M<X> = throw Exception()
// method: _DefaultPackage::setP
// method: PropertySetterOutKt::setP
// jvm signature: (LM;)V
// generic signature: (LM<+LX;>;)V
+1 -1
View File
@@ -1,5 +1,5 @@
fun string(): java.lang.String = throw Exception()
// method: _DefaultPackage::string
// method: JlStringKt::string
// jvm signature: ()Ljava/lang/String;
// generic signature: null
+1 -1
View File
@@ -1,6 +1,6 @@
class C<T>
fun f(p: Nothing, p1: C<Nothing>, p2: C<C<Nothing>>, p3: C<C<Nothing>>?): Nothing = throw Exception()
// method: _DefaultPackage::f
// method: NothingKt::f
// jvm signature: (Ljava/lang/Void;LC;LC;LC;)Ljava/lang/Void;
// generic signature: null
@@ -1,6 +1,6 @@
class C<T>
fun f(p: Nothing?, p1: C<Nothing?>, p2: C<C<Nothing?>>, p3: C<C<Nothing?>>?): Nothing? = throw Exception()
// method: _DefaultPackage::f
// method: NullableNothingKt::f
// jvm signature: (Ljava/lang/Void;LC;LC;LC;)Ljava/lang/Void;
// generic signature: null
@@ -118,8 +118,8 @@ public class KotlinLightClassCoherenceTest extends KotlinAsJavaTestBase {
}
}
public void testPackage() throws Exception {
doTest("test.TestPackage");
public void testFileFacade() throws Exception {
doTest("test.PackageKt");
}
public void testNoModifiers() throws Exception {
@@ -163,7 +163,7 @@ public abstract class KotlinLightClassStructureTest extends KotlinAsJavaTestBase
}
public void testPackage() throws Exception {
checkModifiers("test.TestPackage", PUBLIC, FINAL, DEPRECATED);
checkModifiers("test.PackageKt", PUBLIC, FINAL);
}
}
@@ -177,8 +177,8 @@ public abstract class KotlinLightClassStructureTest extends KotlinAsJavaTestBase
assertTrue(findMethodsOfClass("test.C").length == 2);
}
public void testPackageWithErrors() {
assertTrue(findMethodsOfClass("test.TestPackage").length == 1);
public void testFileFacadeWithErrors() {
assertTrue(findMethodsOfClass("test.CodeWithErrorsKt").length == 1);
}
private PsiMethod[] findMethodsOfClass(String qualifiedName) {
@@ -38,14 +38,14 @@ public class CliCommonTest extends CliBaseTest {
public void simple() throws Exception {
executeCompilerCompareOutputJVM();
Assert.assertTrue(new File(tmpdir.getTmpDir(), PackageClassUtils.getPackageClassName(FqName.ROOT) + ".class").isFile());
Assert.assertTrue(new File(tmpdir.getTmpDir(), "SimpleKt.class").isFile());
}
@Test
public void duplicateSources() throws Exception {
executeCompilerCompareOutputJVM();
Assert.assertTrue(new File(tmpdir.getTmpDir(), PackageClassUtils.getPackageClassName(FqName.ROOT) + ".class").isFile());
Assert.assertTrue(new File(tmpdir.getTmpDir(), "SimpleKt.class").isFile());
}
@Test
@@ -44,7 +44,7 @@ public class K2JvmCliTest extends CliBaseTest {
public void nonExistingClassPathAndAnnotationsPath() throws Exception {
executeCompilerCompareOutputJVM();
Assert.assertTrue(new File(tmpdir.getTmpDir(), PackageClassUtils.getPackageClassName(FqName.ROOT) + ".class").isFile());
Assert.assertTrue(new File(tmpdir.getTmpDir(), "SimpleKt.class").isFile());
}
@Test
@@ -103,7 +103,7 @@ public class CompilerDaemonTest : KotlinIntegrationTestBase() {
TestCase.assertTrue("Expecting that compilation 1 ($compileTime1 ms) is at least two times longer than compilation 2 ($compileTime2 ms)",
compileTime1 > compileTime2 * 2)
logFile.delete()
run("hello.run", "-cp", jar, "Hello.HelloPackage")
run("hello.run", "-cp", jar, "Hello.HelloKt")
}
finally {
if (!daemonShotDown)
@@ -51,21 +51,21 @@ public class CompilerSmokeTest extends KotlinIntegrationTestBase {
String jar = tmpdir.getAbsolutePath() + File.separator + "hello.jar";
assertEquals("compilation failed", 0, runCompiler("hello.compile", "-include-runtime", "hello.kt", "-d", jar));
run("hello.run", "-cp", jar, "Hello.HelloPackage");
run("hello.run", "-cp", jar, "Hello.HelloKt");
}
public void testHelloAppFQMain() throws Exception {
String jar = tmpdir.getAbsolutePath() + File.separator + "hello.jar";
assertEquals("compilation failed", 0, runCompiler("hello.compile", "-include-runtime", "hello.kt", "-d", jar));
run("hello.run", "-cp", jar, "Hello.HelloPackage");
run("hello.run", "-cp", jar, "Hello.HelloKt");
}
public void testHelloAppVarargMain() throws Exception {
String jar = tmpdir.getAbsolutePath() + File.separator + "hello.jar";
assertEquals("compilation failed", 0, runCompiler("hello.compile", "-include-runtime", "hello.kt", "-d", jar));
run("hello.run", "-cp", jar, "Hello.HelloPackage");
run("hello.run", "-cp", jar, "Hello.HelloKt");
}
public void testCompilationFailed() throws Exception {
@@ -49,7 +49,7 @@ public abstract class AbstractCompileKotlinAgainstInlineKotlinTest : AbstractCom
try {
factory1 = compileA(File(files[1]))
factory2 = compileB(File(files[0]))
invokeBox()
invokeBox(files[0])
}
catch (e: Throwable) {
var result = ""
@@ -30,8 +30,7 @@ import org.jetbrains.kotlin.codegen.GenerationUtils;
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime;
import org.jetbrains.kotlin.config.CompilerConfiguration;
import org.jetbrains.kotlin.load.kotlin.ModuleVisibilityManager;
import org.jetbrains.kotlin.load.kotlin.PackageClassUtils;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils;
import org.jetbrains.kotlin.psi.JetFile;
import org.jetbrains.kotlin.test.ConfigurationKind;
import org.jetbrains.kotlin.test.JetTestUtils;
@@ -59,29 +58,31 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends TestCaseWit
public void doTest(@NotNull String fileName) throws Exception {
compileA(new File(fileName));
compileB(new File(fileName.replaceFirst("A\\.kt$", "B.kt")));
invokeMain();
String fileNameB = fileName.replaceFirst("A\\.kt$", "B.kt");
compileB(new File(fileNameB));
invokeMain(fileNameB);
}
private void invokeMain() throws Exception {
Method main = generatedClass().getMethod("main", String[].class);
private void invokeMain(@NotNull String fileName) throws Exception {
Method main = generatedClass(fileName).getMethod("main", String[].class);
main.invoke(null, new Object[] {ArrayUtil.EMPTY_STRING_ARRAY});
}
protected void invokeBox() throws Exception {
Method box = generatedClass().getMethod("box");
protected void invokeBox(@NotNull String fileName) throws Exception {
Method box = generatedClass(fileName).getMethod("box");
String result = (String) box.invoke(null);
assertEquals("OK", result);
}
@NotNull
private Class<?> generatedClass() throws Exception {
private Class<?> generatedClass(@NotNull String fileName) throws Exception {
URLClassLoader classLoader = new URLClassLoader(
new URL[]{ bDir.toURI().toURL(), aDir.toURI().toURL() },
ForTestCompileRuntime.runtimeAndReflectJarClassLoader()
);
return classLoader.loadClass(PackageClassUtils.getPackageClassName(FqName.ROOT));
String fileLastName = new File(fileName).getName();
return classLoader.loadClass(PackagePartClassUtils.getFilePartShortName(fileLastName));
}
protected ClassFileFactory compileA(@NotNull File ktAFile) throws IOException {
@@ -37,7 +37,7 @@ public abstract class AbstractCompileKotlinAgainstMultifileKotlinTest : Abstract
try {
factory1 = compileA(File(files[1]))
factory2 = compileB(File(files[0]))
invokeBox()
invokeBox(files[0])
}
catch (e: Throwable) {
var result = ""
@@ -46,8 +46,8 @@ public class CompileEnvironmentTest extends TestCase {
File[] files = out.listFiles();
Arrays.sort(files);
assertEquals(2, files.length);
assertEquals(1, files[0].listFiles().length);//META-INF
assertEquals(2, files[1].listFiles().length);//Smoke package
assertEquals(1, files[0].listFiles().length); //META-INF
assertEquals(1, files[1].listFiles().length); // SmokeKt
}
finally {
FileUtil.delete(tempDir);
@@ -140,13 +140,17 @@ public abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdi
val packageScopes = arrayListOf<JetScope>()
val classes = arrayListOf<ClassDescriptor>()
var shouldAddPackageView = false
for (classFile in allClassFiles) {
val className = classFile.relativeTo(tmpdir).substringBeforeLast(".class").replace('/', '.').replace('\\', '.')
val klass = classLoader.loadClass(className).sure { "Couldn't load class $className" }
val header = ReflectKotlinClass.create(klass)?.getClassHeader()
if (header?.kind == KotlinClassHeader.Kind.PACKAGE_FACADE || header?.kind == KotlinClassHeader.Kind.FILE_FACADE) {
if (header?.kind == KotlinClassHeader.Kind.PACKAGE_FACADE ||
header?.kind == KotlinClassHeader.Kind.FILE_FACADE ||
header?.kind == KotlinClassHeader.Kind.MULTIFILE_CLASS
) {
val packageView = module.getPackage(LoadDescriptorUtil.TEST_PACKAGE_FQNAME)
if (!packageScopes.contains(packageView.memberScope)) {
packageScopes.add(packageView.memberScope)