.java to binary compilation problem

Jeff Sturm jsturm@sigma6.com
Mon Nov 1 12:57:00 GMT 1999


Per Bothner wrote:
>> Jeff Sturm <jsturm@sigma6.com> writes:
>> > gcj seems to have trouble with ambiguous syntax, like member names vs.
> > subpackages. Try shortening this to:
> >
> > public boolean func() { Context.out.println( "Yo!"); }
> >
> > and use an explicit import:
> >
> > import spec.harness.Context;
> >
> > Let us know if that compiles.
>> I hope not. I'm fairly sure that is not valid Java.
>> Check 6.5.3.1 in the JLS. It says "top-level package".
> "Context" is not a "top-level package".

I'm confused. "Context" is a class name, not a package. The
fully-qualified name is "spec.harness.Context". I don't understand why
the package naming rules are relevant.
6.5.2 describes a recursive process to resolve contextually ambiguous
names. It seems to say a statement like:
 java.lang.System.out.println(msg);
should compile. Javac will compile it, gcj cannot.
Regardless of which is correct and which conforms to the JLS, a lot of
existing Java code does not compile under gcj because of this "feature".
-- 
Jeff Sturm
jsturm@sigma6.com


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /