Rename kotlin.reflect.IllegalAccessException -> IllegalPropertyAccessException
The former name clashes with java.lang.IllegalAccessException and proved to be inconvenient because it should always be qualified in the source. Also use java.lang exception's message as kotlin.reflect exception's message
This commit is contained in:
+3
-3
@@ -1,4 +1,4 @@
|
||||
import kotlin.reflect.IllegalAccessException
|
||||
import kotlin.reflect.IllegalPropertyAccessException
|
||||
import kotlin.reflect.KMemberProperty
|
||||
import kotlin.reflect.jvm.accessible
|
||||
|
||||
@@ -13,7 +13,7 @@ fun box(): String {
|
||||
try {
|
||||
p.get(Result())
|
||||
return "Fail: private property is accessible by default"
|
||||
} catch(e: IllegalAccessException) { }
|
||||
} catch(e: IllegalPropertyAccessException) { }
|
||||
|
||||
p.accessible = true
|
||||
|
||||
@@ -23,7 +23,7 @@ fun box(): String {
|
||||
try {
|
||||
p.get(Result())
|
||||
return "Fail: setAccessible(false) had no effect"
|
||||
} catch(e: IllegalAccessException) { }
|
||||
} catch(e: IllegalPropertyAccessException) { }
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
import kotlin.reflect.IllegalAccessException
|
||||
import kotlin.reflect.IllegalPropertyAccessException
|
||||
import kotlin.reflect.KMutableMemberProperty
|
||||
import kotlin.reflect.jvm.accessible
|
||||
|
||||
@@ -14,7 +14,7 @@ fun box(): String {
|
||||
try {
|
||||
p.set(a, 1)
|
||||
return "Fail: private property is accessible by default"
|
||||
} catch(e: IllegalAccessException) { }
|
||||
} catch(e: IllegalPropertyAccessException) { }
|
||||
|
||||
p.accessible = true
|
||||
|
||||
@@ -25,7 +25,7 @@ fun box(): String {
|
||||
try {
|
||||
p.set(a, 3)
|
||||
return "Fail: setAccessible(false) had no effect"
|
||||
} catch(e: IllegalAccessException) { }
|
||||
} catch(e: IllegalPropertyAccessException) { }
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
import kotlin.reflect.IllegalAccessException
|
||||
import kotlin.reflect.IllegalPropertyAccessException
|
||||
import kotlin.reflect.jvm.accessible
|
||||
|
||||
class A(param: String) {
|
||||
@@ -14,12 +14,12 @@ fun box(): String {
|
||||
try {
|
||||
f.get(a)
|
||||
return "Fail: protected property getter is accessible by default"
|
||||
} catch (e: IllegalAccessException) { }
|
||||
} catch (e: IllegalPropertyAccessException) { }
|
||||
|
||||
try {
|
||||
f.set(a, ":D")
|
||||
return "Fail: protected property setter is accessible by default"
|
||||
} catch (e: IllegalAccessException) { }
|
||||
} catch (e: IllegalPropertyAccessException) { }
|
||||
|
||||
f.accessible = true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user