CN112379888A - Code change analysis method - Google Patents

Code change analysis method Download PDF

Info

Publication number
CN112379888A
CN112379888A CN202011405006.9A CN202011405006A CN112379888A CN 112379888 A CN112379888 A CN 112379888A CN 202011405006 A CN202011405006 A CN 202011405006A CN 112379888 A CN112379888 A CN 112379888A
Authority
CN
China
Prior art keywords
change
code
file
call chain
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011405006.9A
Other languages
Chinese (zh)
Inventor
张慧吉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Pierbulaini Software Co ltd
Original Assignee
Beijing Pierbulaini Software Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Pierbulaini Software Co ltd filed Critical Beijing Pierbulaini Software Co ltd
Priority to CN202011405006.9A priority Critical patent/CN112379888A/en
Publication of CN112379888A publication Critical patent/CN112379888A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a code change analysis method, which is suitable for being executed in computing equipment, wherein the computing equipment is linked with a server, and the method comprises the following steps: acquiring a code change file from a server; determining a change method set according to the code change file; and acquiring a call chain corresponding to each change method according to each change method in the change method set to construct a call chain set. The invention also discloses a computing device and a computer readable storage medium.

Description

Code change analysis method
Technical Field
The invention relates to the field of software development, in particular to a code change analysis method.
Background
With the development of computer technology, the sizes of codes and files become larger and larger, and the interaction relationship among the parts becomes more and more complex. When software is developed, there is an internal connection between different parts of code to form an operational whole. When a part of the code is modified, the influence on the other part of the code is certainly generated, and in the development process, the influence on the whole code caused by the modification needs to be known so as to obtain the influence domain of the code change.
The method for acquiring the influence domain of code change in the prior art comprises two modes of manually evaluating codes and inserting byte codes. When the codes are manually reviewed, the submission records are updated by manually reviewing the codes, and then the quotation of the changed codes is checked step by step. Manual viewing is inefficient, and when the frequency of submitting code is high and complex, it is difficult for developers and testers to analyze all the changes in this way.
And when the method is in a byte instrumentation mode, recording the code execution track information through a hook function. However, the byte instrumentation method can only determine whether the changed code itself is covered, and cannot determine whether the service applying the change method is covered. Especially when the change code is referred to at multiple places, it cannot be guaranteed that all the services of the change code are tested. And this kind of mode requires that the ability of tester to master the programming is higher, is not fit for using widely.
For this reason, a new code change analysis method is required.
Disclosure of Invention
To this end, the present invention provides a code change analysis method in an attempt to solve or at least alleviate the above-presented problems.
According to an aspect of the present invention, there is provided a code change analysis method adapted to be executed in a computing device, the computing device being linked to a server, the method comprising the steps of: acquiring a code change file from a server; determining a change method set according to the code change file; and acquiring a call chain corresponding to each change method according to each change method in the change method set to construct a call chain set.
Optionally, in the method according to the present invention, further comprising: and determining the influence domain of the change method set according to the call chain set.
Optionally, in the method according to the present invention, obtaining the code change file from the server includes: acquiring a code change record from a server; and acquiring a code change file according to the code change record.
Optionally, in the method according to the present invention, determining a change method set according to the code change file includes the steps of: judging whether the code change file comprises a script file or not; and if the code change file does not comprise the script file, not processing the code change file.
Optionally, in the method according to the present invention, determining a change method set according to the code change file further includes: scanning the code change file to determine the number of lines of the changed part; acquiring the changed code file, constructing a class file syntax tree corresponding to the code file, traversing the class file corresponding to the code file according to the syntax tree to determine the number of lines of the method start and end in the class file; and determining a change method set according to the line number of the change part and the line numbers of the start and the end of the method in the class file.
Optionally, in the method according to the present invention, constructing the call chain set includes the steps of: traversing the code of each method in the change method set which is directly or indirectly called; generating a calling chain corresponding to the method according to the code of the calling method; and constructing a call chain set according to the call chain corresponding to the method.
Optionally, in the method according to the present invention, generating a call chain corresponding to the method according to the code of the calling method includes: determining a signature of the change method; analyzing a method call stack in the class file and checking whether the signature of the method in the method call stack is the same as the signature of the change method; and if the signature is the same as the signature of the changed method, adding the class and method to the call chain.
Optionally, in the method according to the present invention, generating a call chain corresponding to the method according to the code of the calling method further includes: determining a dependent method of the method of adding the call chain, and adding the dependent method to the call chain.
Optionally, in the method according to the present invention, determining the influence domain of the change method set includes the steps of: determining whether each method in the change method set comprises an external interface; if the external interface is included, determining the interface attribute of the external debit interface; and adding the method to the set of influencing interfaces and storing the interface attributes in a database.
Optionally, in the method according to the present invention, determining the influence domain of the change method set further includes the steps of: determining whether each method in the set of change methods includes a message queue; if the message queue is included, determining the name and the attribute of the message queue; and adding the method to the set of influencing message queues and storing the message queue names and attributes in a database.
Optionally, in the method according to the present invention, determining the influence domain of the change method set according to the call chain further includes the steps of: determining whether each method in the change method set is a timing task; if the task is a timing task, determining the attribute of the timing task; and adding the method to the timed task set and storing the attributes of the timed task in a database.
Optionally, in the method according to the present invention, determining the influence domain of the change method set further includes the steps of: and drawing the influence domain of the call chain set according to the method for influencing the interface set, the message queue set and the timing task set and the attribute corresponding to the method stored in the database.
According to yet another aspect of the present invention, there is provided a computing device comprising: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for performing any of the methods of a code change analysis method according to the present invention.
According to a further aspect of the present invention, there is provided a computer readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a computing device, cause the computing device to perform any of a code change analysis method according to the present invention.
In the invention, the changed method set is determined by analyzing the code change file acquired from the server, so that the influence of the current modification on all methods in the code can be known, and the call chain set corresponding to the changed method is further acquired according to the changed method, thereby checking the call chain of the influence of the changed method.
Furthermore, the chain set is called by the analysis and change method to obtain the influence domains of different kinds of sets including interfaces, message queues, timing tasks and the like, and the influence domains are displayed to research and development and testing personnel in a visual influence domain, so that regression testing and vulnerability discovery can be conveniently and accurately carried out, and the code quality is improved.
Drawings
To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which are indicative of various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to be within the scope of the claimed subject matter. The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description read in conjunction with the accompanying drawings. Throughout this disclosure, like reference numerals generally refer to like parts or elements.
FIG. 1 illustrates a block diagram of a computing device 100, according to an exemplary embodiment of the invention;
FIG. 2 illustrates a flow diagram of a website deployment method 200 according to one embodiment of the invention;
FIG. 3 illustrates a generated syntax tree according to one embodiment of the present invention; and
FIG. 4 illustrates a method call chain according to one embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art. Like reference numerals generally refer to like parts or elements.
Fig. 1 is a block diagram of a computing device 100 according to an exemplary embodiment of the present invention. A code change analysis method 200 according to the present invention may be performed in a computing device 100. In a basic configuration 102, computing device 100 typically includes system memory 106 and one or more processors 104. A memory bus 108 may be used for communication between the processor 104 and the system memory 106.
Depending on the desired configuration, the processor 104 may be any type of processing, including but not limited to: a microprocessor (μ P), a microcontroller (μ C), a Digital Signal Processor (DSP), or any combination thereof. The processor 104 may include one or more levels of cache, such as a level one cache 110 and a level two cache 112, a processor core 114, and registers 116. The example processor core 114 may include an Arithmetic Logic Unit (ALU), a Floating Point Unit (FPU), a digital signal processing core (DSP core), or any combination thereof. The example memory controller 118 may be used with the processor 104, or in some implementations the memory controller 118 may be an internal part of the processor 104.
Depending on the desired configuration, system memory 106 may be any type of memory, including but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. System memory 106 may include an operating system 120, one or more programs 122, and program data 124. In some implementations, the program 122 can be arranged to execute instructions on an operating system by one or more processors 104 using program data 124.
Computing device 100 may also include an interface bus 140 that facilitates communication from various interface devices (e.g., output devices 142, peripheral interfaces 144, and communication devices 146) to the basic configuration 102 via the bus/interface controller 130. The example output device 142 includes a graphics processing unit 148 and an audio processing unit 150. They may be configured to facilitate communication with various external devices, such as a display or speakers, via one or more a/V ports 152. Example peripheral interfaces 144 may include a serial interface controller 154 and a parallel interface controller 156, which may be configured to facilitate communication with external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.) via one or more I/O ports 158. An example communication device 146 may include a network controller 160, which may be arranged to facilitate communications with one or more other computing devices 162 over a network communication link via one or more communication ports 164.
A network communication link may be one example of a communication medium. Communication media may typically be embodied by computer readable instructions, data structures, program modules, and may include any information delivery media, such as carrier waves or other transport mechanisms, in a modulated data signal. A "modulated data signal" may be a signal that has one or more of its data set or its changes made in such a manner as to encode information in the signal. By way of non-limiting example, communication media may include wired media such as a wired network or private-wired network, and various wireless media such as acoustic, Radio Frequency (RF), microwave, Infrared (IR), or other wireless media. The term computer readable media as used herein may include both storage media and communication media.
In a computing device 100 according to the present invention, the application 122 includes program instructions to perform a code change analysis method 200 that may instruct the processor 104 to perform some of the steps of the code change analysis method 200 of the present invention so that various portions of the computing device 100 implement analysis of code changes by performing the code change analysis method 200 of the present invention.
Computing device 100 may be implemented as a server, e.g., a file server, a database server, an application server, etc., which may be, for example, a Personal Digital Assistant (PDA), a wireless web-browsing device, an application-specific device, or a hybrid device that include any of the above functions. Computing device 100 may also be implemented as a personal computer including both desktop and notebook computer configurations. In some embodiments, the computing device 100 is configured to perform a code change analysis method 200.
FIG. 2 illustrates a flow diagram of a code change analysis method 200 according to an embodiment of the invention. The method 200 is performed in a computing device, such as the computing device 100. As shown in FIG. 2, a code change analysis method 200 begins with step S210, where a code change file is obtained from a server. The developer transmits the written code file to the server, and the server stores the code file. The service area may be implemented as any type of server capable of storing the code file and providing the code change file, or may be implemented as a distributed server convenient for providing the corresponding functions, and the present invention does not limit the type and number of the servers. The server stores a code change record of a code file stored in the server by a developer, and the ID of the code file submitted each time is different from the ID of the code file of the previous version in the code change record. When the code change file is acquired, scanning the code change record in the server at regular time, comparing the ID of the latest changed code file with the ID of the code file of the previous version, and judging the submission record of the new code file stored in the code change record when the IDs are different. And obtaining a new code file and an old code file through the ID of the changed code file and the ID of the old code file, and comparing to obtain a code change file, wherein the code change file comprises the number of changed lines of the new code file, including the number of added lines, the number of modified lines and the number of deleted lines. The invention does not limit the changing form of the code changing file and the frequency of the code changing record of the scanning server.
According to one embodiment of the invention, the server is a git server. And the timing scanning git server obtains the code change record and obtains a new code file commit ID of 002 and a previous version code file commit ID of 001, the code file is judged to be changed, and the new code file with the commit ID of 002 is compared with the previous version code file with the commit ID of 001 to obtain a code change file.
Subsequently, step S220 is executed to determine a change method set according to the code change file. And judging whether the code change file comprises a script file or not when determining the changed method set, and if the code change file does not comprise the script file, not processing the code change file. If the script file is included, the subsequent steps are continued.
According to one embodiment of the invention, the new code file submitted by the developer to the git server is the modification of the non-code itself, and at the moment, the calling chain and the influence domain of the code file are not influenced, and the updated code file is not processed. These updates include: mybatis' mapper. xml file, pom. xml file, or yml resource file, the present invention does not limit the kind of update cases that are not processed. When the code itself is updated, the code change file includes a Java file, and then the analysis of the call chain and the impact domain is performed based on the Java file. The invention does not limit the type of the code change file to be processed.
After the code change file is determined to contain the script file, a method set for changing is determined according to the code change file, and the method set comprises the following steps: the code change file is scanned to determine the number of lines of the changed portion. The code change file is obtained by comparing the changed code file with the code file of the old version, and the line number included in the change part comprises an increased line number, a modified line number and a deleted line number.
Constructing a class file syntax tree corresponding to the changed code file, and traversing the class file corresponding to the code file according to the syntax tree to determine the line numbers of the starting and ending methods in the class file; and determining a change method set according to the line numbers of the start and the end of the method in the change file and the class file. And constructing a syntax tree of the class file corresponding to the changed code file, so that the grammar tree can be conveniently understood and read by the computing equipment, and the speed of traversing the class file to determine the method in the class file is improved. And when the starting line and the ending line of the changed part are between the starting line and the ending line of the method in the class file, judging that the method in the class file is modified. The method is added into a set of changed methods, and after the methods in all the class files are traversed, all the changed methods are determined, namely the set of the changed methods is determined.
After all the methods in the class file are traversed, if the change method set is empty, the table name updates and modifies the code file at this time, only the annotated part in the code is modified, the call chain and the influence domain of the code are not influenced, and the modification is ignored.
According to one embodiment of the invention, the Java code of a class file is as follows:
Figure BDA0002813759390000081
the syntax tree constructed from the above Java code is shown in fig. 3.
According to one embodiment of the invention, the code change file comprises a CallerClass method, a CallerMethod method and a Callertool method. The number of starting and ending lines for the CallerClass method is 29 and 57, respectively, the number of starting and ending lines for the CallerMethod method is 87 and 96, respectively, and the number of enlightenment and ending lines for the Callertool method is 159 and 163, respectively.
The class file of the altered code file is traversed to determine all the methods included therein. When the CallerClass method is compared, the number of the starting lines and the number of the ending lines in the changed code file are 18 and 76, and the number of the starting lines and the ending lines of the CallerClass method in the code change file are both between the CallerClass methods of the changed code file, and the CallerClass method is judged to be modified.
When the CallerMethod method is aligned, the number of lines in the changed code file that start and end is 85 and 100, and similarly, it is determined that the CallerMethod method has been modified. When the Callertool method is compared, if the number of the starting lines and the number of the ending lines in the changed code file are 128 and 158, the number of the starting lines and the ending lines of the Callertool method included in the code change file are not between the Callertool methods of the changed code file, and it is determined that the Callertool method is not modified, and the comments of the Callertool method are modified.
Therefore, callerrclass and CallerMethod are added to the change method set, while Callertool method does not meet the requirements of the change method and is not added to the change method set.
Subsequently, step S230 is executed to obtain a call chain corresponding to each changed method in the changed method set to construct a call chain set according to each changed method in the changed method set. When constructing a call chain set, traversing codes of each method in the change method set, which are directly called or indirectly called; generating a calling chain corresponding to the method according to the code of the calling method; and constructing a call chain combination according to the call chain corresponding to the method.
When step S230 is executed, the change method comes from the change method set determined in step S220, step S230 is executed for each method in the set, the call chain corresponding to the method is determined, and finally the call chain set is obtained. In the whole code, the current code file can call the change method directly, and the current code file can call the change method indirectly by calling or using the code file, namely, the change method is indirectly called. And determining a call chain corresponding to the change method by traversing all codes of the direct call and the indirect call.
Determining the signature of the change method when the code generation method of the call method corresponds to the call chain; analyzing a method call stack in the class file and checking whether the signature of the method in the method call stack is the same as the signature of the change method; and if the signature is the same as the signature of the changed method, adding the class and method to the call chain.
The determined signature of the change method comprises a method return value, a method name and a parameter type, wherein the method return value and the parameter type in the signature are both completed class names, and an identifier L is added in the signature. Parameters in the signature are separated by commas.
According to one embodiment of the invention, a modified class method is as follows:
private String getUnEchoSalesName(List<ImSession>unEchoImSessionList)
{
// service code
}
The signature of the method generated according to the code is:
Ljava.lang.String getUnEchoSalesName(Ljava.util.List)
the method is identified through the signature, the same method with different parameter reloads can be accurately distinguished when the method is compared, and the accuracy rate of judging whether the method is the same is improved.
After the signature of the change method is determined, a call stack of the method in the class file is analyzed, the call stack is compiled and executed to obtain a method signature of the call stack, the method signature is compared with the signature of the change method to judge whether the method signature is consistent or not, if so, the class and the method are added into a call chain, and if not, the next class and the method are judged.
According to one embodiment of the present invention, the class files to be judged include extensions, instance, and @ resource. And respectively judging whether the three class files comprise and call a CallerClass method and a CallerMethod method. Analyzing the method call stacks in the class extensions, compiling the method call stacks into class files through Java, running the class files to obtain signatures of the method call stacks in the class extensions, comparing the signatures with a CallerClass method and a CallerMethod method, adding the class extensions and the method thereof into a call chain if the signatures are consistent with the signatures of the changed methods, and continuing judging class instances if the signatures are inconsistent with the signatures of the changed methods until all the class files and the method thereof are judged.
After the class and the method are added into the call chain, determining a dependent method of the method added into the call chain, adding the dependent method into the call chain to traverse the code for indirectly calling the method, and continuing to add the class and the method for indirectly calling the method into the call chain until all classes and the methods are completely traversed. FIG. 4 shows a schematic diagram of a method call chain according to one embodiment of the invention. After the method calling chain is determined, information of the method calling chain, including a method ID, a method name, the class, a method signature, a father node, whether the father node is a page child node or not, and the like is stored in a database, so that developers can conveniently look up and arrange the information in a follow-up mode.
According to an embodiment of the present invention, if it is determined that the signature of the method in the class extands is consistent with the signature of the CallerClass method, after the class extands and the method thereof are added to the call chain, classes depending on the class extands and the method thereof are traversed, and classes depending on the class extands and the method thereof are added to the call chain.
According to one embodiment of the invention, after the call chain set corresponding to the change method set is determined, the influence domain of the change method set is also determined according to the call chain set. When determining the influence domain, determining whether each method in the change method set comprises an external interface; if the external interface is included, determining the interface attribute of the external debit interface; and adding the method to the set of influencing interfaces and storing the interface attributes in a database.
According to an embodiment of the invention, when the calling chain and the calling chain set of the CallerClass method and the CallerMethod method are judged to include the interface annotation @ RequestMapping, the method is added to the influence interface set I, the path information path in the interface annotation @ RequestMapping is obtained, and the attribute method name, the method signature, the interface annotation @ RequestMapping and the path information path are added to the database.
According to an embodiment of the present invention, determining the impact domain of the change method set according to the call chain further comprises the steps of: determining whether each method in the set of change methods includes a message queue; if the message queue is included, determining the name and the attribute of the message queue; and adding the method to the set of influencing message queues and storing the message queue names and attributes in a database.
According to one embodiment of the invention, according to a call chain set of a CallerClass method and a CallerMethod method, judging that a call chain and the call chain method comprise a message queue annotation @ RabbitHandler, adding the method to a message queue set M, acquiring a queue name in the message queue annotation @ RabbitHandler, storing the message queue attribute queue name and the message queue annotation into a database,
according to an embodiment of the present invention, determining the impact domain of the set of change methods further comprises the steps of: determining whether each method in the change method set is a timing task; if the task is a timing task, determining the attribute of the timing task; the method adds a timed task set and stores the attributes of the timed task in a database.
According to an embodiment of the invention, according to a callerClass method and a callerMethod method call chain set, if the call chain and the method thereof are judged to inherit Abstract JobRunnable, the method is added to an influence message queue set J, the full name of the class where the method is located is obtained and used as a basis for searching the timing task, and the full name of the class where the attribute of the timing task is located is stored in a database.
According to an embodiment of the present invention, determining the impact domain of the set of change methods further comprises the steps of: and drawing the influence domain of the call chain set according to the method for influencing the interface set, the message queue set and the timing task set and the attribute corresponding to the method stored in the database.
According to an embodiment of the invention, the impact domain of the CallerClass method call chain set is drawn according to the method of the impact interface set I, the message queue set M and the message queue set J and the corresponding attribute stored in the database.
In the invention, the change method set is determined by analyzing the code change file acquired from the server, so that the influence of the current modification on all methods in the code can be known, and the call chain set corresponding to the change method is further acquired according to the change method, so that the call chain of the influence of the change method is checked.
Furthermore, the chain set is called by the analysis and change method to obtain the influence domains of different kinds of sets including interfaces, message queues, timing tasks and the like, and the influence domains are displayed to research and development and testing personnel in a visual influence domain, so that regression testing and vulnerability discovery can be conveniently and accurately carried out, and the code quality is improved.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
The method of any one of a9, a2-A8, wherein said determining an impact domain of said set of change methods comprises the steps of:
determining whether each method in the set of change methods includes an external interface;
if the external interface is included, determining the interface attribute of the external debit interface; and
adding the method to a set of influencing interfaces and storing the interface attributes in a database.
A10, the method as in any one of A2-A9, wherein said determining the impact domain of said set of change methods further comprises the steps of:
determining whether each method in the set of change methods includes a message queue;
if the message queue is included, determining the name and the attribute of the message queue; and
adding the method to a set of influencing message queues and storing the message queue names and attributes in the database.
A11, the method as in any one of A2-A10, wherein said determining the impact domain of said set of change methods further comprises the steps of:
determining whether each method in the set of change methods is a timed task;
if the task is a timing task, determining the attribute of the timing task; and
adding a timed task set to the method and storing the attributes of the timed tasks in the database.
A12, the method as in any one of A2-A11, wherein said determining the impact domain of said set of change methods further comprises the steps of:
and drawing the influence domain of the call chain set according to the influence interface set, the influence message queue set, the method of the timing task set and the attribute corresponding to the method stored in the database.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules or units or groups of devices in the examples disclosed herein may be arranged in a device as described in this embodiment, or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into multiple sub-modules.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. Modules or units or groups in embodiments may be combined into one module or unit or group and may furthermore be divided into sub-modules or sub-units or sub-groups. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
Furthermore, some of the described embodiments are described herein as a method or combination of method elements that can be performed by a processor of a computer system or by other means of performing the described functions. A processor having the necessary instructions for carrying out the method or method elements thus forms a means for carrying out the method or method elements. Further, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is used to implement the functions performed by the elements for the purpose of carrying out the invention.
The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, may take the form of program code (i.e., instructions) embodied in tangible media, such as floppy diskettes, CD-ROMs, hard drives, or any other machine-readable storage medium, wherein, when the program is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention.
In the case of program code execution on programmable computers, the computing device will generally include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Wherein the memory is configured to store program code; the processor is configured to execute the method for determining the apparatus shutdown state of the present invention according to instructions in the program code stored in the memory.
By way of example, and not limitation, computer readable media may comprise computer storage media and communication media. Computer-readable media includes both computer storage media and communication media. Computer storage media store information such as computer readable instructions, data structures, program modules or other data. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. Combinations of any of the above are also included within the scope of computer readable media.
As used herein, unless otherwise specified the use of the ordinal adjectives "first", "second", "third", etc., to describe a common object, merely indicate that different instances of like objects are being referred to, and are not intended to imply that the objects so described must be in a given sequence, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of this description, will appreciate that other embodiments can be devised which do not depart from the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. The present invention has been disclosed in an illustrative rather than a restrictive sense, and the scope of the present invention is defined by the appended claims.

Claims (10)

1. A code change analysis method adapted to be executed in a computing device, the computing device being linked to a server, the method comprising the steps of:
acquiring a code change file from the server;
determining a change method set according to the code change file; and
and acquiring a call chain corresponding to each change method according to each change method in the change method set to construct a call chain set.
2. The method of claim 1, further comprising:
and determining the influence domain of the change method set according to the call chain set.
3. The method of any of claims 1-2, wherein said obtaining a code change file from said server comprises the steps of:
acquiring a code change record from the server; and
and acquiring a code change file according to the code change record.
4. The method of any of claims 1-3, wherein said determining a set of change methods from said code change file comprises the steps of:
judging whether the code change file comprises a script file or not; and
and if the code change file does not comprise the script file, not processing the code change file.
5. The method of claim 4, wherein said determining a set of change methods from said code change file further comprises the steps of:
scanning the code change file to determine the number of lines of a changed part;
acquiring a changed code file, constructing a class file syntax tree corresponding to the code file, and traversing the class file corresponding to the code file according to the syntax tree to determine the number of lines of the starting and ending methods in the class file; and
and determining the change method set according to the line number of the change part and the line numbers of the start and the end of the method in the class file.
6. The method of any one of claims 1-5, wherein said constructing a set of call chains comprises the steps of:
traversing code in which each method in the change method set is directly or indirectly called;
generating a calling chain corresponding to the method according to a code calling the method; and
and constructing the call chain set according to the call chain corresponding to the method.
7. The method of claim 6, wherein the generating a call chain corresponding to the method according to the code calling the method comprises:
determining a signature of the change method;
analyzing a method call stack in the class file and checking whether the signature of the method in the method call stack is the same as the signature of the change method; and
if the signature is the same as the signature of the changed method, the class and method are added to the call chain.
8. The method of claim 7, wherein the generating a call chain corresponding to the method according to the code calling the method further comprises:
determining a dependent method of a method of adding the call chain, and adding the dependent method to the call chain.
9. A computing device, comprising:
one or more processors;
a memory; and
one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs comprising instructions for performing any of the methods of claims 1-8.
10. A computer readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a computing device, cause the computing device to perform any of the methods of claims 1-8.
CN202011405006.9A 2020-12-02 2020-12-02 Code change analysis method Pending CN112379888A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011405006.9A CN112379888A (en) 2020-12-02 2020-12-02 Code change analysis method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011405006.9A CN112379888A (en) 2020-12-02 2020-12-02 Code change analysis method

Publications (1)

Publication Number Publication Date
CN112379888A true CN112379888A (en) 2021-02-19

Family

ID=74589344

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011405006.9A Pending CN112379888A (en) 2020-12-02 2020-12-02 Code change analysis method

Country Status (1)

Country Link
CN (1) CN112379888A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112783512A (en) * 2021-03-15 2021-05-11 腾讯科技(深圳)有限公司 Application package processing method, device, equipment and storage medium
CN113297076A (en) * 2021-05-21 2021-08-24 建信金融科技有限责任公司 Service change identification method and device based on call chain
CN113778515A (en) * 2021-11-09 2021-12-10 北京世纪好未来教育科技有限公司 Method and device for determining program package change information
CN117009240A (en) * 2023-08-18 2023-11-07 广州Tcl互联网小额贷款有限公司 Code analysis method, system, device, electronic equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102831057A (en) * 2012-08-13 2012-12-19 于秀山 Method for analyzing software function change and influence thereof by using function diagram
US20180314519A1 (en) * 2017-04-26 2018-11-01 Hyundai Motor Company Method and apparatus for analyzing impact of software change
CN110362310A (en) * 2019-03-19 2019-10-22 南京大学 A kind of code syntax errors repair method based on incomplete abstract syntax tree
CN110716739A (en) * 2019-09-19 2020-01-21 平安科技(深圳)有限公司 Code change information statistical method, system and readable storage medium
CN110895472A (en) * 2018-09-13 2020-03-20 北京京东尚科信息技术有限公司 Method and device for identifying service change
CN111045944A (en) * 2019-12-11 2020-04-21 广州品唯软件有限公司 Regression testing method, device and system and computer readable storage medium
CN112000398A (en) * 2020-08-17 2020-11-27 苏州达家迎信息技术有限公司 Method and device for determining bottom layer interface call link, computer equipment and medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102831057A (en) * 2012-08-13 2012-12-19 于秀山 Method for analyzing software function change and influence thereof by using function diagram
US20180314519A1 (en) * 2017-04-26 2018-11-01 Hyundai Motor Company Method and apparatus for analyzing impact of software change
CN110895472A (en) * 2018-09-13 2020-03-20 北京京东尚科信息技术有限公司 Method and device for identifying service change
CN110362310A (en) * 2019-03-19 2019-10-22 南京大学 A kind of code syntax errors repair method based on incomplete abstract syntax tree
CN110716739A (en) * 2019-09-19 2020-01-21 平安科技(深圳)有限公司 Code change information statistical method, system and readable storage medium
CN111045944A (en) * 2019-12-11 2020-04-21 广州品唯软件有限公司 Regression testing method, device and system and computer readable storage medium
CN112000398A (en) * 2020-08-17 2020-11-27 苏州达家迎信息技术有限公司 Method and device for determining bottom layer interface call link, computer equipment and medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
周海旭: "面向回归测试的代码变更影响度量模型", 《计算机系统应用》, vol. 29, no. 05, pages 270 - 274 *
蔡羽等: "《机械工业出版社》", 31 January 2020, 《机械工业出版社》, pages: 36 - 37 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112783512A (en) * 2021-03-15 2021-05-11 腾讯科技(深圳)有限公司 Application package processing method, device, equipment and storage medium
CN112783512B (en) * 2021-03-15 2024-05-10 腾讯科技(深圳)有限公司 Application package processing method, device, equipment and storage medium
CN113297076A (en) * 2021-05-21 2021-08-24 建信金融科技有限责任公司 Service change identification method and device based on call chain
CN113778515A (en) * 2021-11-09 2021-12-10 北京世纪好未来教育科技有限公司 Method and device for determining program package change information
CN113778515B (en) * 2021-11-09 2022-03-04 北京世纪好未来教育科技有限公司 Method and device for determining program package change information
CN117009240A (en) * 2023-08-18 2023-11-07 广州Tcl互联网小额贷款有限公司 Code analysis method, system, device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN112379888A (en) Code change analysis method
Wassermann et al. Sound and precise analysis of web applications for injection vulnerabilities
US11062022B1 (en) Container packaging device
US7849509B2 (en) Detection of security vulnerabilities in computer programs
US8838964B2 (en) Package audit tool
KR20040097909A (en) Reflection-based processing of input parameters for commands
US11138317B2 (en) System and method for locating and correcting vulnerabilities in a target computer system
US10229273B2 (en) Identifying components for static analysis of software applications
JP2006048645A (en) Method and system for embedding context information in document
US11853422B2 (en) Detecting malicious components using commit histories
US20160371176A1 (en) Method and system for evaluating computational algorithms described in printed publications
CN112925539B (en) Application updating method, computing device and storage medium
CN114816993A (en) Full link interface test method, system, medium and electronic equipment
CN110716866A (en) Code quality scanning method and device, computer equipment and storage medium
US20140137083A1 (en) Instrumenting computer program code by merging template and target code methods
WO2023151397A1 (en) Application program deployment method and apparatus, device, and medium
CN114816772B (en) Debugging method, debugging system and computing device for application running based on compatible layer
CN106372508B (en) Malicious document processing method and device
CN115061688A (en) Page effect display method, computing device and storage medium
CN114691146A (en) Application installation package generation method, computing device and storage medium
US11144287B2 (en) Compile time validation of programming code
CN114168489B (en) Function information acquisition method, computing device and storage medium
CN112182552A (en) Real-name authentication method and device, electronic equipment and storage medium
CN110780983A (en) Task exception handling method and device, computer equipment and storage medium
US7685188B2 (en) Automated generation of computer-executable compensation procedures for previously executed methods

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination