Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Problem with annotation
Problem with annotation [message #164548] Tue, 08 August 2006 14:55 Go to next message
Pavan is currently offline PavanFriend
Messages: 11
Registered: July 2009
Junior Member
Hi,
When i am trying to compile the following code in eclipse 3.2 it gives me
an error

class parent
{
public static void call()
{
System.out.println("I am parent");
}
}

class Child extends parent
{
@Override public static void call()
{
System.out.println("I am child");
}
}


Whereas, when i compile the same code using eclipse 3.1.2 it compiles
fine. what's the problem?
Re: Problem with annotation [message #164556 is a reply to message #164548] Tue, 08 August 2006 15:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: hendrik_maryns.despammed.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Pavan Kumar Mankala schreef:
> Hi,
> When i am trying to compile the following code in eclipse 3.2 it gives
> me an error
>
> class parent
> {
> public static void call()
> {
> System.out.println("I am parent");
> }
> }
>
> class Child extends parent
> {
> @Override public static void call()
> {
> System.out.println("I am child");
> }
> }
>
>
> Whereas, when i compile the same code using eclipse 3.1.2 it compiles
> fine. what's the problem?

Which error? Did you switch to 1.5 compliance?

H.
- --
Hendrik Maryns

==================
http://aouw.org
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFE2Kcee+7xMGD3itQRAnY0AJ4tTIRR3VcRCi5VBxbL1mjTjcM65ACf SrHE
3uIonsouFPfGB12mYZelZ+E=
=56Gq
-----END PGP SIGNATURE-----
Re: Problem with annotation [message #164586 is a reply to message #164556] Tue, 08 August 2006 15:49 Go to previous messageGo to next message
Pavan is currently offline PavanFriend
Messages: 11
Registered: July 2009
Junior Member
The error was

"The method call() of type Child must override a superclass method"

Yes, i did set my project compliance level as 5.0. When i remove the
@Override annotation it complies fine. Can ne1 pls help in this regard.
Re: Problem with annotation [message #164593 is a reply to message #164586] Tue, 08 August 2006 16:08 Go to previous messageGo to next message
Erkki Lindpere is currently offline Erkki LindpereFriend
Messages: 90
Registered: July 2009
Member
I think with static methods, this is called Hiding, not Overriding.

http://java.sun.com/docs/books/jls/third_edition/html/classe s.html#8.4.8.2

Eclipse seems to behave correctly then.

Pavan Kumar Mankala wrote:
> The error was
>
> "The method call() of type Child must override a superclass method"
>
> Yes, i did set my project compliance level as 5.0. When i remove the
> @Override annotation it complies fine. Can ne1 pls help in this regard.
>
>
>
Re: Problem with annotation [message #164759 is a reply to message #164593] Wed, 09 August 2006 10:13 Go to previous message
Pavan is currently offline PavanFriend
Messages: 11
Registered: July 2009
Junior Member
Thnx that helped.

If you compile the code using the javac at command prompt the code
compiles, while it is not compiling with eclipse 3.2. Even, the same piece
of code compiled in eclipse 3.1.2.
Previous Topic:Generate Report Programatically using Design API & flat file as data source
Next Topic:Eclipse + Sun Java System Application Server?
Goto Forum:
  


Current Time: Thu Apr 25 19:16:31 GMT 2024

Powered by FUDForum. Page generated in 0.08863 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top