CN117389859A - Method, device, computer equipment and storage medium for determining influence range - Google Patents
Method, device, computer equipment and storage medium for determining influence range Download PDFInfo
- Publication number
- CN117389859A CN117389859A CN202311152642.9A CN202311152642A CN117389859A CN 117389859 A CN117389859 A CN 117389859A CN 202311152642 A CN202311152642 A CN 202311152642A CN 117389859 A CN117389859 A CN 117389859A
- Authority
- CN
- China
- Prior art keywords
- change point
- code change
- query result
- query
- source file
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 232
- 230000008859 change Effects 0.000 claims abstract description 228
- 238000004590 computer program Methods 0.000 claims abstract description 28
- 238000011161 development Methods 0.000 claims description 48
- 238000005516 engineering process Methods 0.000 abstract description 3
- 230000004048 modification Effects 0.000 description 15
- 238000012986 modification Methods 0.000 description 15
- 238000010586 diagram Methods 0.000 description 8
- 238000004891 communication Methods 0.000 description 4
- 230000009466 transformation Effects 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 238000010276 construction Methods 0.000 description 3
- 239000002243 precursor Substances 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 238000013500 data storage Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- OKTJSMMVPCPJKN-UHFFFAOYSA-N Carbon Chemical compound [C] OKTJSMMVPCPJKN-UHFFFAOYSA-N 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 229910021389 graphene Inorganic materials 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/362—Software debugging
- G06F11/3624—Software debugging by performing operations on the source code, e.g. via a compiler
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/362—Software debugging
- G06F11/3644—Software debugging by instrumenting at runtime
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/14—Details of searching files based on file metadata
- G06F16/148—File search processing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/448—Execution paradigms, e.g. implementations of programming paradigms
- G06F9/4488—Object-oriented
- G06F9/449—Object-oriented method invocation or resolution
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Library & Information Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The present application relates to the field of big data technology, and in particular, to a method, an apparatus, a computer device, a storage medium, and a computer program product for determining an influence range. The method comprises the following steps: acquiring a code change point; inquiring in a source file according to the definition category of the code change point to obtain a first inquiry result which has a direct association relation with the code change point; recursively inquiring in the source file according to the first inquiry result to obtain a second inquiry result which has an indirect association relation with the code change point; and determining the influence range of the code change point according to the first query result and the second query result. The method can reduce the determination error rate of the influence range.
Description
Technical Field
The present application relates to the field of big data technology, and in particular, to a method, an apparatus, a computer device, a storage medium, and a computer program product for determining an influence range.
Background
In a software program, most code is not running independently, and there may be nested calling relationships between each other. When one of the codes is changed, the influence range of the change point on the whole software program is often required to be analyzed, and all codes in the influence range are adaptively modified according to the change point.
Currently, when an IDEA development tool (an integrated development tool applied to Java language) is used, a manually-searching manner is generally used to obtain a called code related to a code change point, and then the influence range of the code change point is determined according to the called code. However, when the above-described manual search method is adopted in a case where the call relationship is relatively complicated, an error is likely to occur.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a method, an apparatus, a computer device, a computer-readable storage medium, and a computer program product for determining an influence range with high accuracy.
In a first aspect, the present application provides a method of determining an impact range. The method comprises the following steps:
acquiring a code change point;
inquiring in a source file according to the definition category of the code change point to obtain a first inquiry result which has a direct association relation with the code change point;
recursively inquiring in the source file according to the first inquiry result to obtain a second inquiry result which has an indirect association relation with the code change point;
and determining the influence range of the code change point according to the first query result and the second query result.
In one embodiment, the determining the influence range of the code change point according to the first query result and the second query result includes:
respectively establishing a first call chain between the code change point and the first query result and a second call chain between the first query result and the second query result;
splicing the first call chain and the second call chain to form a target call chain corresponding to the code change point;
and determining the influence range of the code change point according to the target call chain.
In one embodiment, the querying, in the source file, according to the defined category of the code change point, to obtain a first query result having a direct association relationship with the code change point includes:
when the definition category of the code change point is a class, inquiring in the source file to obtain a target object using the code change point, and taking the target object as the first inquiring result;
and when the definition category of the code change point is a method, inquiring in the source file to obtain a target method for calling the code change point, and taking the target method as the first inquiring result.
In one embodiment, the recursively querying in the source file according to the first query result to obtain a second query result having an indirect association relationship with the code change point includes:
when the definition category of the code change point is the category, inquiring in the source file by taking the target object as an inquiry main key to obtain a definition method using the target object;
inquiring in the source file by taking the definition method as a new inquiry main key to obtain a calling method for calling the definition method;
performing recursive query in the source file by taking the calling method as a new query main key until a recursive query result is obtained when the calling method for calling the query main key does not exist in the source file;
and determining the second query result according to the definition method, the calling method and the recursive query result.
In one embodiment, the recursively querying in the source file according to the first query result to obtain a second query result having an indirect association relationship with the code change point includes:
when the definition category of the code change point is the method, carrying out recursive query in the source file by taking the target method as a query main key until a calling method for calling the query main key does not exist in the source file, and obtaining a recursive query result;
And determining the second query result according to the recursive query result.
In a second aspect, the present application also provides a method for determining an influence range. The method comprises the following steps:
operating an integrated development tool plugin, and responding to change point selection operation through the integrated development tool plugin to obtain a code change point;
calling a preset search tool to search in a source file according to the definition category of the code change point by the integrated development tool plugin to obtain a first search result which has a direct association relation with the code change point;
according to the first query result, the integrated development tool plugin invokes the preset search tool to recursively query in the source file to obtain a second query result which has an indirect association relationship with the code change point;
and determining the influence range of the code change point according to the first query result and the second query result through the integrated development tool plugin.
In a third aspect, the present application further provides an apparatus for determining an influence range. The device comprises:
the change point acquisition module is used for acquiring code change points;
the classification inquiry module is used for inquiring in the source file according to the definition category of the code change point to obtain a first inquiry result which has a direct association relation with the code change point;
The recursive query module is used for recursively querying in the source file according to the first query result to obtain a second query result which has an indirect association relation with the code change point;
and the range determining module is used for determining the influence range of the code change point according to the first query result and the second query result.
In a fourth aspect, the present application further provides an apparatus for determining an influence range. The device comprises:
the parameter acquisition module is used for running an integrated development tool plug-in, and responding to the change point selection operation through the integrated development tool plug-in to acquire a code change point;
the call analysis module is used for calling a preset search tool to inquire in a source file according to the definition category of the code change point through the integrated development tool plug-in, so as to obtain a first inquiry result with a direct association relation with the code change point, and calling the preset search tool to recursively inquire in the source file according to the first inquiry result through the integrated development tool plug-in, so as to obtain a second inquiry result with an indirect association relation with the code change point;
and the relation splicing module is used for determining the influence range of the code change point according to the first query result and the second query result through the integrated development tool plug-in.
In a fifth aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor implementing the method for determining the scope of influence according to any embodiment of the first aspect.
In a sixth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the method for determining an influence range according to any of the embodiments of the first aspect.
In a seventh aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the method of determining the scope of influence of any of the embodiments of the first aspect described above.
The above-described method, apparatus, computer device, storage medium, and computer program product for determining an influence range by acquiring a code change point; inquiring in a source file according to the definition category of the code change point to obtain a first inquiry result which has a direct association relation with the code change point; recursively inquiring in the source file according to the first inquiry result to obtain a second inquiry result which has an indirect association relation with the code change point; according to the first query result and the second query result, the influence range of the code change point is determined, and the determination error rate of the influence range can be reduced.
Drawings
FIG. 1 is an application environment diagram of a method of determining an impact range in one embodiment;
FIG. 2 is a flow chart of a method for determining an influence range in one embodiment;
FIG. 3 is a flow chart of the influence range determining step in one embodiment;
FIG. 4 is a flowchart of a second query result obtaining step in one embodiment;
FIG. 5 is a flow chart of a method for determining an influence range according to another embodiment;
FIG. 6 is a flow chart of a method of determining an influence method according to another embodiment;
FIG. 7 is a block diagram of an apparatus 700 for determining an influence range in one embodiment;
FIG. 8 is a block diagram of an apparatus 800 for determining an influence range in one embodiment;
FIG. 9 is an internal block diagram of a computer device in one embodiment;
fig. 10 is an internal structural view of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
It should be noted that, user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party.
The method for determining the influence scope provided by the embodiment of the application can be applied to an application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The data storage system may store data that the server 104 needs to process. The data storage system may be integrated on the server 104 or may be located on a cloud or other network server. Specifically, the server 102 may obtain the code change point from the terminal 102. And according to the definition category of the code change point, inquiring in the source file to obtain a first inquiring result which has a direct association relation with the code change point. And recursively inquiring in the source file according to the first inquiry result to obtain a second inquiry result which has an indirect association relation with the code change point. And determining the influence range of the code change point according to the first query result and the second query result.
The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices, portable wearable devices, and the internet of things devices may be smart televisions, smart vehicle devices, and the like. The portable wearable device may be a smart watch, smart bracelet, headset, or the like. The server 104 may be implemented as a stand-alone server or as a server cluster of multiple servers.
In one embodiment, as shown in fig. 2, a method for determining an influence range is provided, and the method is applied to the server 104 in fig. 1 for illustration, and includes the following steps:
step S202, a code change point is acquired.
Wherein the code change point may represent the content of the code modification.
In particular, during the development of financial software, it is often necessary to modify the relevant code to fix software failures or to add new financial business functions. The server may have installed therein a development tool for financial software, such as IDEA (IntelliJ IDEA), an integrated development tool for the Java language. The server may present the code to the user through a development tool of the financial software and receive a code change point entered by the user.
Step S204, according to the definition category of the code change point, a first query result with a direct association relation with the code change point is obtained in the source file.
The defined categories of code change points may include, but are not limited to, classes and methods, among others.
A class is a defined collection of attributes and actions in the Java language. It defines the structure and behavior of the object. While an object is an instance of a class that represents a specific existence of a class.
The method is an action defined in the Java language, which describes the function of an object.
The direct association relationship may include, but is not limited to, a direct call relationship and a direct use relationship. For example, when a class has an instance object, there is a direct use relationship between the instance object and the class. When one method is called in another method, there is a direct call relationship between the two methods.
The source file may represent a file in which a full amount of code is stored.
Specifically, since the scope of influence of the code change points in different categories is different, for example, when the code change points are in a category, the object having a direct use relationship with the category is directly affected. When the code change point is a method, other methods which have direct calling relation with the method can be directly affected. Therefore, the server can query the object or the method of the source file to obtain the object or the method of the direct use relation with the code change point according to the definition category of the code change point received currently, so as to obtain a first query result.
Step S206, recursively inquiring in the source file according to the first inquiry result to obtain a second inquiry result which has an indirect association relation with the code change point.
Specifically, the server may use the first query result as a query primary key, and query in the source file to obtain an object or method having a direct association relationship with the first query result. And then taking the object or method obtained by the current query as a new query main key, and querying in the source file to obtain the object or method with a direct association relationship with the new query main key. And repeatedly executing the operation of taking the result obtained by the previous query as the main key of the next query, and querying the object or the method with the direct association relation in the source file until the recursion query is ended when the object or the method with the direct association relation with the new query main key cannot be retrieved in the source file. And taking all query results obtained in the recursive query process as second query results with indirect association relation with the code change points.
Step S208, according to the first query result and the second query result, the influence range of the code change point is determined.
Specifically, the server may directly use the first query result and the second query result as the influence range of the code change point. Or, the server may also construct a call chain between the code change point, the first query result and the second query result according to the association relationship between the code change point, the first query result and the second query result. The scope of influence of the code change point is determined by using the call chain.
In the method for determining the influence range, the code change point is obtained; inquiring in a source file according to the definition category of the code change point to obtain a first inquiry result which has a direct association relation with the code change point; recursively inquiring in the source file according to the first inquiry result to obtain a second inquiry result which has an indirect association relation with the code change point; according to the first query result and the second query result, the influence range of the code change point is determined, and the determination error rate of the influence range can be reduced.
Optionally, in other embodiments, the server may also present the scope of influence of the code change point in a structured manner. For example, the step S208 may be implemented with reference to the flowchart steps shown in fig. 3, including:
step S302, a first call chain between the code change point and the first query result and a second call chain between the first query result and the second query result are respectively established.
Specifically, the server may obtain the storage locations of the code change point, the first query result, and the second query result in the source file. And determining an access path from the code change point to the first query result and an access path from the first query result to the second query result according to the storage position. And establishing a first call chain between the code change point and the first query result by using the access path from the code change point to the first query result. And establishing a second call chain between the first query result and the second query result by using the access path from the first query result to the second query result.
Alternatively, in some embodiments, the second query result may include a query result obtained by a multi-level recursive query. The server may sequentially construct call chains between query results having direct call relationships or usage relationships in pairs according to the recursive query order, thereby forming call chains of the second query result.
And step S304, splicing the first call chain and the second call chain to form a target call chain corresponding to the code change point.
Specifically, the server may splice the tail end of the first call chain and the head end of the second call chain corresponding to the same first query result according to the first query result at the tail end in the first call chain and the first query result at the head end in the second call chain, so as to form a target call chain corresponding to the code change point.
Step S306, according to the target call chain, determining the influence range of the code change point.
Specifically, the server may determine, according to the target call chain, all code blocks in the source file that have a direct or indirect call relationship or use relationship with the code change point as the scope of influence of the code change point. Optionally, in some embodiments, a corresponding mesh map may also be generated based on the target call chain to expose the scope of influence of the code change points.
In this embodiment, a first call chain between the code change point and the first query result and a second call chain between the first query result and the second query result are respectively constructed, the first call chain and the second call chain are spliced to form a target call chain of the code change point, and the influence range of the code change point is determined according to the target call chain, so that the determination error rate of the influence range can be reduced.
Optionally, in some embodiments, step S204 described above, according to the definition category of the code change point, the first query result that has a direct association with the code change point is obtained by querying the source file, which may be specifically implemented with reference to the following manner:
when the definition category of the code change point is a class, inquiring in the source file to obtain a target object using the code change point, and taking the target object as a first inquiring result.
When the definition category of the code change point is a method, inquiring in the source file to obtain a target method for calling the code change point, and taking the target method as a first inquiring result.
In particular, the object using this class is directly affected by the change of the class. Therefore, when the definition category of the code change point is a class, the server can query the source file to obtain a target object of the class directly using the code change point, and the target object obtained by querying is used as a first query result with a direct association relation with the code change point.
The method of calling this method is directly affected by the modification of the method. Therefore, when the definition category of the code change point is a method, the server can query the source file to obtain a target method of directly calling the method of the code change point, and the target method obtained by query at the moment is used as a first query result with a direct association relation with the code change point.
In this embodiment, by adopting different first query result determining manners for different defined categories of the code change points, the accuracy and flexibility of determining the first query result can be improved.
Based on the first query result determining manner corresponding to the code change point defined as the class provided in the foregoing embodiment, the foregoing step S206 may be implemented with reference to the following flowchart steps shown in fig. 4, where the recursive query in the source file according to the first query result obtains a second query result having an indirect association relationship with the code change point, and includes:
in step S402, when the definition category of the code change point is a class, a definition method using the target object is obtained by querying in the source file with the target object as a query primary key.
Wherein the definition method may be used to represent a definition of an attribute or action of the target object.
Specifically, when the definition category of the code change point is a class, the server may query the definition method directly using the target object in the definition method in the source file by using the target object directly using the class of the code change point as a query primary key and adopting a character string matching mode.
Step S404, inquiring the source file by taking the definition method as a new inquiry main key to obtain an invoking method for invoking the definition method.
Specifically, the server may query the method of the source file to obtain a calling method for directly calling the defining method based on the attribute information such as the method name and the method parameter of the defining method by directly using the defining method of the target object as a new query key.
In step S406, the calling method is used as a new query main key to perform recursive query in the source file, until the calling method for calling the query main key does not exist in the source file, and a recursive query result is obtained.
Specifically, the server may perform the recursive query in the source file with reference to the recursive query method provided in step S206 above by using the calling method that directly calls the defining method as a new query main key, until the recursive query ends when there is no calling method that calls the current query main key in the source file. And generating a recursive query result according to all query results obtained by the query in the recursive query process and the recursive order among the query results.
Step S408, determining a second query result according to the definition method, the calling method and the recursive query result.
In particular, the server may construct a call chain between the defining method and the calling method based on the storage locations of the defining method and the calling method that directly calls the defining method in the source file. And constructing a call chain between the methods with direct call relations in pairs according to the call method and the storage position of the recursive query result in the source file, and splicing the call chains with the same method end to obtain the call chain between the call method and the recursive query result. And determining all second query results with indirect association relation with the code change point according to a call chain between the definition method and the call method and a call chain between the call method and the recursive query result.
In this embodiment, by using the association relationship of the class, the target object of the directly used class, the definition method of the directly used target object, the calling method of the directly called definition method, and the calling method of the directly called precursor method, the second query results with indirect association relationships corresponding to the class of the code change point are obtained by recursion query, so that the determination accuracy of the second query results can be improved.
Similarly, based on the first query result determining method corresponding to the code change point defined as the method according to the embodiment, step S206 may be implemented by referring to the following manner, where a second query result having an indirect association relationship with the code change point is obtained by recursively querying the source file according to the first query result:
when the definition category of the code change point is a method, performing recursive query in the source file by taking the target method as a query main key, and obtaining a recursive query result when a calling method for calling the query main key does not exist in the source file; and determining a second query result according to the recursive query result.
Specifically, when the definition category of the code change point is a method, the server may use a target method of directly calling the method of the code change point as a query key, and query the source file to obtain a calling method of directly calling the target method. Referring to step S406, a recursive query is performed in the source file by using the calling method as a new query main key, until a recursive query result is obtained when there is no calling method for calling the query main key in the source file. And constructing a call chain corresponding to the recursive query result according to the recursive query order in the recursive query result. And determining a second query result which has an indirect calling relation with the method of the code change point according to a calling chain corresponding to the recursive query result.
In this embodiment, by using the association relationship of the method, the target method of the direct calling method, the calling method of the direct calling target method, and the calling method of the direct calling precursor calling method, the second query result corresponding to the method of the code change point is obtained by recursion query, so that the determination accuracy of the second query result can be improved.
In one embodiment, as shown in fig. 5, a method for determining an influence range is provided, including:
step S502, a code change point is acquired.
Specifically, the server may obtain the code change point. When the definition category of the code change point is a class, steps S504 to S506 are executed. When the definition category of the code change point is the method, steps S508 to S510 are executed.
In step S504, when the definition category of the code change point is a class, a target object using the code change point is obtained by querying in the source file, the target object is used as a first query result, and a definition method using the target object is obtained by querying in the source file.
Step S506, inquiring a calling method for calling the definition method in the source file by taking the definition method as an inquiry main key, acquiring a recursion inquiry result corresponding to the calling method, and determining a second inquiry result according to the definition method, the calling method and the recursion inquiry result.
Specifically, when the definition category of the code change point is a class, the server may query the source file for a target object that directly uses the class of the code change point by using the class of the code change point as a query primary key. And then taking the target object as a query main key, and querying in the source file to obtain a definition method directly using the target object. And then, inquiring in the source file by taking the definition method as an inquiry main key to obtain a calling method for directly calling the definition method. And recursively inquiring by taking the calling method as an inquiry main key to obtain a corresponding recursion inquiry result. And determining a second query result according to the calling relation among the definition method, the calling method and the recursive query result. Step S512 is performed.
For example, when the definition category of the code change point a is a class, the server may query all target objects C1, C2, and Cn using the code change point a in the source file by using the code change point a as a query main key and information such as a class attribute, a class declaration, and a class name of the code change point a as query conditions. Then, the target objects C1, C2, cn are used as main keys for inquiring, and the source file is inquired to directly use the definition methods D1, D2, dn of the target objects C1, C2, cn. The definition methods D1, D2 are reused, and the calling methods D1', D2'. Continuing the recursive query results to obtain recursive query results D1", D2", and Dn ' that directly invoke the preamble invocation methods D1', D2',. Thereby, the target objects C1, C2, cn, which have a direct use relationship with the code change point a, and the definition methods D1, D2, dn, the calling methods D1', D2', dn ', the recursive query results D1", D2', dn ' which have an indirect calling relationship are obtained.
Optionally, in some embodiments, a calling object for calling the target object may be obtained by querying the target object in the source file, and then the calling object is taken as a new query main key, and whether a calling object for directly calling the query main key and a calling method exist in the source file are recursively queried.
Step S508, when the definition category of the code change point is a method, inquiring the source file to obtain a target method for calling the code change point, and taking the target method as a first inquiring result.
And S510, performing recursion query in the source file by taking the target method as a query main key, obtaining a recursion query result when a calling method for calling the query main key does not exist in the source file, and determining a second query result according to the recursion query result.
Specifically, when the definition category of the code change point is a method, the server may query the source file for a target method directly calling the method of the code change point by using the method of the code change point as a query key. And performing recursion query in the source file by taking the target method as a new query main key until a calling method for calling the query main key does not exist in the source file, and obtaining a recursion query result. The second query result is determined based on the recursive query order among the recursive query results. Step S512 is performed.
For example, when the definition category of the code change point B is a method, the server may query the source file for the target method E1, E2, the..and En that directly invokes the code change point B, using the code change point B as a query key, using the method name of the code change point B. Recursive query results E1', E2'. Thereby obtaining target methods E1, E2, en, which have a direct calling relationship with code modification point B, and recursive query results E1', E2'.
Step S512, a target call chain is formed by splicing a first call chain between the code change point and the first query result and a second call chain between the first query result and the second query result, and the influence range of the code change point is determined according to the target call chain.
Specifically, the server may construct corresponding first and second call chains using the code change point, the first and second query results, and the storage locations of the first and second query results in the source file. And splicing the first call chain and the second call chain end to form a target call chain. And determining the influence range of the code change point according to the target call chain.
In this embodiment, by respectively querying in different search modes to obtain a corresponding first query result for the case that the definition category of the code modification point is a class and the case that the definition category of the code modification point is a method, and recursively querying with the first query result as a new query main key to obtain a corresponding second query result, a call chain among the code modification point, the first query result and the second query result is constructed, and the scope of influence of the code modification point is determined according to the target call chain formed by splicing, so that the error rate of the scope of influence can be reduced.
The application further provides an integrated development tool plug-in based on the same inventive concept as the method for determining the influence range. Integrating the logic for determining the influence range provided in the above embodiment by using the integrated development tool plugin is applied to the method for determining the influence range implemented on the terminal 102 in fig. 1, and includes:
step S602, running an integrated development tool plug-in, and responding to the change point selection operation through the integrated development tool plug-in to acquire a code change point.
The integrated development tool plug-in may be implemented using an IDEA plug-in (auxiliary software that may be installed in the IDEA integrated development tool).
In particular, the terminal may run an integrated development tool plug-in a client of the financial software development tool. And responding to the change point selection operation triggered by the click of the user through the integrated development tool plug-in, acquiring the code change point and the storage position of the code change point in the source code.
Step S604, calling a preset search tool to search in a source file according to the definition category of the code change point through an integrated development tool plug-in to obtain a first search result with a direct association relation with the code change point.
Step S606, calling a preset search tool to recursively search in the source file according to the first search result through the integrated development tool plug-in to obtain a second search result with an indirect association relation with the code change point.
The preset search tool may be implemented by using a find usages tool (abbreviated as fu tool) of IDEA.
Specifically, when the definition category of the code transformation point is a class, the terminal can use the code transformation point as a query main key through the integrated development tool plug-in, call a preset search tool to query in the source file to obtain all target objects of the class of directly using the code transformation point, and take the target objects as a first query result which has a direct use relation with the code transformation point. And calling a preset search tool in a source file to recursively search to obtain data such as a definition method directly using the target object, a calling method directly calling the definition method, a calling method directly calling a precursor calling method and the like by using the first search result, namely the target object as a new search main key through the integrated development tool plug-in, so as to obtain a second search result which has an indirect calling relation with the code change point.
When the definition category of the code modification point is a method, the terminal can call a preset search tool to query in the source file by taking the code modification point as a query main key through an integrated development tool plug-in, so as to obtain a target method directly calling the code modification point, and the target method is used as a first query result which has a direct calling relation with the code modification point. And calling a preset search tool in a source file by using the integrated development tool plugin and taking a first query result, namely the target method, as a new query main key to recursively query to obtain a calling method for directly calling the target method, directly calling data such as a calling method of a preamble calling method, and the like, thereby obtaining a second query result which has an indirect calling relation with a code change point.
In step S608, the integrated development tool plugin determines the influence range of the code change point according to the first query result and the second query result.
Specifically, the terminal can construct a target call chain between the code change point, the first query result and the second query result through the integrated development tool plug-in according to the call relationship or the use relationship between the code change point, the first query result and the second query result. The specific target call chain construction operation may be implemented with reference to the target call chain construction method provided in the above embodiment, which is not specifically described herein. And generating a netlike call relation diagram related to the code change point according to the target call chain, and visually presenting the influence range of the code change point by using the call relation diagram.
According to the method for determining the influence range, the integrated development tool plug-in is operated to interact with a user, the code change point selected by the user is obtained, the preset search tool is called according to the definition category of the code change point to search in the source file to obtain the search result with the direct association relation or the indirect association relation with the code change point, the call relation between the search results is analyzed, the target call chain related to the code change point is constructed, the influence range of the code change point is determined by the target call chain, and the determination efficiency and the accuracy of the influence range can be improved.
It should be understood that, although the steps in the flowcharts related to the above embodiments are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a determination device for determining the influence range of the determination method for determining the influence range. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiment of the determining device for one or more influence ranges provided below may be referred to the limitation of the determining method for the influence range hereinabove, and will not be repeated herein.
In one embodiment, as shown in fig. 7, there is provided an influence range determining apparatus 700, including: a change point acquisition module 702, a classification query module 704, a recursive query module 706, and a range determination module 708, wherein:
the change point acquisition module 702 is configured to acquire a code change point.
And the classification query module 704 is configured to query in the source file according to the defined category of the code change point to obtain a first query result having a direct association relationship with the code change point.
And the recursive query module 706 is configured to recursively query in the source file according to the first query result to obtain a second query result that has an indirect association with the code modification point.
The range determining module 708 is configured to determine an influence range of the code change point according to the first query result and the second query result.
In one embodiment, the range determination module 708 includes: the call chain construction unit is used for respectively establishing a first call chain between the code change point and the first query result and a second call chain between the first query result and the second query result; the call chain splicing unit is used for splicing the first call chain and the second call chain to form a target call chain corresponding to the code change point; and the range determining unit is used for determining the influence range of the code change point according to the target call chain.
In one embodiment, the classification query module 704 includes a class query unit, configured to query a source file for a target object using the code change point when the defined class of the code change point is a class, and take the target object as a first query result; and the method query unit is used for querying a source file to obtain a target method for calling the code change point when the definition category of the code change point is the method, and taking the target method as a first query result.
In one embodiment, the recursive query module 706 is further configured to query the source file with the target object as a query primary key to obtain a definition method using the target object when the definition category of the code change point is a class; inquiring in the source file by taking the definition method as a new inquiry main key to obtain a calling method for calling the definition method; performing recursive query in the source file by taking the calling method as a new query main key until a recursive query result is obtained when the calling method for calling the query main key does not exist in the source file; and determining a second query result according to the definition method, the calling method and the recursive query result.
In one embodiment, the recursive query module 706 is further configured to, when the definition category of the code change point is a method, perform a recursive query in the source file with the target method as a query main key, until a calling method for calling the query main key does not exist in the source file, and obtain a recursive query result; and determining a second query result according to the recursive query result.
In one embodiment, as shown in fig. 8, there is provided an influence range determining apparatus 800, including: a parameter acquisition module 802, a call analysis module 804, and a relationship stitching module 806.
The parameter obtaining module 802 is configured to run an integrated development tool plugin, and obtain a code modification point through the integrated development tool plugin in response to a modification point selection operation.
The call analysis module 804 is configured to call a preset search tool to query in a source file according to a definition category of the code change point through the integrated development tool plug-in, to obtain a first query result having a direct association relationship with the code change point, and call a preset search tool to recursively query in the source file according to the first query result through the integrated development tool plug-in, to obtain a second query result having an indirect association relationship with the code change point.
The relationship splicing module 806 is configured to determine, by using the integrated development tool plug-in, an influence range of the code change point according to the first query result and the second query result.
The respective modules in the above-described influence range determining means may be implemented in whole or in part by software, hardware, and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which may be as shown in fig. 9. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used for storing data such as code change points, first query results, second query results, influence ranges and the like. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of determining an impact range.
In one embodiment, a computer device is provided, which may be a terminal, and an internal structure diagram thereof may be as shown in fig. 10. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a method of determining an impact range. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by persons skilled in the art that the structures shown in the foregoing drawings are merely block diagrams of some of the structures associated with the present application and do not constitute a limitation of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In an embodiment, there is also provided a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, there is also provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples only represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the present application. It should be noted that variations and modifications can be made by those skilled in the art without departing from the spirit of the present application, which falls within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.
Claims (11)
1. A method of determining an impact range, the method comprising:
acquiring a code change point;
inquiring in a source file according to the definition category of the code change point to obtain a first inquiry result which has a direct association relation with the code change point;
recursively inquiring in the source file according to the first inquiry result to obtain a second inquiry result which has an indirect association relation with the code change point;
And determining the influence range of the code change point according to the first query result and the second query result.
2. The method of claim 1, wherein the determining the range of influence of the code change point based on the first query result and the second query result comprises:
respectively establishing a first call chain between the code change point and the first query result and a second call chain between the first query result and the second query result;
splicing the first call chain and the second call chain to form a target call chain corresponding to the code change point;
and determining the influence range of the code change point according to the target call chain.
3. The method according to claim 1, wherein the querying the source file for the first query result having a direct association with the code change point according to the defined category of the code change point includes:
when the definition category of the code change point is a class, inquiring in the source file to obtain a target object using the code change point, and taking the target object as the first inquiring result;
And when the definition category of the code change point is a method, inquiring in the source file to obtain a target method for calling the code change point, and taking the target method as the first inquiring result.
4. A method according to claim 3, wherein recursively querying in the source file from the first query result results in a second query result having an indirect association with the code change point, comprises:
when the definition category of the code change point is the category, inquiring in the source file by taking the target object as an inquiry main key to obtain a definition method using the target object;
inquiring in the source file by taking the definition method as a new inquiry main key to obtain a calling method for calling the definition method;
performing recursive query in the source file by taking the calling method as a new query main key until a recursive query result is obtained when the calling method for calling the query main key does not exist in the source file;
and determining the second query result according to the definition method, the calling method and the recursive query result.
5. A method according to claim 3, wherein recursively querying in the source file from the first query result results in a second query result having an indirect association with the code change point, comprises:
When the definition category of the code change point is the method, carrying out recursive query in the source file by taking the target method as a query main key until a calling method for calling the query main key does not exist in the source file, and obtaining a recursive query result;
and determining the second query result according to the recursive query result.
6. A method of determining an impact range, the method comprising:
operating an integrated development tool plugin, and responding to change point selection operation through the integrated development tool plugin to obtain a code change point;
calling a preset search tool to search in a source file according to the definition category of the code change point by the integrated development tool plugin to obtain a first search result which has a direct association relation with the code change point;
according to the first query result, the integrated development tool plugin invokes the preset search tool to recursively query in the source file to obtain a second query result which has an indirect association relationship with the code change point;
and determining the influence range of the code change point according to the first query result and the second query result through the integrated development tool plugin.
7. An apparatus for determining an influence range, the apparatus comprising:
the change point acquisition module is used for acquiring code change points;
the classification inquiry module is used for inquiring in the source file according to the definition category of the code change point to obtain a first inquiry result which has a direct association relation with the code change point;
the recursive query module is used for recursively querying in the source file according to the first query result to obtain a second query result which has an indirect association relation with the code change point;
and the range determining module is used for determining the influence range of the code change point according to the first query result and the second query result.
8. An apparatus for determining an influence range, the apparatus comprising:
the parameter acquisition module is used for running an integrated development tool plug-in, and responding to the change point selection operation through the integrated development tool plug-in to acquire a code change point;
the call analysis module is used for calling a preset search tool to inquire in a source file according to the definition category of the code change point through the integrated development tool plug-in, so as to obtain a first inquiry result with a direct association relation with the code change point, and calling the preset search tool to recursively inquire in the source file according to the first inquiry result through the integrated development tool plug-in, so as to obtain a second inquiry result with an indirect association relation with the code change point;
And the relation splicing module is used for determining the influence range of the code change point according to the first query result and the second query result through the integrated development tool plug-in.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
11. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311152642.9A CN117389859A (en) | 2023-09-07 | 2023-09-07 | Method, device, computer equipment and storage medium for determining influence range |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311152642.9A CN117389859A (en) | 2023-09-07 | 2023-09-07 | Method, device, computer equipment and storage medium for determining influence range |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117389859A true CN117389859A (en) | 2024-01-12 |
Family
ID=89436271
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311152642.9A Pending CN117389859A (en) | 2023-09-07 | 2023-09-07 | Method, device, computer equipment and storage medium for determining influence range |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117389859A (en) |
-
2023
- 2023-09-07 CN CN202311152642.9A patent/CN117389859A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN117390011A (en) | Report data processing method, device, computer equipment and storage medium | |
CN116738954A (en) | Report export method, report template configuration device and computer equipment | |
CN114997111B (en) | Service processing method, device, computer equipment and storage medium | |
CN117389859A (en) | Method, device, computer equipment and storage medium for determining influence range | |
CN114629951A (en) | Address service switching method and device, computer equipment and storage medium | |
CN115879895B (en) | Protocol admittance method, device, computer equipment and storage medium | |
CN113918996B (en) | Distributed data processing method, device, computer equipment and storage medium | |
CN114528045B (en) | Plug-in operation method, device, computer equipment and storage medium | |
CN114036170A (en) | Associated case acquisition method, associated case acquisition device, associated case acquisition apparatus, storage medium, and program product | |
CN117612192A (en) | Electronic drawing information identification method, system, electronic equipment and storage medium | |
CN117667985A (en) | Data positioning method, device, computer equipment and storage medium | |
CN116894044A (en) | Data management method, device, computer equipment and storage medium | |
CN116881388A (en) | Entry database determination method, apparatus, device, storage medium, and program product | |
CN116757176A (en) | Different version business bill comparison method and related products | |
CN115510130A (en) | Report generation method and device, computer equipment and storage medium | |
CN116910115A (en) | Group query method, device, computer equipment and storage medium | |
CN116258597A (en) | Document processing method, device, computer equipment and storage medium | |
CN116775955A (en) | Data tag solidifying method, device, computer equipment and storage medium | |
CN116225426A (en) | Method and device for calling reusable module, computer equipment and storage medium | |
CN118132656A (en) | Knowledge graph construction method, knowledge graph construction device, computer equipment and storage medium | |
CN115878715A (en) | Method and device for generating page display scheme and computer equipment | |
CN114915573A (en) | Test method, device, equipment, storage medium and program product | |
CN117151717A (en) | Device password modification method, device, computer device and storage medium | |
CN116860576A (en) | Method, device, computer equipment and storage medium for recording operation log | |
CN118363983A (en) | Reference data management method, apparatus, device, storage medium, and program product |
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 |