Annotations were introduced in Java 6 in 2006, and we all got excited. Such a great instrument to make code shorter! No more Hibernate/Spring XML configuration files! Just annotations, right there in the code where we need them. No more marker interfaces, just a runtime-retained reflection-discoverable annotation! I was excited too. Moreover, I've made a few open source libraries which use annotations heavily. Take jcabi-aspects, for example. However, I'm not excited any more. Moreover, I believe that annotations are a big mistake in Java design.
- Posted by: Yegor Bugayenko
- Posted on: April 13 2016 15:18 EDT
Annotations have many uses; declaring them to be a mistake because they can be misused is to throw out the baby with the bathwater.