playframework/Play20 — pull request #481 by deansher (2012-10-11 19:51:30+00:00)
Title: 2012.10.11.deansher

In spite of 5a971da (which supports a more liberal set of Java class names, and is cherry-picked as part of this branch), Play still does not support some of our valid and reasonable fully qualified Java class names. The issue now (addressed here) is the set of valid package identifier elements.

In Play master (the old, incorrect logic), a Java package name element is defined by the regex [a-z]+. A Java class name is defined as any valid Java identifier. The parsing of a routes file looks for a series of dot-delimited [a-z]+ elements followed by any valid Java identifier not matching that pattern, which is taken to be the class name.

In my version, a Java package name element is defined to be a lowercase letter followed by a sequence of valid Java "identifier parts". A Java class name is defined to be an uppercase letter that is then also followed by a sequence of valid Java "identifier parts". This leaves some valid Java identifiers (such as those beginning with '$' or '_') that the routes file compiler will not accept, but it eliminates the ambiguity, and I believe it will work for almost all real Java or Scala code.