top | item 40512114

(no title)

the-alchemist | 1 year ago

Don't quite understand the hate. This is very reasonable behavior for a compiler in 2024. I would even go so far as to say that a compiler should never execute any user code by default.

Imagine if gcc could automatically, by default, download some shared library and include it in the build because of a special macro included by a random header file on the system.

Of course, this change is optional (just add `-proc:full` to the command line) if you want the old, less secure behavior.

Also, Lombok is not affected because it's not an annotation processor. (Also, look at Immutables: https://immutables.github.io/).

discuss

order

cies|1 year ago

I find it a great improvement. Secure by default.

To me the hate started when Java went from a statically compiled languages, to a half way dynamic language that does a fair bit of compilation at application startup, based on a bunch of annotations. Suddenly many Java projects introduced Ruby-on-Rails level "magic" (yes looking at you Spring(Boot)).

I'm not totally against annotations, but it's easier to over use them just to remove a bit of boiler plate.

To me Kotlin's approach makes more sense: reduce boilerplate by making the language more expressive, adding KClass and KFunction (https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect) while mostly avoiding annotations and exceptions.

Kotlin also has a nice story for immutability.