Search code examples
javaeclipsenetbeansannotationscode-folding

Is there a way to hide annotations in Netbeans or Eclipse?


Maybe a dumb question, but it would be nice if there was a way to hide or collapse Java annotations when viewing source in Netbeans (or Eclipse). I'm not finding an option and a quick search didn't turn anything up.

Is this one of those "you should never want to do that, code folding is a sin!" things?

Personally I'd find it useful for annotated entity classes. All the hibernate / etc annotations are just fluff that I never look at once my mapping is working fine. It's similar to imports, really.

(Yes, I can use XML instead of annotations, which I might start doing. But I was just wondering...)


Solution

  • Having only used Eclipse or IDEA, I'm unaware of any IDE options to hide annotations, and in my opinion it's a good thing.

    Your annotations affect the way your code compiles and often, how it runs. In my opinion hiding them is tantamount to hiding public/protected/private keywords in method signatures, or any other component of the language. Their exclusion changes the meaning of their surrounding context and therefore, a developer's expectations.