TY - GEN
T1 - Using Graph Neural Network to Analyse and Detect Annotation Misuse in Java Code
AU - Yang, Jingbo
AU - Ji, Xin
AU - Wu, Wenjun
AU - Ren, Jian
AU - Zhang, Kui
AU - Zhang, Wenya
AU - Wang, Qingliang
AU - Dong, Tingting
N1 - Publisher Copyright:
© The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd. 2024.
PY - 2024
Y1 - 2024
N2 - Annotations have been widely applied in Java projects to support agile development, expecially in software enterprises. Developers make full use of annotations to conveniently implement special functions such as creating objects, operating database and providing URL links for network requests and so on. However, analyzing the usage of annotations in Java code data is not easy for developers, and the misuse of annotations can sometimes cause serious problems for their Java programs. Traditional statistic analysis method usually relies on the frequency of code and may not perform well in low frequent data. In this paper, we focus on leveraging graph neural network (GNN) to analyse and grasp Java annotation usage knowledge and detect misused annotations. Firstly, to better represent the project structure and the annotation usage knowledge, a novel annotation usage project structure graph (AUPSG) is designed. Secondly, using AUPSG, a structure-aware GNN based model is proposed to analyze and acquire knowledge of annotation usage during the training stage. This is achieved by categorizing code nodes at the class, method, field, and parameter levels into suitable annotations. With the learnt knowledge, the proposed model can more accurately detect annotation misuse. Finally, two annotation misuse datasets, each of which includes 150 independent Java projects/files, are curated to evaluate different annotation misuse detection methods. The performance evaluation results demonstrate that our method can achieve better performance than state-of-the-art baseline models in terms of precision, recall, and F1.
AB - Annotations have been widely applied in Java projects to support agile development, expecially in software enterprises. Developers make full use of annotations to conveniently implement special functions such as creating objects, operating database and providing URL links for network requests and so on. However, analyzing the usage of annotations in Java code data is not easy for developers, and the misuse of annotations can sometimes cause serious problems for their Java programs. Traditional statistic analysis method usually relies on the frequency of code and may not perform well in low frequent data. In this paper, we focus on leveraging graph neural network (GNN) to analyse and grasp Java annotation usage knowledge and detect misused annotations. Firstly, to better represent the project structure and the annotation usage knowledge, a novel annotation usage project structure graph (AUPSG) is designed. Secondly, using AUPSG, a structure-aware GNN based model is proposed to analyze and acquire knowledge of annotation usage during the training stage. This is achieved by categorizing code nodes at the class, method, field, and parameter levels into suitable annotations. With the learnt knowledge, the proposed model can more accurately detect annotation misuse. Finally, two annotation misuse datasets, each of which includes 150 independent Java projects/files, are curated to evaluate different annotation misuse detection methods. The performance evaluation results demonstrate that our method can achieve better performance than state-of-the-art baseline models in terms of precision, recall, and F1.
KW - GNN
KW - Java annotation
KW - Misuse detection
KW - Stack Overflow
KW - Statistic analysis
UR - https://www.scopus.com/pages/publications/85201238402
U2 - 10.1007/978-981-97-5663-6_11
DO - 10.1007/978-981-97-5663-6_11
M3 - 会议稿件
AN - SCOPUS:85201238402
SN - 9789819756629
T3 - Lecture Notes in Computer Science
SP - 120
EP - 131
BT - Advanced Intelligent Computing Technology and Applications - 20th International Conference, ICIC 2024, Proceedings
A2 - Huang, De-Shuang
A2 - Zhang, Qinhu
A2 - Zhang, Xiankun
PB - Springer Science and Business Media Deutschland GmbH
T2 - 20th International Conference on Intelligent Computing, ICIC 2024
Y2 - 5 August 2024 through 8 August 2024
ER -