计算机科学 ›› 2015, Vol. 42 ›› Issue (4): 151-155.doi: 10.11896/j.issn.1002-137X.2015.04.030

• 软件与数据库技术 • 上一篇    下一篇

UML模型和Java代码之间的一致性检测方法

曾 一,李函逾,刘慧君,余双双,周 波   

  1. 重庆大学计算机学院 重庆400030;软件理论与技术重庆市重点实验室 重庆400030,重庆大学计算机学院 重庆400030,重庆大学计算机学院 重庆400030;软件理论与技术重庆市重点实验室 重庆400030,重庆大学计算机学院 重庆400030,重庆大学计算机学院 重庆400030
  • 出版日期:2018-11-14 发布日期:2018-11-14
  • 基金资助:
    本文受国家自然科学基金:自然最近邻居的特征分析与应用研究(61272194)资助

Consistency Detection Method between UML Model and Java Source Code

ZENG Yi, LI Han-yu, LIU Hui-jun, YU Shuang-shuang and ZHOU Bo   

  • Online:2018-11-14 Published:2018-11-14

摘要: 针对代码与模型之间的不一致性问题,提出了一种基于UML模型和Java代码之间的一致性检测方法。首先,对UML类图和时序图进行形式化描述,并提出时序调用图(SD-CG)这一概念,在此基础上完成类的关联关系到关联属性的转换以及UML时序图到时序调用图SD-CG的转换;其次,通过方法调用图CG来表达类方法之间的调用关系,从而反映代码动态行为,由此通过对Java源代码的词法分析与语法分析,可获得类的信息及方法调用图CG;然后设计了UML模型与Java源代码间一致性检测算法,包括对类间静态信息以及时序调用图SD-CG与方法调用图CG间的一致性检测;最后,通过开发UML模型与Java源代码一致性检测工具,验证了所提出的方法是可行有效的。

关键词: UML模型,Java代码,时序调用图,方法调用图,一致性检测

Abstract: Aiming at the problem of inconsistencies between the code and the model,this paper presented a consistency detection method based on UML model and the JAVA code.Firstly,the UML class diagram and sequence diagram are formalized and a concept of sequence diagram call graph(SD-CG) is put forward.On this basis,the transformation from the associated relationship between classes to the associated attribute of class and the transformation from the sequence diagram to sequence diagram call graph are completed.Thirdly,based on call graph which is made up of class methods being as nodes and the call relation between them being as edges,to analyze the dynamic behavior in the source code,this paper got the information of Java classes and the method call graph (CG) by the lexical analysis and syntax analysis of Java source code.Then the consistency detection algorithm between UML model and Java source code was designed,including the static information consistency detection and the interactive information consistency detection.At last,we developed a prototype tool which can complete information consistency detection to verify the feasibility and effectiveness of the proposed method.

Key words: UML model,Java code,Sequence diagram call graph(SD-CG),Call graph(CG),Consistency detection

[1] Balzer R.“Tolerating Inconsistency” revisited[C]∥Proc.of the 23rd Int’l Conf.on Software Engineering.Toronto:IEEE Computer Press,2001:665
[2] Ghezzi C,Nuseibeh B.Guest editorial:Introduction to the special section[J].IEEE Trans.on Software Engineering,1999,5(6):782-783
[3] Easterbrook S,Chechik M.Int’l workshop on living with inconsistency[C]∥Proc.of the 23rd Int’l Conf.on Software Engineering.Toronto:IEEE Computer Press,2001:749-750
[4] Clarke E,Grumberg O,Long D.Verification tools for finite-state concurrent systems[C]∥Lecture Notes in Computer Science 803.London:Springer-Verlag,1994:124-175
[5] Holzmann J.The model checker SPIN[J].IEEE Trans.on Software Engineering,1997,3(5):279-95
[6] Heitmeyer C,Jeffords R,Kiskis D.Automated consistency checking requirements specifications[J].ACM Trans.on Software Engineering and Methodology,1996,5(3):231-261
[7] Chan W,Anderson R,Beame P,et al.Model checking large software specifications[J].IEEE Trans.on Software Engineering,1998,4(7):498-519
[8] Atlee J,Gannon J.State-Based model checking of event-driven system requirements[J].IEEE Trans.on Software Engineering,1993,19(1):24-40
[9] 丁娜.带OCL约束的活动图多态测试方法的研究[D].重庆:重庆大学,2012
[10] 逄瑞娟.基于UML顺序图的场景测试用例生成研究[D].青岛:青岛大学,2007
[11] 赵平.Java源代码静态分析系统的设计与实现[D].长春:吉林大学,2013
[12] 章程.基于机器学习和程序分析相结合的程序调用技术研究[D].上海:上海交通大学,2012
[13] 张健.精确的程序静态分析[J].计算机学报,2008,31(9):1550-1555
[14] 逄龙,王甜甜,苏小红,等.支持多程序语言的静态信息提取方法[J].哈尔滨工业大学学报,2011(3):62-66

No related articles found!
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!