Re:Please stop saying Java sucks
by AnimalMuppet on Wednesday June 24, 2015 @12:17PM
(#9772607)
Could you be more specific? How is it really annoying to define new types in Java?
[ Parent
| on HN ]
Re:Please stop saying Java sucks
by SamReidHughes on Wednesday June 24, 2015 @01:05PM
(#9772959)
You have to manually define its constructor, manually provide getters if you want the value to be immutable, put each class in a separate file (or namespaced inside another class), and if your type has finitely many alternatives you have to set up the whole visitor pattern thing. Compare that with C#'s properties and readonly, Scala's case classes, Swift's enum types.
Making immutable structures in Java truly does suck... this is the most valid complaint that I've heard in a long time about the language.
It would be extremely easy to implement properties as syntactic sugar in the language or via built-in annotations without changing the class file spec at all.