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
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package kotlin.reflect
|
||||
|
||||
suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
|
||||
public class IllegalAccessException(cause: java.lang.IllegalAccessException) : Exception() {
|
||||
public class IllegalPropertyAccessException(cause: IllegalAccessException) : Exception(cause.getMessage()) {
|
||||
{
|
||||
(this as java.lang.Throwable).initCause(cause)
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ open class KForeignMemberProperty<T : Any, out R>(
|
||||
try {
|
||||
return field.get(receiver) as R
|
||||
}
|
||||
catch (e: java.lang.IllegalAccessException) {
|
||||
throw kotlin.reflect.IllegalAccessException(e)
|
||||
catch (e: IllegalAccessException) {
|
||||
throw IllegalPropertyAccessException(e)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@ class KMutableForeignMemberProperty<T : Any, R>(
|
||||
try {
|
||||
field.set(receiver, value)
|
||||
}
|
||||
catch (e: java.lang.IllegalAccessException) {
|
||||
throw kotlin.reflect.IllegalAccessException(e)
|
||||
catch (e: IllegalAccessException) {
|
||||
throw IllegalPropertyAccessException(e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ open class KMemberPropertyImpl<T : Any, out R>(
|
||||
try {
|
||||
return (if (getter != null) getter!!(receiver) else field!!.get(receiver)) as R
|
||||
}
|
||||
catch (e: java.lang.IllegalAccessException) {
|
||||
throw kotlin.reflect.IllegalAccessException(e)
|
||||
catch (e: IllegalAccessException) {
|
||||
throw IllegalPropertyAccessException(e)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,8 +87,8 @@ class KMutableMemberPropertyImpl<T : Any, R>(
|
||||
try {
|
||||
if (setter != null) setter!!(receiver, value) else field!!.set(receiver, value)
|
||||
}
|
||||
catch (e: java.lang.IllegalAccessException) {
|
||||
throw kotlin.reflect.IllegalAccessException(e)
|
||||
catch (e: IllegalAccessException) {
|
||||
throw IllegalPropertyAccessException(e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -38,8 +38,8 @@ open class KTopLevelExtensionPropertyImpl<T, out R>(
|
||||
try {
|
||||
return getter(null, receiver) as R
|
||||
}
|
||||
catch (e: java.lang.IllegalAccessException) {
|
||||
throw kotlin.reflect.IllegalAccessException(e)
|
||||
catch (e: IllegalAccessException) {
|
||||
throw IllegalPropertyAccessException(e)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ class KMutableTopLevelExtensionPropertyImpl<T, R>(
|
||||
try {
|
||||
setter.invoke(null, receiver, value)
|
||||
}
|
||||
catch (e: java.lang.IllegalAccessException) {
|
||||
throw kotlin.reflect.IllegalAccessException(e)
|
||||
catch (e: IllegalAccessException) {
|
||||
throw IllegalPropertyAccessException(e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ open class KTopLevelVariableImpl<out R>(
|
||||
try {
|
||||
return getter(null) as R
|
||||
}
|
||||
catch (e: java.lang.IllegalAccessException) {
|
||||
throw kotlin.reflect.IllegalAccessException(e)
|
||||
catch (e: IllegalAccessException) {
|
||||
throw IllegalPropertyAccessException(e)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,8 +69,8 @@ class KMutableTopLevelVariableImpl<R>(
|
||||
try {
|
||||
setter.invoke(null, value)
|
||||
}
|
||||
catch (e: java.lang.IllegalAccessException) {
|
||||
throw kotlin.reflect.IllegalAccessException(e)
|
||||
catch (e: IllegalAccessException) {
|
||||
throw IllegalPropertyAccessException(e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public class Reflection {
|
||||
catch (ClassCastException e) { impl = null; }
|
||||
catch (ClassNotFoundException e) { impl = null; }
|
||||
catch (InstantiationException e) { impl = null; }
|
||||
catch (java.lang.IllegalAccessException e) { impl = null; }
|
||||
catch (IllegalAccessException e) { impl = null; }
|
||||
|
||||
factory = impl != null ? impl : new ReflectionFactory();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user