[169] in java-interest
Re: non-public classes in packages
daemon@ATHENA.MIT.EDU (Arthur van Hoff)
Thu Jun 1 18:24:56 1995
Date: Thu, 1 Jun 1995 15:12:40 -0700
From: Arthur.Vanhoff@Eng.Sun.COM (Arthur van Hoff)
To: java-interest@java.Eng.Sun.COM
Hi Bert,
> I tried to define an ApplyButton class in following code:
>
> package X;
> import awt.*;
> import browser.*;
>
> class X extends Object {
> public X() {
> new ApplyButton(this);
> }
> }
> class ApplyButton extends Button {
> private X x;
> public ApplyButton(X x) {
> super(null,null,(Window)null);
> }
> }
>
>
> I get the compiler error:
> "Ambiguous class: browser.ApplyButton and X.ApplyButton"
>
> If I take the package statement out I get the compiler errors:
> "Invalid method declaration, return type required"
> and
> "Can't access class ApplyButton. Only public classes and interfaces in other packages can be accessed"
>
> If browser.ApplyButton is not public why should the importing
> browser.* cause a name conflict?
Good point. This is probably a bug in the compiler. I'll take a look
at it. For now just the fully qualified name X.ApplyButton.
Have fun,
Arthur van Hoff (avh@eng.sun.com)
http://java.sun.com/people/avh/
PS: For questions about HotJava and/or Java please use our
mailing lists java-interest@java.sun.com or hotjava-interest@java.sun.com
instead of mailing me directly. Thanks.
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com