I would like to disable automatic import of stdlib’s Result class, as I have my own implementation, but imports are always breaking as stdlib implementation has priority. Anyone knows how to deal with this?
b
Ben Woodworth
05/21/2021, 2:40 PM
I generally try to avoid naming things the same. Is there something about your class that differentiates it from the stdlib's? You might be able to name it based on that
s
solidogen
05/21/2021, 2:46 PM
Classes often have the same name (f.e. JDK class vs Android SDK bundled equivalent) and it isn't a problem.
Problem is, using Result class from stdlib doesn't involve explicit import at top of file. I want to get rid of it, as all usage is implied to be kotlin.Result and it's super annoying. You don't get a choice what you want to use unless you write/paste this import yourself.
v
Victor Cardona
05/24/2021, 5:13 AM
As I see it you have two options:
1. Always use your Result classes’ fully qualified name.
2. You could do this in files where you use your result class :