[m-rev.] diff: java name mangling
pbone at csse.unimelb.edu.au
Wed Apr 22 16:42:17 AEST 2009
On Wed, Apr 22, 2009 at 04:37:04PM +1000, Peter Wang wrote:
> Julien ok'd the package name mangling in email.
> Branches: main
> Java backend name mangling fun:
> 1. Java doesn't allow a class name to have the same name as a package, which
> conflicts with Mercury nested modules. Work around this problem by suffixing
> package name components with underscores. For example, the Mercury module
> `mammal.primate.chimp' would correspond to a Java class `chimp' in the package
> `mammal_.primate_'. The exceptions to this are the `mercury' and
> `mercury.runtime' as the first two package name components.
> 2. When compiling the standard library, javac aborts on the name of a `.class'
> file generated for a nested class, saying the file name is too long. Avoid the
> problem by arbitrarily shortening the names of wrapper classes generated for
> taking the addresses of predicates. (In the future we may need to do more of
> the same in other contexts but this is enough for the standard library.)
It will be interesting to test things such as the second point here against
other java versions and implementations such as gjc.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 197 bytes
Desc: Digital signature
More information about the reviews