[Java Spec Report] import static and Object's method

RĂ©mi Forax <[email protected]> Thu, 15 Jul 2004 22:52:43 +0200
Newsgroups gmane.comp.java.spec-report
Message-ID <[email protected]>
Hi everybody,
to explain to one of my friend how static import works,
i write the following code :

package fr.umlv.asmvisitor;

import static fr.umlv.asmvisitor.A.*;

class A {
   public static int finalize(int i) {
     return i;
   }
   public static int finalize2(int i) {
       return i;
   }
}

public class Test {
   public static void main(String[] args) {
     System.out.println(finalize2(3));
     System.out.println(finalize(3));  // this line is rejected by javac
   }
}

And the compiler rejects the last line with a weird message :
"finalize() in java.lang.Object cannot be applied to (int)".

So, i post a bug report but Johnathan
(X from Sun, i don't know his name) reply me this comment :

[quote]This behavior is expected.  The calls to finalize() do not 
referred to any class.  Try using "A.finalize2()" and "A.finalize()".[quote]

What do you think about this ?

Remi Forax


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/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/