Supercharge Your Innovation With Domain-Expert AI Agents!

Redundant variable and redundant method detection method and system based on abstract syntax tree

An abstract syntax tree and detection method technology, applied in the computer field, can solve problems such as low efficiency, reduced code readability, poor detection of redundant codes, etc.

Pending Publication Date: 2021-04-13
NANJING UNIV OF AERONAUTICS & ASTRONAUTICS
View PDF0 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

On the one hand, these codes reduce the readability of the code, on the other hand, there may be software loopholes and security risks. How to detect and eliminate repetitive and redundant codes in the source code has become an inevitable problem in the software development process. Difficulties that personnel need to solve urgently
Although many redundant code detection and analysis tools have been produced, most of the tools are not effective in detecting redundant code, or run for too long and are inefficient
[0003] Redundant variables and redundant methods are part of redundant code and occupy most of them. It is often because the variable or method is defined first, but it is not used in the end, which inevitably reduces the execution efficiency of the code. , so how to detect and delete redundant variables and redundant methods is also a difficult problem to be solved by researchers

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Redundant variable and redundant method detection method and system based on abstract syntax tree
  • Redundant variable and redundant method detection method and system based on abstract syntax tree
  • Redundant variable and redundant method detection method and system based on abstract syntax tree

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0029] The technical solution of the present invention will be further described below in conjunction with the accompanying drawings.

[0030] refer to figure 1 , the detection method of redundant variable and redundant method that the present invention proposes, utilizes Abstract Syntax Tree (Abstract Syntax Tree, AST) to parse java source file, obtain variable array and method array, analyze corresponding dependency, obtain redundant variables and methods, and finally delete redundant variables and redundant methods.

[0031] Specific steps are as follows:

[0032] Step 1, parse the java source file, and generate the abstract syntax tree of the java file.

[0033] The abstract syntax tree is a tree representation of the abstract syntax structure of the source code, and each node on the tree represents a structure in the source code. According to the grammatical characteristics of the Java language, the node structure of the abstract syntax tree of the Java language is des...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention provides a redundant variable and redundant method detection method and system based on an abstract syntax tree. The method comprises the following steps of: analyzing a java source file by using an abstract syntax tree technology, generating a corresponding variable array and a method array in an analysis process, and detecting a redundant variable and a redundant method through a relation dependence array of the variable, a calling variable array of the method and an unmatched character string array, executing deletion operation on the detected redundant variables and redundant methods. Through the method and the system, all redundant variables and redundant methods can be output by inputting the java source file containing the main method, and the detected redundant variables and redundant methods can be automatically deleted. According to the method, artificial judgment of the redundancy variable and the redundancy method is not required, and the redundancy variable and the redundancy method can be deleted under the condition that the specific positions of the redundancy variable and the redundancy method are not known, so that a good solution is provided for detection and deletion of the redundancy variable and the redundancy method.

Description

technical field [0001] The invention belongs to the field of computers, and in particular relates to a detection method and a detection system of redundant codes in software development. Background technique [0002] In the current software development process, development methods such as multi-person development and software reuse have become common means to speed up software development, so many repetitive and redundant codes are usually accumulated during the development process. On the one hand, these codes reduce the readability of the code, on the other hand, there may be software loopholes and security risks. How to detect and eliminate repetitive and redundant codes in the source code has become an inevitable problem in the software development process. Difficulties that personnel urgently need to solve. Although many redundant code detection and analysis tools have been produced, most of the tools are not effective in detecting redundant code, or run for too long a...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F11/36
CPCG06F11/3616
Inventor 张智轶熊超黄志球陶传奇周玉倩
Owner NANJING UNIV OF AERONAUTICS & ASTRONAUTICS
Features
  • R&D
  • Intellectual Property
  • Life Sciences
  • Materials
  • Tech Scout
Why Patsnap Eureka
  • Unparalleled Data Quality
  • Higher Quality Content
  • 60% Fewer Hallucinations
Social media
Patsnap Eureka Blog
Learn More