Support [throws] annotation
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
class JavaClass {
|
||||
void testMethod() {
|
||||
Test test = new Test();
|
||||
test.none();
|
||||
|
||||
try {
|
||||
test.one();
|
||||
}
|
||||
catch (E1 e) {}
|
||||
|
||||
try {
|
||||
test.two();
|
||||
}
|
||||
catch (E1 e) {}
|
||||
catch (E2 e) {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
class E1: Exception()
|
||||
class E2: Exception()
|
||||
|
||||
class Test {
|
||||
throws()
|
||||
fun none() {}
|
||||
|
||||
throws(javaClass<E1>())
|
||||
fun one() {}
|
||||
|
||||
throws(javaClass<E1>(), javaClass<E2>())
|
||||
fun two() {}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
class JavaClass {
|
||||
void testMethod() {
|
||||
new None();
|
||||
|
||||
try {
|
||||
new One();
|
||||
}
|
||||
catch (E1 e) {}
|
||||
|
||||
try {
|
||||
new OneWithParam(1);
|
||||
}
|
||||
catch (E1 e) {}
|
||||
|
||||
try {
|
||||
new Two();
|
||||
}
|
||||
catch (E1 e) {}
|
||||
catch (E2 e) {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class E1: Exception()
|
||||
class E2: Exception()
|
||||
|
||||
class None [throws()]() {}
|
||||
class One [throws(javaClass<E1>())]()
|
||||
class Two [throws(javaClass<E1>(), javaClass<E2>())]()
|
||||
|
||||
class OneWithParam [throws(javaClass<E1>())](a: Int)
|
||||
@@ -0,0 +1,33 @@
|
||||
class JavaClass {
|
||||
void testMethod(One instance) {
|
||||
try {
|
||||
new One(1);
|
||||
}
|
||||
catch (E1 e) {}
|
||||
|
||||
try {
|
||||
new One(1, 0);
|
||||
}
|
||||
catch (E1 e) {}
|
||||
|
||||
try {
|
||||
new One();
|
||||
}
|
||||
catch (E1 e) {}
|
||||
|
||||
try {
|
||||
One.one$default(instance, 1, 1);
|
||||
}
|
||||
catch (E1 e) {}
|
||||
|
||||
try {
|
||||
_DefaultPackage.one(1);
|
||||
}
|
||||
catch (E1 e) {}
|
||||
|
||||
try {
|
||||
_DefaultPackage.one$default(1, 0);
|
||||
}
|
||||
catch (E1 e) {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class E1: Exception()
|
||||
|
||||
throws(javaClass<E1>())
|
||||
fun one(a: Int = 1) {}
|
||||
|
||||
class One [throws(javaClass<E1>())] (a: Int = 1) {
|
||||
throws(javaClass<E1>())
|
||||
fun one(a: Int = 1) {}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
class JavaClass {
|
||||
void testMethod() {
|
||||
Test test = new Test();
|
||||
test.none();
|
||||
|
||||
try {
|
||||
test.one();
|
||||
}
|
||||
catch (E1 e) {}
|
||||
|
||||
try {
|
||||
test.two();
|
||||
}
|
||||
catch (E1 e) {}
|
||||
catch (E2 e) {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
class E1: Exception()
|
||||
class E2: Exception()
|
||||
|
||||
trait Trait {
|
||||
throws()
|
||||
fun none()
|
||||
|
||||
throws(javaClass<E1>())
|
||||
fun one()
|
||||
|
||||
throws(javaClass<E1>(), javaClass<E2>())
|
||||
fun two()
|
||||
}
|
||||
|
||||
class Impl: Trait {
|
||||
override fun none() {}
|
||||
override fun one() {}
|
||||
override fun two() {}
|
||||
}
|
||||
|
||||
class Test: Trait by Impl()
|
||||
@@ -0,0 +1,16 @@
|
||||
class JavaClass {
|
||||
void testMethod() {
|
||||
_DefaultPackage.none();
|
||||
|
||||
try {
|
||||
_DefaultPackage.one();
|
||||
}
|
||||
catch (E1 e) {}
|
||||
|
||||
try {
|
||||
_DefaultPackage.two();
|
||||
}
|
||||
catch (E1 e) {}
|
||||
catch (E2 e) {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class E1: Exception()
|
||||
class E2: Exception()
|
||||
|
||||
throws()
|
||||
fun none() {}
|
||||
|
||||
throws(javaClass<E1>())
|
||||
fun one() {}
|
||||
|
||||
throws(javaClass<E1>(), javaClass<E2>())
|
||||
fun two() {}
|
||||
@@ -0,0 +1,17 @@
|
||||
class JavaClass {
|
||||
void testMethod() {
|
||||
Test test = new Test();
|
||||
test.none();
|
||||
|
||||
try {
|
||||
test.one();
|
||||
}
|
||||
catch (E1 e) {}
|
||||
|
||||
try {
|
||||
test.two();
|
||||
}
|
||||
catch (E1 e) {}
|
||||
catch (E2 e) {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
class E1: Exception()
|
||||
class E2: Exception()
|
||||
|
||||
trait Trait {
|
||||
throws()
|
||||
fun none() {}
|
||||
|
||||
throws(javaClass<E1>())
|
||||
fun one() {}
|
||||
|
||||
throws(javaClass<E1>(), javaClass<E2>())
|
||||
fun two() {}
|
||||
}
|
||||
|
||||
class Test: Trait
|
||||
Reference in New Issue
Block a user