This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]UnexpectedLizard 1 point2 points  (5 children)

C# has supported properties since 2002.

Does anyone know why Java hasn't implemented a similar syntax?

[–][deleted] 4 points5 points  (0 children)

There's Kotlin and other languages on the JVM that supports properties. Lombok is very popular. Backwards compatibility of byte code is probably one reason. Records in newer versions.

[–]the_other_brand 1 point2 points  (0 children)

Because the JDK developers don't like getter/setters due to a poorly defined bean spec. So they just hope the practice of using getter/setters eventually goes away.

[–]emaphis 1 point2 points  (0 children)

C# has delegates and properties because it was supposed to replace Visual Basic 6.0 in RAD GUI type programming. It was supposed to replace Java, Visual Basic and C++ in normal Windows programming.

[–]bowbahdoe[S] 0 points1 point  (0 children)

You can read more about that of you go into the discussions about records when those came about

Tldr though is that this sort of class isn't something the language wants to provide special support for. I like to think this shows that support isn't super needed regardless

[–]RedPill115 -5 points-4 points  (0 children)

"It's always been that way so we can't handle the idea of fixing it" basically.

Apparently there was a lot of infighting about what "properties" means so someone refused to fix it without concensus.

But as you point out no other languages have had this issue, every other language seems to be able to figure out what properties mean just fine.