Font Size: a A A

Research On Annotation Transfer Technology Based On Static Program Analysis

Posted on:2020-02-18Degree:MasterType:Thesis
Country:ChinaCandidate:J M YuanFull Text:PDF
GTID:2428330590495563Subject:Software engineering
Abstract/Summary:PDF Full Text Request
Comments are one of the important ways to help developers understand code.Comments are more direct,more descriptive,and easier to understand by developers than source code.But because the correct and high-quality comments are too costly,and as the project continues to iterate,the code will inevitably change,so the source code comments are often missing or inconsistent,which may lead developers to follow-up development.Introducing new bugs in the process.Because developers consider the meaning of their representation when naming code,the existing research work mainly combines program analysis and natural language processing techniques to automatically generate comments by analyzing the statement structure,variable names,and method names of the code,or by code.Compare to migrate existing comments.These methods all require the code itself to be of high quality and readability,and the internal comments of the project itself are not well utilized.Therefore,this paper proposes an annotation transfer technology based on static program analysis.The first is to use a non-intrusive,concealable new comment,called annotation to transfer,in order to achieve the purpose of not destroying the code structure;then by extending the existing annotation classification method,the annotations are classified and different delivery rules are defined for each type.At the same time,two delivery methods are proposed,which are deterministic delivery based on program analysis and non-deterministic transmission based on probability derivation.There are two ways of transferring in deterministic delivery,one is based on the transfer of Call Graph,the annotation of the target method can be transferred to the calling method through the calling relationship;the other is based on the transfer of the control flow graph between programs,through the program the inter-control flow graph transferes the annotations of the arguments to the target method,giving more contextual descriptions on the arguments.In non-deterministic propagation,the relationship between parameters and return values is mainly mined,and the probability constraints are generated by data flow constraints,naming constraints and type constraints,and then the factor graph is constructed and the annotation is calculated by confidence propagation.The probability of a variable to determine the probability that an annotation can be transferred between the parameter and the return value.Finally,based on these two modes of transfertion,this paper selects ten open source projects on GitHub for experiments.The results show that after the transferred annotations are compared with the original annotations,the annotations for the method are up to 88% with the original annotations.Similarly,up to 80% of the variable annotations are the same as the original annotations.And extract some annotations and give them to ten developers for manual evaluation.The results show that most of the transferred annotations are consistent and helpful.
Keywords/Search Tags:Program analysis, annotation taxonomy, annotation transfer, probability inference
PDF Full Text Request
Related items