Re: [Java Spec Report] static import question
Neal Gafter <[email protected]> Sun, 21 Mar 2004 12:40:35 -0800
| Newsgroups | gmane.comp.java.spec-report |
|---|---|
| Message-ID | <[email protected]> |
You are correct - it should be an error. I'll take a note of the javac bug and
aim to fix it for tiger-beta2.
-Neal
Timothy Hanson wrote:
> In the example below, Test imports method m1 via a single static import, and there is also an m1 in T2 that is imported via a static import on-demand. Is the invocation of m1() with no arguments ok?
>
> In the spec section 7.5.3 para 3, it says: "A single-static import declaration d in a compilation unit c of package p that imports a member named n shadows the declaration of any static member named n imported by a static import-on-decmand declaration in c, throughout c."
>
> To me this implies that T2.m1 shadows T1.m1, even though T2.m1() is not applicable.
>
> Thanks,
> Tim
>
>
> --- File Test.java ----
>
> package p1;
> import static p1.T1.*;
> import static p1.T2.m1;
>
> public class Test {
> void foo() {
> m1(); // <-- is this an error?
> }
> }
>
> --- File T1.java ---
>
> package p1;
>
> public class T1 {
> public static void m1();
> }
>
> --- File T2.java ---
>
> package p1;
> public class T2 {
> public static void m1(int i) {}
> }
>
>
> To unsubscribe from this mailing list, send an email to:
> [email protected]
>
> Yahoo! Groups Links
>
>
>
>
>
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Upgrade to 128-bit SSL Security!
http://us.click.yahoo.com/LPJzrA/yjVHAA/TtwFAA/5cFolB/TM
---------------------------------------------------------------------~->
To unsubscribe from this mailing list, send an email to:
[email protected]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/java-spec-report/
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/