annotations have been widely used in java programs to support additional compile-time, deployment-time, and runtime processing. Developers use annotations to delegate repetitive logics such as object initialization an...
详细信息
ISBN:
(纸本)9781665437868
annotations have been widely used in java programs to support additional compile-time, deployment-time, and runtime processing. Developers use annotations to delegate repetitive logics such as object initialization and request forwarding to compilers and runtime frameworks. Therefore, these annotations are important for the correct execution of programs. In practice, however, developers often find it hard to correctly use annotations and the misuse of annotations has led to real bugs in java programs. In this paper, we conduct an empirical study on Stack Overflow questions to investigate the major development frameworks that are involved in questions about java annotations and the main problems encountered by developers in the use of java annotations. Based on the findings of the study, we propose DeepAnna, a deep learning based java annotation recommendation and misuse detection approach. Based on a corpus of java programs with intensive use of annotations, DeepAnna trains a deep learning based multi-label classification model by considering both the structural and textual contexts of source code. DeepAnna can recommend annotations at both class level and method level. Our evaluation with a large corpus of open-source java projects shows that DeepAnna outperforms state-of-the-art text multi-label classification approaches in annotation recommendation and can effectively detect annotation misuses. Based on our analysis, we submit 85 bug-fixing pull requests for annotation misuses in open-source projects and 20 of them have been accepted and merged.
In the implementation of Observer pattern by OOP, the subject objects and the observer objects must implement an interface or extend an abstract class to indicate their roles. When the pattern is implemented by AOP, t...
详细信息
ISBN:
(纸本)9781424455379
In the implementation of Observer pattern by OOP, the subject objects and the observer objects must implement an interface or extend an abstract class to indicate their roles. When the pattern is implemented by AOP, there is not such a requirement. The participants and their relations are defined in an aspect, it isn't necessary for these participants to implement an interface or extending an abstract class. But users are required to know an aspect language to use this method. This paper provides a novel method to implement this pattern;participant objects and their relations are defined by java annotations. On the basis of analyzing Observer pattern Implemented by AOP, the paper discusses how to define annotations to annotate participant classes and define their relations, how to establish the association between the subject and the observer is discussed in details. After analyzing classes annotated, the aspect is generated, then compiling and weaving this aspect with the target classes is done. So users may use Aspect implementation by java annotation.
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 creat...
详细信息
ISBN:
(纸本)9789819756629;9789819756636
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.
In-app privacy notices can help smartphone users make informed privacy decisions. However, they are rarely used in real-world apps, since developers often lack the knowledge, time, and resources to design and implemen...
详细信息
In-app privacy notices can help smartphone users make informed privacy decisions. However, they are rarely used in real-world apps, since developers often lack the knowledge, time, and resources to design and implement them well. We present Honeysuckle, a programming tool that helps Android developers build in-app privacy notices using an annotation-based code generation approach facilitated by an IDE plugin, a build system plugin, and a library. We conducted a within-subjects study with 12 Android developers to evaluate Honeysuckle. Each participant was asked to implement privacy notices for two popular open-source apps using the Honeysuckle library as a baseline as well as the annotation-based approach. Our results show that the annotation-based approach helps developers accomplish the task faster with significantly lower cognitive load. Developers preferred the annotation-based approach over the library approach because it was much easier to learn and use and allowed developers to achieve various types of privacy notices using a unified code format, which can enhance code readability and benefit team collaboration.
Tato práce se zabývá převodem imperativního způsobu konfigurace testů v projektu Apache Camel na deklarativní způsob v podobě anotací. Je zde představen projekt Apache Camel s důrazem na...
详细信息
Tato práce se zabývá převodem imperativního způsobu konfigurace testů v projektu Apache Camel na deklarativní způsob v podobě anotací. Je zde představen projekt Apache Camel s důrazem na jeho komponentu sloužící k testování distribuovaných aplikací, které používají knihovny tohoto projektu. Testovací komponenta je analyzována a na základě vybraných metod jsou navrženy a implementovány anotace. Projekty JBoss Arquillian a Pax Exam slouží jako inspirace pro následující práci.
暂无评论