how does the JLS deal with the >> ambiguity?
sf
sf@b-i-t.de
Thu Sep 15 12:51:00 GMT 2005
Adam Megacz wrote:
> This probably isn't the perfect mailing list for this, but it's close ;)
>
> In C++ there's a known ambiguity where you have to put a space between
> two right-angle brackets in a template instantiation:
>
> Foo<Bar,Baz<Bop> >
>
> Otherwise the ">>" is treated as the "shift-right" token by the lexer.
>
> I was wondering how JLS 1.5 handles this, since Javac seems to do just
> fine when the space isn't there. The JLS itself isn't sufficiently
> formal at the lexical level to clarify this -- it just says that '>'
> "is a token" and '>>' "is a token".
There is a section called "2.3 Handling Consecutive Type Parameter
Brackets" in
http://www.cis.unisa.edu.au/~pizza/gj/Documents/gj-specification.pdf.
As I understand it all cases of single and double (and in Java even
triple) right-angle braces are handled in the parser.
Hope it helps
Stephan
More information about the Java
mailing list