question of compiler code
Jonathan Gibbons
Jonathan.Gibbons at Sun.COM
Tue Sep 1 18:18:32 PDT 2009
ÎÒ²»ÖªµÀ wrote:
> I am sorry, I do not speak English, but there are problems on the
> compiler.
> Hope to get help,Thanks.
>
> (source code version:openjdk-7-ea-src-b70-20_aug_2009)
> 1,
> --------------------------------------source begin
> package com.sun.tools.javac.util;
> public interface LayoutCharacters
> /** Tabulator character.
> */
> final static byte TAB = 0x8;
> ---------------------------------------source end
> ---------------------------------------question begin
> TAB = 0x8;???
> (ASCII-TAB==0x9??)
> ---------------------------------------question end
Yes, this is an error, but the value TAB is unused, so
there is no incorrect behavior. The value should be
fixed or deleted. I have filed CR 6878146.
>
> 2,
> --------------------------------------source begin
> package com.sun.tools.javac.parser;
> private void scanOperator() {
> while (true) {
> putC har(ch);
> Name newname = names.fromChars(sbuf, 0, sp);
> if (keywords.key(newname) == IDENTIFIER) {
> sp--;
> break;
> }
> ---------------------------------------source end
> ---------------------------------------question begin
> keywords.key(newname) == IDENTIFIER;
> Special Operator--> IDENTIFIER ?
> ---------------------------------------question end
This looks like defensive programming since Keywords.key(Name)
can return IDENTIFIER. The normal exit from the loop is here:
if (!isSpecial(ch)) break;
>
> mail end
> Thanks
> ------------------------------------------------------------------------
> ʹÓÃÐÂÒ»´ú Windows Live Messenger ÇáËɽ»Á÷ºÍ¹²Ïí£¡ Á¢¿ÌÏÂÔØ£¡
> <http://www.windowslive.cn/Messenger/>
-- Jonathan Gibbons
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20090901/d5cd0805/attachment.html
More information about the compiler-dev
mailing list