https://kotlinlang.org logo
Title
j

Jason5lee

05/01/2021, 2:42 PM
Why
kotlin.io.AccessDeniedException
isn’t a alias of
java.nio.AccessDeniedException
on JVM? Why creating such a new class that might confused the user that tries to catch this exception?
n

nanodeath

05/01/2021, 2:52 PM
hm, what's it thrown by?
only reason I can think of is multiplatform
j

Jason5lee

05/01/2021, 3:14 PM
I’m calling Java’s file IO (AFAIK kotlin has no own file IO except some extension methods of Java’s type), which throws
java.nio.AccessDeniedException
. I wrongly catch
kotlin.io.AccessDeniedException
and realizes it doesn’t work and it’s not an alias (as other kotlin standard types are). Not a big deal but it’s confusing.
As I did more research I found
kotlin.io.AccessDeniedException
seems to be not used in Kotlin standard library so I’m quite confused about its existence only used in
FileTreeWalk
.
n

nanodeath

05/01/2021, 3:19 PM
FileTreeWalk
uses it
but yeah I can see how that'd be confusing