PROPOSAL: Sameness operators (version 2)
mthornton at optrak.co.uk
Fri May 1 01:33:53 PDT 2009
Derek Foster wrote:
> This would only happen in generated code (the only place a $ character is supposed to be used, according to the JLS), and is expected to be an extremely rare phenomenon, since generated code rarely starts identifiers with dollar signs, and also usually generates code with spaces around operators for readability. This problem can be easily fixed when upgrading to Java 7 by altering the code generator to put a space in front of any such identifiers, either globally or only when they follow a < or > character. Note that internal synthetic variables generated by a compiler in a class file would be immune from this problem since they would never appear in source code form.
I use a code generator to automatically generate a test class when a bug
occurs. The test class includes all the data necessary to reproduce the
bug automatically under JUnit. It isn't possible in this case to rerun
the code generator --- hopefully I will have fixed the bug, and in many
cases the code which gives rise to the bug uses random numbers.
Fortunately I use very few variables in this code and none containing $,
but other people may have written similar generators which have used $
(after all the JLS could be read as an invitation to use $ in generated
names). As it happens I will have to introduce more variables as the
current code is giving rise to stack overflow in the compiler (long
chains of methods, where long is ~ 50 in a statement).
More information about the coin-dev