Mining Annotation Usage Rules of Enterprise Java Frameworks

  • Author / Creator
    Nuryyev, Batyr
  • Application Programming Interfaces (APIs) allow developers to reuse existing functionality without knowing the implementation details. However, developers might make mistakes in using APIs, which are known as API misuses. One way to detect and prevent API misuses is to encode usage specifications in static checkers that automatically verify the correctness of API usages. There are two popular approaches to encoding specifications: manual encoding by API developers and automatic mining of the specifications from the source code. Manual encoding of specifications is a tedious process, and it also requires that specifications are known in advance. On the other hand, encoding specifications by mining source code is more efficient and requires no advanced knowledge of specifications. However, existing mining tools do not extract annotation-based API usage rules, while annotations are widely used in enterprise microservices Java frameworks.

    In this thesis, we investigate whether the idea of pattern-based discovery of rules can be applied to annotation-based API usages for enterprise microservice frameworks. We evaluate the effectiveness and usefulness of our approach on two different microservice frameworks: MicroProfile and Spring Boot. We select MicroProfile based on our industry partner's interests while we select Spring Boot, which is a widely used microservice framework, for generalizability. Our approach successfully mines 73 annotation-based API usage rules. We verify the correctness of the mined rules with expert developers. We find that the mined rules require some edits to become fully correct, which is much better than writing rules manually from scratch. To evaluate the usefulness of the mined rules, we scan more than 1,500 client projects that use MicroProfile or Spring Boot frameworks for rule violations. We find 28 violations in 24 projects, which we report as issues in GitHub. We also analyze commit histories of the projects to check whether developers have made mistakes in using annotation-based APIs corresponding to the mined rules and fixed them. We find 12 violations in 9 projects that have been fixed by developers. Overall, the results show that the mined rules can be useful in detecting and preventing annotation-based API misuses.

  • Subjects / Keywords
  • Graduation date
    Fall 2021
  • Type of Item
  • Degree
    Master of Science
  • DOI
  • License
    This thesis is made available by the University of Alberta Libraries with permission of the copyright owner solely for non-commercial purposes. This thesis, or any portion thereof, may not otherwise be copied or reproduced without the written consent of the copyright owner, except to the extent permitted by Canadian copyright law.