Migrate type of throws parameter to KClass

Change declaration, testData and codegen parts for `throws`
This commit is contained in:
Denis Zharkov
2015-04-20 19:58:02 +03:00
parent e1dfdc582d
commit 6ef2340eb5
9 changed files with 21 additions and 20 deletions
@@ -46,7 +46,7 @@ import org.jetbrains.kotlin.resolve.annotations.AnnotationsPackage;
import org.jetbrains.kotlin.resolve.calls.CallResolverUtil;
import org.jetbrains.kotlin.resolve.constants.ArrayValue;
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant;
import org.jetbrains.kotlin.resolve.constants.JavaClassValue;
import org.jetbrains.kotlin.resolve.constants.KClassValue;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.DiagnosticsPackage;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind;
@@ -545,8 +545,8 @@ public class FunctionCodegen {
new Function<CompileTimeConstant<?>, String>() {
@Override
public String fun(CompileTimeConstant<?> constant) {
if (constant instanceof JavaClassValue) {
JavaClassValue classValue = (JavaClassValue) constant;
if (constant instanceof KClassValue) {
KClassValue classValue = (KClassValue) constant;
ClassDescriptor classDescriptor = DescriptorUtils.getClassDescriptorForType(classValue.getValue());
return mapper.mapClass(classDescriptor).getInternalName();
}
@@ -7,9 +7,9 @@ class Test {
throws()
fun none() {}
throws(javaClass<E1>())
throws(E1::class)
fun one() {}
throws(javaClass<E1>(), javaClass<E2>())
throws(E1::class, E2::class)
fun two() {}
}
@@ -4,7 +4,7 @@ class E1: Exception()
class E2: Exception()
class None [throws()]() {}
class One [throws(javaClass<E1>())]()
class Two [throws(javaClass<E1>(), javaClass<E2>())]()
class One [throws(E1::class)]()
class Two [throws(E1::class, E2::class)]()
class OneWithParam [throws(javaClass<E1>())](a: Int)
class OneWithParam [throws(E1::class)](a: Int)
@@ -2,10 +2,10 @@ package test
class E1: Exception()
throws(javaClass<E1>()) overloads
throws(E1::class) overloads
fun one(a: Int = 1) {}
class One [throws(javaClass<E1>())] (a: Int = 1) {
throws(javaClass<E1>())
class One [throws(E1::class)] (a: Int = 1) {
throws(E1::class)
fun one(a: Int = 1) {}
}
@@ -7,10 +7,10 @@ trait Trait {
throws()
fun none()
throws(javaClass<E1>())
throws(E1::class)
fun one()
throws(javaClass<E1>(), javaClass<E2>())
throws(E1::class, E2::class)
fun two()
}
@@ -3,7 +3,7 @@ package test
class E1: Exception()
trait Base<T> {
throws(javaClass<E1>())
throws(E1::class)
fun one(t: T) {}
}
@@ -6,8 +6,8 @@ class E2: Exception()
throws()
fun none() {}
throws(javaClass<E1>())
throws(E1::class)
fun one() {}
throws(javaClass<E1>(), javaClass<E2>())
throws(E1::class, E2::class)
fun two() {}
@@ -7,10 +7,10 @@ trait Trait {
throws()
fun none() {}
throws(javaClass<E1>())
throws(E1::class)
fun one() {}
throws(javaClass<E1>(), javaClass<E2>())
throws(E1::class, E2::class)
fun two() {}
}