Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

Cyclic annotation element type

Thread view: 
Christopher Benson-Manica - 15 Mar 2007 22:41 GMT
If the following annotations are specified in different files, javac
(correctly) rejects them:

public @interface Bar {
 Baz baz();
}

public @interface Baz {
 Bar bar();
}

It seems to me then that the following should also be rejected on the
same grounds:

public class Foo {
 public static @interface Bar {
   Foo.Baz baz();
 }

 public static @interface Baz {
   Foo.Bar bar();
 }
}

However, javac 1.5.0_11 accepts this class.  Is there some arcane
scope reason why the above is acceptable, or is javac wrong?

Signature

C. Benson Manica           | I *should* know what I'm talking about - if I
cbmanica(at)gmail.com      | don't, I need to know.  Flames welcome.

Mark Rafn - 16 Mar 2007 17:15 GMT
>If the following annotations are specified in different files, javac
>(correctly) rejects them:

Agreed.

>It seems to me then that the following should also be rejected on the
>same grounds:
[quoted text clipped - 8 lines]
>  }
>}

I can't think why javac should accept them.  I didn't see anything with a
quick search in bugs.sun.com - if you can't find one, I'd say to file it.

>However, javac 1.5.0_11 accepts this class.  Is there some arcane
>scope reason why the above is acceptable, or is javac wrong?

Is there any way to use such an annotation?  I think javac is wrong.
--
Mark Rafn    dagon@dagon.net    <http://www.dagon.net/>


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.