|
|
|
|
|
by bronty
4470 days ago
|
|
Java 8 adds support for type annotations, which enables developers to write code such as: @Currency("USD") double amount; These annotations can be checked automatically using a compiler plug-in, such as the Checker Framework [1]. The Checker Framework comes pre-packaged with a units checker [2] along with checkers for null pointer errors, locks, string formatting, security, and many more. Java's domain-specific language (DSL) features aren't as rich as Scala's. However, you could implement some DSL-like features using aspect-oriented programming (AOP) tools or other similar compiler plug-ins. [1] http://types.cs.washington.edu/checker-framework/
[2] http://types.cs.washington.edu/checker-framework/current/che... |
|
Given the choice I always pick Scala over Java. Maintaining legacy Java code with AspectJ, Lombok and other behind-your-back bytecode manipulations are literally the bane of my existence.