• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with Annotation  RSS feed

 
Robert Raps
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thinking in Java 4-th Edition. Chapter- Annotations
This is example from the book:

Part1

Part2


But, IDEA doesn't like this row Constraints constraints() default @Constraints;
and forces me to remove "default @Constraints" - "annotations are not allowed here".

I don't know where problem exists. In spec i couldn't find answer.

P.S. Thank for help. Everything compile notwithstanding warnings and protest from IDEA. Maybe, it is connected with some weird settings or something else..
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both compile fine for me in Eclipse. What is the exact full error message that you are getting?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought this might be a difference between Java versions, so I tried it with JDK 5, 6 and 7 (I have all of those installed on my machine), compiled your code from the command line, but all three versions accept the code without errors. So that's not it.
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marking this thread as resolved since the topic starter edited the first post with this:

Robert Raps wrote:

P.S. Thank for help. Everything compile notwithstanding warnings and protest from IDEA. Maybe, it is connected with some weird settings or something else..


P.S: It's better to post a reply instead of editing a post which already has received replies.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!