From a8046020fb173335694048d89f571c48bc50c267 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Tue, 3 Mar 2015 17:23:21 +0300 Subject: [PATCH] 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 --- .../callableReference/property/privateClassVal.kt | 6 +++--- .../callableReference/property/privateClassVar.kt | 6 +++--- .../callableReference/property/protectedClassVar.kt | 6 +++--- core/reflection.jvm/src/kotlin/reflect/exceptions.kt | 2 +- .../kotlin/reflect/jvm/internal/KForeignMemberProperty.kt | 8 ++++---- .../kotlin/reflect/jvm/internal/KMemberPropertyImpl.kt | 8 ++++---- .../jvm/internal/KTopLevelExtensionPropertyImpl.kt | 8 ++++---- .../kotlin/reflect/jvm/internal/KTopLevelVariableImpl.kt | 8 ++++---- core/runtime.jvm/src/kotlin/jvm/internal/Reflection.java | 2 +- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/compiler/testData/codegen/boxWithStdlib/callableReference/property/privateClassVal.kt b/compiler/testData/codegen/boxWithStdlib/callableReference/property/privateClassVal.kt index 74399986a8f..c6ed7d44c65 100644 --- a/compiler/testData/codegen/boxWithStdlib/callableReference/property/privateClassVal.kt +++ b/compiler/testData/codegen/boxWithStdlib/callableReference/property/privateClassVal.kt @@ -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 } diff --git a/compiler/testData/codegen/boxWithStdlib/callableReference/property/privateClassVar.kt b/compiler/testData/codegen/boxWithStdlib/callableReference/property/privateClassVar.kt index 42fde2a640f..f8f4d8226ca 100644 --- a/compiler/testData/codegen/boxWithStdlib/callableReference/property/privateClassVar.kt +++ b/compiler/testData/codegen/boxWithStdlib/callableReference/property/privateClassVar.kt @@ -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" } diff --git a/compiler/testData/codegen/boxWithStdlib/callableReference/property/protectedClassVar.kt b/compiler/testData/codegen/boxWithStdlib/callableReference/property/protectedClassVar.kt index 35237e8c153..9263a9b188f 100644 --- a/compiler/testData/codegen/boxWithStdlib/callableReference/property/protectedClassVar.kt +++ b/compiler/testData/codegen/boxWithStdlib/callableReference/property/protectedClassVar.kt @@ -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 diff --git a/core/reflection.jvm/src/kotlin/reflect/exceptions.kt b/core/reflection.jvm/src/kotlin/reflect/exceptions.kt index 850e660d943..c8632479a8e 100644 --- a/core/reflection.jvm/src/kotlin/reflect/exceptions.kt +++ b/core/reflection.jvm/src/kotlin/reflect/exceptions.kt @@ -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) } diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KForeignMemberProperty.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KForeignMemberProperty.kt index 3657fd4784b..2887cad2f3d 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KForeignMemberProperty.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KForeignMemberProperty.kt @@ -36,8 +36,8 @@ open class KForeignMemberProperty( 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( try { field.set(receiver, value) } - catch (e: java.lang.IllegalAccessException) { - throw kotlin.reflect.IllegalAccessException(e) + catch (e: IllegalAccessException) { + throw IllegalPropertyAccessException(e) } } diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KMemberPropertyImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KMemberPropertyImpl.kt index 93269825fda..a952bc6d715 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KMemberPropertyImpl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KMemberPropertyImpl.kt @@ -50,8 +50,8 @@ open class KMemberPropertyImpl( 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( 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) } } diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KTopLevelExtensionPropertyImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KTopLevelExtensionPropertyImpl.kt index 6be866dc6bb..41e2d712be0 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KTopLevelExtensionPropertyImpl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KTopLevelExtensionPropertyImpl.kt @@ -38,8 +38,8 @@ open class KTopLevelExtensionPropertyImpl( 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( try { setter.invoke(null, receiver, value) } - catch (e: java.lang.IllegalAccessException) { - throw kotlin.reflect.IllegalAccessException(e) + catch (e: IllegalAccessException) { + throw IllegalPropertyAccessException(e) } } diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KTopLevelVariableImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KTopLevelVariableImpl.kt index b4d7903d10f..234e9ac7f18 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KTopLevelVariableImpl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KTopLevelVariableImpl.kt @@ -38,8 +38,8 @@ open class KTopLevelVariableImpl( 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( try { setter.invoke(null, value) } - catch (e: java.lang.IllegalAccessException) { - throw kotlin.reflect.IllegalAccessException(e) + catch (e: IllegalAccessException) { + throw IllegalPropertyAccessException(e) } } diff --git a/core/runtime.jvm/src/kotlin/jvm/internal/Reflection.java b/core/runtime.jvm/src/kotlin/jvm/internal/Reflection.java index e80f515a2b6..f6da8f40534 100644 --- a/core/runtime.jvm/src/kotlin/jvm/internal/Reflection.java +++ b/core/runtime.jvm/src/kotlin/jvm/internal/Reflection.java @@ -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(); }