• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

isAnnotationPresent returning false

 
Jayavardhan geepi
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Test class


Why it is printing false for doesNothing method.
Can anybody trace it out please.
Thanks
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15448
42
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
Jayavardhan geepi
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jasper. I got it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic