Generic marshalledName for functions.

Move Java-specific code to lang-java.

The generic code will work with the forthcoming "plain C++"
wrappers that are intended for use by multiple languages.