This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Java in General and the fly likes isAnnotationPresent returning false Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "isAnnotationPresent returning false" Watch "isAnnotationPresent returning false" New topic
Author

isAnnotationPresent returning false

Jayavardhan geepi
Ranch Hand

Joined: Jul 21, 2010
Posts: 66


Test class


Why it is printing false for doesNothing method.
Can anybody trace it out please.
Thanks
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13869
    
  10

You have to annotate your annotation to tell the compiler to keep the annotation in the class file. If you don't, then the compiler will just throw away the annotation and you won't be able to see it at runtime.
Jayavardhan geepi wrote:


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Jayavardhan geepi
Ranch Hand

Joined: Jul 21, 2010
Posts: 66
Thanks Jasper. I got it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: isAnnotationPresent returning false
 
Similar Threads
why does method get called twice though it is called only once?
Clone problem
Hibernate SaveOrUpdate
Sort Arraylist by passing runtime parameter
Query