I just don't understand where there's syntax sugar for propeties in Java. There are lot of unneeded stuff added, that I don't really care about. But my classes are still full of autogenerated getters/setters. I recently tried to find some JEP and I did not find one. There was some talk around Java 7, but nothing since that. Nobody even wants to add properties support for Java?
Interesting how that goes...: the sibling comment to yours said the exact opposite. How does this feature get in your way?
if (this.prop != null) {
this.prop.something() // does not work
}
this construction works for local variables, but not for properties. Yeah, theoretically it could be modified by another thread or function in the middle. In practice it does not happen and I'm forced to use terrible code like this.prop?.apply { prop ->
prop.something()
}
(this example could be written as this.prop?.something() but that's not the point, usually it's harder than that.2. Interoperation problem. A lot of Java code does not use @Nullable annotations, so all types are just that: platform types. So Kotlin nullability adds nothing to that.
EDIT: to clarify: for example, I consider std::optional as an example of a very "un-OO" type that's immensely useful. In general I like the idea from functional programming that complex types can be treated no different than primitives, rather than the OO way of wrapping and uplifting everything until even integers have methods.
Since when are nulls the biggest problem for developers? Null pointer exceptions are by far some the simplest problems to avoid and/or solve.
There are more serious arguments that can be made in favor of Kotlin.
But they are a problem that happens, and in Kotlin, the compiler checks your nullable logic for you; instead of your users finding the errors at runtime.
People will murder all kinds of productivity to avoid potential NPEs, when as you say they are generally the easiest bugs in the world to contend with.
It is beyond baffling to me, and given how often I hear it, it makes me question the dev world’s sanity.
For this same reason I don't care for NullObject/Maybe/Optional type approaches which simply do not change the branching forking in your code:
if (val == null) { ...logic... }
This branching here ^ is not improved at all by a different syntactical representation: ((Optional) val).ifNull(v -> ...logic...)
You are still branching, so in my opinion you've made no substantial improvement here. (I can already hear the "but, but..."s.Optional to me is a large leap forward. That being said, I also don't like its verbosity and wish for it to be improved somehow.
It usually ends up at odds with better objectives & heavily taxes conscientious developers, for whom we should really be optimizing things imo.
It's not just syntax sugar.
KVM might well turn out to be ART, but that is the extent of it.
For example, the graphical debugger for Kotlin/Native is only available in Clion.
There is even a statement in that regard.