Invoking a static method with 0 parameters yields a NoSuchFieldException:
Cause: This particular path in the Compiler covers both static field access and 0 argument static method invocation and in this case results in a confusing exception.
Patch with whitespace differences ignored, intended only for review purposes, not for committing: clj-1130-v2-ignore-ws.diff
Approach: The guess that the form is trying to access a static field is still done the same as before. However, with the patch it will now check for a field with the specified name, and if there is none, the compiler will assume that the user is really trying to invoke a static method.
The error message for attempting to call a static method now gives more details about the erroneous attempt, including the class name and that there is no such method that takes <n> arguments, where <n> is the number of arguments in the attempted method call.
Screened by: Alex Miller. Question: Is the performance impact prohibitive to add this reflective check for the existence of a static field when compiling 0-arg calls to static methods or static fields? It would be a bigger change (I think) but it might alternately be possible to do this check only in the case of a failure.