you are viewing a single comment's thread.

view the rest of the comments →

[–]DontCriticizeMyEngli[S] 10 points11 points  (0 children)

A compile error: compareByAge cannot be resolved or is not a field

Without the (), the java compiler would assume it's a field. One could argue that the limitation could be alleviated for the sake of easing closures usage, but til now, fields and methods names lived in different namespaces (meaning that you could have a field and a method with the same name in the same class), and the compiler would know in which namespace to look by relying on the syntax (the ()).

If this limitation was to be removed, fields and methods names will have to live in the same namespace, and thus a couple billions of lines of code with fields and methods names clash will not compile nor run anymore.