This is the mail archive of the mailing list for the Java project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Freenet compilation errors.

>>>>> "Mark" == Mark J Roberts <> writes:

Mark> public class Test {
Mark>     public static void main(String[] args) {
Mark>         System.out.println(Bug.other.OtherClass.number);
Mark>     }
Mark> }

Mark> [root@rm03-24-131-185-22 /freenet]# gcj -o test --main=Bug.Test
Mark> Bug/ Bug/other/
Mark> Bug/ In class `Bug.Test':
Mark> Bug/ In method `main(java.lang.String[])':
Mark> Bug/ Internal error: Segmentation fault.
Mark> Please submit a full bug report.
Mark>  See <URL:> for instructions.

I looked at this a bit.

The problem introduces itself in parse.y:resolve_package().
This code:

  /* Try the current package. */
  if (ctxp->package && !strncmp (name, IDENTIFIER_POINTER (ctxp->package),  
				 IDENTIFIER_LENGTH (ctxp->package)))

decides that `Bug.other.OtherClass.number' must be in the current
package, and that `Bug.other' must therefore be the type.

Of course, this is wrong.

If I let the body of the `if' run and then set `type_name' to null
before it has a chance to test and return, then things compile

I don't know this code well enough to suggest a fix though.  Alex, is
this test for the current package just an optimization?  If so perhaps
we can just remove it, or further refine it so that it only returns if
there is not a remaining `.' in the name, or something like that.

Also, there is some code at the top of this function to optimize for
java.lang and java.lang.reflect.  Shouldn't java.lang.ref also be
checked for there?

Finally, I don't understand the loop marked `Search in imported
package'.  This loop does a `break' when it find the answer.  But the
answer seems to be ignored by the rest of the function; instead it
looks like it can be overwritten by the "progressive construction"
loop.  Maybe I'm misreading this though.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]