Characterizing the Usage and Impact of Java Annotations Over 1000+ Projects
As a kind of meta-data feature, annotations have been formally introduced into Java since Java 5. Since the introduction, annotations have been widely used by the Java community for different purposes, such as compiler guidance and runtime processing. Despite the ever-growing use, there is still limited empirical evidence about how developers use annotations in practice and the impact of annotation use on software quality. To fill this gap, we perform the first large-scale empirical study about Java annotation uses on 1,094 open-source projects hosted on GitHub. Our study answers some fundamental questions about Java annotation use. First, we answer the question "annotate what?" and find that annotations are typically used to annotate 4 aspects of program elements. Second, we answer the question "how annotations evolve?" and identify 6 different annotation change types, their frequencies, and their characteristics. Third, we answer the question "who uses annotations?" and establish the relationships between annotation uses and code ownership and developer experience. In addition, we also use regression models to explore the correlation between annotation uses and code quality, and we find that annotations do have an impact on making code less error-prone.
READ FULL TEXT