lex.c oddity

Jeff Sturm jsturm@one-point.com
Wed Nov 19 21:54:00 GMT 2003

On 18 Nov 2003, Tom Tromey wrote:

> >>>>> "Jeff" == Jeff Sturm <jsturm@one-point.com> writes:
> Jeff> While debugging the parser, I stumbled across this code in java_init_lex:
> Jeff>   int java_lang_imported = 0;
> Jeff>   ...
> Jeff>   if (!java_lang_imported)
> Jeff>     {
> Jeff>       ...
> Jeff>       java_lang_imported = 1;
> Jeff> Clearly the conditional is always taken.  Was this meant to be declared
> Jeff> static?  (I tried; it doesn't work.)
> Sure looks that way, doesn't it?
> Hmm, that line predates the import into the public gcc tree.
> At this point, probably no-one knows what was intended here.
> What happens when you change this to static?

Nothing good.  It doesn't seem to find java.lang at all:

../../../libjava/java/awt/AWTPermission.java:103: error: Type `String' not
found in the declaration of the argument `name' of method `<init>'.
     public AWTPermission(String name)

> Perhaps we're supposed to read java.lang for each file.  That makes
> sense in a way... but then, I've never really read through the import
> handling code.

Yeah.  It may have been meant as an optimization but I'm inclined to just
remove it.


More information about the Java mailing list