The invention relates to a method for generating a class using Java code. The present invention provides a Java project source code, enter the name of the project in a class, to analyze each call public methods for each project, a calculation method is called program slicing, slice to set using Simian to check for duplicate code, was identified as type 2 clone code example of extraction, annotation the information from the Javadoc document, and each method of the sample list combined document display sample list; extraction, use and dependence relationship between inheritance, calculate the class stability, creating a class document and developers to display sample information. The invention overcomes the defects that may lead to the use of a class that has been eliminated by developers. The invention can help the developer to understand the maintenance condition of the class directly through the stability, and is more convenient to judge the selection of the class, which is convenient for the use of the class.
【技术实现步骤摘要】
本专利技术属于软件理解领域,特别涉及一种面向Java代码的类使用示例生成方法。
技术介绍
对于软件开发人员,经常需要使用他们不熟悉或他们不记得怎么用的类。要了解这些类,开发者通常需要花大量的时间查阅参考手册(Javadoc),求助于问答(Q&A)论坛(StackOverflow),或其他信息来源。通常情况下,这些资源提供类使用语法多一点,并且注重方法的技术细节。而现有的技术仅仅只对类的用途和公共方法的用途进行阐述,并不教你如何去使用这个类,没有直观的例子供开发人员参考,开发人员并不知道在使用类公共方法的具体使用步骤,并且现有技术并不提供类的历史维护信息,这可能导致开发人员在软件开发过程中使用一些已经被淘汰掉的类或者不安全的类。
技术实现思路
本专利技术的目的就在于克服上述缺陷,研制一种面向Java代码的类使用示例生成方法。本专利技术的技术方案是:一种面向Java代码的类使用示例生成方法,其主要技术特征在于如下步骤:步骤1).开发人员提供Java项目源代码,输入该项目中的一个类的名称,若类名存在,则这个类的公共方法、公共属性和所属包将被自动提取,形成类的初始信 ...
【技术保护点】
一种面向Java代码的类使用示例生成方法,其特征在于如下步骤:步骤1).开发人员提供Java项目源代码,输入该项目中的一个类的名称,这个类的公共方法、公共属性和所属包将被自动提取,形成类的初始信息;步骤2).在步骤1)结果中对每个调用类公共方法的项目进行分析,为每次方法调用计算一个程序切片,代表一个“原始”的使用示例;步骤3).由于会计算出许多方法使用示例,其中有很多是相似的,所以在步骤2)的结果中对每个方法的切片集使E={ex1,ex2,...,exn}用Simian来检查重复代码,其输出由所有被确定为2型克隆的代码示例对组(exk,exi)∈E×E成,并基于他们的克隆的 ...
【技术特征摘要】
1.一种面向Java代码的类使用示例生成方法,其特征在于如下步骤:步骤1).开发人员提供Java项目源代码,输入该项目中的一个类的名称,这个类的公共方法、公共属性和所属包将被自动提取,形成类的初始信息;步骤2).在步骤1)结果中对...
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。